diff --git a/go.mod b/go.mod index 927e27172c..2a05ea7321 100644 --- a/go.mod +++ b/go.mod @@ -17,33 +17,33 @@ require ( github.com/kubernetes-csi/csi-lib-utils v0.17.0 github.com/kubernetes-csi/csi-proxy/client v1.1.3 github.com/kubernetes-csi/external-snapshotter/client/v4 v4.2.0 - github.com/onsi/ginkgo/v2 v2.21.0 - github.com/onsi/gomega v1.35.1 - github.com/stretchr/testify v1.9.0 + github.com/onsi/ginkgo/v2 v2.22.0 + github.com/onsi/gomega v1.36.0 + github.com/stretchr/testify v1.10.0 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 go.opentelemetry.io/otel v1.32.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.29.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.28.0 - go.opentelemetry.io/otel/sdk v1.31.0 + go.opentelemetry.io/otel/sdk v1.32.0 go.uber.org/mock v0.5.0 golang.org/x/net v0.31.0 golang.org/x/sync v0.9.0 golang.org/x/sys v0.27.0 google.golang.org/grpc v1.66.1 google.golang.org/protobuf v1.35.1 - k8s.io/api v0.31.2 - k8s.io/apimachinery v0.31.2 - k8s.io/client-go v0.31.2 - k8s.io/cloud-provider v0.31.2 - k8s.io/component-base v0.31.2 + k8s.io/api v0.31.3 + k8s.io/apimachinery v0.31.3 + k8s.io/client-go v0.31.3 + k8s.io/cloud-provider v0.31.3 + k8s.io/component-base v0.31.3 k8s.io/klog/v2 v2.130.1 k8s.io/kubernetes v1.31.2 k8s.io/mount-utils v0.29.7 k8s.io/pod-security-admission v0.0.0 k8s.io/utils v0.0.0-20241104163129-6fe5fd82f078 - sigs.k8s.io/cloud-provider-azure v1.29.1-0.20241111034044-6ebb6c3c3260 - sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.1.17 - sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.1.3 + sigs.k8s.io/cloud-provider-azure v1.29.1-0.20241203125659-88ef46cb15b8 + sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.2.2 + sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.1.8 sigs.k8s.io/yaml v1.4.0 ) @@ -52,7 +52,7 @@ require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2 v2.2.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry v1.2.0 // indirect - github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6 v6.2.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6 v6.3.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault v1.4.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/msi/armmsi v1.2.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns v1.3.0 // indirect @@ -122,7 +122,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.60.0 // indirect + github.com/prometheus/common v0.60.1 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/spf13/cobra v1.8.1 // indirect github.com/spf13/pflag v1.0.5 // indirect @@ -132,9 +132,9 @@ require ( go.etcd.io/etcd/client/pkg/v3 v3.5.14 // indirect go.etcd.io/etcd/client/v3 v3.5.14 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect - go.opentelemetry.io/otel/exporters/prometheus v0.53.0 // indirect + go.opentelemetry.io/otel/exporters/prometheus v0.54.0 // indirect go.opentelemetry.io/otel/metric v1.32.0 // indirect - go.opentelemetry.io/otel/sdk/metric v1.31.0 // indirect + go.opentelemetry.io/otel/sdk/metric v1.32.0 // indirect go.opentelemetry.io/otel/trace v1.32.0 // indirect go.opentelemetry.io/proto/otlp v1.3.1 // indirect go.uber.org/multierr v1.11.0 // indirect @@ -156,13 +156,13 @@ require ( gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/apiextensions-apiserver v0.0.0 // indirect - k8s.io/apiserver v0.31.2 // indirect - k8s.io/component-helpers v0.31.2 // indirect - k8s.io/controller-manager v0.31.2 // indirect + k8s.io/apiserver v0.31.3 // indirect + k8s.io/component-helpers v0.31.3 // indirect + k8s.io/controller-manager v0.31.3 // indirect k8s.io/kms v0.32.0-alpha.0 // indirect k8s.io/kube-openapi v0.0.0-20240730131305-7a9a4e85957e // indirect k8s.io/kubectl v0.0.0 // indirect - k8s.io/kubelet v0.31.2 // indirect + k8s.io/kubelet v0.31.3 // indirect sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect diff --git a/go.sum b/go.sum index d1ce4b61d7..4898ab7841 100644 --- a/go.sum +++ b/go.sum @@ -19,8 +19,8 @@ github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armconta github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry v1.2.0/go.mod h1:E7ltexgRDmeJ0fJWv0D/HLwY2xbDdN+uv+X2uZtOx3w= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v5 v5.0.0 h1:5n7dPVqsWfVKw+ZiEKSd3Kzu7gwBkbEBkeXb8rgaE9Q= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v5 v5.0.0/go.mod h1:HcZY0PHPo/7d75p99lB6lK0qYOP4vLRJUBpiehYXtLQ= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6 v6.2.0 h1:qXCssQ563JFkqh+5YQSXqqJMROSTh9ZraEe33nVeDAA= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6 v6.2.0/go.mod h1:drbnYtukMoZqUQq9hJASf41w3RB4VoTJPoPpe+XDHPU= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6 v6.3.0 h1:4ZTvMq5AWtRIPM06RzdfKwKyVJ0eUOfm4QUBVDQFqQ4= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6 v6.3.0/go.mod h1:drbnYtukMoZqUQq9hJASf41w3RB4VoTJPoPpe+XDHPU= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0 h1:PTFGRSlMKCQelWwxUyYVEUqseBJVemLyqWJjvMyt0do= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0/go.mod h1:LRr2FzBTQlONPPa5HREE5+RjSCTXl7BwOvYOaWTqCaI= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0 h1:2qsIIvxVT+uE6yrNldntJKlLRgxGbZ85kgtz5SNBhMw= @@ -313,8 +313,8 @@ github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xl github.com/onsi/ginkgo/v2 v2.17.1/go.mod h1:llBI3WDLL9Z6taip6f33H76YcWtJv+7R3HigUjbIBOs= github.com/onsi/ginkgo/v2 v2.17.2/go.mod h1:nP2DPOQoNsQmsVyv5rDA8JkXQoCs6goXIvr/PRJ1eCc= github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To= -github.com/onsi/ginkgo/v2 v2.21.0 h1:7rg/4f3rB88pb5obDgNZrNHrQ4e6WpjonchcpuBRnZM= -github.com/onsi/ginkgo/v2 v2.21.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo= +github.com/onsi/ginkgo/v2 v2.22.0 h1:Yed107/8DjTr0lKCNt7Dn8yQ6ybuDRQoMGrNFKzMfHg= +github.com/onsi/ginkgo/v2 v2.22.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo= 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.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= @@ -335,8 +335,8 @@ github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3ev github.com/onsi/gomega v1.30.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= github.com/onsi/gomega v1.33.0/go.mod h1:+925n5YtiFsLzzafLUHzVMBpvvRAzrydIBiSIxjX3wY= github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0= -github.com/onsi/gomega v1.35.1 h1:Cwbd75ZBPxFSuZ6T+rN/WCb/gOc6YgFBXLlZLhC7Ds4= -github.com/onsi/gomega v1.35.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog= +github.com/onsi/gomega v1.36.0 h1:Pb12RlruUtj4XUuPUqeEWc6j5DkVVVA49Uf6YLfC95Y= +github.com/onsi/gomega v1.36.0/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/selinux v1.11.0 h1:+5Zbo97w3Lbmb3PeqQtpmTkMwsW5nRI3YaLpt7tQ7oU= @@ -356,8 +356,8 @@ github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/j github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= -github.com/prometheus/common v0.60.0 h1:+V9PAREWNvJMAuJ1x1BaWl9dewMW4YrHZQbx0sJNllA= -github.com/prometheus/common v0.60.0/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw= +github.com/prometheus/common v0.60.1 h1:FUas6GcOw66yB/73KC+BOZoFJmbo/1pojoILArPAaSc= +github.com/prometheus/common v0.60.1/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/redis/go-redis/v9 v9.6.1 h1:HHDteefn6ZkTtY5fGUE8tj8uy85AHk6zP7CpzIAM0y4= @@ -391,8 +391,9 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/tmc/grpc-websocket-proxy v0.0.0-20220101234140-673ab2c3ae75 h1:6fotK7otjonDflCTK0BCfls4SPy3NcCVb5dqqmbRknE= github.com/tmc/grpc-websocket-proxy v0.0.0-20220101234140-673ab2c3ae75/go.mod h1:KO6IkyS8Y3j8OdNO85qEYBsRPuteD+YciPomcXdrMnk= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= @@ -429,14 +430,14 @@ go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.29.0 h1:dIIDULZJpgdiHz5tXrT go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.29.0/go.mod h1:jlRVBe7+Z1wyxFSUs48L6OBQZ5JwH2Hg/Vbl+t9rAgI= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.28.0 h1:R3X6ZXmNPRR8ul6i3WgFURCHzaXjHdm0karRG/+dj3s= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.28.0/go.mod h1:QWFXnDavXWwMx2EEcZsf3yxgEKAqsxQ+Syjp+seyInw= -go.opentelemetry.io/otel/exporters/prometheus v0.53.0 h1:QXobPHrwiGLM4ufrY3EOmDPJpo2P90UuFau4CDPJA/I= -go.opentelemetry.io/otel/exporters/prometheus v0.53.0/go.mod h1:WOAXGr3D00CfzmFxtTV1eR0GpoHuPEu+HJT8UWW2SIU= +go.opentelemetry.io/otel/exporters/prometheus v0.54.0 h1:rFwzp68QMgtzu9PgP3jm9XaMICI6TsofWWPcBDKwlsU= +go.opentelemetry.io/otel/exporters/prometheus v0.54.0/go.mod h1:QyjcV9qDP6VeK5qPyKETvNjmaaEc7+gqjh4SS0ZYzDU= go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M= go.opentelemetry.io/otel/metric v1.32.0/go.mod h1:jH7CIbbK6SH2V2wE16W05BHCtIDzauciCRLoc/SyMv8= -go.opentelemetry.io/otel/sdk v1.31.0 h1:xLY3abVHYZ5HSfOg3l2E5LUj2Cwva5Y7yGxnSW9H5Gk= -go.opentelemetry.io/otel/sdk v1.31.0/go.mod h1:TfRbMdhvxIIr/B2N2LQW2S5v9m3gOQ/08KsbbO5BPT0= -go.opentelemetry.io/otel/sdk/metric v1.31.0 h1:i9hxxLJF/9kkvfHppyLL55aW7iIJz4JjxTeYusH7zMc= -go.opentelemetry.io/otel/sdk/metric v1.31.0/go.mod h1:CRInTMVvNhUKgSAMbKyTMxqOBC0zgyxzW55lZzX43Y8= +go.opentelemetry.io/otel/sdk v1.32.0 h1:RNxepc9vK59A8XsgZQouW8ue8Gkb4jpWtJm9ge5lEG4= +go.opentelemetry.io/otel/sdk v1.32.0/go.mod h1:LqgegDBjKMmb2GC6/PrTnteJG39I8/vJCAP9LlJXEjU= +go.opentelemetry.io/otel/sdk/metric v1.32.0 h1:rZvFnvmvawYb0alrYkjraqJq0Z4ZUJAiyYCU9snn1CU= +go.opentelemetry.io/otel/sdk/metric v1.32.0/go.mod h1:PWeZlq0zt9YkYAp3gjKZ0eicRYvOh1Gd+X99x6GHpCQ= go.opentelemetry.io/otel/trace v1.32.0 h1:WIC9mYrXf8TmY/EXuULKc8hR17vE+Hjv2cssQDe03fM= go.opentelemetry.io/otel/trace v1.32.0/go.mod h1:+i4rkvCraA+tG6AzwloGaCtkx53Fa+L+V8e9a7YvhT8= go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= @@ -782,12 +783,12 @@ k8s.io/utils v0.0.0-20241104163129-6fe5fd82f078 h1:jGnCPejIetjiy2gqaJ5V0NLwTpF4w k8s.io/utils v0.0.0-20241104163129-6fe5fd82f078/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3 h1:2770sDpzrjjsAtVhSeUFseziht227YAWYHLGNM8QPwY= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw= -sigs.k8s.io/cloud-provider-azure v1.29.1-0.20241111034044-6ebb6c3c3260 h1:fojDjExSwK4UcEV5uGBNiGp55uly70rp9k7+YXhNjXI= -sigs.k8s.io/cloud-provider-azure v1.29.1-0.20241111034044-6ebb6c3c3260/go.mod h1:mHnDlABcVBbkfA9qNFIYeFcEOritZWoJkpUylkIA7Mo= -sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.1.17 h1:xl40PwT1GmKqDjHtJQ1V7JQFlmyzwFvR2uxucCQwc4c= -sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.1.17/go.mod h1:P9bc1WdAEjxt/o9D2eBKGyrtHAkBMe/Qyl0baTMUC0g= -sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.1.3 h1:IiAbtW5mYf2d9sOejwBxOXm5+DxcYEOrslt909e6Sio= -sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.1.3/go.mod h1:6xHgJ5wg7E/hQO578W6n2zmlqhSDByHoh52pMDudtWQ= +sigs.k8s.io/cloud-provider-azure v1.29.1-0.20241203125659-88ef46cb15b8 h1:vw3n4jN/Ae2eKbYTlFBnfILgEamXDHLfUVrGlkxjfdM= +sigs.k8s.io/cloud-provider-azure v1.29.1-0.20241203125659-88ef46cb15b8/go.mod h1:fRhllZZHriqySUa9iN2wmryUlelFuIzvAao+cUfscVo= +sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.2.2 h1:Cb/7iBFeZKlFLvZCu7oz0O5JYGkZhFojNnPTfZdxVJA= +sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.2.2/go.mod h1:WSsOhr3Kr9BqIb88mgoEvcreu7vZujsQ31x3HXM+X6Y= +sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.1.8 h1:fwg1J+nRRXkcA0lIJ/a4fJPg7tNggRH1pPOukthuAGw= +sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.1.8/go.mod h1:kUW9qMqi412c5+nXdYA00oSudWC9nVUCM4v1k3HtgZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/structured-merge-diff/v4 v4.2.3/go.mod h1:qjx8mGObPmV2aSZepjQjbmb2ihdVs8cGKBraizNC69E= diff --git a/pkg/azuredisk/azure_managedDiskController_test.go b/pkg/azuredisk/azure_managedDiskController_test.go index 64806eee86..fbf2061c28 100644 --- a/pkg/azuredisk/azure_managedDiskController_test.go +++ b/pkg/azuredisk/azure_managedDiskController_test.go @@ -347,11 +347,7 @@ func TestCreateManagedDiskWithExtendedLocation(t *testing.T) { mockDisksClient := mock_diskclient.NewMockInterface(ctrl) common.clientFactory.(*mock_azclient.MockClientFactory).EXPECT().GetDiskClientForSub(testCloud.SubscriptionID).Return(mockDisksClient, nil).AnyTimes() - mockDisksClient.EXPECT().CreateOrUpdate(gomock.Any(), testCloud.ResourceGroup, diskName, gomock.Any()). - Do(func(_ interface{}, _, _ string, disk armcompute.Disk) { - assert.Equal(t, el.Name, disk.ExtendedLocation.Name, "The extended location name should match.") - assert.Equal(t, el.Type, disk.ExtendedLocation.Type, "The extended location type should match.") - }).Return(to.Ptr(diskreturned), nil) + mockDisksClient.EXPECT().CreateOrUpdate(gomock.Any(), testCloud.ResourceGroup, diskName, gomock.Any()).Return(to.Ptr(diskreturned), nil) mockDisksClient.EXPECT().Get(gomock.Any(), testCloud.ResourceGroup, diskName).Return(&diskreturned, nil).AnyTimes() diff --git a/pkg/azureutils/azure_disk_utils.go b/pkg/azureutils/azure_disk_utils.go index 62dda56a84..62f0c2b022 100644 --- a/pkg/azureutils/azure_disk_utils.go +++ b/pkg/azureutils/azure_disk_utils.go @@ -48,6 +48,7 @@ import ( "sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader" azclients "sigs.k8s.io/cloud-provider-azure/pkg/azureclients" azure "sigs.k8s.io/cloud-provider-azure/pkg/provider" + azureconfig "sigs.k8s.io/cloud-provider-azure/pkg/provider/config" ) const ( @@ -153,13 +154,13 @@ func GetAttachDiskInitialDelay(attributes map[string]string) int { // GetCloudProviderFromClient get Azure Cloud Provider func GetCloudProviderFromClient(ctx context.Context, kubeClient clientset.Interface, secretName, secretNamespace, userAgent string, allowEmptyCloudConfig bool, enableTrafficMgr bool, trafficMgrPort int64) (*azure.Cloud, error) { - var config *azure.Config + var config *azureconfig.Config var fromSecret bool var err error az := &azure.Cloud{} if kubeClient != nil { klog.V(2).Infof("reading cloud config from secret %s/%s", secretNamespace, secretName) - config, err = configloader.Load[azure.Config](ctx, &configloader.K8sSecretLoaderConfig{ + config, err = configloader.Load[azureconfig.Config](ctx, &configloader.K8sSecretLoaderConfig{ K8sSecretConfig: configloader.K8sSecretConfig{ SecretName: secretName, SecretNamespace: secretNamespace, @@ -189,7 +190,7 @@ func GetCloudProviderFromClient(ctx context.Context, kubeClient clientset.Interf } klog.V(2).Infof("use default %s env var: %v", consts.DefaultAzureCredentialFileEnv, credFile) } - config, err = configloader.Load[azure.Config](ctx, nil, &configloader.FileLoaderConfig{FilePath: credFile}) + config, err = configloader.Load[azureconfig.Config](ctx, nil, &configloader.FileLoaderConfig{FilePath: credFile}) if err != nil { klog.Warningf("load azure config from file(%s) failed with %v", credFile, err) } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/CHANGELOG.md index 297d79344f..ce6f863756 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/CHANGELOG.md +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/CHANGELOG.md @@ -1,5 +1,25 @@ # Release History +## 6.3.0 (2024-11-18) +### Features Added + +- New enum type `RestrictionLevel` with values `RestrictionLevelReadOnly`, `RestrictionLevelUnrestricted` +- New struct `AdvancedNetworking` +- New struct `AdvancedNetworkingObservability` +- New struct `AdvancedNetworkingSecurity` +- New struct `ManagedClusterNodeResourceGroupProfile` +- New field `IfMatch`, `IfNoneMatch` in struct `AgentPoolsClientBeginCreateOrUpdateOptions` +- New field `IfMatch` in struct `AgentPoolsClientBeginDeleteOptions` +- New field `ETag` in struct `ManagedCluster` +- New field `ETag` in struct `ManagedClusterAgentPoolProfile` +- New field `ETag` in struct `ManagedClusterAgentPoolProfileProperties` +- New field `NodeResourceGroupProfile` in struct `ManagedClusterProperties` +- New field `IfMatch`, `IfNoneMatch` in struct `ManagedClustersClientBeginCreateOrUpdateOptions` +- New field `IfMatch` in struct `ManagedClustersClientBeginDeleteOptions` +- New field `IfMatch` in struct `ManagedClustersClientBeginUpdateTagsOptions` +- New field `AdvancedNetworking` in struct `NetworkProfile` + + ## 6.2.0 (2024-10-24) ### Features Added diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/README.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/README.md index b2e7e682be..3ce88ae6a0 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/README.md +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/README.md @@ -1,7 +1,5 @@ # Azure Container Service Module for Go -[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6) - The `armcontainerservice` module provides operations for working with Azure Container Service. [Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/containerservice/armcontainerservice) @@ -25,7 +23,7 @@ go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/ar ## Authorization -When creating a client, you will need to provide a credential for authenticating with Azure Container Service. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. +When creating a client, you will need to provide a credential for authenticating with Azure Container Service. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. ```go cred, err := azidentity.NewDefaultAzureCredential(nil) @@ -54,7 +52,7 @@ clientFactory, err := armcontainerservice.NewClientFactory(, cr ## Clients -A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. +A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. ```go client := clientFactory.NewAgentPoolsClient() diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/agentpools_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/agentpools_client.go index c62fa5e25c..6b5d592fe3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/agentpools_client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/agentpools_client.go @@ -49,7 +49,7 @@ func NewAgentPoolsClient(subscriptionID string, credential azcore.TokenCredentia // before cancellation can take place, a 409 error code is returned. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - agentPoolName - The name of the agent pool. @@ -78,7 +78,7 @@ func (client *AgentPoolsClient) BeginAbortLatestOperation(ctx context.Context, r // before cancellation can take place, a 409 error code is returned. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 func (client *AgentPoolsClient) abortLatestOperation(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *AgentPoolsClientBeginAbortLatestOperationOptions) (*http.Response, error) { var err error const operationName = "AgentPoolsClient.BeginAbortLatestOperation" @@ -124,7 +124,7 @@ func (client *AgentPoolsClient) abortLatestOperationCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -133,7 +133,7 @@ func (client *AgentPoolsClient) abortLatestOperationCreateRequest(ctx context.Co // BeginCreateOrUpdate - Creates or updates an agent pool in the specified managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - agentPoolName - The name of the agent pool. @@ -160,7 +160,7 @@ func (client *AgentPoolsClient) BeginCreateOrUpdate(ctx context.Context, resourc // CreateOrUpdate - Creates or updates an agent pool in the specified managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 func (client *AgentPoolsClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, parameters AgentPool, options *AgentPoolsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "AgentPoolsClient.BeginCreateOrUpdate" @@ -206,9 +206,15 @@ func (client *AgentPoolsClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + if options != nil && options.IfNoneMatch != nil { + req.Raw().Header["If-None-Match"] = []string{*options.IfNoneMatch} + } if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } @@ -218,7 +224,7 @@ func (client *AgentPoolsClient) createOrUpdateCreateRequest(ctx context.Context, // BeginDelete - Deletes an agent pool in the specified managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - agentPoolName - The name of the agent pool. @@ -243,7 +249,7 @@ func (client *AgentPoolsClient) BeginDelete(ctx context.Context, resourceGroupNa // Delete - Deletes an agent pool in the specified managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 func (client *AgentPoolsClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *AgentPoolsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "AgentPoolsClient.BeginDelete" @@ -289,19 +295,22 @@ func (client *AgentPoolsClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") if options != nil && options.IgnorePodDisruptionBudget != nil { reqQP.Set("ignore-pod-disruption-budget", strconv.FormatBool(*options.IgnorePodDisruptionBudget)) } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } return req, nil } // BeginDeleteMachines - Deletes specific machines in an agent pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - agentPoolName - The name of the agent pool. @@ -328,7 +337,7 @@ func (client *AgentPoolsClient) BeginDeleteMachines(ctx context.Context, resourc // DeleteMachines - Deletes specific machines in an agent pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 func (client *AgentPoolsClient) deleteMachines(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, machines AgentPoolDeleteMachinesParameter, options *AgentPoolsClientBeginDeleteMachinesOptions) (*http.Response, error) { var err error const operationName = "AgentPoolsClient.BeginDeleteMachines" @@ -374,7 +383,7 @@ func (client *AgentPoolsClient) deleteMachinesCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, machines); err != nil { @@ -386,7 +395,7 @@ func (client *AgentPoolsClient) deleteMachinesCreateRequest(ctx context.Context, // Get - Gets the specified managed cluster agent pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - agentPoolName - The name of the agent pool. @@ -437,7 +446,7 @@ func (client *AgentPoolsClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -456,7 +465,7 @@ func (client *AgentPoolsClient) getHandleResponse(resp *http.Response) (AgentPoo // for more details about the version lifecycle. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - AgentPoolsClientGetAvailableAgentPoolVersionsOptions contains the optional parameters for the AgentPoolsClient.GetAvailableAgentPoolVersions @@ -503,7 +512,7 @@ func (client *AgentPoolsClient) getAvailableAgentPoolVersionsCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -521,7 +530,7 @@ func (client *AgentPoolsClient) getAvailableAgentPoolVersionsHandleResponse(resp // GetUpgradeProfile - Gets the upgrade profile for an agent pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - agentPoolName - The name of the agent pool. @@ -573,7 +582,7 @@ func (client *AgentPoolsClient) getUpgradeProfileCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -590,7 +599,7 @@ func (client *AgentPoolsClient) getUpgradeProfileHandleResponse(resp *http.Respo // NewListPager - Gets a list of agent pools in the specified managed cluster. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - AgentPoolsClientListOptions contains the optional parameters for the AgentPoolsClient.NewListPager method. @@ -637,7 +646,7 @@ func (client *AgentPoolsClient) listCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -657,7 +666,7 @@ func (client *AgentPoolsClient) listHandleResponse(resp *http.Response) (AgentPo // versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - agentPoolName - The name of the agent pool. @@ -686,7 +695,7 @@ func (client *AgentPoolsClient) BeginUpgradeNodeImageVersion(ctx context.Context // versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 func (client *AgentPoolsClient) upgradeNodeImageVersion(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, options *AgentPoolsClientBeginUpgradeNodeImageVersionOptions) (*http.Response, error) { var err error const operationName = "AgentPoolsClient.BeginUpgradeNodeImageVersion" @@ -732,7 +741,7 @@ func (client *AgentPoolsClient) upgradeNodeImageVersionCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/assets.json b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/assets.json index dabcb0ed37..d442470501 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/assets.json +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "go", "TagPrefix": "go/resourcemanager/containerservice/armcontainerservice", - "Tag": "go/resourcemanager/containerservice/armcontainerservice_134198359a" + "Tag": "go/resourcemanager/containerservice/armcontainerservice_d075a00cde" } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/autorest.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/autorest.md index 157c2aede5..f2339883a6 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/autorest.md +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/e838027e88cca634c1545e744630de9262a6e72a/specification/containerservice/resource-manager/Microsoft.ContainerService/aks/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 6.2.0 -tag: package-2024-08 +module-version: 6.3.0 +tag: package-2024-09 ``` diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/constants.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/constants.go index db1a2ad33a..46e99857b1 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/constants.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/constants.go @@ -10,7 +10,7 @@ package armcontainerservice const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice" - moduleVersion = "v6.2.0" + moduleVersion = "v6.3.0" ) // AgentPoolMode - A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent @@ -728,6 +728,25 @@ func PossibleResourceIdentityTypeValues() []ResourceIdentityType { } } +// RestrictionLevel - The restriction level applied to the cluster's node resource group. If not specified, the default is +// 'Unrestricted' +type RestrictionLevel string + +const ( + // RestrictionLevelReadOnly - Only */read RBAC permissions allowed on the managed node resource group + RestrictionLevelReadOnly RestrictionLevel = "ReadOnly" + // RestrictionLevelUnrestricted - All RBAC permissions are allowed on the managed node resource group + RestrictionLevelUnrestricted RestrictionLevel = "Unrestricted" +) + +// PossibleRestrictionLevelValues returns the possible values for the RestrictionLevel const type. +func PossibleRestrictionLevelValues() []RestrictionLevel { + return []RestrictionLevel{ + RestrictionLevelReadOnly, + RestrictionLevelUnrestricted, + } +} + // ScaleDownMode - Describes how VMs are added to or removed from Agent Pools. See billing states [https://docs.microsoft.com/azure/virtual-machines/states-billing]. type ScaleDownMode string diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/machines_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/machines_client.go index c3c6d885fe..562112dea9 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/machines_client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/machines_client.go @@ -46,7 +46,7 @@ func NewMachinesClient(subscriptionID string, credential azcore.TokenCredential, // Get - Get a specific machine in the specified agent pool. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - agentPoolName - The name of the agent pool. @@ -102,7 +102,7 @@ func (client *MachinesClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -119,7 +119,7 @@ func (client *MachinesClient) getHandleResponse(resp *http.Response) (MachinesCl // NewListPager - Gets a list of machines in the specified agent pool. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - agentPoolName - The name of the agent pool. @@ -171,7 +171,7 @@ func (client *MachinesClient) listCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/maintenanceconfigurations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/maintenanceconfigurations_client.go index 622117c2c6..bf9a0d592b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/maintenanceconfigurations_client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/maintenanceconfigurations_client.go @@ -46,7 +46,7 @@ func NewMaintenanceConfigurationsClient(subscriptionID string, credential azcore // CreateOrUpdate - Creates or updates a maintenance configuration in the specified managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - configName - The name of the maintenance configuration. @@ -99,7 +99,7 @@ func (client *MaintenanceConfigurationsClient) createOrUpdateCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -120,7 +120,7 @@ func (client *MaintenanceConfigurationsClient) createOrUpdateHandleResponse(resp // Delete - Deletes a maintenance configuration. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - configName - The name of the maintenance configuration. @@ -171,7 +171,7 @@ func (client *MaintenanceConfigurationsClient) deleteCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -180,7 +180,7 @@ func (client *MaintenanceConfigurationsClient) deleteCreateRequest(ctx context.C // Get - Gets the specified maintenance configuration of a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - configName - The name of the maintenance configuration. @@ -232,7 +232,7 @@ func (client *MaintenanceConfigurationsClient) getCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -249,7 +249,7 @@ func (client *MaintenanceConfigurationsClient) getHandleResponse(resp *http.Resp // NewListByManagedClusterPager - Gets a list of maintenance configurations in the specified managed cluster. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - MaintenanceConfigurationsClientListByManagedClusterOptions contains the optional parameters for the MaintenanceConfigurationsClient.NewListByManagedClusterPager @@ -297,7 +297,7 @@ func (client *MaintenanceConfigurationsClient) listByManagedClusterCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/managedclusters_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/managedclusters_client.go index f79514584a..e9f1dbc41d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/managedclusters_client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/managedclusters_client.go @@ -48,7 +48,7 @@ func NewManagedClustersClient(subscriptionID string, credential azcore.TokenCred // completes before cancellation can take place, a 409 error code is returned. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - ManagedClustersClientBeginAbortLatestOperationOptions contains the optional parameters for the ManagedClustersClient.BeginAbortLatestOperation @@ -76,7 +76,7 @@ func (client *ManagedClustersClient) BeginAbortLatestOperation(ctx context.Conte // completes before cancellation can take place, a 409 error code is returned. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 func (client *ManagedClustersClient) abortLatestOperation(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginAbortLatestOperationOptions) (*http.Response, error) { var err error const operationName = "ManagedClustersClient.BeginAbortLatestOperation" @@ -118,7 +118,7 @@ func (client *ManagedClustersClient) abortLatestOperationCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -127,7 +127,7 @@ func (client *ManagedClustersClient) abortLatestOperationCreateRequest(ctx conte // BeginCreateOrUpdate - Creates or updates a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - parameters - The managed cluster to create or update. @@ -153,7 +153,7 @@ func (client *ManagedClustersClient) BeginCreateOrUpdate(ctx context.Context, re // CreateOrUpdate - Creates or updates a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 func (client *ManagedClustersClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedCluster, options *ManagedClustersClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "ManagedClustersClient.BeginCreateOrUpdate" @@ -195,9 +195,15 @@ func (client *ManagedClustersClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + if options != nil && options.IfNoneMatch != nil { + req.Raw().Header["If-None-Match"] = []string{*options.IfNoneMatch} + } if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } @@ -207,7 +213,7 @@ func (client *ManagedClustersClient) createOrUpdateCreateRequest(ctx context.Con // BeginDelete - Deletes a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - ManagedClustersClientBeginDeleteOptions contains the optional parameters for the ManagedClustersClient.BeginDelete @@ -232,7 +238,7 @@ func (client *ManagedClustersClient) BeginDelete(ctx context.Context, resourceGr // Delete - Deletes a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 func (client *ManagedClustersClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ManagedClustersClient.BeginDelete" @@ -274,16 +280,19 @@ func (client *ManagedClustersClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } return req, nil } // Get - Gets a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - ManagedClustersClientGetOptions contains the optional parameters for the ManagedClustersClient.Get method. @@ -329,7 +338,7 @@ func (client *ManagedClustersClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -349,7 +358,7 @@ func (client *ManagedClustersClient) getHandleResponse(resp *http.Response) (Man // [https://docs.microsoft.com/rest/api/aks/managedclusters/listclusteradmincredentials] . // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - roleName - The name of the role for managed cluster accessProfile resource. @@ -401,7 +410,7 @@ func (client *ManagedClustersClient) getAccessProfileCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -419,7 +428,7 @@ func (client *ManagedClustersClient) getAccessProfileHandleResponse(resp *http.R // GetCommandResult - Gets the results of a command which has been run on the Managed Cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - commandID - Id of the command. @@ -471,7 +480,7 @@ func (client *ManagedClustersClient) getCommandResultCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -493,7 +502,7 @@ func (client *ManagedClustersClient) getCommandResultHandleResponse(resp *http.R // and available upgrades // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - location - The name of the Azure region. // - mode - The mode of the mesh. // - options - ManagedClustersClientGetMeshRevisionProfileOptions contains the optional parameters for the ManagedClustersClient.GetMeshRevisionProfile @@ -540,7 +549,7 @@ func (client *ManagedClustersClient) getMeshRevisionProfileCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -558,7 +567,7 @@ func (client *ManagedClustersClient) getMeshRevisionProfileHandleResponse(resp * // GetMeshUpgradeProfile - Gets available upgrades for a service mesh in a cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - mode - The mode of the mesh. @@ -610,7 +619,7 @@ func (client *ManagedClustersClient) getMeshUpgradeProfileCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -628,7 +637,7 @@ func (client *ManagedClustersClient) getMeshUpgradeProfileHandleResponse(resp *h // GetUpgradeProfile - Gets the upgrade profile of a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - ManagedClustersClientGetUpgradeProfileOptions contains the optional parameters for the ManagedClustersClient.GetUpgradeProfile @@ -675,7 +684,7 @@ func (client *ManagedClustersClient) getUpgradeProfileCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -692,7 +701,7 @@ func (client *ManagedClustersClient) getUpgradeProfileHandleResponse(resp *http. // NewListPager - Gets a list of managed clusters in the specified subscription. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - options - ManagedClustersClientListOptions contains the optional parameters for the ManagedClustersClient.NewListPager // method. func (client *ManagedClustersClient) NewListPager(options *ManagedClustersClientListOptions) *runtime.Pager[ManagedClustersClientListResponse] { @@ -730,7 +739,7 @@ func (client *ManagedClustersClient) listCreateRequest(ctx context.Context, opti return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -747,7 +756,7 @@ func (client *ManagedClustersClient) listHandleResponse(resp *http.Response) (Ma // NewListByResourceGroupPager - Lists managed clusters in the specified subscription and resource group. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ManagedClustersClientListByResourceGroupOptions contains the optional parameters for the ManagedClustersClient.NewListByResourceGroupPager // method. @@ -790,7 +799,7 @@ func (client *ManagedClustersClient) listByResourceGroupCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -808,7 +817,7 @@ func (client *ManagedClustersClient) listByResourceGroupHandleResponse(resp *htt // ListClusterAdminCredentials - Lists the admin credentials of a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - ManagedClustersClientListClusterAdminCredentialsOptions contains the optional parameters for the ManagedClustersClient.ListClusterAdminCredentials @@ -855,7 +864,7 @@ func (client *ManagedClustersClient) listClusterAdminCredentialsCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") if options != nil && options.ServerFqdn != nil { reqQP.Set("server-fqdn", *options.ServerFqdn) } @@ -876,7 +885,7 @@ func (client *ManagedClustersClient) listClusterAdminCredentialsHandleResponse(r // ListClusterMonitoringUserCredentials - Lists the cluster monitoring user credentials of a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - ManagedClustersClientListClusterMonitoringUserCredentialsOptions contains the optional parameters for the ManagedClustersClient.ListClusterMonitoringUserCredentials @@ -923,7 +932,7 @@ func (client *ManagedClustersClient) listClusterMonitoringUserCredentialsCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") if options != nil && options.ServerFqdn != nil { reqQP.Set("server-fqdn", *options.ServerFqdn) } @@ -944,7 +953,7 @@ func (client *ManagedClustersClient) listClusterMonitoringUserCredentialsHandleR // ListClusterUserCredentials - Lists the user credentials of a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - ManagedClustersClientListClusterUserCredentialsOptions contains the optional parameters for the ManagedClustersClient.ListClusterUserCredentials @@ -991,7 +1000,7 @@ func (client *ManagedClustersClient) listClusterUserCredentialsCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") if options != nil && options.Format != nil { reqQP.Set("format", string(*options.Format)) } @@ -1016,7 +1025,7 @@ func (client *ManagedClustersClient) listClusterUserCredentialsHandleResponse(re // upgrades, and details on preview status of the version // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - location - The name of the Azure region. // - options - ManagedClustersClientListKubernetesVersionsOptions contains the optional parameters for the ManagedClustersClient.ListKubernetesVersions // method. @@ -1058,7 +1067,7 @@ func (client *ManagedClustersClient) listKubernetesVersionsCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1076,7 +1085,7 @@ func (client *ManagedClustersClient) listKubernetesVersionsHandleResponse(resp * // NewListMeshRevisionProfilesPager - Contains extra metadata on each revision, including supported revisions, cluster compatibility // and available upgrades // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - location - The name of the Azure region. // - options - ManagedClustersClientListMeshRevisionProfilesOptions contains the optional parameters for the ManagedClustersClient.NewListMeshRevisionProfilesPager // method. @@ -1119,7 +1128,7 @@ func (client *ManagedClustersClient) listMeshRevisionProfilesCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1136,7 +1145,7 @@ func (client *ManagedClustersClient) listMeshRevisionProfilesHandleResponse(resp // NewListMeshUpgradeProfilesPager - Lists available upgrades for all service meshes in a specific cluster. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - ManagedClustersClientListMeshUpgradeProfilesOptions contains the optional parameters for the ManagedClustersClient.NewListMeshUpgradeProfilesPager @@ -1184,7 +1193,7 @@ func (client *ManagedClustersClient) listMeshUpgradeProfilesCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1202,7 +1211,7 @@ func (client *ManagedClustersClient) listMeshUpgradeProfilesHandleResponse(resp // NewListOutboundNetworkDependenciesEndpointsPager - Gets a list of egress endpoints (network endpoints of all outbound dependencies) // in the specified managed cluster. The operation returns properties of each egress endpoint. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - ManagedClustersClientListOutboundNetworkDependenciesEndpointsOptions contains the optional parameters for the @@ -1250,7 +1259,7 @@ func (client *ManagedClustersClient) listOutboundNetworkDependenciesEndpointsCre return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1269,7 +1278,7 @@ func (client *ManagedClustersClient) listOutboundNetworkDependenciesEndpointsHan // [https://aka.ms/aks-managed-aad] to update your cluster with AKS-managed Azure AD. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - parameters - The AAD profile to set on the Managed Cluster @@ -1297,7 +1306,7 @@ func (client *ManagedClustersClient) BeginResetAADProfile(ctx context.Context, r // to update your cluster with AKS-managed Azure AD. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 func (client *ManagedClustersClient) resetAADProfile(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterAADProfile, options *ManagedClustersClientBeginResetAADProfileOptions) (*http.Response, error) { var err error const operationName = "ManagedClustersClient.BeginResetAADProfile" @@ -1339,7 +1348,7 @@ func (client *ManagedClustersClient) resetAADProfileCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -1351,7 +1360,7 @@ func (client *ManagedClustersClient) resetAADProfileCreateRequest(ctx context.Co // BeginResetServicePrincipalProfile - This action cannot be performed on a cluster that is not using a service principal // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - parameters - The service principal profile to set on the managed cluster. @@ -1378,7 +1387,7 @@ func (client *ManagedClustersClient) BeginResetServicePrincipalProfile(ctx conte // ResetServicePrincipalProfile - This action cannot be performed on a cluster that is not using a service principal // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 func (client *ManagedClustersClient) resetServicePrincipalProfile(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterServicePrincipalProfile, options *ManagedClustersClientBeginResetServicePrincipalProfileOptions) (*http.Response, error) { var err error const operationName = "ManagedClustersClient.BeginResetServicePrincipalProfile" @@ -1420,7 +1429,7 @@ func (client *ManagedClustersClient) resetServicePrincipalProfileCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -1433,7 +1442,7 @@ func (client *ManagedClustersClient) resetServicePrincipalProfileCreateRequest(c // more details about rotating managed cluster certificates. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - ManagedClustersClientBeginRotateClusterCertificatesOptions contains the optional parameters for the ManagedClustersClient.BeginRotateClusterCertificates @@ -1460,7 +1469,7 @@ func (client *ManagedClustersClient) BeginRotateClusterCertificates(ctx context. // details about rotating managed cluster certificates. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 func (client *ManagedClustersClient) rotateClusterCertificates(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginRotateClusterCertificatesOptions) (*http.Response, error) { var err error const operationName = "ManagedClustersClient.BeginRotateClusterCertificates" @@ -1502,7 +1511,7 @@ func (client *ManagedClustersClient) rotateClusterCertificatesCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1511,7 +1520,7 @@ func (client *ManagedClustersClient) rotateClusterCertificatesCreateRequest(ctx // BeginRotateServiceAccountSigningKeys - Rotates the service account signing keys of a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - ManagedClustersClientBeginRotateServiceAccountSigningKeysOptions contains the optional parameters for the ManagedClustersClient.BeginRotateServiceAccountSigningKeys @@ -1537,7 +1546,7 @@ func (client *ManagedClustersClient) BeginRotateServiceAccountSigningKeys(ctx co // RotateServiceAccountSigningKeys - Rotates the service account signing keys of a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 func (client *ManagedClustersClient) rotateServiceAccountSigningKeys(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginRotateServiceAccountSigningKeysOptions) (*http.Response, error) { var err error const operationName = "ManagedClustersClient.BeginRotateServiceAccountSigningKeys" @@ -1579,7 +1588,7 @@ func (client *ManagedClustersClient) rotateServiceAccountSigningKeysCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1590,7 +1599,7 @@ func (client *ManagedClustersClient) rotateServiceAccountSigningKeysCreateReques // [https://docs.microsoft.com/azure/aks/private-clusters#aks-run-command-preview]. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - requestPayload - The run command request @@ -1619,7 +1628,7 @@ func (client *ManagedClustersClient) BeginRunCommand(ctx context.Context, resour // [https://docs.microsoft.com/azure/aks/private-clusters#aks-run-command-preview]. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 func (client *ManagedClustersClient) runCommand(ctx context.Context, resourceGroupName string, resourceName string, requestPayload RunCommandRequest, options *ManagedClustersClientBeginRunCommandOptions) (*http.Response, error) { var err error const operationName = "ManagedClustersClient.BeginRunCommand" @@ -1661,7 +1670,7 @@ func (client *ManagedClustersClient) runCommandCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, requestPayload); err != nil { @@ -1674,7 +1683,7 @@ func (client *ManagedClustersClient) runCommandCreateRequest(ctx context.Context // a cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - ManagedClustersClientBeginStartOptions contains the optional parameters for the ManagedClustersClient.BeginStart @@ -1701,7 +1710,7 @@ func (client *ManagedClustersClient) BeginStart(ctx context.Context, resourceGro // a cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 func (client *ManagedClustersClient) start(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginStartOptions) (*http.Response, error) { var err error const operationName = "ManagedClustersClient.BeginStart" @@ -1743,7 +1752,7 @@ func (client *ManagedClustersClient) startCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1755,7 +1764,7 @@ func (client *ManagedClustersClient) startCreateRequest(ctx context.Context, res // for more details about stopping a cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - ManagedClustersClientBeginStopOptions contains the optional parameters for the ManagedClustersClient.BeginStop @@ -1784,7 +1793,7 @@ func (client *ManagedClustersClient) BeginStop(ctx context.Context, resourceGrou // for more details about stopping a cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 func (client *ManagedClustersClient) stop(ctx context.Context, resourceGroupName string, resourceName string, options *ManagedClustersClientBeginStopOptions) (*http.Response, error) { var err error const operationName = "ManagedClustersClient.BeginStop" @@ -1826,7 +1835,7 @@ func (client *ManagedClustersClient) stopCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1835,7 +1844,7 @@ func (client *ManagedClustersClient) stopCreateRequest(ctx context.Context, reso // BeginUpdateTags - Updates tags on a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - parameters - Parameters supplied to the Update Managed Cluster Tags operation. @@ -1861,7 +1870,7 @@ func (client *ManagedClustersClient) BeginUpdateTags(ctx context.Context, resour // UpdateTags - Updates tags on a managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 func (client *ManagedClustersClient) updateTags(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject, options *ManagedClustersClientBeginUpdateTagsOptions) (*http.Response, error) { var err error const operationName = "ManagedClustersClient.BeginUpdateTags" @@ -1903,9 +1912,12 @@ func (client *ManagedClustersClient) updateTagsCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/models.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/models.go index aa214773fa..8aa03b31a1 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/models.go @@ -25,6 +25,35 @@ type AccessProfile struct { KubeConfig []byte } +// AdvancedNetworking - Advanced Networking profile for enabling observability and security feature suite on a cluster. For +// more information see aka.ms/aksadvancednetworking. +type AdvancedNetworking struct { + // Indicates the enablement of Advanced Networking functionalities of observability and security on AKS clusters. When this + // is set to true, all observability and security features will be set to enabled + // unless explicitly disabled. If not specified, the default is false. + Enabled *bool + + // Observability profile to enable advanced network metrics and flow logs with historical contexts. + Observability *AdvancedNetworkingObservability + + // Security profile to enable security features on cilium based cluster. + Security *AdvancedNetworkingSecurity +} + +// AdvancedNetworkingObservability - Observability profile to enable advanced network metrics and flow logs with historical +// contexts. +type AdvancedNetworkingObservability struct { + // Indicates the enablement of Advanced Networking observability functionalities on clusters. + Enabled *bool +} + +// AdvancedNetworkingSecurity - Security profile to enable security features on cilium based cluster. +type AdvancedNetworkingSecurity struct { + // This feature allows user to configure network policy based on DNS (FQDN) names. It can be enabled only on cilium based + // clusters. If not specified, the default is false. + Enabled *bool +} + // AgentPool - Agent Pool. type AgentPool struct { // Properties of an agent pool. @@ -635,6 +664,11 @@ type ManagedCluster struct { // Resource tags. Tags map[string]*string + // READ-ONLY; Unique read-only string used to implement optimistic concurrency. The eTag value will change when the resource + // is updated. Specify an if-match or if-none-match header with the eTag value for a + // subsequent request to enable optimistic concurrency per the normal etag convention. + ETag *string + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string @@ -905,6 +939,11 @@ type ManagedClusterAgentPoolProfile struct { // is , this field will contain the full version being used. CurrentOrchestratorVersion *string + // READ-ONLY; Unique read-only string used to implement optimistic concurrency. The eTag value will change when the resource + // is updated. Specify an if-match or if-none-match header with the eTag value for a + // subsequent request to enable optimistic concurrency per the normal etag convention. + ETag *string + // READ-ONLY; The version of node image NodeImageVersion *string @@ -1073,6 +1112,11 @@ type ManagedClusterAgentPoolProfileProperties struct { // is , this field will contain the full version being used. CurrentOrchestratorVersion *string + // READ-ONLY; Unique read-only string used to implement optimistic concurrency. The eTag value will change when the resource + // is updated. Specify an if-match or if-none-match header with the eTag value for a + // subsequent request to enable optimistic concurrency per the normal etag convention. + ETag *string + // READ-ONLY; The version of node image NodeImageVersion *string @@ -1282,6 +1326,12 @@ type ManagedClusterNATGatewayProfile struct { ManagedOutboundIPProfile *ManagedClusterManagedOutboundIPProfile } +// ManagedClusterNodeResourceGroupProfile - Node resource group lockdown profile for a managed cluster. +type ManagedClusterNodeResourceGroupProfile struct { + // The restriction level applied to the cluster's node resource group. If not specified, the default is 'Unrestricted' + RestrictionLevel *RestrictionLevel +} + // ManagedClusterOIDCIssuerProfile - The OIDC issuer profile of the Managed Cluster. type ManagedClusterOIDCIssuerProfile struct { // Whether the OIDC issuer is enabled. @@ -1441,7 +1491,9 @@ type ManagedClusterProperties struct { // Configurations for provisioning the cluster with HTTP proxy servers. HTTPProxyConfig *ManagedClusterHTTPProxyConfig - // Identities associated with the cluster. + // The user identity associated with the managed cluster. This identity will be used by the kubelet. Only one user assigned + // identity is allowed. The only accepted key is "kubeletidentity", with value of + // "resourceId": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}". IdentityProfile map[string]*UserAssignedIdentity // Ingress profile for the managed cluster. @@ -1468,6 +1520,9 @@ type ManagedClusterProperties struct { // The name of the resource group containing agent pool nodes. NodeResourceGroup *string + // Profile of the node resource group configuration. + NodeResourceGroupProfile *ManagedClusterNodeResourceGroupProfile + // The OIDC issuer profile of the Managed Cluster. OidcIssuerProfile *ManagedClusterOIDCIssuerProfile @@ -1890,6 +1945,10 @@ type MeshUpgradeProfileProperties struct { // NetworkProfile - Profile of network configuration. type NetworkProfile struct { + // Advanced Networking profile for enabling observability and security feature suite on a cluster. For more information see + // aka.ms/aksadvancednetworking. + AdvancedNetworking *AdvancedNetworking + // An IP address assigned to the Kubernetes DNS service. It must be within the Kubernetes service address range specified // in serviceCidr. DNSServiceIP *string diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/models_serde.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/models_serde.go index 2cbf85c4fc..c680389b79 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/models_serde.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/models_serde.go @@ -78,6 +78,95 @@ func (a *AccessProfile) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AdvancedNetworking. +func (a AdvancedNetworking) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", a.Enabled) + populate(objectMap, "observability", a.Observability) + populate(objectMap, "security", a.Security) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdvancedNetworking. +func (a *AdvancedNetworking) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &a.Enabled) + delete(rawMsg, key) + case "observability": + err = unpopulate(val, "Observability", &a.Observability) + delete(rawMsg, key) + case "security": + err = unpopulate(val, "Security", &a.Security) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AdvancedNetworkingObservability. +func (a AdvancedNetworkingObservability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", a.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdvancedNetworkingObservability. +func (a *AdvancedNetworkingObservability) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &a.Enabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AdvancedNetworkingSecurity. +func (a AdvancedNetworkingSecurity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", a.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdvancedNetworkingSecurity. +func (a *AdvancedNetworkingSecurity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &a.Enabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type AgentPool. func (a AgentPool) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1748,6 +1837,7 @@ func (m *MaintenanceWindow) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ManagedCluster. func (m ManagedCluster) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "eTag", m.ETag) populate(objectMap, "extendedLocation", m.ExtendedLocation) populate(objectMap, "id", m.ID) populate(objectMap, "identity", m.Identity) @@ -1770,6 +1860,9 @@ func (m *ManagedCluster) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "eTag": + err = unpopulate(val, "ETag", &m.ETag) + delete(rawMsg, key) case "extendedLocation": err = unpopulate(val, "ExtendedLocation", &m.ExtendedLocation) delete(rawMsg, key) @@ -2031,6 +2124,7 @@ func (m ManagedClusterAgentPoolProfile) MarshalJSON() ([]byte, error) { populate(objectMap, "count", m.Count) populate(objectMap, "creationData", m.CreationData) populate(objectMap, "currentOrchestratorVersion", m.CurrentOrchestratorVersion) + populate(objectMap, "eTag", m.ETag) populate(objectMap, "enableAutoScaling", m.EnableAutoScaling) populate(objectMap, "enableEncryptionAtHost", m.EnableEncryptionAtHost) populate(objectMap, "enableFIPS", m.EnableFIPS) @@ -2099,6 +2193,9 @@ func (m *ManagedClusterAgentPoolProfile) UnmarshalJSON(data []byte) error { case "currentOrchestratorVersion": err = unpopulate(val, "CurrentOrchestratorVersion", &m.CurrentOrchestratorVersion) delete(rawMsg, key) + case "eTag": + err = unpopulate(val, "ETag", &m.ETag) + delete(rawMsg, key) case "enableAutoScaling": err = unpopulate(val, "EnableAutoScaling", &m.EnableAutoScaling) delete(rawMsg, key) @@ -2238,6 +2335,7 @@ func (m ManagedClusterAgentPoolProfileProperties) MarshalJSON() ([]byte, error) populate(objectMap, "count", m.Count) populate(objectMap, "creationData", m.CreationData) populate(objectMap, "currentOrchestratorVersion", m.CurrentOrchestratorVersion) + populate(objectMap, "eTag", m.ETag) populate(objectMap, "enableAutoScaling", m.EnableAutoScaling) populate(objectMap, "enableEncryptionAtHost", m.EnableEncryptionAtHost) populate(objectMap, "enableFIPS", m.EnableFIPS) @@ -2305,6 +2403,9 @@ func (m *ManagedClusterAgentPoolProfileProperties) UnmarshalJSON(data []byte) er case "currentOrchestratorVersion": err = unpopulate(val, "CurrentOrchestratorVersion", &m.CurrentOrchestratorVersion) delete(rawMsg, key) + case "eTag": + err = unpopulate(val, "ETag", &m.ETag) + delete(rawMsg, key) case "enableAutoScaling": err = unpopulate(val, "EnableAutoScaling", &m.EnableAutoScaling) delete(rawMsg, key) @@ -2984,6 +3085,33 @@ func (m *ManagedClusterNATGatewayProfile) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ManagedClusterNodeResourceGroupProfile. +func (m ManagedClusterNodeResourceGroupProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "restrictionLevel", m.RestrictionLevel) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedClusterNodeResourceGroupProfile. +func (m *ManagedClusterNodeResourceGroupProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "restrictionLevel": + err = unpopulate(val, "RestrictionLevel", &m.RestrictionLevel) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ManagedClusterOIDCIssuerProfile. func (m ManagedClusterOIDCIssuerProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3327,6 +3455,7 @@ func (m ManagedClusterProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "metricsProfile", m.MetricsProfile) populate(objectMap, "networkProfile", m.NetworkProfile) populate(objectMap, "nodeResourceGroup", m.NodeResourceGroup) + populate(objectMap, "nodeResourceGroupProfile", m.NodeResourceGroupProfile) populate(objectMap, "oidcIssuerProfile", m.OidcIssuerProfile) populate(objectMap, "podIdentityProfile", m.PodIdentityProfile) populate(objectMap, "powerState", m.PowerState) @@ -3430,6 +3559,9 @@ func (m *ManagedClusterProperties) UnmarshalJSON(data []byte) error { case "nodeResourceGroup": err = unpopulate(val, "NodeResourceGroup", &m.NodeResourceGroup) delete(rawMsg, key) + case "nodeResourceGroupProfile": + err = unpopulate(val, "NodeResourceGroupProfile", &m.NodeResourceGroupProfile) + delete(rawMsg, key) case "oidcIssuerProfile": err = unpopulate(val, "OidcIssuerProfile", &m.OidcIssuerProfile) delete(rawMsg, key) @@ -4430,6 +4562,7 @@ func (m *MeshUpgradeProfileProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type NetworkProfile. func (n NetworkProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "advancedNetworking", n.AdvancedNetworking) populate(objectMap, "dnsServiceIP", n.DNSServiceIP) populate(objectMap, "ipFamilies", n.IPFamilies) populate(objectMap, "loadBalancerProfile", n.LoadBalancerProfile) @@ -4457,6 +4590,9 @@ func (n *NetworkProfile) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "advancedNetworking": + err = unpopulate(val, "AdvancedNetworking", &n.AdvancedNetworking) + delete(rawMsg, key) case "dnsServiceIP": err = unpopulate(val, "DNSServiceIP", &n.DNSServiceIP) delete(rawMsg, key) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/operations_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/operations_client.go index 06d8cc67c8..708497743a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/operations_client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/operations_client.go @@ -39,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Gets a list of operations. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -73,7 +73,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/options.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/options.go index 46faa5387c..84c564e892 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/options.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/options.go @@ -18,6 +18,12 @@ type AgentPoolsClientBeginAbortLatestOperationOptions struct { // AgentPoolsClientBeginCreateOrUpdateOptions contains the optional parameters for the AgentPoolsClient.BeginCreateOrUpdate // method. type AgentPoolsClientBeginCreateOrUpdateOptions struct { + // The request should only proceed if an entity matches this string. + IfMatch *string + + // The request should only proceed if no entity matches this string. + IfNoneMatch *string + // Resumes the LRO from the provided token. ResumeToken string } @@ -31,6 +37,9 @@ type AgentPoolsClientBeginDeleteMachinesOptions struct { // AgentPoolsClientBeginDeleteOptions contains the optional parameters for the AgentPoolsClient.BeginDelete method. type AgentPoolsClientBeginDeleteOptions struct { + // The request should only proceed if an entity matches this string. + IfMatch *string + // ignore-pod-disruption-budget=true to delete those pods on a node without considering Pod Disruption Budget IgnorePodDisruptionBudget *bool @@ -110,12 +119,21 @@ type ManagedClustersClientBeginAbortLatestOperationOptions struct { // ManagedClustersClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedClustersClient.BeginCreateOrUpdate // method. type ManagedClustersClientBeginCreateOrUpdateOptions struct { + // The request should only proceed if an entity matches this string. + IfMatch *string + + // The request should only proceed if no entity matches this string. + IfNoneMatch *string + // Resumes the LRO from the provided token. ResumeToken string } // ManagedClustersClientBeginDeleteOptions contains the optional parameters for the ManagedClustersClient.BeginDelete method. type ManagedClustersClientBeginDeleteOptions struct { + // The request should only proceed if an entity matches this string. + IfMatch *string + // Resumes the LRO from the provided token. ResumeToken string } @@ -170,6 +188,9 @@ type ManagedClustersClientBeginStopOptions struct { // ManagedClustersClientBeginUpdateTagsOptions contains the optional parameters for the ManagedClustersClient.BeginUpdateTags // method. type ManagedClustersClientBeginUpdateTagsOptions struct { + // The request should only proceed if an entity matches this string. + IfMatch *string + // Resumes the LRO from the provided token. ResumeToken string } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/privateendpointconnections_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/privateendpointconnections_client.go index 975a836bf5..e666eb61df 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/privateendpointconnections_client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/privateendpointconnections_client.go @@ -46,7 +46,7 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // BeginDelete - Deletes a private endpoint connection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - privateEndpointConnectionName - The name of the private endpoint connection. @@ -72,7 +72,7 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // Delete - Deletes a private endpoint connection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginDelete" @@ -118,7 +118,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -127,7 +127,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - privateEndpointConnectionName - The name of the private endpoint connection. @@ -179,7 +179,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -197,7 +197,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // List - To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.List @@ -244,7 +244,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -262,7 +262,7 @@ func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Re // Update - Updates a private endpoint connection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - privateEndpointConnectionName - The name of the private endpoint connection. @@ -315,7 +315,7 @@ func (client *PrivateEndpointConnectionsClient) updateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/privatelinkresources_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/privatelinkresources_client.go index eac5bfaf38..e85c096902 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/privatelinkresources_client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/privatelinkresources_client.go @@ -46,7 +46,7 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // List - To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.List @@ -93,7 +93,7 @@ func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/resolveprivatelinkserviceid_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/resolveprivatelinkserviceid_client.go index b9be6ed99a..b1a8fc1144 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/resolveprivatelinkserviceid_client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/resolveprivatelinkserviceid_client.go @@ -46,7 +46,7 @@ func NewResolvePrivateLinkServiceIDClient(subscriptionID string, credential azco // POST - Gets the private link service ID for the specified managed cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - parameters - Parameters required in order to resolve a private link service ID. @@ -94,7 +94,7 @@ func (client *ResolvePrivateLinkServiceIDClient) postCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/snapshots_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/snapshots_client.go index 3ce76250e6..b720528337 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/snapshots_client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/snapshots_client.go @@ -46,7 +46,7 @@ func NewSnapshotsClient(subscriptionID string, credential azcore.TokenCredential // CreateOrUpdate - Creates or updates a snapshot. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - parameters - The snapshot to create or update. @@ -94,7 +94,7 @@ func (client *SnapshotsClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -115,7 +115,7 @@ func (client *SnapshotsClient) createOrUpdateHandleResponse(resp *http.Response) // Delete - Deletes a snapshot. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - SnapshotsClientDeleteOptions contains the optional parameters for the SnapshotsClient.Delete method. @@ -160,7 +160,7 @@ func (client *SnapshotsClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -169,7 +169,7 @@ func (client *SnapshotsClient) deleteCreateRequest(ctx context.Context, resource // Get - Gets a snapshot. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - SnapshotsClientGetOptions contains the optional parameters for the SnapshotsClient.Get method. @@ -215,7 +215,7 @@ func (client *SnapshotsClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -232,7 +232,7 @@ func (client *SnapshotsClient) getHandleResponse(resp *http.Response) (Snapshots // NewListPager - Gets a list of snapshots in the specified subscription. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - options - SnapshotsClientListOptions contains the optional parameters for the SnapshotsClient.NewListPager method. func (client *SnapshotsClient) NewListPager(options *SnapshotsClientListOptions) *runtime.Pager[SnapshotsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[SnapshotsClientListResponse]{ @@ -269,7 +269,7 @@ func (client *SnapshotsClient) listCreateRequest(ctx context.Context, options *S return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -286,7 +286,7 @@ func (client *SnapshotsClient) listHandleResponse(resp *http.Response) (Snapshot // NewListByResourceGroupPager - Lists snapshots in the specified subscription and resource group. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - SnapshotsClientListByResourceGroupOptions contains the optional parameters for the SnapshotsClient.NewListByResourceGroupPager // method. @@ -329,7 +329,7 @@ func (client *SnapshotsClient) listByResourceGroupCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -347,7 +347,7 @@ func (client *SnapshotsClient) listByResourceGroupHandleResponse(resp *http.Resp // UpdateTags - Updates tags on a snapshot. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - parameters - Parameters supplied to the Update snapshot Tags operation. @@ -394,7 +394,7 @@ func (client *SnapshotsClient) updateTagsCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/trustedaccessrolebindings_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/trustedaccessrolebindings_client.go index 56ae891dd3..3f2357ddc0 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/trustedaccessrolebindings_client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/trustedaccessrolebindings_client.go @@ -46,7 +46,7 @@ func NewTrustedAccessRoleBindingsClient(subscriptionID string, credential azcore // BeginCreateOrUpdate - Create or update a trusted access role binding // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - trustedAccessRoleBindingName - The name of trusted access role binding. @@ -73,7 +73,7 @@ func (client *TrustedAccessRoleBindingsClient) BeginCreateOrUpdate(ctx context.C // CreateOrUpdate - Create or update a trusted access role binding // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 func (client *TrustedAccessRoleBindingsClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, trustedAccessRoleBindingName string, trustedAccessRoleBinding TrustedAccessRoleBinding, options *TrustedAccessRoleBindingsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "TrustedAccessRoleBindingsClient.BeginCreateOrUpdate" @@ -119,7 +119,7 @@ func (client *TrustedAccessRoleBindingsClient) createOrUpdateCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, trustedAccessRoleBinding); err != nil { @@ -131,7 +131,7 @@ func (client *TrustedAccessRoleBindingsClient) createOrUpdateCreateRequest(ctx c // BeginDelete - Delete a trusted access role binding. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - trustedAccessRoleBindingName - The name of trusted access role binding. @@ -157,7 +157,7 @@ func (client *TrustedAccessRoleBindingsClient) BeginDelete(ctx context.Context, // Delete - Delete a trusted access role binding. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 func (client *TrustedAccessRoleBindingsClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, trustedAccessRoleBindingName string, options *TrustedAccessRoleBindingsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "TrustedAccessRoleBindingsClient.BeginDelete" @@ -203,7 +203,7 @@ func (client *TrustedAccessRoleBindingsClient) deleteCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -212,7 +212,7 @@ func (client *TrustedAccessRoleBindingsClient) deleteCreateRequest(ctx context.C // Get - Get a trusted access role binding. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - trustedAccessRoleBindingName - The name of trusted access role binding. @@ -264,7 +264,7 @@ func (client *TrustedAccessRoleBindingsClient) getCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -281,7 +281,7 @@ func (client *TrustedAccessRoleBindingsClient) getHandleResponse(resp *http.Resp // NewListPager - List trusted access role bindings. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the managed cluster resource. // - options - TrustedAccessRoleBindingsClientListOptions contains the optional parameters for the TrustedAccessRoleBindingsClient.NewListPager @@ -329,7 +329,7 @@ func (client *TrustedAccessRoleBindingsClient) listCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/trustedaccessroles_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/trustedaccessroles_client.go index e08d2af088..c8b0df43ea 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/trustedaccessroles_client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/trustedaccessroles_client.go @@ -45,7 +45,7 @@ func NewTrustedAccessRolesClient(subscriptionID string, credential azcore.TokenC // NewListPager - List supported trusted access roles. // -// Generated from API version 2024-08-01 +// Generated from API version 2024-09-01 // - location - The name of the Azure region. // - options - TrustedAccessRolesClientListOptions contains the optional parameters for the TrustedAccessRolesClient.NewListPager // method. @@ -88,7 +88,7 @@ func (client *TrustedAccessRolesClient) listCreateRequest(ctx context.Context, l return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md b/vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md index 3011efb57a..fd6e070c1e 100644 --- a/vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md +++ b/vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md @@ -1,3 +1,13 @@ +## 2.22.0 + +### Features +- Add label to serial nodes [0fcaa08] + +This allows serial tests to be filtered using the `label-filter` + +### Maintenance +Various doc fixes + ## 2.21.0 diff --git a/vendor/github.com/onsi/ginkgo/v2/internal/node.go b/vendor/github.com/onsi/ginkgo/v2/internal/node.go index 6a15f19ae0..0686f74103 100644 --- a/vendor/github.com/onsi/ginkgo/v2/internal/node.go +++ b/vendor/github.com/onsi/ginkgo/v2/internal/node.go @@ -241,6 +241,9 @@ func NewNode(deprecationTracker *types.DeprecationTracker, nodeType types.NodeTy } case t == reflect.TypeOf(Serial): node.MarkedSerial = bool(arg.(serialType)) + if !labelsSeen["Serial"] { + node.Labels = append(node.Labels, "Serial") + } if !nodeType.Is(types.NodeTypesForContainerAndIt) { appendError(types.GinkgoErrors.InvalidDecoratorForNodeType(node.CodeLocation, nodeType, "Serial")) } diff --git a/vendor/github.com/onsi/ginkgo/v2/table_dsl.go b/vendor/github.com/onsi/ginkgo/v2/table_dsl.go index c7de7a8be0..9074a57ac9 100644 --- a/vendor/github.com/onsi/ginkgo/v2/table_dsl.go +++ b/vendor/github.com/onsi/ginkgo/v2/table_dsl.go @@ -95,7 +95,7 @@ For example: }) It("should return the expected message", func() { - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) Expect(err).NotTo(HaveOccurred()) Expect(string(body)).To(Equal(message)) }) diff --git a/vendor/github.com/onsi/ginkgo/v2/types/version.go b/vendor/github.com/onsi/ginkgo/v2/types/version.go index caf3c9f5e7..0b51c0b565 100644 --- a/vendor/github.com/onsi/ginkgo/v2/types/version.go +++ b/vendor/github.com/onsi/ginkgo/v2/types/version.go @@ -1,3 +1,3 @@ package types -const VERSION = "2.21.0" +const VERSION = "2.22.0" diff --git a/vendor/github.com/onsi/gomega/CHANGELOG.md b/vendor/github.com/onsi/gomega/CHANGELOG.md index 9f6090b8d3..b797577ffc 100644 --- a/vendor/github.com/onsi/gomega/CHANGELOG.md +++ b/vendor/github.com/onsi/gomega/CHANGELOG.md @@ -1,3 +1,12 @@ +## 1.36.0 + +### Features +- new: make collection-related matchers Go 1.23 iterator aware [4c964c6] + +### Maintenance +- Replace min/max helpers with built-in min/max [ece6872] +- Fix some typos in docs [8e924d7] + ## 1.35.1 ### Fixes diff --git a/vendor/github.com/onsi/gomega/gomega_dsl.go b/vendor/github.com/onsi/gomega/gomega_dsl.go index 1038d7dd41..eb74f6f6ac 100644 --- a/vendor/github.com/onsi/gomega/gomega_dsl.go +++ b/vendor/github.com/onsi/gomega/gomega_dsl.go @@ -22,7 +22,7 @@ import ( "github.com/onsi/gomega/types" ) -const GOMEGA_VERSION = "1.35.1" +const GOMEGA_VERSION = "1.36.0" const nilGomegaPanic = `You are trying to make an assertion, but haven't registered Gomega's fail handler. If you're using Ginkgo then you probably forgot to put your assertion in an It(). diff --git a/vendor/github.com/onsi/gomega/matchers/be_empty_matcher.go b/vendor/github.com/onsi/gomega/matchers/be_empty_matcher.go index 527c1a1c10..bd7f0b96e7 100644 --- a/vendor/github.com/onsi/gomega/matchers/be_empty_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/be_empty_matcher.go @@ -4,17 +4,31 @@ package matchers import ( "fmt" + "reflect" "github.com/onsi/gomega/format" + "github.com/onsi/gomega/matchers/internal/miter" ) type BeEmptyMatcher struct { } func (matcher *BeEmptyMatcher) Match(actual interface{}) (success bool, err error) { + // short-circuit the iterator case, as we only need to see the first + // element, if any. + if miter.IsIter(actual) { + var length int + if miter.IsSeq2(actual) { + miter.IterateKV(actual, func(k, v reflect.Value) bool { length++; return false }) + } else { + miter.IterateV(actual, func(v reflect.Value) bool { length++; return false }) + } + return length == 0, nil + } + length, ok := lengthOf(actual) if !ok { - return false, fmt.Errorf("BeEmpty matcher expects a string/array/map/channel/slice. Got:\n%s", format.Object(actual, 1)) + return false, fmt.Errorf("BeEmpty matcher expects a string/array/map/channel/slice/iterator. Got:\n%s", format.Object(actual, 1)) } return length == 0, nil diff --git a/vendor/github.com/onsi/gomega/matchers/consist_of.go b/vendor/github.com/onsi/gomega/matchers/consist_of.go index f69037a4f0..a111881825 100644 --- a/vendor/github.com/onsi/gomega/matchers/consist_of.go +++ b/vendor/github.com/onsi/gomega/matchers/consist_of.go @@ -7,6 +7,7 @@ import ( "reflect" "github.com/onsi/gomega/format" + "github.com/onsi/gomega/matchers/internal/miter" "github.com/onsi/gomega/matchers/support/goraph/bipartitegraph" ) @@ -17,8 +18,8 @@ type ConsistOfMatcher struct { } func (matcher *ConsistOfMatcher) Match(actual interface{}) (success bool, err error) { - if !isArrayOrSlice(actual) && !isMap(actual) { - return false, fmt.Errorf("ConsistOf matcher expects an array/slice/map. Got:\n%s", format.Object(actual, 1)) + if !isArrayOrSlice(actual) && !isMap(actual) && !miter.IsIter(actual) { + return false, fmt.Errorf("ConsistOf matcher expects an array/slice/map/iter.Seq/iter.Seq2. Got:\n%s", format.Object(actual, 1)) } matchers := matchers(matcher.Elements) @@ -60,10 +61,21 @@ func equalMatchersToElements(matchers []interface{}) (elements []interface{}) { } func flatten(elems []interface{}) []interface{} { - if len(elems) != 1 || !isArrayOrSlice(elems[0]) { + if len(elems) != 1 || + !(isArrayOrSlice(elems[0]) || + (miter.IsIter(elems[0]) && !miter.IsSeq2(elems[0]))) { return elems } + if miter.IsIter(elems[0]) { + flattened := []any{} + miter.IterateV(elems[0], func(v reflect.Value) bool { + flattened = append(flattened, v.Interface()) + return true + }) + return flattened + } + value := reflect.ValueOf(elems[0]) flattened := make([]interface{}, value.Len()) for i := 0; i < value.Len(); i++ { @@ -116,7 +128,19 @@ func presentable(elems []interface{}) interface{} { func valuesOf(actual interface{}) []interface{} { value := reflect.ValueOf(actual) values := []interface{}{} - if isMap(actual) { + if miter.IsIter(actual) { + if miter.IsSeq2(actual) { + miter.IterateKV(actual, func(k, v reflect.Value) bool { + values = append(values, v.Interface()) + return true + }) + } else { + miter.IterateV(actual, func(v reflect.Value) bool { + values = append(values, v.Interface()) + return true + }) + } + } else if isMap(actual) { keys := value.MapKeys() for i := 0; i < value.Len(); i++ { values = append(values, value.MapIndex(keys[i]).Interface()) diff --git a/vendor/github.com/onsi/gomega/matchers/contain_element_matcher.go b/vendor/github.com/onsi/gomega/matchers/contain_element_matcher.go index 3d45c9ebc6..830239c7b6 100644 --- a/vendor/github.com/onsi/gomega/matchers/contain_element_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/contain_element_matcher.go @@ -8,6 +8,7 @@ import ( "reflect" "github.com/onsi/gomega/format" + "github.com/onsi/gomega/matchers/internal/miter" ) type ContainElementMatcher struct { @@ -16,16 +17,18 @@ type ContainElementMatcher struct { } func (matcher *ContainElementMatcher) Match(actual interface{}) (success bool, err error) { - if !isArrayOrSlice(actual) && !isMap(actual) { - return false, fmt.Errorf("ContainElement matcher expects an array/slice/map. Got:\n%s", format.Object(actual, 1)) + if !isArrayOrSlice(actual) && !isMap(actual) && !miter.IsIter(actual) { + return false, fmt.Errorf("ContainElement matcher expects an array/slice/map/iterator. Got:\n%s", format.Object(actual, 1)) } var actualT reflect.Type var result reflect.Value - switch l := len(matcher.Result); { - case l > 1: + switch numResultArgs := len(matcher.Result); { + case numResultArgs > 1: return false, errors.New("ContainElement matcher expects at most a single optional pointer to store its findings at") - case l == 1: + case numResultArgs == 1: + // Check the optional result arg to point to a single value/array/slice/map + // of a type compatible with the actual value. if reflect.ValueOf(matcher.Result[0]).Kind() != reflect.Ptr { return false, fmt.Errorf("ContainElement matcher expects a non-nil pointer to store its findings at. Got\n%s", format.Object(matcher.Result[0], 1)) @@ -34,93 +37,209 @@ func (matcher *ContainElementMatcher) Match(actual interface{}) (success bool, e resultReference := matcher.Result[0] result = reflect.ValueOf(resultReference).Elem() // what ResultReference points to, to stash away our findings switch result.Kind() { - case reflect.Array: + case reflect.Array: // result arrays are not supported, as they cannot be dynamically sized. + if miter.IsIter(actual) { + _, actualvT := miter.IterKVTypes(actual) + return false, fmt.Errorf("ContainElement cannot return findings. Need *%s, got *%s", + reflect.SliceOf(actualvT), result.Type().String()) + } return false, fmt.Errorf("ContainElement cannot return findings. Need *%s, got *%s", reflect.SliceOf(actualT.Elem()).String(), result.Type().String()) - case reflect.Slice: - if !isArrayOrSlice(actual) { + + case reflect.Slice: // result slice + // can we assign elements in actual to elements in what the result + // arg points to? + // - ✔ actual is an array or slice + // - ✔ actual is an iter.Seq producing "v" elements + // - ✔ actual is an iter.Seq2 producing "v" elements, ignoring + // the "k" elements. + switch { + case isArrayOrSlice(actual): + if !actualT.Elem().AssignableTo(result.Type().Elem()) { + return false, fmt.Errorf("ContainElement cannot return findings. Need *%s, got *%s", + actualT.String(), result.Type().String()) + } + + case miter.IsIter(actual): + _, actualvT := miter.IterKVTypes(actual) + if !actualvT.AssignableTo(result.Type().Elem()) { + return false, fmt.Errorf("ContainElement cannot return findings. Need *%s, got *%s", + actualvT.String(), result.Type().String()) + } + + default: // incompatible result reference return false, fmt.Errorf("ContainElement cannot return findings. Need *%s, got *%s", reflect.MapOf(actualT.Key(), actualT.Elem()).String(), result.Type().String()) } - if !actualT.Elem().AssignableTo(result.Type().Elem()) { - return false, fmt.Errorf("ContainElement cannot return findings. Need *%s, got *%s", - actualT.String(), result.Type().String()) - } - case reflect.Map: - if !isMap(actual) { - return false, fmt.Errorf("ContainElement cannot return findings. Need *%s, got *%s", - actualT.String(), result.Type().String()) - } - if !actualT.AssignableTo(result.Type()) { + + case reflect.Map: // result map + // can we assign elements in actual to elements in what the result + // arg points to? + // - ✔ actual is a map + // - ✔ actual is an iter.Seq2 (iter.Seq doesn't fit though) + switch { + case isMap(actual): + if !actualT.AssignableTo(result.Type()) { + return false, fmt.Errorf("ContainElement cannot return findings. Need *%s, got *%s", + actualT.String(), result.Type().String()) + } + + case miter.IsIter(actual): + actualkT, actualvT := miter.IterKVTypes(actual) + if actualkT == nil { + return false, fmt.Errorf("ContainElement cannot return findings. Need *%s, got *%s", + reflect.SliceOf(actualvT).String(), result.Type().String()) + } + if !reflect.MapOf(actualkT, actualvT).AssignableTo(result.Type()) { + return false, fmt.Errorf("ContainElement cannot return findings. Need *%s, got *%s", + reflect.MapOf(actualkT, actualvT), result.Type().String()) + } + + default: // incompatible result reference return false, fmt.Errorf("ContainElement cannot return findings. Need *%s, got *%s", actualT.String(), result.Type().String()) } + default: - if !actualT.Elem().AssignableTo(result.Type()) { - return false, fmt.Errorf("ContainElement cannot return findings. Need *%s, got *%s", - actualT.Elem().String(), result.Type().String()) + // can we assign a (single) element in actual to what the result arg + // points to? + switch { + case miter.IsIter(actual): + _, actualvT := miter.IterKVTypes(actual) + if !actualvT.AssignableTo(result.Type()) { + return false, fmt.Errorf("ContainElement cannot return findings. Need *%s, got *%s", + actualvT.String(), result.Type().String()) + } + default: + if !actualT.Elem().AssignableTo(result.Type()) { + return false, fmt.Errorf("ContainElement cannot return findings. Need *%s, got *%s", + actualT.Elem().String(), result.Type().String()) + } } } } + // If the supplied matcher isn't an Omega matcher, default to the Equal + // matcher. elemMatcher, elementIsMatcher := matcher.Element.(omegaMatcher) if !elementIsMatcher { elemMatcher = &EqualMatcher{Expected: matcher.Element} } value := reflect.ValueOf(actual) - var valueAt func(int) interface{} - var getFindings func() reflect.Value - var foundAt func(int) + var getFindings func() reflect.Value // abstracts how the findings are collected and stored + var lastError error - if isMap(actual) { - keys := value.MapKeys() - valueAt = func(i int) interface{} { - return value.MapIndex(keys[i]).Interface() + if !miter.IsIter(actual) { + var valueAt func(int) interface{} + var foundAt func(int) + // We're dealing with an array/slice/map, so in all cases we can iterate + // over the elements in actual using indices (that can be considered + // keys in case of maps). + if isMap(actual) { + keys := value.MapKeys() + valueAt = func(i int) interface{} { + return value.MapIndex(keys[i]).Interface() + } + if result.Kind() != reflect.Invalid { + fm := reflect.MakeMap(actualT) + getFindings = func() reflect.Value { return fm } + foundAt = func(i int) { + fm.SetMapIndex(keys[i], value.MapIndex(keys[i])) + } + } + } else { + valueAt = func(i int) interface{} { + return value.Index(i).Interface() + } + if result.Kind() != reflect.Invalid { + var fsl reflect.Value + if result.Kind() == reflect.Slice { + fsl = reflect.MakeSlice(result.Type(), 0, 0) + } else { + fsl = reflect.MakeSlice(reflect.SliceOf(result.Type()), 0, 0) + } + getFindings = func() reflect.Value { return fsl } + foundAt = func(i int) { + fsl = reflect.Append(fsl, value.Index(i)) + } + } } - if result.Kind() != reflect.Invalid { - fm := reflect.MakeMap(actualT) - getFindings = func() reflect.Value { - return fm + + for i := 0; i < value.Len(); i++ { + elem := valueAt(i) + success, err := elemMatcher.Match(elem) + if err != nil { + lastError = err + continue } - foundAt = func(i int) { - fm.SetMapIndex(keys[i], value.MapIndex(keys[i])) + if success { + if result.Kind() == reflect.Invalid { + return true, nil + } + foundAt(i) } } } else { - valueAt = func(i int) interface{} { - return value.Index(i).Interface() - } + // We're dealing with an iterator as a first-class construct, so things + // are slightly different: there is no index defined as in case of + // arrays/slices/maps, just "ooooorder" + var found func(k, v reflect.Value) if result.Kind() != reflect.Invalid { - var f reflect.Value - if result.Kind() == reflect.Slice { - f = reflect.MakeSlice(result.Type(), 0, 0) + if result.Kind() == reflect.Map { + fm := reflect.MakeMap(result.Type()) + getFindings = func() reflect.Value { return fm } + found = func(k, v reflect.Value) { fm.SetMapIndex(k, v) } } else { - f = reflect.MakeSlice(reflect.SliceOf(result.Type()), 0, 0) - } - getFindings = func() reflect.Value { - return f - } - foundAt = func(i int) { - f = reflect.Append(f, value.Index(i)) + var fsl reflect.Value + if result.Kind() == reflect.Slice { + fsl = reflect.MakeSlice(result.Type(), 0, 0) + } else { + fsl = reflect.MakeSlice(reflect.SliceOf(result.Type()), 0, 0) + } + getFindings = func() reflect.Value { return fsl } + found = func(_, v reflect.Value) { fsl = reflect.Append(fsl, v) } } } - } - var lastError error - for i := 0; i < value.Len(); i++ { - elem := valueAt(i) - success, err := elemMatcher.Match(elem) - if err != nil { - lastError = err - continue + success := false + actualkT, _ := miter.IterKVTypes(actual) + if actualkT == nil { + miter.IterateV(actual, func(v reflect.Value) bool { + var err error + success, err = elemMatcher.Match(v.Interface()) + if err != nil { + lastError = err + return true // iterate on... + } + if success { + if result.Kind() == reflect.Invalid { + return false // a match and no result needed, so we're done + } + found(reflect.Value{}, v) + } + return true // iterate on... + }) + } else { + miter.IterateKV(actual, func(k, v reflect.Value) bool { + var err error + success, err = elemMatcher.Match(v.Interface()) + if err != nil { + lastError = err + return true // iterate on... + } + if success { + if result.Kind() == reflect.Invalid { + return false // a match and no result needed, so we're done + } + found(k, v) + } + return true // iterate on... + }) } - if success { - if result.Kind() == reflect.Invalid { - return true, nil - } - foundAt(i) + if success && result.Kind() == reflect.Invalid { + return true, nil } } diff --git a/vendor/github.com/onsi/gomega/matchers/contain_elements_matcher.go b/vendor/github.com/onsi/gomega/matchers/contain_elements_matcher.go index 946cd8bea5..d9fcb8b804 100644 --- a/vendor/github.com/onsi/gomega/matchers/contain_elements_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/contain_elements_matcher.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/onsi/gomega/format" + "github.com/onsi/gomega/matchers/internal/miter" "github.com/onsi/gomega/matchers/support/goraph/bipartitegraph" ) @@ -13,8 +14,8 @@ type ContainElementsMatcher struct { } func (matcher *ContainElementsMatcher) Match(actual interface{}) (success bool, err error) { - if !isArrayOrSlice(actual) && !isMap(actual) { - return false, fmt.Errorf("ContainElements matcher expects an array/slice/map. Got:\n%s", format.Object(actual, 1)) + if !isArrayOrSlice(actual) && !isMap(actual) && !miter.IsIter(actual) { + return false, fmt.Errorf("ContainElements matcher expects an array/slice/map/iter.Seq/iter.Seq2. Got:\n%s", format.Object(actual, 1)) } matchers := matchers(matcher.Elements) diff --git a/vendor/github.com/onsi/gomega/matchers/have_each_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_each_matcher.go index 025b6e1ac2..4111f2b867 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_each_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/have_each_matcher.go @@ -5,6 +5,7 @@ import ( "reflect" "github.com/onsi/gomega/format" + "github.com/onsi/gomega/matchers/internal/miter" ) type HaveEachMatcher struct { @@ -12,8 +13,8 @@ type HaveEachMatcher struct { } func (matcher *HaveEachMatcher) Match(actual interface{}) (success bool, err error) { - if !isArrayOrSlice(actual) && !isMap(actual) { - return false, fmt.Errorf("HaveEach matcher expects an array/slice/map. Got:\n%s", + if !isArrayOrSlice(actual) && !isMap(actual) && !miter.IsIter(actual) { + return false, fmt.Errorf("HaveEach matcher expects an array/slice/map/iter.Seq/iter.Seq2. Got:\n%s", format.Object(actual, 1)) } @@ -22,6 +23,38 @@ func (matcher *HaveEachMatcher) Match(actual interface{}) (success bool, err err elemMatcher = &EqualMatcher{Expected: matcher.Element} } + if miter.IsIter(actual) { + // rejecting the non-elements case works different for iterators as we + // don't want to fetch all elements into a slice first. + count := 0 + var success bool + var err error + if miter.IsSeq2(actual) { + miter.IterateKV(actual, func(k, v reflect.Value) bool { + count++ + success, err = elemMatcher.Match(v.Interface()) + if err != nil { + return false + } + return success + }) + } else { + miter.IterateV(actual, func(v reflect.Value) bool { + count++ + success, err = elemMatcher.Match(v.Interface()) + if err != nil { + return false + } + return success + }) + } + if count == 0 { + return false, fmt.Errorf("HaveEach matcher expects a non-empty iter.Seq/iter.Seq2. Got:\n%s", + format.Object(actual, 1)) + } + return success, err + } + value := reflect.ValueOf(actual) if value.Len() == 0 { return false, fmt.Errorf("HaveEach matcher expects a non-empty array/slice/map. Got:\n%s", @@ -40,7 +73,8 @@ func (matcher *HaveEachMatcher) Match(actual interface{}) (success bool, err err } } - // if there are no elements, then HaveEach will match. + // if we never failed then we succeed; the empty/nil cases have already been + // rejected above. for i := 0; i < value.Len(); i++ { success, err := elemMatcher.Match(valueAt(i)) if err != nil { diff --git a/vendor/github.com/onsi/gomega/matchers/have_exact_elements.go b/vendor/github.com/onsi/gomega/matchers/have_exact_elements.go index 5a236d7d69..23799f1c6f 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_exact_elements.go +++ b/vendor/github.com/onsi/gomega/matchers/have_exact_elements.go @@ -2,8 +2,10 @@ package matchers import ( "fmt" + "reflect" "github.com/onsi/gomega/format" + "github.com/onsi/gomega/matchers/internal/miter" ) type mismatchFailure struct { @@ -21,17 +23,58 @@ type HaveExactElementsMatcher struct { func (matcher *HaveExactElementsMatcher) Match(actual interface{}) (success bool, err error) { matcher.resetState() - if isMap(actual) { - return false, fmt.Errorf("error") + if isMap(actual) || miter.IsSeq2(actual) { + return false, fmt.Errorf("HaveExactElements matcher doesn't work on map or iter.Seq2. Got:\n%s", format.Object(actual, 1)) } matchers := matchers(matcher.Elements) - values := valuesOf(actual) - lenMatchers := len(matchers) - lenValues := len(values) + success = true + if miter.IsIter(actual) { + // In the worst case, we need to see everything before we can give our + // verdict. The only exception is fast fail. + i := 0 + miter.IterateV(actual, func(v reflect.Value) bool { + if i >= lenMatchers { + // the iterator produces more values than we got matchers: this + // is not good. + matcher.extraIndex = i + success = false + return false + } + + elemMatcher := matchers[i].(omegaMatcher) + match, err := elemMatcher.Match(v.Interface()) + if err != nil { + matcher.mismatchFailures = append(matcher.mismatchFailures, mismatchFailure{ + index: i, + failure: err.Error(), + }) + success = false + } else if !match { + matcher.mismatchFailures = append(matcher.mismatchFailures, mismatchFailure{ + index: i, + failure: elemMatcher.FailureMessage(v.Interface()), + }) + success = false + } + i++ + return true + }) + if i < len(matchers) { + // the iterator produced less values than we got matchers: this is + // no good, no no no. + matcher.missingIndex = i + success = false + } + return success, nil + } + + values := valuesOf(actual) + lenValues := len(values) + for i := 0; i < lenMatchers || i < lenValues; i++ { if i >= lenMatchers { matcher.extraIndex = i diff --git a/vendor/github.com/onsi/gomega/matchers/have_key_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_key_matcher.go index 00cffec70e..b62ee93cb0 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_key_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/have_key_matcher.go @@ -7,6 +7,7 @@ import ( "reflect" "github.com/onsi/gomega/format" + "github.com/onsi/gomega/matchers/internal/miter" ) type HaveKeyMatcher struct { @@ -14,8 +15,8 @@ type HaveKeyMatcher struct { } func (matcher *HaveKeyMatcher) Match(actual interface{}) (success bool, err error) { - if !isMap(actual) { - return false, fmt.Errorf("HaveKey matcher expects a map. Got:%s", format.Object(actual, 1)) + if !isMap(actual) && !miter.IsSeq2(actual) { + return false, fmt.Errorf("HaveKey matcher expects a map/iter.Seq2. Got:%s", format.Object(actual, 1)) } keyMatcher, keyIsMatcher := matcher.Key.(omegaMatcher) @@ -23,6 +24,20 @@ func (matcher *HaveKeyMatcher) Match(actual interface{}) (success bool, err erro keyMatcher = &EqualMatcher{Expected: matcher.Key} } + if miter.IsSeq2(actual) { + var success bool + var err error + miter.IterateKV(actual, func(k, v reflect.Value) bool { + success, err = keyMatcher.Match(k.Interface()) + if err != nil { + err = fmt.Errorf("HaveKey's key matcher failed with:\n%s%s", format.Indent, err.Error()) + return false + } + return !success + }) + return success, err + } + keys := reflect.ValueOf(actual).MapKeys() for i := 0; i < len(keys); i++ { success, err := keyMatcher.Match(keys[i].Interface()) diff --git a/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher.go index 4c59168047..3d608f63eb 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher.go @@ -7,6 +7,7 @@ import ( "reflect" "github.com/onsi/gomega/format" + "github.com/onsi/gomega/matchers/internal/miter" ) type HaveKeyWithValueMatcher struct { @@ -15,8 +16,8 @@ type HaveKeyWithValueMatcher struct { } func (matcher *HaveKeyWithValueMatcher) Match(actual interface{}) (success bool, err error) { - if !isMap(actual) { - return false, fmt.Errorf("HaveKeyWithValue matcher expects a map. Got:%s", format.Object(actual, 1)) + if !isMap(actual) && !miter.IsSeq2(actual) { + return false, fmt.Errorf("HaveKeyWithValue matcher expects a map/iter.Seq2. Got:%s", format.Object(actual, 1)) } keyMatcher, keyIsMatcher := matcher.Key.(omegaMatcher) @@ -29,6 +30,27 @@ func (matcher *HaveKeyWithValueMatcher) Match(actual interface{}) (success bool, valueMatcher = &EqualMatcher{Expected: matcher.Value} } + if miter.IsSeq2(actual) { + var success bool + var err error + miter.IterateKV(actual, func(k, v reflect.Value) bool { + success, err = keyMatcher.Match(k.Interface()) + if err != nil { + err = fmt.Errorf("HaveKey's key matcher failed with:\n%s%s", format.Indent, err.Error()) + return false + } + if success { + success, err = valueMatcher.Match(v.Interface()) + if err != nil { + err = fmt.Errorf("HaveKeyWithValue's value matcher failed with:\n%s%s", format.Indent, err.Error()) + return false + } + } + return !success + }) + return success, err + } + keys := reflect.ValueOf(actual).MapKeys() for i := 0; i < len(keys); i++ { success, err := keyMatcher.Match(keys[i].Interface()) diff --git a/vendor/github.com/onsi/gomega/matchers/have_len_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_len_matcher.go index ee4276189d..ca25713fe2 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_len_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/have_len_matcher.go @@ -13,7 +13,7 @@ type HaveLenMatcher struct { func (matcher *HaveLenMatcher) Match(actual interface{}) (success bool, err error) { length, ok := lengthOf(actual) if !ok { - return false, fmt.Errorf("HaveLen matcher expects a string/array/map/channel/slice. Got:\n%s", format.Object(actual, 1)) + return false, fmt.Errorf("HaveLen matcher expects a string/array/map/channel/slice/iterator. Got:\n%s", format.Object(actual, 1)) } return length == matcher.Count, nil diff --git a/vendor/github.com/onsi/gomega/matchers/internal/miter/type_support_iter.go b/vendor/github.com/onsi/gomega/matchers/internal/miter/type_support_iter.go new file mode 100644 index 0000000000..d8837a4d09 --- /dev/null +++ b/vendor/github.com/onsi/gomega/matchers/internal/miter/type_support_iter.go @@ -0,0 +1,128 @@ +//go:build go1.23 + +package miter + +import ( + "reflect" +) + +// HasIterators always returns false for Go versions before 1.23. +func HasIterators() bool { return true } + +// IsIter returns true if the specified value is a function type that can be +// range-d over, otherwise false. +// +// We don't use reflect's CanSeq and CanSeq2 directly, as these would return +// true also for other value types that are range-able, such as integers, +// slices, et cetera. Here, we aim only at range-able (iterator) functions. +func IsIter(it any) bool { + if it == nil { // on purpose we only test for untyped nil. + return false + } + // reject all non-iterator-func values, even if they're range-able. + t := reflect.TypeOf(it) + if t.Kind() != reflect.Func { + return false + } + return t.CanSeq() || t.CanSeq2() +} + +// IterKVTypes returns the reflection types of an iterator's yield function's K +// and optional V arguments, otherwise nil K and V reflection types. +func IterKVTypes(it any) (k, v reflect.Type) { + if it == nil { + return + } + // reject all non-iterator-func values, even if they're range-able. + t := reflect.TypeOf(it) + if t.Kind() != reflect.Func { + return + } + // get the reflection types for V, and where applicable, K. + switch { + case t.CanSeq(): + v = t. /*iterator fn*/ In(0). /*yield fn*/ In(0) + case t.CanSeq2(): + yieldfn := t. /*iterator fn*/ In(0) + k = yieldfn.In(0) + v = yieldfn.In(1) + } + return +} + +// IsSeq2 returns true if the passed iterator function is compatible with +// iter.Seq2, otherwise false. +// +// IsSeq2 hides the Go 1.23+ specific reflect.Type.CanSeq2 behind a facade which +// is empty for Go versions before 1.23. +func IsSeq2(it any) bool { + if it == nil { + return false + } + t := reflect.TypeOf(it) + return t.Kind() == reflect.Func && t.CanSeq2() +} + +// isNilly returns true if v is either an untyped nil, or is a nil function (not +// necessarily an iterator function). +func isNilly(v any) bool { + if v == nil { + return true + } + rv := reflect.ValueOf(v) + return rv.Kind() == reflect.Func && rv.IsNil() +} + +// IterateV loops over the elements produced by an iterator function, passing +// the elements to the specified yield function individually and stopping only +// when either the iterator function runs out of elements or the yield function +// tell us to stop it. +// +// IterateV works very much like reflect.Value.Seq but hides the Go 1.23+ +// specific parts behind a facade which is empty for Go versions before 1.23, in +// order to simplify code maintenance for matchers when using older Go versions. +func IterateV(it any, yield func(v reflect.Value) bool) { + if isNilly(it) { + return + } + // reject all non-iterator-func values, even if they're range-able. + t := reflect.TypeOf(it) + if t.Kind() != reflect.Func || !t.CanSeq() { + return + } + // Call the specified iterator function, handing it our adaptor to call the + // specified generic reflection yield function. + reflectedYield := reflect.MakeFunc( + t. /*iterator fn*/ In(0), + func(args []reflect.Value) []reflect.Value { + return []reflect.Value{reflect.ValueOf(yield(args[0]))} + }) + reflect.ValueOf(it).Call([]reflect.Value{reflectedYield}) +} + +// IterateKV loops over the key-value elements produced by an iterator function, +// passing the elements to the specified yield function individually and +// stopping only when either the iterator function runs out of elements or the +// yield function tell us to stop it. +// +// IterateKV works very much like reflect.Value.Seq2 but hides the Go 1.23+ +// specific parts behind a facade which is empty for Go versions before 1.23, in +// order to simplify code maintenance for matchers when using older Go versions. +func IterateKV(it any, yield func(k, v reflect.Value) bool) { + if isNilly(it) { + return + } + // reject all non-iterator-func values, even if they're range-able. + t := reflect.TypeOf(it) + if t.Kind() != reflect.Func || !t.CanSeq2() { + return + } + // Call the specified iterator function, handing it our adaptor to call the + // specified generic reflection yield function. + reflectedYield := reflect.MakeFunc( + t. /*iterator fn*/ In(0), + func(args []reflect.Value) []reflect.Value { + return []reflect.Value{reflect.ValueOf(yield(args[0], args[1]))} + }) + reflect.ValueOf(it).Call([]reflect.Value{reflectedYield}) +} diff --git a/vendor/github.com/onsi/gomega/matchers/internal/miter/type_support_noiter.go b/vendor/github.com/onsi/gomega/matchers/internal/miter/type_support_noiter.go new file mode 100644 index 0000000000..4b8fcc55bd --- /dev/null +++ b/vendor/github.com/onsi/gomega/matchers/internal/miter/type_support_noiter.go @@ -0,0 +1,44 @@ +//go:build !go1.23 + +/* +Gomega matchers + +This package implements the Gomega matchers and does not typically need to be imported. +See the docs for Gomega for documentation on the matchers + +http://onsi.github.io/gomega/ +*/ + +package miter + +import "reflect" + +// HasIterators always returns false for Go versions before 1.23. +func HasIterators() bool { return false } + +// IsIter always returns false for Go versions before 1.23 as there is no +// iterator (function) pattern defined yet; see also: +// https://tip.golang.org/blog/range-functions. +func IsIter(i any) bool { return false } + +// IsSeq2 always returns false for Go versions before 1.23 as there is no +// iterator (function) pattern defined yet; see also: +// https://tip.golang.org/blog/range-functions. +func IsSeq2(it any) bool { return false } + +// IterKVTypes always returns nil reflection types for Go versions before 1.23 +// as there is no iterator (function) pattern defined yet; see also: +// https://tip.golang.org/blog/range-functions. +func IterKVTypes(i any) (k, v reflect.Type) { + return +} + +// IterateV never loops over what has been passed to it as an iterator for Go +// versions before 1.23 as there is no iterator (function) pattern defined yet; +// see also: https://tip.golang.org/blog/range-functions. +func IterateV(it any, yield func(v reflect.Value) bool) {} + +// IterateKV never loops over what has been passed to it as an iterator for Go +// versions before 1.23 as there is no iterator (function) pattern defined yet; +// see also: https://tip.golang.org/blog/range-functions. +func IterateKV(it any, yield func(k, v reflect.Value) bool) {} diff --git a/vendor/github.com/onsi/gomega/matchers/type_support.go b/vendor/github.com/onsi/gomega/matchers/type_support.go index dced2419ea..b9440ac7ad 100644 --- a/vendor/github.com/onsi/gomega/matchers/type_support.go +++ b/vendor/github.com/onsi/gomega/matchers/type_support.go @@ -15,6 +15,8 @@ import ( "encoding/json" "fmt" "reflect" + + "github.com/onsi/gomega/matchers/internal/miter" ) type omegaMatcher interface { @@ -152,6 +154,17 @@ func lengthOf(a interface{}) (int, bool) { switch reflect.TypeOf(a).Kind() { case reflect.Map, reflect.Array, reflect.String, reflect.Chan, reflect.Slice: return reflect.ValueOf(a).Len(), true + case reflect.Func: + if !miter.IsIter(a) { + return 0, false + } + var l int + if miter.IsSeq2(a) { + miter.IterateKV(a, func(k, v reflect.Value) bool { l++; return true }) + } else { + miter.IterateV(a, func(v reflect.Value) bool { l++; return true }) + } + return l, true default: return 0, false } diff --git a/vendor/github.com/stretchr/testify/assert/assertion_compare.go b/vendor/github.com/stretchr/testify/assert/assertion_compare.go index 4d4b4aad6f..7e19eba090 100644 --- a/vendor/github.com/stretchr/testify/assert/assertion_compare.go +++ b/vendor/github.com/stretchr/testify/assert/assertion_compare.go @@ -7,10 +7,13 @@ import ( "time" ) -type CompareType int +// Deprecated: CompareType has only ever been for internal use and has accidentally been published since v1.6.0. Do not use it. +type CompareType = compareResult + +type compareResult int const ( - compareLess CompareType = iota - 1 + compareLess compareResult = iota - 1 compareEqual compareGreater ) @@ -39,7 +42,7 @@ var ( bytesType = reflect.TypeOf([]byte{}) ) -func compare(obj1, obj2 interface{}, kind reflect.Kind) (CompareType, bool) { +func compare(obj1, obj2 interface{}, kind reflect.Kind) (compareResult, bool) { obj1Value := reflect.ValueOf(obj1) obj2Value := reflect.ValueOf(obj2) @@ -325,7 +328,13 @@ func compare(obj1, obj2 interface{}, kind reflect.Kind) (CompareType, bool) { timeObj2 = obj2Value.Convert(timeType).Interface().(time.Time) } - return compare(timeObj1.UnixNano(), timeObj2.UnixNano(), reflect.Int64) + if timeObj1.Before(timeObj2) { + return compareLess, true + } + if timeObj1.Equal(timeObj2) { + return compareEqual, true + } + return compareGreater, true } case reflect.Slice: { @@ -345,7 +354,7 @@ func compare(obj1, obj2 interface{}, kind reflect.Kind) (CompareType, bool) { bytesObj2 = obj2Value.Convert(bytesType).Interface().([]byte) } - return CompareType(bytes.Compare(bytesObj1, bytesObj2)), true + return compareResult(bytes.Compare(bytesObj1, bytesObj2)), true } case reflect.Uintptr: { @@ -381,7 +390,7 @@ func Greater(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface if h, ok := t.(tHelper); ok { h.Helper() } - return compareTwoValues(t, e1, e2, []CompareType{compareGreater}, "\"%v\" is not greater than \"%v\"", msgAndArgs...) + return compareTwoValues(t, e1, e2, []compareResult{compareGreater}, "\"%v\" is not greater than \"%v\"", msgAndArgs...) } // GreaterOrEqual asserts that the first element is greater than or equal to the second @@ -394,7 +403,7 @@ func GreaterOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...in if h, ok := t.(tHelper); ok { h.Helper() } - return compareTwoValues(t, e1, e2, []CompareType{compareGreater, compareEqual}, "\"%v\" is not greater than or equal to \"%v\"", msgAndArgs...) + return compareTwoValues(t, e1, e2, []compareResult{compareGreater, compareEqual}, "\"%v\" is not greater than or equal to \"%v\"", msgAndArgs...) } // Less asserts that the first element is less than the second @@ -406,7 +415,7 @@ func Less(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) if h, ok := t.(tHelper); ok { h.Helper() } - return compareTwoValues(t, e1, e2, []CompareType{compareLess}, "\"%v\" is not less than \"%v\"", msgAndArgs...) + return compareTwoValues(t, e1, e2, []compareResult{compareLess}, "\"%v\" is not less than \"%v\"", msgAndArgs...) } // LessOrEqual asserts that the first element is less than or equal to the second @@ -419,7 +428,7 @@ func LessOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...inter if h, ok := t.(tHelper); ok { h.Helper() } - return compareTwoValues(t, e1, e2, []CompareType{compareLess, compareEqual}, "\"%v\" is not less than or equal to \"%v\"", msgAndArgs...) + return compareTwoValues(t, e1, e2, []compareResult{compareLess, compareEqual}, "\"%v\" is not less than or equal to \"%v\"", msgAndArgs...) } // Positive asserts that the specified element is positive @@ -431,7 +440,7 @@ func Positive(t TestingT, e interface{}, msgAndArgs ...interface{}) bool { h.Helper() } zero := reflect.Zero(reflect.TypeOf(e)) - return compareTwoValues(t, e, zero.Interface(), []CompareType{compareGreater}, "\"%v\" is not positive", msgAndArgs...) + return compareTwoValues(t, e, zero.Interface(), []compareResult{compareGreater}, "\"%v\" is not positive", msgAndArgs...) } // Negative asserts that the specified element is negative @@ -443,10 +452,10 @@ func Negative(t TestingT, e interface{}, msgAndArgs ...interface{}) bool { h.Helper() } zero := reflect.Zero(reflect.TypeOf(e)) - return compareTwoValues(t, e, zero.Interface(), []CompareType{compareLess}, "\"%v\" is not negative", msgAndArgs...) + return compareTwoValues(t, e, zero.Interface(), []compareResult{compareLess}, "\"%v\" is not negative", msgAndArgs...) } -func compareTwoValues(t TestingT, e1 interface{}, e2 interface{}, allowedComparesResults []CompareType, failMessage string, msgAndArgs ...interface{}) bool { +func compareTwoValues(t TestingT, e1 interface{}, e2 interface{}, allowedComparesResults []compareResult, failMessage string, msgAndArgs ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() } @@ -469,7 +478,7 @@ func compareTwoValues(t TestingT, e1 interface{}, e2 interface{}, allowedCompare return true } -func containsValue(values []CompareType, value CompareType) bool { +func containsValue(values []compareResult, value compareResult) bool { for _, v := range values { if v == value { return true diff --git a/vendor/github.com/stretchr/testify/assert/assertion_format.go b/vendor/github.com/stretchr/testify/assert/assertion_format.go index 3ddab109ad..1906341657 100644 --- a/vendor/github.com/stretchr/testify/assert/assertion_format.go +++ b/vendor/github.com/stretchr/testify/assert/assertion_format.go @@ -104,8 +104,8 @@ func EqualExportedValuesf(t TestingT, expected interface{}, actual interface{}, return EqualExportedValues(t, expected, actual, append([]interface{}{msg}, args...)...) } -// EqualValuesf asserts that two objects are equal or convertible to the same types -// and equal. +// EqualValuesf asserts that two objects are equal or convertible to the larger +// type 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{}) bool { @@ -186,7 +186,7 @@ func Eventuallyf(t TestingT, condition func() bool, waitFor time.Duration, tick // assert.EventuallyWithTf(t, func(c *assert.CollectT, "error message %s", "formatted") { // // add assertions as needed; any assertion failure will fail the current tick // assert.True(c, externalValue, "expected 'externalValue' to be true") -// }, 1*time.Second, 10*time.Second, "external state has not changed to 'true'; still false") +// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false") func EventuallyWithTf(t TestingT, condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() @@ -568,6 +568,23 @@ func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, a return NotContains(t, s, contains, append([]interface{}{msg}, args...)...) } +// NotElementsMatchf asserts that the specified listA(array, slice...) is NOT 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 not match. +// This is an inverse of ElementsMatch. +// +// assert.NotElementsMatchf(t, [1, 1, 2, 3], [1, 1, 2, 3], "error message %s", "formatted") -> false +// +// assert.NotElementsMatchf(t, [1, 1, 2, 3], [1, 2, 3], "error message %s", "formatted") -> true +// +// assert.NotElementsMatchf(t, [1, 2, 3], [1, 2, 4], "error message %s", "formatted") -> true +func NotElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return NotElementsMatch(t, listA, listB, append([]interface{}{msg}, args...)...) +} + // 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. // @@ -604,7 +621,16 @@ func NotEqualValuesf(t TestingT, expected interface{}, actual interface{}, msg s return NotEqualValues(t, expected, actual, append([]interface{}{msg}, args...)...) } -// NotErrorIsf asserts that at none of the errors in err's chain matches target. +// NotErrorAsf asserts that none of the errors in err's chain matches target, +// but if so, sets target to that error value. +func NotErrorAsf(t TestingT, err error, target interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return NotErrorAs(t, err, target, append([]interface{}{msg}, args...)...) +} + +// NotErrorIsf asserts that 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{}) bool { if h, ok := t.(tHelper); ok { diff --git a/vendor/github.com/stretchr/testify/assert/assertion_forward.go b/vendor/github.com/stretchr/testify/assert/assertion_forward.go index a84e09bd40..21629087ba 100644 --- a/vendor/github.com/stretchr/testify/assert/assertion_forward.go +++ b/vendor/github.com/stretchr/testify/assert/assertion_forward.go @@ -186,8 +186,8 @@ func (a *Assertions) EqualExportedValuesf(expected interface{}, actual interface return EqualExportedValuesf(a.t, expected, actual, msg, args...) } -// EqualValues asserts that two objects are equal or convertible to the same types -// and equal. +// EqualValues asserts that two objects are equal or convertible to the larger +// type and equal. // // a.EqualValues(uint32(123), int32(123)) func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { @@ -197,8 +197,8 @@ func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAn return EqualValues(a.t, expected, actual, msgAndArgs...) } -// EqualValuesf asserts that two objects are equal or convertible to the same types -// and equal. +// EqualValuesf asserts that two objects are equal or convertible to the larger +// type and equal. // // a.EqualValuesf(uint32(123), int32(123), "error message %s", "formatted") func (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool { @@ -336,7 +336,7 @@ func (a *Assertions) Eventually(condition func() bool, waitFor time.Duration, ti // a.EventuallyWithT(func(c *assert.CollectT) { // // add assertions as needed; any assertion failure will fail the current tick // assert.True(c, externalValue, "expected 'externalValue' to be true") -// }, 1*time.Second, 10*time.Second, "external state has not changed to 'true'; still false") +// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false") func (a *Assertions) EventuallyWithT(condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -361,7 +361,7 @@ func (a *Assertions) EventuallyWithT(condition func(collect *CollectT), waitFor // a.EventuallyWithTf(func(c *assert.CollectT, "error message %s", "formatted") { // // add assertions as needed; any assertion failure will fail the current tick // assert.True(c, externalValue, "expected 'externalValue' to be true") -// }, 1*time.Second, 10*time.Second, "external state has not changed to 'true'; still false") +// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false") func (a *Assertions) EventuallyWithTf(condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -1128,6 +1128,40 @@ func (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg strin return NotContainsf(a.t, s, contains, msg, args...) } +// NotElementsMatch asserts that the specified listA(array, slice...) is NOT 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 not match. +// This is an inverse of ElementsMatch. +// +// a.NotElementsMatch([1, 1, 2, 3], [1, 1, 2, 3]) -> false +// +// a.NotElementsMatch([1, 1, 2, 3], [1, 2, 3]) -> true +// +// a.NotElementsMatch([1, 2, 3], [1, 2, 4]) -> true +func (a *Assertions) NotElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotElementsMatch(a.t, listA, listB, msgAndArgs...) +} + +// NotElementsMatchf asserts that the specified listA(array, slice...) is NOT 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 not match. +// This is an inverse of ElementsMatch. +// +// a.NotElementsMatchf([1, 1, 2, 3], [1, 1, 2, 3], "error message %s", "formatted") -> false +// +// a.NotElementsMatchf([1, 1, 2, 3], [1, 2, 3], "error message %s", "formatted") -> true +// +// a.NotElementsMatchf([1, 2, 3], [1, 2, 4], "error message %s", "formatted") -> true +func (a *Assertions) NotElementsMatchf(listA interface{}, listB interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotElementsMatchf(a.t, listA, listB, 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. // @@ -1200,7 +1234,25 @@ func (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg str return NotEqualf(a.t, expected, actual, msg, args...) } -// NotErrorIs asserts that at none of the errors in err's chain matches target. +// NotErrorAs asserts that none of the errors in err's chain matches target, +// but if so, sets target to that error value. +func (a *Assertions) NotErrorAs(err error, target interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotErrorAs(a.t, err, target, msgAndArgs...) +} + +// NotErrorAsf asserts that none of the errors in err's chain matches target, +// but if so, sets target to that error value. +func (a *Assertions) NotErrorAsf(err error, target interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return NotErrorAsf(a.t, err, target, msg, args...) +} + +// NotErrorIs asserts that 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{}) bool { if h, ok := a.t.(tHelper); ok { @@ -1209,7 +1261,7 @@ func (a *Assertions) NotErrorIs(err error, target error, msgAndArgs ...interface return NotErrorIs(a.t, err, target, msgAndArgs...) } -// NotErrorIsf asserts that at none of the errors in err's chain matches target. +// NotErrorIsf asserts that 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{}) bool { if h, ok := a.t.(tHelper); ok { diff --git a/vendor/github.com/stretchr/testify/assert/assertion_order.go b/vendor/github.com/stretchr/testify/assert/assertion_order.go index 00df62a059..1d2f71824a 100644 --- a/vendor/github.com/stretchr/testify/assert/assertion_order.go +++ b/vendor/github.com/stretchr/testify/assert/assertion_order.go @@ -6,7 +6,7 @@ import ( ) // isOrdered checks that collection contains orderable elements. -func isOrdered(t TestingT, object interface{}, allowedComparesResults []CompareType, failMessage string, msgAndArgs ...interface{}) bool { +func isOrdered(t TestingT, object interface{}, allowedComparesResults []compareResult, failMessage string, msgAndArgs ...interface{}) bool { objKind := reflect.TypeOf(object).Kind() if objKind != reflect.Slice && objKind != reflect.Array { return false @@ -50,7 +50,7 @@ func isOrdered(t TestingT, object interface{}, allowedComparesResults []CompareT // assert.IsIncreasing(t, []float{1, 2}) // assert.IsIncreasing(t, []string{"a", "b"}) func IsIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { - return isOrdered(t, object, []CompareType{compareLess}, "\"%v\" is not less than \"%v\"", msgAndArgs...) + return isOrdered(t, object, []compareResult{compareLess}, "\"%v\" is not less than \"%v\"", msgAndArgs...) } // IsNonIncreasing asserts that the collection is not increasing @@ -59,7 +59,7 @@ func IsIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) boo // assert.IsNonIncreasing(t, []float{2, 1}) // assert.IsNonIncreasing(t, []string{"b", "a"}) func IsNonIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { - return isOrdered(t, object, []CompareType{compareEqual, compareGreater}, "\"%v\" is not greater than or equal to \"%v\"", msgAndArgs...) + return isOrdered(t, object, []compareResult{compareEqual, compareGreater}, "\"%v\" is not greater than or equal to \"%v\"", msgAndArgs...) } // IsDecreasing asserts that the collection is decreasing @@ -68,7 +68,7 @@ func IsNonIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) // assert.IsDecreasing(t, []float{2, 1}) // assert.IsDecreasing(t, []string{"b", "a"}) func IsDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { - return isOrdered(t, object, []CompareType{compareGreater}, "\"%v\" is not greater than \"%v\"", msgAndArgs...) + return isOrdered(t, object, []compareResult{compareGreater}, "\"%v\" is not greater than \"%v\"", msgAndArgs...) } // IsNonDecreasing asserts that the collection is not decreasing @@ -77,5 +77,5 @@ func IsDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) boo // assert.IsNonDecreasing(t, []float{1, 2}) // assert.IsNonDecreasing(t, []string{"a", "b"}) func IsNonDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { - return isOrdered(t, object, []CompareType{compareLess, compareEqual}, "\"%v\" is not less than or equal to \"%v\"", msgAndArgs...) + return isOrdered(t, object, []compareResult{compareLess, compareEqual}, "\"%v\" is not less than or equal to \"%v\"", msgAndArgs...) } diff --git a/vendor/github.com/stretchr/testify/assert/assertions.go b/vendor/github.com/stretchr/testify/assert/assertions.go index 0b7570f21c..4e91332bb5 100644 --- a/vendor/github.com/stretchr/testify/assert/assertions.go +++ b/vendor/github.com/stretchr/testify/assert/assertions.go @@ -19,7 +19,9 @@ import ( "github.com/davecgh/go-spew/spew" "github.com/pmezard/go-difflib/difflib" - "gopkg.in/yaml.v3" + + // Wrapper around gopkg.in/yaml.v3 + "github.com/stretchr/testify/assert/yaml" ) //go:generate sh -c "cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=assert -template=assertion_format.go.tmpl" @@ -45,6 +47,10 @@ type BoolAssertionFunc func(TestingT, bool, ...interface{}) bool // for table driven tests. type ErrorAssertionFunc func(TestingT, error, ...interface{}) bool +// PanicAssertionFunc is a common function prototype when validating a panic value. Can be useful +// for table driven tests. +type PanicAssertionFunc = func(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool + // Comparison is a custom function that returns true on success and false on failure type Comparison func() (success bool) @@ -496,7 +502,13 @@ func Same(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) b h.Helper() } - if !samePointers(expected, actual) { + same, ok := samePointers(expected, actual) + if !ok { + return Fail(t, "Both arguments must be pointers", msgAndArgs...) + } + + if !same { + // both are pointers but not the same type & pointing to the same address return Fail(t, fmt.Sprintf("Not same: \n"+ "expected: %p %#v\n"+ "actual : %p %#v", expected, expected, actual, actual), msgAndArgs...) @@ -516,7 +528,13 @@ func NotSame(t TestingT, expected, actual interface{}, msgAndArgs ...interface{} h.Helper() } - if samePointers(expected, actual) { + same, ok := samePointers(expected, actual) + if !ok { + //fails when the arguments are not pointers + return !(Fail(t, "Both arguments must be pointers", msgAndArgs...)) + } + + if same { return Fail(t, fmt.Sprintf( "Expected and actual point to the same object: %p %#v", expected, expected), msgAndArgs...) @@ -524,21 +542,23 @@ func NotSame(t TestingT, expected, actual interface{}, msgAndArgs ...interface{} return true } -// samePointers compares two generic interface objects and returns whether -// they point to the same object -func samePointers(first, second interface{}) bool { +// samePointers checks if two generic interface objects are pointers of the same +// type pointing to the same object. It returns two values: same indicating if +// they are the same type and point to the same object, and ok indicating that +// both inputs are pointers. +func samePointers(first, second interface{}) (same bool, ok bool) { firstPtr, secondPtr := reflect.ValueOf(first), reflect.ValueOf(second) if firstPtr.Kind() != reflect.Ptr || secondPtr.Kind() != reflect.Ptr { - return false + return false, false //not both are pointers } firstType, secondType := reflect.TypeOf(first), reflect.TypeOf(second) if firstType != secondType { - return false + return false, true // both are pointers, but of different types } // compare pointer addresses - return first == second + return first == second, true } // formatUnequalValues takes two values of arbitrary types and returns string @@ -572,8 +592,8 @@ func truncatingFormat(data interface{}) string { return value } -// EqualValues asserts that two objects are equal or convertible to the same types -// and equal. +// EqualValues asserts that two objects are equal or convertible to the larger +// type and equal. // // assert.EqualValues(t, uint32(123), int32(123)) func EqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { @@ -615,21 +635,6 @@ func EqualExportedValues(t TestingT, expected, actual interface{}, msgAndArgs .. return Fail(t, fmt.Sprintf("Types expected to match exactly\n\t%v != %v", aType, bType), msgAndArgs...) } - if aType.Kind() == reflect.Ptr { - aType = aType.Elem() - } - if bType.Kind() == reflect.Ptr { - bType = bType.Elem() - } - - if aType.Kind() != reflect.Struct { - return Fail(t, fmt.Sprintf("Types expected to both be struct or pointer to struct \n\t%v != %v", aType.Kind(), reflect.Struct), msgAndArgs...) - } - - if bType.Kind() != reflect.Struct { - return Fail(t, fmt.Sprintf("Types expected to both be struct or pointer to struct \n\t%v != %v", bType.Kind(), reflect.Struct), msgAndArgs...) - } - expected = copyExportedFields(expected) actual = copyExportedFields(actual) @@ -1170,6 +1175,39 @@ func formatListDiff(listA, listB interface{}, extraA, extraB []interface{}) stri return msg.String() } +// NotElementsMatch asserts that the specified listA(array, slice...) is NOT 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 not match. +// This is an inverse of ElementsMatch. +// +// assert.NotElementsMatch(t, [1, 1, 2, 3], [1, 1, 2, 3]) -> false +// +// assert.NotElementsMatch(t, [1, 1, 2, 3], [1, 2, 3]) -> true +// +// assert.NotElementsMatch(t, [1, 2, 3], [1, 2, 4]) -> true +func NotElementsMatch(t TestingT, listA, listB interface{}, msgAndArgs ...interface{}) (ok bool) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if isEmpty(listA) && isEmpty(listB) { + return Fail(t, "listA and listB contain the same elements", msgAndArgs) + } + + if !isList(t, listA, msgAndArgs...) { + return Fail(t, "listA is not a list type", msgAndArgs...) + } + if !isList(t, listB, msgAndArgs...) { + return Fail(t, "listB is not a list type", msgAndArgs...) + } + + extraA, extraB := diffLists(listA, listB) + if len(extraA) == 0 && len(extraB) == 0 { + return Fail(t, "listA and listB contain the same elements", msgAndArgs) + } + + return true +} + // Condition uses a Comparison to assert a complex condition. func Condition(t TestingT, comp Comparison, msgAndArgs ...interface{}) bool { if h, ok := t.(tHelper); ok { @@ -1488,6 +1526,9 @@ func InEpsilon(t TestingT, expected, actual interface{}, epsilon float64, msgAnd if err != nil { return Fail(t, err.Error(), msgAndArgs...) } + if math.IsNaN(actualEpsilon) { + return Fail(t, "relative error is NaN", msgAndArgs...) + } if actualEpsilon > epsilon { return Fail(t, fmt.Sprintf("Relative error is too high: %#v (expected)\n"+ " < %#v (actual)", epsilon, actualEpsilon), msgAndArgs...) @@ -1611,7 +1652,6 @@ func ErrorContains(t TestingT, theError error, contains string, msgAndArgs ...in // matchRegexp return true if a specified regexp matches a string. func matchRegexp(rx interface{}, str interface{}) bool { - var r *regexp.Regexp if rr, ok := rx.(*regexp.Regexp); ok { r = rr @@ -1619,7 +1659,14 @@ func matchRegexp(rx interface{}, str interface{}) bool { r = regexp.MustCompile(fmt.Sprint(rx)) } - return (r.FindStringIndex(fmt.Sprint(str)) != nil) + switch v := str.(type) { + case []byte: + return r.Match(v) + case string: + return r.MatchString(v) + default: + return r.MatchString(fmt.Sprint(v)) + } } @@ -1872,7 +1919,7 @@ var spewConfigStringerEnabled = spew.ConfigState{ MaxDepth: 10, } -type tHelper interface { +type tHelper = interface { Helper() } @@ -1911,6 +1958,9 @@ func Eventually(t TestingT, condition func() bool, waitFor time.Duration, tick t // CollectT implements the TestingT interface and collects all errors. type CollectT struct { + // A slice of errors. Non-nil slice denotes a failure. + // If it's non-nil but len(c.errors) == 0, this is also a failure + // obtained by direct c.FailNow() call. errors []error } @@ -1919,9 +1969,10 @@ func (c *CollectT) Errorf(format string, args ...interface{}) { c.errors = append(c.errors, fmt.Errorf(format, args...)) } -// FailNow panics. -func (*CollectT) FailNow() { - panic("Assertion failed") +// FailNow stops execution by calling runtime.Goexit. +func (c *CollectT) FailNow() { + c.fail() + runtime.Goexit() } // Deprecated: That was a method for internal usage that should not have been published. Now just panics. @@ -1934,6 +1985,16 @@ func (*CollectT) Copy(TestingT) { panic("Copy() is deprecated") } +func (c *CollectT) fail() { + if !c.failed() { + c.errors = []error{} // Make it non-nil to mark a failure. + } +} + +func (c *CollectT) failed() bool { + return c.errors != nil +} + // EventuallyWithT asserts that given condition will be met in waitFor time, // periodically checking target function each tick. In contrast to Eventually, // it supplies a CollectT to the condition function, so that the condition @@ -1951,14 +2012,14 @@ func (*CollectT) Copy(TestingT) { // assert.EventuallyWithT(t, func(c *assert.CollectT) { // // add assertions as needed; any assertion failure will fail the current tick // assert.True(c, externalValue, "expected 'externalValue' to be true") -// }, 1*time.Second, 10*time.Second, "external state has not changed to 'true'; still false") +// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false") func EventuallyWithT(t TestingT, condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() } var lastFinishedTickErrs []error - ch := make(chan []error, 1) + ch := make(chan *CollectT, 1) timer := time.NewTimer(waitFor) defer timer.Stop() @@ -1978,16 +2039,16 @@ func EventuallyWithT(t TestingT, condition func(collect *CollectT), waitFor time go func() { collect := new(CollectT) defer func() { - ch <- collect.errors + ch <- collect }() condition(collect) }() - case errs := <-ch: - if len(errs) == 0 { + case collect := <-ch: + if !collect.failed() { return true } // Keep the errors from the last ended condition, so that they can be copied to t if timeout is reached. - lastFinishedTickErrs = errs + lastFinishedTickErrs = collect.errors tick = ticker.C } } @@ -2049,7 +2110,7 @@ func ErrorIs(t TestingT, err, target error, msgAndArgs ...interface{}) bool { ), msgAndArgs...) } -// NotErrorIs asserts that at none of the errors in err's chain matches target. +// NotErrorIs asserts that none of the errors in err's chain matches target. // This is a wrapper for errors.Is. func NotErrorIs(t TestingT, err, target error, msgAndArgs ...interface{}) bool { if h, ok := t.(tHelper); ok { @@ -2090,6 +2151,24 @@ func ErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interface{ ), msgAndArgs...) } +// NotErrorAs asserts that none of the errors in err's chain matches target, +// but if so, sets target to that error value. +func NotErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if !errors.As(err, target) { + return true + } + + chain := buildErrorChainString(err) + + return Fail(t, fmt.Sprintf("Target error should not be in err chain:\n"+ + "found: %q\n"+ + "in chain: %s", target, chain, + ), msgAndArgs...) +} + func buildErrorChainString(err error) string { if err == nil { return "" diff --git a/vendor/github.com/stretchr/testify/assert/yaml/yaml_custom.go b/vendor/github.com/stretchr/testify/assert/yaml/yaml_custom.go new file mode 100644 index 0000000000..baa0cc7d7f --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/yaml/yaml_custom.go @@ -0,0 +1,25 @@ +//go:build testify_yaml_custom && !testify_yaml_fail && !testify_yaml_default +// +build testify_yaml_custom,!testify_yaml_fail,!testify_yaml_default + +// Package yaml is an implementation of YAML functions that calls a pluggable implementation. +// +// This implementation is selected with the testify_yaml_custom build tag. +// +// go test -tags testify_yaml_custom +// +// This implementation can be used at build time to replace the default implementation +// to avoid linking with [gopkg.in/yaml.v3]. +// +// In your test package: +// +// import assertYaml "github.com/stretchr/testify/assert/yaml" +// +// func init() { +// assertYaml.Unmarshal = func (in []byte, out interface{}) error { +// // ... +// return nil +// } +// } +package yaml + +var Unmarshal func(in []byte, out interface{}) error diff --git a/vendor/github.com/stretchr/testify/assert/yaml/yaml_default.go b/vendor/github.com/stretchr/testify/assert/yaml/yaml_default.go new file mode 100644 index 0000000000..b83c6cf64c --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/yaml/yaml_default.go @@ -0,0 +1,37 @@ +//go:build !testify_yaml_fail && !testify_yaml_custom +// +build !testify_yaml_fail,!testify_yaml_custom + +// Package yaml is just an indirection to handle YAML deserialization. +// +// This package is just an indirection that allows the builder to override the +// indirection with an alternative implementation of this package that uses +// another implementation of YAML deserialization. This allows to not either not +// use YAML deserialization at all, or to use another implementation than +// [gopkg.in/yaml.v3] (for example for license compatibility reasons, see [PR #1120]). +// +// Alternative implementations are selected using build tags: +// +// - testify_yaml_fail: [Unmarshal] always fails with an error +// - testify_yaml_custom: [Unmarshal] is a variable. Caller must initialize it +// before calling any of [github.com/stretchr/testify/assert.YAMLEq] or +// [github.com/stretchr/testify/assert.YAMLEqf]. +// +// Usage: +// +// go test -tags testify_yaml_fail +// +// You can check with "go list" which implementation is linked: +// +// go list -f '{{.Imports}}' github.com/stretchr/testify/assert/yaml +// go list -tags testify_yaml_fail -f '{{.Imports}}' github.com/stretchr/testify/assert/yaml +// go list -tags testify_yaml_custom -f '{{.Imports}}' github.com/stretchr/testify/assert/yaml +// +// [PR #1120]: https://github.com/stretchr/testify/pull/1120 +package yaml + +import goyaml "gopkg.in/yaml.v3" + +// Unmarshal is just a wrapper of [gopkg.in/yaml.v3.Unmarshal]. +func Unmarshal(in []byte, out interface{}) error { + return goyaml.Unmarshal(in, out) +} diff --git a/vendor/github.com/stretchr/testify/assert/yaml/yaml_fail.go b/vendor/github.com/stretchr/testify/assert/yaml/yaml_fail.go new file mode 100644 index 0000000000..e78f7dfe69 --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/yaml/yaml_fail.go @@ -0,0 +1,18 @@ +//go:build testify_yaml_fail && !testify_yaml_custom && !testify_yaml_default +// +build testify_yaml_fail,!testify_yaml_custom,!testify_yaml_default + +// Package yaml is an implementation of YAML functions that always fail. +// +// This implementation can be used at build time to replace the default implementation +// to avoid linking with [gopkg.in/yaml.v3]: +// +// go test -tags testify_yaml_fail +package yaml + +import "errors" + +var errNotImplemented = errors.New("YAML functions are not available (see https://pkg.go.dev/github.com/stretchr/testify/assert/yaml)") + +func Unmarshal([]byte, interface{}) error { + return errNotImplemented +} diff --git a/vendor/github.com/stretchr/testify/require/require.go b/vendor/github.com/stretchr/testify/require/require.go index 506a82f807..d8921950d7 100644 --- a/vendor/github.com/stretchr/testify/require/require.go +++ b/vendor/github.com/stretchr/testify/require/require.go @@ -34,9 +34,9 @@ func Conditionf(t TestingT, comp assert.Comparison, msg string, args ...interfac // 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") +// require.Contains(t, "Hello World", "World") +// require.Contains(t, ["Hello", "World"], "World") +// require.Contains(t, {"Hello": "World"}, "Hello") func Contains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -50,9 +50,9 @@ func Contains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...int // 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") +// require.Containsf(t, "Hello World", "World", "error message %s", "formatted") +// require.Containsf(t, ["Hello", "World"], "World", "error message %s", "formatted") +// require.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() @@ -91,7 +91,7 @@ func DirExistsf(t TestingT, path string, msg string, args ...interface{}) { // 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]) +// require.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() @@ -106,7 +106,7 @@ func ElementsMatch(t TestingT, listA interface{}, listB interface{}, msgAndArgs // 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") +// require.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() @@ -120,7 +120,7 @@ func ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string // 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) +// require.Empty(t, obj) func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -134,7 +134,7 @@ func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) { // 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") +// require.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() @@ -147,7 +147,7 @@ func Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) { // Equal asserts that two objects are equal. // -// assert.Equal(t, 123, 123) +// require.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 @@ -166,7 +166,7 @@ func Equal(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...i // and that it is equal to the provided error. // // actualObj, err := SomeFunction() -// assert.EqualError(t, err, expectedErrorString) +// require.EqualError(t, err, expectedErrorString) func EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -181,7 +181,7 @@ func EqualError(t TestingT, theError error, errString string, msgAndArgs ...inte // and that it is equal to the provided error. // // actualObj, err := SomeFunction() -// assert.EqualErrorf(t, err, expectedErrorString, "error message %s", "formatted") +// require.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() @@ -200,8 +200,8 @@ func EqualErrorf(t TestingT, theError error, errString string, msg string, args // Exported int // notExported int // } -// assert.EqualExportedValues(t, S{1, 2}, S{1, 3}) => true -// assert.EqualExportedValues(t, S{1, 2}, S{2, 3}) => false +// require.EqualExportedValues(t, S{1, 2}, S{1, 3}) => true +// require.EqualExportedValues(t, S{1, 2}, S{2, 3}) => false func EqualExportedValues(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -220,8 +220,8 @@ func EqualExportedValues(t TestingT, expected interface{}, actual interface{}, m // Exported int // notExported int // } -// assert.EqualExportedValuesf(t, S{1, 2}, S{1, 3}, "error message %s", "formatted") => true -// assert.EqualExportedValuesf(t, S{1, 2}, S{2, 3}, "error message %s", "formatted") => false +// require.EqualExportedValuesf(t, S{1, 2}, S{1, 3}, "error message %s", "formatted") => true +// require.EqualExportedValuesf(t, S{1, 2}, S{2, 3}, "error message %s", "formatted") => false func EqualExportedValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -232,10 +232,10 @@ func EqualExportedValuesf(t TestingT, expected interface{}, actual interface{}, t.FailNow() } -// EqualValues asserts that two objects are equal or convertible to the same types -// and equal. +// EqualValues asserts that two objects are equal or convertible to the larger +// type and equal. // -// assert.EqualValues(t, uint32(123), int32(123)) +// require.EqualValues(t, uint32(123), int32(123)) func EqualValues(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -246,10 +246,10 @@ func EqualValues(t TestingT, expected interface{}, actual interface{}, msgAndArg t.FailNow() } -// EqualValuesf asserts that two objects are equal or convertible to the same types -// and equal. +// EqualValuesf asserts that two objects are equal or convertible to the larger +// type and equal. // -// assert.EqualValuesf(t, uint32(123), int32(123), "error message %s", "formatted") +// require.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() @@ -262,7 +262,7 @@ func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg stri // Equalf asserts that two objects are equal. // -// assert.Equalf(t, 123, 123, "error message %s", "formatted") +// require.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 @@ -280,8 +280,8 @@ func Equalf(t TestingT, expected interface{}, actual interface{}, msg string, ar // 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) +// if require.Error(t, err) { +// require.Equal(t, expectedError, err) // } func Error(t TestingT, err error, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { @@ -321,7 +321,7 @@ func ErrorAsf(t TestingT, err error, target interface{}, msg string, args ...int // and that the error contains the specified substring. // // actualObj, err := SomeFunction() -// assert.ErrorContains(t, err, expectedErrorSubString) +// require.ErrorContains(t, err, expectedErrorSubString) func ErrorContains(t TestingT, theError error, contains string, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -336,7 +336,7 @@ func ErrorContains(t TestingT, theError error, contains string, msgAndArgs ...in // and that the error contains the specified substring. // // actualObj, err := SomeFunction() -// assert.ErrorContainsf(t, err, expectedErrorSubString, "error message %s", "formatted") +// require.ErrorContainsf(t, err, expectedErrorSubString, "error message %s", "formatted") func ErrorContainsf(t TestingT, theError error, contains string, msg string, args ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -374,8 +374,8 @@ func ErrorIsf(t TestingT, err error, target error, msg string, args ...interface // 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) +// if require.Errorf(t, err, "error message %s", "formatted") { +// require.Equal(t, expectedErrorf, err) // } func Errorf(t TestingT, err error, msg string, args ...interface{}) { if h, ok := t.(tHelper); ok { @@ -390,7 +390,7 @@ func Errorf(t TestingT, err error, msg string, args ...interface{}) { // 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) +// require.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() @@ -415,10 +415,10 @@ func Eventually(t TestingT, condition func() bool, waitFor time.Duration, tick t // time.Sleep(8*time.Second) // externalValue = true // }() -// assert.EventuallyWithT(t, func(c *assert.CollectT) { +// require.EventuallyWithT(t, func(c *require.CollectT) { // // add assertions as needed; any assertion failure will fail the current tick -// assert.True(c, externalValue, "expected 'externalValue' to be true") -// }, 1*time.Second, 10*time.Second, "external state has not changed to 'true'; still false") +// require.True(c, externalValue, "expected 'externalValue' to be true") +// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false") func EventuallyWithT(t TestingT, condition func(collect *assert.CollectT), waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -443,10 +443,10 @@ func EventuallyWithT(t TestingT, condition func(collect *assert.CollectT), waitF // time.Sleep(8*time.Second) // externalValue = true // }() -// assert.EventuallyWithTf(t, func(c *assert.CollectT, "error message %s", "formatted") { +// require.EventuallyWithTf(t, func(c *require.CollectT, "error message %s", "formatted") { // // add assertions as needed; any assertion failure will fail the current tick -// assert.True(c, externalValue, "expected 'externalValue' to be true") -// }, 1*time.Second, 10*time.Second, "external state has not changed to 'true'; still false") +// require.True(c, externalValue, "expected 'externalValue' to be true") +// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false") func EventuallyWithTf(t TestingT, condition func(collect *assert.CollectT), waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -460,7 +460,7 @@ func EventuallyWithTf(t TestingT, condition func(collect *assert.CollectT), wait // 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") +// require.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() @@ -473,7 +473,7 @@ func Eventuallyf(t TestingT, condition func() bool, waitFor time.Duration, tick // Exactly asserts that two objects are equal in value and type. // -// assert.Exactly(t, int32(123), int64(123)) +// require.Exactly(t, int32(123), int64(123)) func Exactly(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -486,7 +486,7 @@ func Exactly(t TestingT, expected interface{}, actual interface{}, msgAndArgs .. // Exactlyf asserts that two objects are equal in value and type. // -// assert.Exactlyf(t, int32(123), int64(123), "error message %s", "formatted") +// require.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() @@ -543,7 +543,7 @@ func Failf(t TestingT, failureMessage string, msg string, args ...interface{}) { // False asserts that the specified value is false. // -// assert.False(t, myBool) +// require.False(t, myBool) func False(t TestingT, value bool, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -556,7 +556,7 @@ func False(t TestingT, value bool, msgAndArgs ...interface{}) { // Falsef asserts that the specified value is false. // -// assert.Falsef(t, myBool, "error message %s", "formatted") +// require.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() @@ -593,9 +593,9 @@ func FileExistsf(t TestingT, path string, msg string, args ...interface{}) { // 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") +// require.Greater(t, 2, 1) +// require.Greater(t, float64(2), float64(1)) +// require.Greater(t, "b", "a") func Greater(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -608,10 +608,10 @@ func Greater(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface // 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") +// require.GreaterOrEqual(t, 2, 1) +// require.GreaterOrEqual(t, 2, 2) +// require.GreaterOrEqual(t, "b", "a") +// require.GreaterOrEqual(t, "b", "b") func GreaterOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -624,10 +624,10 @@ func GreaterOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...in // 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") +// require.GreaterOrEqualf(t, 2, 1, "error message %s", "formatted") +// require.GreaterOrEqualf(t, 2, 2, "error message %s", "formatted") +// require.GreaterOrEqualf(t, "b", "a", "error message %s", "formatted") +// require.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() @@ -640,9 +640,9 @@ func GreaterOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, arg // 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") +// require.Greaterf(t, 2, 1, "error message %s", "formatted") +// require.Greaterf(t, float64(2), float64(1), "error message %s", "formatted") +// require.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() @@ -656,7 +656,7 @@ func Greaterf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...in // 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") +// require.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{}) { @@ -672,7 +672,7 @@ func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method string, url s // 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") +// require.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{}) { @@ -688,7 +688,7 @@ func HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url // 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") +// require.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{}) { @@ -704,7 +704,7 @@ func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method string, ur // 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") +// require.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{}) { @@ -719,7 +719,7 @@ func HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, u // 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"}} +// require.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{}) { @@ -734,7 +734,7 @@ func HTTPError(t TestingT, handler http.HandlerFunc, method string, url string, // 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"}} +// require.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{}) { @@ -749,7 +749,7 @@ func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, // 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"}} +// require.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{}) { @@ -764,7 +764,7 @@ func HTTPRedirect(t TestingT, handler http.HandlerFunc, method string, url strin // 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"}} +// require.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{}) { @@ -779,7 +779,7 @@ func HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url stri // HTTPStatusCode asserts that a specified handler returns a specified status code. // -// assert.HTTPStatusCode(t, myHandler, "GET", "/notImplemented", nil, 501) +// require.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{}) { @@ -794,7 +794,7 @@ func HTTPStatusCode(t TestingT, handler http.HandlerFunc, method string, url str // HTTPStatusCodef asserts that a specified handler returns a specified status code. // -// assert.HTTPStatusCodef(t, myHandler, "GET", "/notImplemented", nil, 501, "error message %s", "formatted") +// require.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{}) { @@ -809,7 +809,7 @@ func HTTPStatusCodef(t TestingT, handler http.HandlerFunc, method string, url st // HTTPSuccess asserts that a specified handler returns a success status code. // -// assert.HTTPSuccess(t, myHandler, "POST", "http://www.google.com", nil) +// require.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{}) { @@ -824,7 +824,7 @@ func HTTPSuccess(t TestingT, handler http.HandlerFunc, method string, url string // 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") +// require.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{}) { @@ -839,7 +839,7 @@ func HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url strin // Implements asserts that an object is implemented by the specified interface. // -// assert.Implements(t, (*MyInterface)(nil), new(MyObject)) +// require.Implements(t, (*MyInterface)(nil), new(MyObject)) func Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -852,7 +852,7 @@ func Implements(t TestingT, interfaceObject interface{}, object interface{}, msg // Implementsf asserts that an object is implemented by the specified interface. // -// assert.Implementsf(t, (*MyInterface)(nil), new(MyObject), "error message %s", "formatted") +// require.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() @@ -865,7 +865,7 @@ func Implementsf(t TestingT, interfaceObject interface{}, object interface{}, ms // InDelta asserts that the two numerals are within delta of each other. // -// assert.InDelta(t, math.Pi, 22/7.0, 0.01) +// require.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() @@ -922,7 +922,7 @@ func InDeltaSlicef(t TestingT, expected interface{}, actual interface{}, delta f // 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") +// require.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() @@ -979,9 +979,9 @@ func InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon fl // 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"}) +// require.IsDecreasing(t, []int{2, 1, 0}) +// require.IsDecreasing(t, []float{2, 1}) +// require.IsDecreasing(t, []string{"b", "a"}) func IsDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -994,9 +994,9 @@ func IsDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) { // 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") +// require.IsDecreasingf(t, []int{2, 1, 0}, "error message %s", "formatted") +// require.IsDecreasingf(t, []float{2, 1}, "error message %s", "formatted") +// require.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() @@ -1009,9 +1009,9 @@ func IsDecreasingf(t TestingT, object interface{}, msg string, args ...interface // 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"}) +// require.IsIncreasing(t, []int{1, 2, 3}) +// require.IsIncreasing(t, []float{1, 2}) +// require.IsIncreasing(t, []string{"a", "b"}) func IsIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1024,9 +1024,9 @@ func IsIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) { // 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") +// require.IsIncreasingf(t, []int{1, 2, 3}, "error message %s", "formatted") +// require.IsIncreasingf(t, []float{1, 2}, "error message %s", "formatted") +// require.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() @@ -1039,9 +1039,9 @@ func IsIncreasingf(t TestingT, object interface{}, msg string, args ...interface // 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"}) +// require.IsNonDecreasing(t, []int{1, 1, 2}) +// require.IsNonDecreasing(t, []float{1, 2}) +// require.IsNonDecreasing(t, []string{"a", "b"}) func IsNonDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1054,9 +1054,9 @@ func IsNonDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) // 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") +// require.IsNonDecreasingf(t, []int{1, 1, 2}, "error message %s", "formatted") +// require.IsNonDecreasingf(t, []float{1, 2}, "error message %s", "formatted") +// require.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() @@ -1069,9 +1069,9 @@ func IsNonDecreasingf(t TestingT, object interface{}, msg string, args ...interf // 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"}) +// require.IsNonIncreasing(t, []int{2, 1, 1}) +// require.IsNonIncreasing(t, []float{2, 1}) +// require.IsNonIncreasing(t, []string{"b", "a"}) func IsNonIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1084,9 +1084,9 @@ func IsNonIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) // 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") +// require.IsNonIncreasingf(t, []int{2, 1, 1}, "error message %s", "formatted") +// require.IsNonIncreasingf(t, []float{2, 1}, "error message %s", "formatted") +// require.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() @@ -1121,7 +1121,7 @@ func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg strin // JSONEq asserts that two JSON strings are equivalent. // -// assert.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) +// require.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() @@ -1134,7 +1134,7 @@ func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{ // JSONEqf asserts that two JSON strings are equivalent. // -// assert.JSONEqf(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted") +// require.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() @@ -1148,7 +1148,7 @@ func JSONEqf(t TestingT, expected string, actual string, msg string, args ...int // 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) +// require.Len(t, mySlice, 3) func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1162,7 +1162,7 @@ func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) // 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") +// require.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() @@ -1175,9 +1175,9 @@ func Lenf(t TestingT, object interface{}, length int, msg string, args ...interf // 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") +// require.Less(t, 1, 2) +// require.Less(t, float64(1), float64(2)) +// require.Less(t, "a", "b") func Less(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1190,10 +1190,10 @@ func Less(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) // 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") +// require.LessOrEqual(t, 1, 2) +// require.LessOrEqual(t, 2, 2) +// require.LessOrEqual(t, "a", "b") +// require.LessOrEqual(t, "b", "b") func LessOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1206,10 +1206,10 @@ func LessOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...inter // 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") +// require.LessOrEqualf(t, 1, 2, "error message %s", "formatted") +// require.LessOrEqualf(t, 2, 2, "error message %s", "formatted") +// require.LessOrEqualf(t, "a", "b", "error message %s", "formatted") +// require.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() @@ -1222,9 +1222,9 @@ func LessOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args . // 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") +// require.Lessf(t, 1, 2, "error message %s", "formatted") +// require.Lessf(t, float64(1), float64(2), "error message %s", "formatted") +// require.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() @@ -1237,8 +1237,8 @@ func Lessf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...inter // Negative asserts that the specified element is negative // -// assert.Negative(t, -1) -// assert.Negative(t, -1.23) +// require.Negative(t, -1) +// require.Negative(t, -1.23) func Negative(t TestingT, e interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1251,8 +1251,8 @@ func Negative(t TestingT, e interface{}, msgAndArgs ...interface{}) { // 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") +// require.Negativef(t, -1, "error message %s", "formatted") +// require.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() @@ -1266,7 +1266,7 @@ func Negativef(t TestingT, e interface{}, msg string, args ...interface{}) { // 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) +// require.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() @@ -1280,7 +1280,7 @@ func Never(t TestingT, condition func() bool, waitFor time.Duration, tick time.D // 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") +// require.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() @@ -1293,7 +1293,7 @@ func Neverf(t TestingT, condition func() bool, waitFor time.Duration, tick time. // Nil asserts that the specified object is nil. // -// assert.Nil(t, err) +// require.Nil(t, err) func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1306,7 +1306,7 @@ func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) { // Nilf asserts that the specified object is nil. // -// assert.Nilf(t, err, "error message %s", "formatted") +// require.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() @@ -1344,8 +1344,8 @@ func NoDirExistsf(t TestingT, path string, msg string, args ...interface{}) { // NoError asserts that a function returned no error (i.e. `nil`). // // actualObj, err := SomeFunction() -// if assert.NoError(t, err) { -// assert.Equal(t, expectedObj, actualObj) +// if require.NoError(t, err) { +// require.Equal(t, expectedObj, actualObj) // } func NoError(t TestingT, err error, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { @@ -1360,8 +1360,8 @@ func NoError(t TestingT, err error, msgAndArgs ...interface{}) { // 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) +// if require.NoErrorf(t, err, "error message %s", "formatted") { +// require.Equal(t, expectedObj, actualObj) // } func NoErrorf(t TestingT, err error, msg string, args ...interface{}) { if h, ok := t.(tHelper); ok { @@ -1400,9 +1400,9 @@ func NoFileExistsf(t TestingT, path string, msg string, args ...interface{}) { // 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") +// require.NotContains(t, "Hello World", "Earth") +// require.NotContains(t, ["Hello", "World"], "Earth") +// require.NotContains(t, {"Hello": "World"}, "Earth") func NotContains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1416,9 +1416,9 @@ func NotContains(t TestingT, s interface{}, contains interface{}, msgAndArgs ... // 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") +// require.NotContainsf(t, "Hello World", "Earth", "error message %s", "formatted") +// require.NotContainsf(t, ["Hello", "World"], "Earth", "error message %s", "formatted") +// require.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() @@ -1429,11 +1429,51 @@ func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, a t.FailNow() } +// NotElementsMatch asserts that the specified listA(array, slice...) is NOT 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 not match. +// This is an inverse of ElementsMatch. +// +// require.NotElementsMatch(t, [1, 1, 2, 3], [1, 1, 2, 3]) -> false +// +// require.NotElementsMatch(t, [1, 1, 2, 3], [1, 2, 3]) -> true +// +// require.NotElementsMatch(t, [1, 2, 3], [1, 2, 4]) -> true +func NotElementsMatch(t TestingT, listA interface{}, listB interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotElementsMatch(t, listA, listB, msgAndArgs...) { + return + } + t.FailNow() +} + +// NotElementsMatchf asserts that the specified listA(array, slice...) is NOT 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 not match. +// This is an inverse of ElementsMatch. +// +// require.NotElementsMatchf(t, [1, 1, 2, 3], [1, 1, 2, 3], "error message %s", "formatted") -> false +// +// require.NotElementsMatchf(t, [1, 1, 2, 3], [1, 2, 3], "error message %s", "formatted") -> true +// +// require.NotElementsMatchf(t, [1, 2, 3], [1, 2, 4], "error message %s", "formatted") -> true +func NotElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotElementsMatchf(t, listA, listB, 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]) +// if require.NotEmpty(t, obj) { +// require.Equal(t, "two", obj[1]) // } func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { @@ -1448,8 +1488,8 @@ func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) { // 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]) +// if require.NotEmptyf(t, obj, "error message %s", "formatted") { +// require.Equal(t, "two", obj[1]) // } func NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) { if h, ok := t.(tHelper); ok { @@ -1463,7 +1503,7 @@ func NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) // NotEqual asserts that the specified values are NOT equal. // -// assert.NotEqual(t, obj1, obj2) +// require.NotEqual(t, obj1, obj2) // // Pointer variable equality is determined based on the equality of the // referenced values (as opposed to the memory addresses). @@ -1479,7 +1519,7 @@ func NotEqual(t TestingT, expected interface{}, actual interface{}, msgAndArgs . // NotEqualValues asserts that two objects are not equal even when converted to the same type // -// assert.NotEqualValues(t, obj1, obj2) +// require.NotEqualValues(t, obj1, obj2) func NotEqualValues(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1492,7 +1532,7 @@ func NotEqualValues(t TestingT, expected interface{}, actual interface{}, msgAnd // NotEqualValuesf asserts that two objects are not equal even when converted to the same type // -// assert.NotEqualValuesf(t, obj1, obj2, "error message %s", "formatted") +// require.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() @@ -1505,7 +1545,7 @@ func NotEqualValuesf(t TestingT, expected interface{}, actual interface{}, msg s // NotEqualf asserts that the specified values are NOT equal. // -// assert.NotEqualf(t, obj1, obj2, "error message %s", "formatted") +// require.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). @@ -1519,7 +1559,31 @@ func NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string, t.FailNow() } -// NotErrorIs asserts that at none of the errors in err's chain matches target. +// NotErrorAs asserts that none of the errors in err's chain matches target, +// but if so, sets target to that error value. +func NotErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotErrorAs(t, err, target, msgAndArgs...) { + return + } + t.FailNow() +} + +// NotErrorAsf asserts that none of the errors in err's chain matches target, +// but if so, sets target to that error value. +func NotErrorAsf(t TestingT, err error, target interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotErrorAsf(t, err, target, msg, args...) { + return + } + t.FailNow() +} + +// NotErrorIs asserts that 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 { @@ -1531,7 +1595,7 @@ func NotErrorIs(t TestingT, err error, target error, msgAndArgs ...interface{}) t.FailNow() } -// NotErrorIsf asserts that at none of the errors in err's chain matches target. +// NotErrorIsf asserts that 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 { @@ -1545,7 +1609,7 @@ func NotErrorIsf(t TestingT, err error, target error, msg string, args ...interf // NotImplements asserts that an object does not implement the specified interface. // -// assert.NotImplements(t, (*MyInterface)(nil), new(MyObject)) +// require.NotImplements(t, (*MyInterface)(nil), new(MyObject)) func NotImplements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1558,7 +1622,7 @@ func NotImplements(t TestingT, interfaceObject interface{}, object interface{}, // NotImplementsf asserts that an object does not implement the specified interface. // -// assert.NotImplementsf(t, (*MyInterface)(nil), new(MyObject), "error message %s", "formatted") +// require.NotImplementsf(t, (*MyInterface)(nil), new(MyObject), "error message %s", "formatted") func NotImplementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1571,7 +1635,7 @@ func NotImplementsf(t TestingT, interfaceObject interface{}, object interface{}, // NotNil asserts that the specified object is not nil. // -// assert.NotNil(t, err) +// require.NotNil(t, err) func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1584,7 +1648,7 @@ func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) { // NotNilf asserts that the specified object is not nil. // -// assert.NotNilf(t, err, "error message %s", "formatted") +// require.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() @@ -1597,7 +1661,7 @@ func NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) { // NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. // -// assert.NotPanics(t, func(){ RemainCalm() }) +// require.NotPanics(t, func(){ RemainCalm() }) func NotPanics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1610,7 +1674,7 @@ func NotPanics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) { // NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic. // -// assert.NotPanicsf(t, func(){ RemainCalm() }, "error message %s", "formatted") +// require.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() @@ -1623,8 +1687,8 @@ func NotPanicsf(t TestingT, f assert.PanicTestFunc, msg string, args ...interfac // 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") +// require.NotRegexp(t, regexp.MustCompile("starts"), "it's starting") +// require.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() @@ -1637,8 +1701,8 @@ func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interf // 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") +// require.NotRegexpf(t, regexp.MustCompile("starts"), "it's starting", "error message %s", "formatted") +// require.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() @@ -1651,7 +1715,7 @@ func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args .. // NotSame asserts that two pointers do not reference the same object. // -// assert.NotSame(t, ptr1, ptr2) +// require.NotSame(t, ptr1, ptr2) // // Both arguments must be pointer variables. Pointer variable sameness is // determined based on the equality of both type and value. @@ -1667,7 +1731,7 @@ func NotSame(t TestingT, expected interface{}, actual interface{}, msgAndArgs .. // NotSamef asserts that two pointers do not reference the same object. // -// assert.NotSamef(t, ptr1, ptr2, "error message %s", "formatted") +// require.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. @@ -1685,8 +1749,8 @@ func NotSamef(t TestingT, expected interface{}, actual interface{}, msg string, // contain all elements given in the specified subset list(array, slice...) or // map. // -// assert.NotSubset(t, [1, 3, 4], [1, 2]) -// assert.NotSubset(t, {"x": 1, "y": 2}, {"z": 3}) +// require.NotSubset(t, [1, 3, 4], [1, 2]) +// require.NotSubset(t, {"x": 1, "y": 2}, {"z": 3}) func NotSubset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1701,8 +1765,8 @@ func NotSubset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...i // contain all elements given in the specified subset list(array, slice...) or // map. // -// assert.NotSubsetf(t, [1, 3, 4], [1, 2], "error message %s", "formatted") -// assert.NotSubsetf(t, {"x": 1, "y": 2}, {"z": 3}, "error message %s", "formatted") +// require.NotSubsetf(t, [1, 3, 4], [1, 2], "error message %s", "formatted") +// require.NotSubsetf(t, {"x": 1, "y": 2}, {"z": 3}, "error message %s", "formatted") func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1737,7 +1801,7 @@ func NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) { // Panics asserts that the code inside the specified PanicTestFunc panics. // -// assert.Panics(t, func(){ GoCrazy() }) +// require.Panics(t, func(){ GoCrazy() }) func Panics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1752,7 +1816,7 @@ func Panics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) { // panics, and that the recovered panic value is an error that satisfies the // EqualError comparison. // -// assert.PanicsWithError(t, "crazy error", func(){ GoCrazy() }) +// require.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() @@ -1767,7 +1831,7 @@ func PanicsWithError(t TestingT, errString string, f assert.PanicTestFunc, msgAn // 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") +// require.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() @@ -1781,7 +1845,7 @@ func PanicsWithErrorf(t TestingT, errString string, f assert.PanicTestFunc, msg // 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() }) +// require.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() @@ -1795,7 +1859,7 @@ func PanicsWithValue(t TestingT, expected interface{}, f assert.PanicTestFunc, m // 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") +// require.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() @@ -1808,7 +1872,7 @@ func PanicsWithValuef(t TestingT, expected interface{}, f assert.PanicTestFunc, // Panicsf asserts that the code inside the specified PanicTestFunc panics. // -// assert.Panicsf(t, func(){ GoCrazy() }, "error message %s", "formatted") +// require.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() @@ -1821,8 +1885,8 @@ func Panicsf(t TestingT, f assert.PanicTestFunc, msg string, args ...interface{} // Positive asserts that the specified element is positive // -// assert.Positive(t, 1) -// assert.Positive(t, 1.23) +// require.Positive(t, 1) +// require.Positive(t, 1.23) func Positive(t TestingT, e interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1835,8 +1899,8 @@ func Positive(t TestingT, e interface{}, msgAndArgs ...interface{}) { // 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") +// require.Positivef(t, 1, "error message %s", "formatted") +// require.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() @@ -1849,8 +1913,8 @@ func Positivef(t TestingT, e interface{}, msg string, args ...interface{}) { // 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") +// require.Regexp(t, regexp.MustCompile("start"), "it's starting") +// require.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() @@ -1863,8 +1927,8 @@ func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface // 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") +// require.Regexpf(t, regexp.MustCompile("start"), "it's starting", "error message %s", "formatted") +// require.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() @@ -1877,7 +1941,7 @@ func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...in // Same asserts that two pointers reference the same object. // -// assert.Same(t, ptr1, ptr2) +// require.Same(t, ptr1, ptr2) // // Both arguments must be pointer variables. Pointer variable sameness is // determined based on the equality of both type and value. @@ -1893,7 +1957,7 @@ func Same(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...in // Samef asserts that two pointers reference the same object. // -// assert.Samef(t, ptr1, ptr2, "error message %s", "formatted") +// require.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. @@ -1910,8 +1974,8 @@ func Samef(t TestingT, expected interface{}, actual interface{}, msg string, arg // Subset asserts that the specified list(array, slice...) or map contains all // elements given in the specified subset list(array, slice...) or map. // -// assert.Subset(t, [1, 2, 3], [1, 2]) -// assert.Subset(t, {"x": 1, "y": 2}, {"x": 1}) +// require.Subset(t, [1, 2, 3], [1, 2]) +// require.Subset(t, {"x": 1, "y": 2}, {"x": 1}) func Subset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1925,8 +1989,8 @@ func Subset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...inte // Subsetf asserts that the specified list(array, slice...) or map contains all // elements given in the specified subset list(array, slice...) or map. // -// assert.Subsetf(t, [1, 2, 3], [1, 2], "error message %s", "formatted") -// assert.Subsetf(t, {"x": 1, "y": 2}, {"x": 1}, "error message %s", "formatted") +// require.Subsetf(t, [1, 2, 3], [1, 2], "error message %s", "formatted") +// require.Subsetf(t, {"x": 1, "y": 2}, {"x": 1}, "error message %s", "formatted") func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1939,7 +2003,7 @@ func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args // True asserts that the specified value is true. // -// assert.True(t, myBool) +// require.True(t, myBool) func True(t TestingT, value bool, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1952,7 +2016,7 @@ func True(t TestingT, value bool, msgAndArgs ...interface{}) { // Truef asserts that the specified value is true. // -// assert.Truef(t, myBool, "error message %s", "formatted") +// require.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() @@ -1965,7 +2029,7 @@ func Truef(t TestingT, value bool, msg string, args ...interface{}) { // WithinDuration asserts that the two times are within duration delta of each other. // -// assert.WithinDuration(t, time.Now(), time.Now(), 10*time.Second) +// require.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() @@ -1978,7 +2042,7 @@ func WithinDuration(t TestingT, expected time.Time, actual time.Time, delta time // 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") +// require.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() @@ -1991,7 +2055,7 @@ func WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta tim // WithinRange asserts that a time is within a time range (inclusive). // -// assert.WithinRange(t, time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second)) +// require.WithinRange(t, time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second)) func WithinRange(t TestingT, actual time.Time, start time.Time, end time.Time, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() @@ -2004,7 +2068,7 @@ func WithinRange(t TestingT, actual time.Time, start time.Time, end time.Time, m // WithinRangef asserts that a time is within a time range (inclusive). // -// assert.WithinRangef(t, time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second), "error message %s", "formatted") +// require.WithinRangef(t, time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second), "error message %s", "formatted") func WithinRangef(t TestingT, actual time.Time, start time.Time, end time.Time, msg string, args ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() diff --git a/vendor/github.com/stretchr/testify/require/require.go.tmpl b/vendor/github.com/stretchr/testify/require/require.go.tmpl index 55e42ddebd..8b32836850 100644 --- a/vendor/github.com/stretchr/testify/require/require.go.tmpl +++ b/vendor/github.com/stretchr/testify/require/require.go.tmpl @@ -1,4 +1,4 @@ -{{.Comment}} +{{ replace .Comment "assert." "require."}} func {{.DocInfo.Name}}(t TestingT, {{.Params}}) { if h, ok := t.(tHelper); ok { h.Helper() } if assert.{{.DocInfo.Name}}(t, {{.ForwardedParams}}) { return } diff --git a/vendor/github.com/stretchr/testify/require/require_forward.go b/vendor/github.com/stretchr/testify/require/require_forward.go index eee8310a5f..1bd87304f4 100644 --- a/vendor/github.com/stretchr/testify/require/require_forward.go +++ b/vendor/github.com/stretchr/testify/require/require_forward.go @@ -187,8 +187,8 @@ func (a *Assertions) EqualExportedValuesf(expected interface{}, actual interface EqualExportedValuesf(a.t, expected, actual, msg, args...) } -// EqualValues asserts that two objects are equal or convertible to the same types -// and equal. +// EqualValues asserts that two objects are equal or convertible to the larger +// type and equal. // // a.EqualValues(uint32(123), int32(123)) func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { @@ -198,8 +198,8 @@ func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAn EqualValues(a.t, expected, actual, msgAndArgs...) } -// EqualValuesf asserts that two objects are equal or convertible to the same types -// and equal. +// EqualValuesf asserts that two objects are equal or convertible to the larger +// type and equal. // // a.EqualValuesf(uint32(123), int32(123), "error message %s", "formatted") func (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) { @@ -337,7 +337,7 @@ func (a *Assertions) Eventually(condition func() bool, waitFor time.Duration, ti // a.EventuallyWithT(func(c *assert.CollectT) { // // add assertions as needed; any assertion failure will fail the current tick // assert.True(c, externalValue, "expected 'externalValue' to be true") -// }, 1*time.Second, 10*time.Second, "external state has not changed to 'true'; still false") +// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false") func (a *Assertions) EventuallyWithT(condition func(collect *assert.CollectT), waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -362,7 +362,7 @@ func (a *Assertions) EventuallyWithT(condition func(collect *assert.CollectT), w // a.EventuallyWithTf(func(c *assert.CollectT, "error message %s", "formatted") { // // add assertions as needed; any assertion failure will fail the current tick // assert.True(c, externalValue, "expected 'externalValue' to be true") -// }, 1*time.Second, 10*time.Second, "external state has not changed to 'true'; still false") +// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false") func (a *Assertions) EventuallyWithTf(condition func(collect *assert.CollectT), waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -1129,6 +1129,40 @@ func (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg strin NotContainsf(a.t, s, contains, msg, args...) } +// NotElementsMatch asserts that the specified listA(array, slice...) is NOT 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 not match. +// This is an inverse of ElementsMatch. +// +// a.NotElementsMatch([1, 1, 2, 3], [1, 1, 2, 3]) -> false +// +// a.NotElementsMatch([1, 1, 2, 3], [1, 2, 3]) -> true +// +// a.NotElementsMatch([1, 2, 3], [1, 2, 4]) -> true +func (a *Assertions) NotElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotElementsMatch(a.t, listA, listB, msgAndArgs...) +} + +// NotElementsMatchf asserts that the specified listA(array, slice...) is NOT 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 not match. +// This is an inverse of ElementsMatch. +// +// a.NotElementsMatchf([1, 1, 2, 3], [1, 1, 2, 3], "error message %s", "formatted") -> false +// +// a.NotElementsMatchf([1, 1, 2, 3], [1, 2, 3], "error message %s", "formatted") -> true +// +// a.NotElementsMatchf([1, 2, 3], [1, 2, 4], "error message %s", "formatted") -> true +func (a *Assertions) NotElementsMatchf(listA interface{}, listB interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotElementsMatchf(a.t, listA, listB, 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. // @@ -1201,7 +1235,25 @@ func (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg str NotEqualf(a.t, expected, actual, msg, args...) } -// NotErrorIs asserts that at none of the errors in err's chain matches target. +// NotErrorAs asserts that none of the errors in err's chain matches target, +// but if so, sets target to that error value. +func (a *Assertions) NotErrorAs(err error, target interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotErrorAs(a.t, err, target, msgAndArgs...) +} + +// NotErrorAsf asserts that none of the errors in err's chain matches target, +// but if so, sets target to that error value. +func (a *Assertions) NotErrorAsf(err error, target interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotErrorAsf(a.t, err, target, msg, args...) +} + +// NotErrorIs asserts that 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 { @@ -1210,7 +1262,7 @@ func (a *Assertions) NotErrorIs(err error, target error, msgAndArgs ...interface NotErrorIs(a.t, err, target, msgAndArgs...) } -// NotErrorIsf asserts that at none of the errors in err's chain matches target. +// NotErrorIsf asserts that 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 { diff --git a/vendor/github.com/stretchr/testify/require/requirements.go b/vendor/github.com/stretchr/testify/require/requirements.go index 91772dfeb9..6b7ce929eb 100644 --- a/vendor/github.com/stretchr/testify/require/requirements.go +++ b/vendor/github.com/stretchr/testify/require/requirements.go @@ -6,7 +6,7 @@ type TestingT interface { FailNow() } -type tHelper interface { +type tHelper = interface { Helper() } diff --git a/vendor/go.opentelemetry.io/otel/exporters/prometheus/exporter.go b/vendor/go.opentelemetry.io/otel/exporters/prometheus/exporter.go index b0f5f3730d..3cd457a03c 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/prometheus/exporter.go +++ b/vendor/go.opentelemetry.io/otel/exporters/prometheus/exporter.go @@ -33,15 +33,14 @@ const ( scopeInfoMetricName = "otel_scope_info" scopeInfoDescription = "Instrumentation Scope metadata" + scopeNameLabel = "otel_scope_name" + scopeVersionLabel = "otel_scope_version" + traceIDExemplarKey = "trace_id" spanIDExemplarKey = "span_id" ) -var ( - scopeInfoKeys = [2]string{"otel_scope_name", "otel_scope_version"} - - errScopeInvalid = errors.New("invalid scope") -) +var errScopeInvalid = errors.New("invalid scope") // Exporter is a Prometheus Exporter that embeds the OTel metric.Reader // interface for easy instantiation with a MeterProvider. @@ -187,7 +186,11 @@ func (c *collector) Collect(ch chan<- prometheus.Metric) { } for _, scopeMetrics := range metrics.ScopeMetrics { - var keys, values [2]string + n := len(c.resourceKeyVals.keys) + 2 // resource attrs + scope name + scope version + kv := keyVals{ + keys: make([]string, 0, n), + vals: make([]string, 0, n), + } if !c.disableScopeInfo { scopeInfo, err := c.scopeInfo(scopeMetrics.Scope) @@ -202,10 +205,13 @@ func (c *collector) Collect(ch chan<- prometheus.Metric) { ch <- scopeInfo - keys = scopeInfoKeys - values = [2]string{scopeMetrics.Scope.Name, scopeMetrics.Scope.Version} + kv.keys = append(kv.keys, scopeNameLabel, scopeVersionLabel) + kv.vals = append(kv.vals, scopeMetrics.Scope.Name, scopeMetrics.Scope.Version) } + kv.keys = append(kv.keys, c.resourceKeyVals.keys...) + kv.vals = append(kv.vals, c.resourceKeyVals.vals...) + for _, m := range scopeMetrics.Metrics { typ := c.metricType(m) if typ == nil { @@ -224,25 +230,27 @@ func (c *collector) Collect(ch chan<- prometheus.Metric) { switch v := m.Data.(type) { case metricdata.Histogram[int64]: - addHistogramMetric(ch, v, m, keys, values, name, c.resourceKeyVals) + addHistogramMetric(ch, v, m, name, kv) case metricdata.Histogram[float64]: - addHistogramMetric(ch, v, m, keys, values, name, c.resourceKeyVals) + addHistogramMetric(ch, v, m, name, kv) case metricdata.Sum[int64]: - addSumMetric(ch, v, m, keys, values, name, c.resourceKeyVals) + addSumMetric(ch, v, m, name, kv) case metricdata.Sum[float64]: - addSumMetric(ch, v, m, keys, values, name, c.resourceKeyVals) + addSumMetric(ch, v, m, name, kv) case metricdata.Gauge[int64]: - addGaugeMetric(ch, v, m, keys, values, name, c.resourceKeyVals) + addGaugeMetric(ch, v, m, name, kv) case metricdata.Gauge[float64]: - addGaugeMetric(ch, v, m, keys, values, name, c.resourceKeyVals) + addGaugeMetric(ch, v, m, name, kv) } } } } -func addHistogramMetric[N int64 | float64](ch chan<- prometheus.Metric, histogram metricdata.Histogram[N], m metricdata.Metrics, ks, vs [2]string, name string, resourceKV keyVals) { +func addHistogramMetric[N int64 | float64](ch chan<- prometheus.Metric, histogram metricdata.Histogram[N], m metricdata.Metrics, name string, kv keyVals) { for _, dp := range histogram.DataPoints { - keys, values := getAttrs(dp.Attributes, ks, vs, resourceKV) + keys, values := getAttrs(dp.Attributes) + keys = append(keys, kv.keys...) + values = append(values, kv.vals...) desc := prometheus.NewDesc(name, m.Description, keys, nil) buckets := make(map[float64]uint64, len(dp.Bounds)) @@ -262,14 +270,16 @@ func addHistogramMetric[N int64 | float64](ch chan<- prometheus.Metric, histogra } } -func addSumMetric[N int64 | float64](ch chan<- prometheus.Metric, sum metricdata.Sum[N], m metricdata.Metrics, ks, vs [2]string, name string, resourceKV keyVals) { +func addSumMetric[N int64 | float64](ch chan<- prometheus.Metric, sum metricdata.Sum[N], m metricdata.Metrics, name string, kv keyVals) { valueType := prometheus.CounterValue if !sum.IsMonotonic { valueType = prometheus.GaugeValue } for _, dp := range sum.DataPoints { - keys, values := getAttrs(dp.Attributes, ks, vs, resourceKV) + keys, values := getAttrs(dp.Attributes) + keys = append(keys, kv.keys...) + values = append(values, kv.vals...) desc := prometheus.NewDesc(name, m.Description, keys, nil) m, err := prometheus.NewConstMetric(desc, valueType, float64(dp.Value), values...) @@ -277,14 +287,20 @@ func addSumMetric[N int64 | float64](ch chan<- prometheus.Metric, sum metricdata otel.Handle(err) continue } - m = addExemplars(m, dp.Exemplars) + // GaugeValues don't support Exemplars at this time + // https://github.com/prometheus/client_golang/blob/aef8aedb4b6e1fb8ac1c90790645169125594096/prometheus/metric.go#L199 + if valueType != prometheus.GaugeValue { + m = addExemplars(m, dp.Exemplars) + } ch <- m } } -func addGaugeMetric[N int64 | float64](ch chan<- prometheus.Metric, gauge metricdata.Gauge[N], m metricdata.Metrics, ks, vs [2]string, name string, resourceKV keyVals) { +func addGaugeMetric[N int64 | float64](ch chan<- prometheus.Metric, gauge metricdata.Gauge[N], m metricdata.Metrics, name string, kv keyVals) { for _, dp := range gauge.DataPoints { - keys, values := getAttrs(dp.Attributes, ks, vs, resourceKV) + keys, values := getAttrs(dp.Attributes) + keys = append(keys, kv.keys...) + values = append(values, kv.vals...) desc := prometheus.NewDesc(name, m.Description, keys, nil) m, err := prometheus.NewConstMetric(desc, prometheus.GaugeValue, float64(dp.Value), values...) @@ -296,9 +312,9 @@ func addGaugeMetric[N int64 | float64](ch chan<- prometheus.Metric, gauge metric } } -// getAttrs parses the attribute.Set to two lists of matching Prometheus-style +// getAttrs converts the attribute.Set to two lists of matching Prometheus-style // keys and values. -func getAttrs(attrs attribute.Set, ks, vs [2]string, resourceKV keyVals) ([]string, []string) { +func getAttrs(attrs attribute.Set) ([]string, []string) { keys := make([]string, 0, attrs.Len()) values := make([]string, 0, attrs.Len()) itr := attrs.Iter() @@ -330,30 +346,24 @@ func getAttrs(attrs attribute.Set, ks, vs [2]string, resourceKV keyVals) ([]stri values = append(values, strings.Join(vals, ";")) } } - - if ks[0] != "" { - keys = append(keys, ks[:]...) - values = append(values, vs[:]...) - } - - for idx := range resourceKV.keys { - keys = append(keys, resourceKV.keys[idx]) - values = append(values, resourceKV.vals[idx]) - } - return keys, values } func createInfoMetric(name, description string, res *resource.Resource) (prometheus.Metric, error) { - keys, values := getAttrs(*res.Set(), [2]string{}, [2]string{}, keyVals{}) + keys, values := getAttrs(*res.Set()) desc := prometheus.NewDesc(name, description, keys, nil) return prometheus.NewConstMetric(desc, prometheus.GaugeValue, float64(1), values...) } func createScopeInfoMetric(scope instrumentation.Scope) (prometheus.Metric, error) { - keys := scopeInfoKeys[:] + attrs := make([]attribute.KeyValue, 0, scope.Attributes.Len()+2) // resource attrs + scope name + scope version + attrs = append(attrs, scope.Attributes.ToSlice()...) + attrs = append(attrs, attribute.String(scopeNameLabel, scope.Name)) + attrs = append(attrs, attribute.String(scopeVersionLabel, scope.Version)) + + keys, values := getAttrs(attribute.NewSet(attrs...)) desc := prometheus.NewDesc(scopeInfoMetricName, scopeInfoDescription, keys, nil) - return prometheus.NewConstMetric(desc, prometheus.GaugeValue, float64(1), scope.Name, scope.Version) + return prometheus.NewConstMetric(desc, prometheus.GaugeValue, float64(1), values...) } var unitSuffixes = map[string]string{ @@ -442,7 +452,7 @@ func (c *collector) createResourceAttributes(res *resource.Resource) { defer c.mu.Unlock() resourceAttrs, _ := res.Set().Filter(c.resourceAttributesFilter) - resourceKeys, resourceValues := getAttrs(resourceAttrs, [2]string{}, [2]string{}, keyVals{}) + resourceKeys, resourceValues := getAttrs(resourceAttrs) c.resourceKeyVals = keyVals{keys: resourceKeys, vals: resourceValues} } diff --git a/vendor/go.opentelemetry.io/otel/sdk/instrumentation/scope.go b/vendor/go.opentelemetry.io/otel/sdk/instrumentation/scope.go index 728115045b..34852a47b2 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/instrumentation/scope.go +++ b/vendor/go.opentelemetry.io/otel/sdk/instrumentation/scope.go @@ -3,6 +3,8 @@ package instrumentation // import "go.opentelemetry.io/otel/sdk/instrumentation" +import "go.opentelemetry.io/otel/attribute" + // Scope represents the instrumentation scope. type Scope struct { // Name is the name of the instrumentation scope. This should be the @@ -12,4 +14,6 @@ type Scope struct { Version string // SchemaURL of the telemetry emitted by the scope. SchemaURL string + // Attributes of the telemetry emitted by the scope. + Attributes attribute.Set } diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/config.go b/vendor/go.opentelemetry.io/otel/sdk/metric/config.go index 544275a114..203cd9d650 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/metric/config.go +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/config.go @@ -5,18 +5,22 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( "context" - "fmt" + "errors" + "os" + "strings" "sync" "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/sdk/metric/exemplar" "go.opentelemetry.io/otel/sdk/resource" ) // config contains configuration options for a MeterProvider. type config struct { - res *resource.Resource - readers []Reader - views []View + res *resource.Resource + readers []Reader + views []View + exemplarFilter exemplar.Filter } // readerSignals returns a force-flush and shutdown function for a @@ -40,25 +44,13 @@ func (c config) readerSignals() (forceFlush, shutdown func(context.Context) erro // value. func unify(funcs []func(context.Context) error) func(context.Context) error { return func(ctx context.Context) error { - var errs []error + var err error for _, f := range funcs { - if err := f(ctx); err != nil { - errs = append(errs, err) + if e := f(ctx); e != nil { + err = errors.Join(err, e) } } - return unifyErrors(errs) - } -} - -// unifyErrors combines multiple errors into a single error. -func unifyErrors(errs []error) error { - switch len(errs) { - case 0: - return nil - case 1: - return errs[0] - default: - return fmt.Errorf("%v", errs) + return err } } @@ -76,7 +68,13 @@ func unifyShutdown(funcs []func(context.Context) error) func(context.Context) er // newConfig returns a config configured with options. func newConfig(options []Option) config { - conf := config{res: resource.Default()} + conf := config{ + res: resource.Default(), + exemplarFilter: exemplar.TraceBasedFilter, + } + for _, o := range meterProviderOptionsFromEnv() { + conf = o.apply(conf) + } for _, o := range options { conf = o.apply(conf) } @@ -140,3 +138,35 @@ func WithView(views ...View) Option { return cfg }) } + +// WithExemplarFilter configures the exemplar filter. +// +// The exemplar filter determines which measurements are offered to the +// exemplar reservoir, but the exemplar reservoir makes the final decision of +// whether to store an exemplar. +// +// By default, the [exemplar.SampledFilter] +// is used. Exemplars can be entirely disabled by providing the +// [exemplar.AlwaysOffFilter]. +func WithExemplarFilter(filter exemplar.Filter) Option { + return optionFunc(func(cfg config) config { + cfg.exemplarFilter = filter + return cfg + }) +} + +func meterProviderOptionsFromEnv() []Option { + var opts []Option + // https://github.com/open-telemetry/opentelemetry-specification/blob/d4b241f451674e8f611bb589477680341006ad2b/specification/configuration/sdk-environment-variables.md#exemplar + const filterEnvKey = "OTEL_METRICS_EXEMPLAR_FILTER" + + switch strings.ToLower(strings.TrimSpace(os.Getenv(filterEnvKey))) { + case "always_on": + opts = append(opts, WithExemplarFilter(exemplar.AlwaysOnFilter)) + case "always_off": + opts = append(opts, WithExemplarFilter(exemplar.AlwaysOffFilter)) + case "trace_based": + opts = append(opts, WithExemplarFilter(exemplar.TraceBasedFilter)) + } + return opts +} diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/exemplar.go b/vendor/go.opentelemetry.io/otel/sdk/metric/exemplar.go index 4beaa9ea00..0335b8ae48 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/metric/exemplar.go +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/exemplar.go @@ -4,48 +4,49 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( - "os" "runtime" - "slices" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/metric/exemplar" "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" ) -// reservoirFunc returns the appropriately configured exemplar reservoir -// creation func based on the passed InstrumentKind and user defined -// environment variables. -// -// Note: This will only return non-nil values when the experimental exemplar -// feature is enabled and the OTEL_METRICS_EXEMPLAR_FILTER environment variable -// is not set to always_off. -func reservoirFunc[N int64 | float64](agg Aggregation) func() aggregate.FilteredExemplarReservoir[N] { - // https://github.com/open-telemetry/opentelemetry-specification/blob/d4b241f451674e8f611bb589477680341006ad2b/specification/configuration/sdk-environment-variables.md#exemplar - const filterEnvKey = "OTEL_METRICS_EXEMPLAR_FILTER" - - var filter exemplar.Filter +// ExemplarReservoirProviderSelector selects the +// [exemplar.ReservoirProvider] to use +// based on the [Aggregation] of the metric. +type ExemplarReservoirProviderSelector func(Aggregation) exemplar.ReservoirProvider - switch os.Getenv(filterEnvKey) { - case "always_on": - filter = exemplar.AlwaysOnFilter - case "always_off": - return aggregate.DropReservoir - case "trace_based": - fallthrough - default: - filter = exemplar.TraceBasedFilter +// reservoirFunc returns the appropriately configured exemplar reservoir +// creation func based on the passed InstrumentKind and filter configuration. +func reservoirFunc[N int64 | float64](provider exemplar.ReservoirProvider, filter exemplar.Filter) func(attribute.Set) aggregate.FilteredExemplarReservoir[N] { + return func(attrs attribute.Set) aggregate.FilteredExemplarReservoir[N] { + return aggregate.NewFilteredExemplarReservoir[N](filter, provider(attrs)) } +} +// DefaultExemplarReservoirProviderSelector returns the default +// [exemplar.ReservoirProvider] for the +// provided [Aggregation]. +// +// For explicit bucket histograms with more than 1 bucket, it uses the +// [exemplar.HistogramReservoirProvider]. +// For exponential histograms, it uses the +// [exemplar.FixedSizeReservoirProvider] +// with a size of min(20, max_buckets). +// For all other aggregations, it uses the +// [exemplar.FixedSizeReservoirProvider] +// with a size equal to the number of CPUs. +// +// Exemplar default reservoirs MAY change in a minor version bump. No +// guarantees are made on the shape or statistical properties of returned +// exemplars. +func DefaultExemplarReservoirProviderSelector(agg Aggregation) exemplar.ReservoirProvider { // https://github.com/open-telemetry/opentelemetry-specification/blob/d4b241f451674e8f611bb589477680341006ad2b/specification/metrics/sdk.md#exemplar-defaults // Explicit bucket histogram aggregation with more than 1 bucket will // use AlignedHistogramBucketExemplarReservoir. a, ok := agg.(AggregationExplicitBucketHistogram) if ok && len(a.Boundaries) > 0 { - cp := slices.Clone(a.Boundaries) - return func() aggregate.FilteredExemplarReservoir[N] { - bounds := cp - return aggregate.NewFilteredExemplarReservoir[N](filter, exemplar.NewHistogramReservoir(bounds)) - } + return exemplar.HistogramReservoirProvider(a.Boundaries) } var n int @@ -72,7 +73,5 @@ func reservoirFunc[N int64 | float64](agg Aggregation) func() aggregate.Filtered } } - return func() aggregate.FilteredExemplarReservoir[N] { - return aggregate.NewFilteredExemplarReservoir[N](filter, exemplar.NewFixedSizeReservoir(n)) - } + return exemplar.FixedSizeReservoirProvider(n) } diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/exemplar/filter.go b/vendor/go.opentelemetry.io/otel/sdk/metric/exemplar/filter.go index 4d485200f5..b595e2acef 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/metric/exemplar/filter.go +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/exemplar/filter.go @@ -27,3 +27,8 @@ func TraceBasedFilter(ctx context.Context) bool { func AlwaysOnFilter(ctx context.Context) bool { return true } + +// AlwaysOffFilter is a [Filter] that never offers measurements. +func AlwaysOffFilter(ctx context.Context) bool { + return false +} diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/exemplar/fixed_size_reservoir.go b/vendor/go.opentelemetry.io/otel/sdk/metric/exemplar/fixed_size_reservoir.go index 34160ca608..d4aab0aad4 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/metric/exemplar/fixed_size_reservoir.go +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/exemplar/fixed_size_reservoir.go @@ -12,6 +12,13 @@ import ( "go.opentelemetry.io/otel/attribute" ) +// FixedSizeReservoirProvider returns a provider of [FixedSizeReservoir]. +func FixedSizeReservoirProvider(k int) ReservoirProvider { + return func(_ attribute.Set) Reservoir { + return NewFixedSizeReservoir(k) + } +} + // NewFixedSizeReservoir returns a [FixedSizeReservoir] that samples at most // k exemplars. If there are k or less measurements made, the Reservoir will // sample each one. If there are more than k, the Reservoir will then randomly diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/exemplar/histogram_reservoir.go b/vendor/go.opentelemetry.io/otel/sdk/metric/exemplar/histogram_reservoir.go index c27545a409..3b76cf305a 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/metric/exemplar/histogram_reservoir.go +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/exemplar/histogram_reservoir.go @@ -12,13 +12,21 @@ import ( "go.opentelemetry.io/otel/attribute" ) +// HistogramReservoirProvider is a provider of [HistogramReservoir]. +func HistogramReservoirProvider(bounds []float64) ReservoirProvider { + cp := slices.Clone(bounds) + slices.Sort(cp) + return func(_ attribute.Set) Reservoir { + return NewHistogramReservoir(cp) + } +} + // NewHistogramReservoir returns a [HistogramReservoir] that samples the last // measurement that falls within a histogram bucket. The histogram bucket // upper-boundaries are define by bounds. // -// The passed bounds will be sorted by this function. +// The passed bounds must be sorted before calling this function. func NewHistogramReservoir(bounds []float64) *HistogramReservoir { - slices.Sort(bounds) return &HistogramReservoir{ bounds: bounds, storage: newStorage(len(bounds) + 1), diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/exemplar/reservoir.go b/vendor/go.opentelemetry.io/otel/sdk/metric/exemplar/reservoir.go index 055ce5bc8e..ba5cd1a6b3 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/metric/exemplar/reservoir.go +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/exemplar/reservoir.go @@ -30,3 +30,11 @@ type Reservoir interface { // The Reservoir state is preserved after this call. Collect(dest *[]Exemplar) } + +// ReservoirProvider creates new [Reservoir]s. +// +// The attributes provided are attributes which are kept by the aggregation, and +// are exclusive with attributes passed to Offer. The combination of these +// attributes and the attributes passed to Offer is the complete set of +// attributes a measurement was made with. +type ReservoirProvider func(attr attribute.Set) Reservoir diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/instrument.go b/vendor/go.opentelemetry.io/otel/sdk/metric/instrument.go index 2e6ac54340..48b723a7b3 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/metric/instrument.go +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/instrument.go @@ -144,6 +144,12 @@ type Stream struct { // Use NewAllowKeysFilter from "go.opentelemetry.io/otel/attribute" to // provide an allow-list of attribute keys here. AttributeFilter attribute.Filter + // ExemplarReservoirProvider selects the + // [go.opentelemetry.io/otel/sdk/metric/exemplar.ReservoirProvider] based + // on the [Aggregation]. + // + // If unspecified, [DefaultExemplarReservoirProviderSelector] is used. + ExemplarReservoirProviderSelector ExemplarReservoirProviderSelector } // instID are the identifying properties of a instrument. diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/aggregate.go b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/aggregate.go index f1f3ab6731..fde2193338 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/aggregate.go +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/aggregate.go @@ -37,8 +37,8 @@ type Builder[N int64 | float64] struct { // create new exemplar reservoirs for a new seen attribute set. // // If this is not provided a default factory function that returns an - // DropReservoir reservoir will be used. - ReservoirFunc func() FilteredExemplarReservoir[N] + // dropReservoir reservoir will be used. + ReservoirFunc func(attribute.Set) FilteredExemplarReservoir[N] // AggregationLimit is the cardinality limit of measurement attributes. Any // measurement for new attributes once the limit has been reached will be // aggregated into a single aggregate for the "otel.metric.overflow" @@ -49,12 +49,12 @@ type Builder[N int64 | float64] struct { AggregationLimit int } -func (b Builder[N]) resFunc() func() FilteredExemplarReservoir[N] { +func (b Builder[N]) resFunc() func(attribute.Set) FilteredExemplarReservoir[N] { if b.ReservoirFunc != nil { return b.ReservoirFunc } - return DropReservoir + return dropReservoir } type fltrMeasure[N int64 | float64] func(ctx context.Context, value N, fltrAttr attribute.Set, droppedAttr []attribute.KeyValue) diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/drop.go b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/drop.go index 4a3d4cc221..8396faaa4a 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/drop.go +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/drop.go @@ -10,8 +10,10 @@ import ( "go.opentelemetry.io/otel/sdk/metric/exemplar" ) -// DropReservoir returns a [FilteredReservoir] that drops all measurements it is offered. -func DropReservoir[N int64 | float64]() FilteredExemplarReservoir[N] { return &dropRes[N]{} } +// dropReservoir returns a [FilteredReservoir] that drops all measurements it is offered. +func dropReservoir[N int64 | float64](attribute.Set) FilteredExemplarReservoir[N] { + return &dropRes[N]{} +} type dropRes[N int64 | float64] struct{} @@ -20,5 +22,6 @@ func (r *dropRes[N]) Offer(context.Context, N, []attribute.KeyValue) {} // Collect resets dest. No exemplars will ever be returned. func (r *dropRes[N]) Collect(dest *[]exemplar.Exemplar) { + clear(*dest) // Erase elements to let GC collect objects *dest = (*dest)[:0] } diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/exemplar.go b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/exemplar.go index dcb899d626..25d709948e 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/exemplar.go +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/exemplar.go @@ -17,6 +17,7 @@ var exemplarPool = sync.Pool{ func collectExemplars[N int64 | float64](out *[]metricdata.Exemplar[N], f func(*[]exemplar.Exemplar)) { dest := exemplarPool.Get().(*[]exemplar.Exemplar) defer func() { + clear(*dest) // Erase elements to let GC collect objects. *dest = (*dest)[:0] exemplarPool.Put(dest) }() diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/exponential_histogram.go b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/exponential_histogram.go index a4de5674ba..b7aa721651 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/exponential_histogram.go +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/exponential_histogram.go @@ -283,7 +283,7 @@ func (b *expoBuckets) downscale(delta int32) { // newExponentialHistogram returns an Aggregator that summarizes a set of // measurements as an exponential histogram. Each histogram is scoped by attributes // and the aggregation cycle the measurements were made in. -func newExponentialHistogram[N int64 | float64](maxSize, maxScale int32, noMinMax, noSum bool, limit int, r func() FilteredExemplarReservoir[N]) *expoHistogram[N] { +func newExponentialHistogram[N int64 | float64](maxSize, maxScale int32, noMinMax, noSum bool, limit int, r func(attribute.Set) FilteredExemplarReservoir[N]) *expoHistogram[N] { return &expoHistogram[N]{ noSum: noSum, noMinMax: noMinMax, @@ -306,7 +306,7 @@ type expoHistogram[N int64 | float64] struct { maxSize int maxScale int32 - newRes func() FilteredExemplarReservoir[N] + newRes func(attribute.Set) FilteredExemplarReservoir[N] limit limiter[*expoHistogramDataPoint[N]] values map[attribute.Distinct]*expoHistogramDataPoint[N] valuesMu sync.Mutex @@ -327,7 +327,7 @@ func (e *expoHistogram[N]) measure(ctx context.Context, value N, fltrAttr attrib v, ok := e.values[attr.Equivalent()] if !ok { v = newExpoHistogramDataPoint[N](attr, e.maxSize, e.maxScale, e.noMinMax, e.noSum) - v.res = e.newRes() + v.res = e.newRes(attr) e.values[attr.Equivalent()] = v } diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/histogram.go b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/histogram.go index 35d020378b..d577ae2c19 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/histogram.go +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/histogram.go @@ -47,13 +47,13 @@ type histValues[N int64 | float64] struct { noSum bool bounds []float64 - newRes func() FilteredExemplarReservoir[N] + newRes func(attribute.Set) FilteredExemplarReservoir[N] limit limiter[*buckets[N]] values map[attribute.Distinct]*buckets[N] valuesMu sync.Mutex } -func newHistValues[N int64 | float64](bounds []float64, noSum bool, limit int, r func() FilteredExemplarReservoir[N]) *histValues[N] { +func newHistValues[N int64 | float64](bounds []float64, noSum bool, limit int, r func(attribute.Set) FilteredExemplarReservoir[N]) *histValues[N] { // The responsibility of keeping all buckets correctly associated with the // passed boundaries is ultimately this type's responsibility. Make a copy // here so we can always guarantee this. Or, in the case of failure, have @@ -93,7 +93,7 @@ func (s *histValues[N]) measure(ctx context.Context, value N, fltrAttr attribute // // buckets = (-∞, 0], (0, 5.0], (5.0, 10.0], (10.0, +∞) b = newBuckets[N](attr, len(s.bounds)+1) - b.res = s.newRes() + b.res = s.newRes(attr) // Ensure min and max are recorded values (not zero), for new buckets. b.min, b.max = value, value @@ -108,7 +108,7 @@ func (s *histValues[N]) measure(ctx context.Context, value N, fltrAttr attribute // newHistogram returns an Aggregator that summarizes a set of measurements as // an histogram. -func newHistogram[N int64 | float64](boundaries []float64, noMinMax, noSum bool, limit int, r func() FilteredExemplarReservoir[N]) *histogram[N] { +func newHistogram[N int64 | float64](boundaries []float64, noMinMax, noSum bool, limit int, r func(attribute.Set) FilteredExemplarReservoir[N]) *histogram[N] { return &histogram[N]{ histValues: newHistValues[N](boundaries, noSum, limit, r), noMinMax: noMinMax, diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/lastvalue.go b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/lastvalue.go index a7b5fe572b..d3a93f085c 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/lastvalue.go +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/lastvalue.go @@ -19,7 +19,7 @@ type datapoint[N int64 | float64] struct { res FilteredExemplarReservoir[N] } -func newLastValue[N int64 | float64](limit int, r func() FilteredExemplarReservoir[N]) *lastValue[N] { +func newLastValue[N int64 | float64](limit int, r func(attribute.Set) FilteredExemplarReservoir[N]) *lastValue[N] { return &lastValue[N]{ newRes: r, limit: newLimiter[datapoint[N]](limit), @@ -32,7 +32,7 @@ func newLastValue[N int64 | float64](limit int, r func() FilteredExemplarReservo type lastValue[N int64 | float64] struct { sync.Mutex - newRes func() FilteredExemplarReservoir[N] + newRes func(attribute.Set) FilteredExemplarReservoir[N] limit limiter[datapoint[N]] values map[attribute.Distinct]datapoint[N] start time.Time @@ -45,7 +45,7 @@ func (s *lastValue[N]) measure(ctx context.Context, value N, fltrAttr attribute. attr := s.limit.Attributes(fltrAttr, s.values) d, ok := s.values[attr.Equivalent()] if !ok { - d.res = s.newRes() + d.res = s.newRes(attr) } d.attrs = attr @@ -114,7 +114,7 @@ func (s *lastValue[N]) copyDpts(dest *[]metricdata.DataPoint[N], t time.Time) in // newPrecomputedLastValue returns an aggregator that summarizes a set of // observations as the last one made. -func newPrecomputedLastValue[N int64 | float64](limit int, r func() FilteredExemplarReservoir[N]) *precomputedLastValue[N] { +func newPrecomputedLastValue[N int64 | float64](limit int, r func(attribute.Set) FilteredExemplarReservoir[N]) *precomputedLastValue[N] { return &precomputedLastValue[N]{lastValue: newLastValue[N](limit, r)} } diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/sum.go b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/sum.go index c3b591c37c..8e132ad618 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/sum.go +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/internal/aggregate/sum.go @@ -21,12 +21,12 @@ type sumValue[N int64 | float64] struct { // valueMap is the storage for sums. type valueMap[N int64 | float64] struct { sync.Mutex - newRes func() FilteredExemplarReservoir[N] + newRes func(attribute.Set) FilteredExemplarReservoir[N] limit limiter[sumValue[N]] values map[attribute.Distinct]sumValue[N] } -func newValueMap[N int64 | float64](limit int, r func() FilteredExemplarReservoir[N]) *valueMap[N] { +func newValueMap[N int64 | float64](limit int, r func(attribute.Set) FilteredExemplarReservoir[N]) *valueMap[N] { return &valueMap[N]{ newRes: r, limit: newLimiter[sumValue[N]](limit), @@ -41,7 +41,7 @@ func (s *valueMap[N]) measure(ctx context.Context, value N, fltrAttr attribute.S attr := s.limit.Attributes(fltrAttr, s.values) v, ok := s.values[attr.Equivalent()] if !ok { - v.res = s.newRes() + v.res = s.newRes(attr) } v.attrs = attr @@ -54,7 +54,7 @@ func (s *valueMap[N]) measure(ctx context.Context, value N, fltrAttr attribute.S // newSum returns an aggregator that summarizes a set of measurements as their // arithmetic sum. Each sum is scoped by attributes and the aggregation cycle // the measurements were made in. -func newSum[N int64 | float64](monotonic bool, limit int, r func() FilteredExemplarReservoir[N]) *sum[N] { +func newSum[N int64 | float64](monotonic bool, limit int, r func(attribute.Set) FilteredExemplarReservoir[N]) *sum[N] { return &sum[N]{ valueMap: newValueMap[N](limit, r), monotonic: monotonic, @@ -143,7 +143,7 @@ func (s *sum[N]) cumulative(dest *metricdata.Aggregation) int { // newPrecomputedSum returns an aggregator that summarizes a set of // observations as their arithmetic sum. Each sum is scoped by attributes and // the aggregation cycle the measurements were made in. -func newPrecomputedSum[N int64 | float64](monotonic bool, limit int, r func() FilteredExemplarReservoir[N]) *precomputedSum[N] { +func newPrecomputedSum[N int64 | float64](monotonic bool, limit int, r func(attribute.Set) FilteredExemplarReservoir[N]) *precomputedSum[N] { return &precomputedSum[N]{ valueMap: newValueMap[N](limit, r), monotonic: monotonic, diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/manual_reader.go b/vendor/go.opentelemetry.io/otel/sdk/metric/manual_reader.go index e0fd86ca78..c495985bc2 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/metric/manual_reader.go +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/manual_reader.go @@ -113,18 +113,17 @@ func (mr *ManualReader) Collect(ctx context.Context, rm *metricdata.ResourceMetr if err != nil { return err } - var errs []error for _, producer := range mr.externalProducers.Load().([]Producer) { - externalMetrics, err := producer.Produce(ctx) - if err != nil { - errs = append(errs, err) + externalMetrics, e := producer.Produce(ctx) + if e != nil { + err = errors.Join(err, e) } rm.ScopeMetrics = append(rm.ScopeMetrics, externalMetrics...) } global.Debug("ManualReader collection", "Data", rm) - return unifyErrors(errs) + return err } // MarshalLog returns logging data about the ManualReader. diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/meter.go b/vendor/go.opentelemetry.io/otel/sdk/metric/meter.go index abff4650e1..823cdf2c62 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/metric/meter.go +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/meter.go @@ -150,6 +150,11 @@ func (m *meter) int64ObservableInstrument(id Instrument, callbacks []metric.Int6 continue } inst.appendMeasures(in) + + // Add the measures to the pipeline. It is required to maintain + // measures per pipeline to avoid calling the measure that + // is not part of the pipeline. + insert.pipeline.addInt64Measure(inst.observableID, in) for _, cback := range callbacks { inst := int64Observer{measures: in} fn := cback @@ -309,6 +314,11 @@ func (m *meter) float64ObservableInstrument(id Instrument, callbacks []metric.Fl continue } inst.appendMeasures(in) + + // Add the measures to the pipeline. It is required to maintain + // measures per pipeline to avoid calling the measure that + // is not part of the pipeline. + insert.pipeline.addFloat64Measure(inst.observableID, in) for _, cback := range callbacks { inst := float64Observer{measures: in} fn := cback @@ -441,68 +451,75 @@ func (m *meter) RegisterCallback(f metric.Callback, insts ...metric.Observable) return noopRegister{}, nil } - reg := newObserver() - var errs multierror + var err error + validInstruments := make([]metric.Observable, 0, len(insts)) for _, inst := range insts { - // Unwrap any global. - if u, ok := inst.(interface { - Unwrap() metric.Observable - }); ok { - inst = u.Unwrap() - } - switch o := inst.(type) { case int64Observable: - if err := o.registerable(m); err != nil { - if !errors.Is(err, errEmptyAgg) { - errs.append(err) + if e := o.registerable(m); e != nil { + if !errors.Is(e, errEmptyAgg) { + err = errors.Join(err, e) } continue } - reg.registerInt64(o.observableID) + + validInstruments = append(validInstruments, inst) case float64Observable: - if err := o.registerable(m); err != nil { - if !errors.Is(err, errEmptyAgg) { - errs.append(err) + if e := o.registerable(m); e != nil { + if !errors.Is(e, errEmptyAgg) { + err = errors.Join(err, e) } continue } - reg.registerFloat64(o.observableID) + + validInstruments = append(validInstruments, inst) default: // Instrument external to the SDK. return nil, fmt.Errorf("invalid observable: from different implementation") } } - err := errs.errorOrNil() - if reg.len() == 0 { + if len(validInstruments) == 0 { // All insts use drop aggregation or are invalid. return noopRegister{}, err } - // Some or all instruments were valid. - cback := func(ctx context.Context) error { return f(ctx, reg) } - return m.pipes.registerMultiCallback(cback), err + unregs := make([]func(), len(m.pipes)) + for ix, pipe := range m.pipes { + reg := newObserver(pipe) + for _, inst := range validInstruments { + switch o := inst.(type) { + case int64Observable: + reg.registerInt64(o.observableID) + case float64Observable: + reg.registerFloat64(o.observableID) + } + } + + // Some or all instruments were valid. + cBack := func(ctx context.Context) error { return f(ctx, reg) } + unregs[ix] = pipe.addMultiCallback(cBack) + } + + return unregisterFuncs{f: unregs}, err } type observer struct { embedded.Observer + pipe *pipeline float64 map[observableID[float64]]struct{} int64 map[observableID[int64]]struct{} } -func newObserver() observer { +func newObserver(p *pipeline) observer { return observer{ + pipe: p, float64: make(map[observableID[float64]]struct{}), int64: make(map[observableID[int64]]struct{}), } } -func (r observer) len() int { - return len(r.float64) + len(r.int64) -} - func (r observer) registerFloat64(id observableID[float64]) { r.float64[id] = struct{}{} } @@ -521,16 +538,6 @@ func (r observer) ObserveFloat64(o metric.Float64Observable, v float64, opts ... switch conv := o.(type) { case float64Observable: oImpl = conv - case interface { - Unwrap() metric.Observable - }: - // Unwrap any global. - async := conv.Unwrap() - var ok bool - if oImpl, ok = async.(float64Observable); !ok { - global.Error(errUnknownObserver, "failed to record asynchronous") - return - } default: global.Error(errUnknownObserver, "failed to record") return @@ -548,7 +555,12 @@ func (r observer) ObserveFloat64(o metric.Float64Observable, v float64, opts ... return } c := metric.NewObserveConfig(opts) - oImpl.observe(v, c.Attributes()) + // Access to r.pipe.float64Measure is already guarded by a lock in pipeline.produce. + // TODO (#5946): Refactor pipeline and observable measures. + measures := r.pipe.float64Measures[oImpl.observableID] + for _, m := range measures { + m(context.Background(), v, c.Attributes()) + } } func (r observer) ObserveInt64(o metric.Int64Observable, v int64, opts ...metric.ObserveOption) { @@ -556,16 +568,6 @@ func (r observer) ObserveInt64(o metric.Int64Observable, v int64, opts ...metric switch conv := o.(type) { case int64Observable: oImpl = conv - case interface { - Unwrap() metric.Observable - }: - // Unwrap any global. - async := conv.Unwrap() - var ok bool - if oImpl, ok = async.(int64Observable); !ok { - global.Error(errUnknownObserver, "failed to record asynchronous") - return - } default: global.Error(errUnknownObserver, "failed to record") return @@ -583,7 +585,12 @@ func (r observer) ObserveInt64(o metric.Int64Observable, v int64, opts ...metric return } c := metric.NewObserveConfig(opts) - oImpl.observe(v, c.Attributes()) + // Access to r.pipe.int64Measures is already guarded b a lock in pipeline.produce. + // TODO (#5946): Refactor pipeline and observable measures. + measures := r.pipe.int64Measures[oImpl.observableID] + for _, m := range measures { + m(context.Background(), v, c.Attributes()) + } } type noopRegister struct{ embedded.Registration } diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/periodic_reader.go b/vendor/go.opentelemetry.io/otel/sdk/metric/periodic_reader.go index 67ee1b11a2..dcd2182d9a 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/metric/periodic_reader.go +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/periodic_reader.go @@ -251,18 +251,17 @@ func (r *PeriodicReader) collect(ctx context.Context, p interface{}, rm *metricd if err != nil { return err } - var errs []error for _, producer := range r.externalProducers.Load().([]Producer) { - externalMetrics, err := producer.Produce(ctx) - if err != nil { - errs = append(errs, err) + externalMetrics, e := producer.Produce(ctx) + if e != nil { + err = errors.Join(err, e) } rm.ScopeMetrics = append(rm.ScopeMetrics, externalMetrics...) } global.Debug("PeriodicReader collection", "Data", rm) - return unifyErrors(errs) + return err } // export exports metric data m using r's exporter. diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/pipeline.go b/vendor/go.opentelemetry.io/otel/sdk/metric/pipeline.go index 823bf2fe3d..775e245261 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/metric/pipeline.go +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/pipeline.go @@ -8,14 +8,13 @@ import ( "context" "errors" "fmt" - "strings" "sync" "sync/atomic" "go.opentelemetry.io/otel/internal/global" - "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/embedded" "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/metric/exemplar" "go.opentelemetry.io/otel/sdk/metric/internal" "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" "go.opentelemetry.io/otel/sdk/metric/internal/x" @@ -38,14 +37,17 @@ type instrumentSync struct { compAgg aggregate.ComputeAggregation } -func newPipeline(res *resource.Resource, reader Reader, views []View) *pipeline { +func newPipeline(res *resource.Resource, reader Reader, views []View, exemplarFilter exemplar.Filter) *pipeline { if res == nil { res = resource.Empty() } return &pipeline{ - resource: res, - reader: reader, - views: views, + resource: res, + reader: reader, + views: views, + int64Measures: map[observableID[int64]][]aggregate.Measure[int64]{}, + float64Measures: map[observableID[float64]][]aggregate.Measure[float64]{}, + exemplarFilter: exemplarFilter, // aggregations is lazy allocated when needed. } } @@ -63,9 +65,26 @@ type pipeline struct { views []View sync.Mutex - aggregations map[instrumentation.Scope][]instrumentSync - callbacks []func(context.Context) error - multiCallbacks list.List + int64Measures map[observableID[int64]][]aggregate.Measure[int64] + float64Measures map[observableID[float64]][]aggregate.Measure[float64] + aggregations map[instrumentation.Scope][]instrumentSync + callbacks []func(context.Context) error + multiCallbacks list.List + exemplarFilter exemplar.Filter +} + +// addInt64Measure adds a new int64 measure to the pipeline for each observer. +func (p *pipeline) addInt64Measure(id observableID[int64], m []aggregate.Measure[int64]) { + p.Lock() + defer p.Unlock() + p.int64Measures[id] = m +} + +// addFloat64Measure adds a new float64 measure to the pipeline for each observer. +func (p *pipeline) addFloat64Measure(id observableID[float64], m []aggregate.Measure[float64]) { + p.Lock() + defer p.Unlock() + p.float64Measures[id] = m } // addSync adds the instrumentSync to pipeline p with scope. This method is not @@ -105,14 +124,15 @@ func (p *pipeline) produce(ctx context.Context, rm *metricdata.ResourceMetrics) p.Lock() defer p.Unlock() - var errs multierror + var err error for _, c := range p.callbacks { // TODO make the callbacks parallel. ( #3034 ) - if err := c(ctx); err != nil { - errs.append(err) + if e := c(ctx); e != nil { + err = errors.Join(err, e) } if err := ctx.Err(); err != nil { rm.Resource = nil + clear(rm.ScopeMetrics) // Erase elements to let GC collect objects. rm.ScopeMetrics = rm.ScopeMetrics[:0] return err } @@ -120,12 +140,13 @@ func (p *pipeline) produce(ctx context.Context, rm *metricdata.ResourceMetrics) for e := p.multiCallbacks.Front(); e != nil; e = e.Next() { // TODO make the callbacks parallel. ( #3034 ) f := e.Value.(multiCallback) - if err := f(ctx); err != nil { - errs.append(err) + if e := f(ctx); e != nil { + err = errors.Join(err, e) } if err := ctx.Err(); err != nil { // This means the context expired before we finished running callbacks. rm.Resource = nil + clear(rm.ScopeMetrics) // Erase elements to let GC collect objects. rm.ScopeMetrics = rm.ScopeMetrics[:0] return err } @@ -157,7 +178,7 @@ func (p *pipeline) produce(ctx context.Context, rm *metricdata.ResourceMetrics) rm.ScopeMetrics = rm.ScopeMetrics[:i] - return errs.errorOrNil() + return err } // inserter facilitates inserting of new instruments from a single scope into a @@ -219,7 +240,7 @@ func (i *inserter[N]) Instrument(inst Instrument, readerAggregation Aggregation) measures []aggregate.Measure[N] ) - errs := &multierror{wrapped: errCreatingAggregators} + var err error seen := make(map[uint64]struct{}) for _, v := range i.pipeline.views { stream, match := v(inst) @@ -227,9 +248,9 @@ func (i *inserter[N]) Instrument(inst Instrument, readerAggregation Aggregation) continue } matched = true - in, id, err := i.cachedAggregator(inst.Scope, inst.Kind, stream, readerAggregation) - if err != nil { - errs.append(err) + in, id, e := i.cachedAggregator(inst.Scope, inst.Kind, stream, readerAggregation) + if e != nil { + err = errors.Join(err, e) } if in == nil { // Drop aggregation. continue @@ -242,8 +263,12 @@ func (i *inserter[N]) Instrument(inst Instrument, readerAggregation Aggregation) measures = append(measures, in) } + if err != nil { + err = errors.Join(errCreatingAggregators, err) + } + if matched { - return measures, errs.errorOrNil() + return measures, err } // Apply implicit default view if no explicit matched. @@ -252,15 +277,18 @@ func (i *inserter[N]) Instrument(inst Instrument, readerAggregation Aggregation) Description: inst.Description, Unit: inst.Unit, } - in, _, err := i.cachedAggregator(inst.Scope, inst.Kind, stream, readerAggregation) - if err != nil { - errs.append(err) + in, _, e := i.cachedAggregator(inst.Scope, inst.Kind, stream, readerAggregation) + if e != nil { + if err == nil { + err = errCreatingAggregators + } + err = errors.Join(err, e) } if in != nil { // Ensured to have not seen given matched was false. measures = append(measures, in) } - return measures, errs.errorOrNil() + return measures, err } // addCallback registers a single instrument callback to be run when @@ -329,6 +357,9 @@ func (i *inserter[N]) cachedAggregator(scope instrumentation.Scope, kind Instrum // The view explicitly requested the default aggregation. stream.Aggregation = DefaultAggregationSelector(kind) } + if stream.ExemplarReservoirProviderSelector == nil { + stream.ExemplarReservoirProviderSelector = DefaultExemplarReservoirProviderSelector + } if err := isAggregatorCompatible(kind, stream.Aggregation); err != nil { return nil, 0, fmt.Errorf( @@ -349,7 +380,7 @@ func (i *inserter[N]) cachedAggregator(scope instrumentation.Scope, kind Instrum cv := i.aggregators.Lookup(normID, func() aggVal[N] { b := aggregate.Builder[N]{ Temporality: i.pipeline.reader.temporality(kind), - ReservoirFunc: reservoirFunc[N](stream.Aggregation), + ReservoirFunc: reservoirFunc[N](stream.ExemplarReservoirProviderSelector(stream.Aggregation), i.pipeline.exemplarFilter), } b.Filter = stream.AttributeFilter // A value less than or equal to zero will disable the aggregation @@ -552,24 +583,16 @@ func isAggregatorCompatible(kind InstrumentKind, agg Aggregation) error { // measurement. type pipelines []*pipeline -func newPipelines(res *resource.Resource, readers []Reader, views []View) pipelines { +func newPipelines(res *resource.Resource, readers []Reader, views []View, exemplarFilter exemplar.Filter) pipelines { pipes := make([]*pipeline, 0, len(readers)) for _, r := range readers { - p := newPipeline(res, r, views) + p := newPipeline(res, r, views, exemplarFilter) r.register(p) pipes = append(pipes, p) } return pipes } -func (p pipelines) registerMultiCallback(c multiCallback) metric.Registration { - unregs := make([]func(), len(p)) - for i, pipe := range p { - unregs[i] = pipe.addMultiCallback(c) - } - return unregisterFuncs{f: unregs} -} - type unregisterFuncs struct { embedded.Registration f []func() @@ -602,15 +625,15 @@ func newResolver[N int64 | float64](p pipelines, vc *cache[string, instID]) reso func (r resolver[N]) Aggregators(id Instrument) ([]aggregate.Measure[N], error) { var measures []aggregate.Measure[N] - errs := &multierror{} + var err error for _, i := range r.inserters { - in, err := i.Instrument(id, i.readerDefaultAggregation(id.Kind)) - if err != nil { - errs.append(err) + in, e := i.Instrument(id, i.readerDefaultAggregation(id.Kind)) + if e != nil { + err = errors.Join(err, e) } measures = append(measures, in...) } - return measures, errs.errorOrNil() + return measures, err } // HistogramAggregators returns the histogram Aggregators that must be updated by the instrument @@ -619,37 +642,18 @@ func (r resolver[N]) Aggregators(id Instrument) ([]aggregate.Measure[N], error) func (r resolver[N]) HistogramAggregators(id Instrument, boundaries []float64) ([]aggregate.Measure[N], error) { var measures []aggregate.Measure[N] - errs := &multierror{} + var err error for _, i := range r.inserters { agg := i.readerDefaultAggregation(id.Kind) if histAgg, ok := agg.(AggregationExplicitBucketHistogram); ok && len(boundaries) > 0 { histAgg.Boundaries = boundaries agg = histAgg } - in, err := i.Instrument(id, agg) - if err != nil { - errs.append(err) + in, e := i.Instrument(id, agg) + if e != nil { + err = errors.Join(err, e) } measures = append(measures, in...) } - return measures, errs.errorOrNil() -} - -type multierror struct { - wrapped error - errors []string -} - -func (m *multierror) errorOrNil() error { - if len(m.errors) == 0 { - return nil - } - if m.wrapped == nil { - return errors.New(strings.Join(m.errors, "; ")) - } - return fmt.Errorf("%w: %s", m.wrapped, strings.Join(m.errors, "; ")) -} - -func (m *multierror) append(err error) { - m.errors = append(m.errors, err.Error()) + return measures, err } diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/provider.go b/vendor/go.opentelemetry.io/otel/sdk/metric/provider.go index a82af538e6..2fca89e5a8 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/metric/provider.go +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/provider.go @@ -42,7 +42,7 @@ func NewMeterProvider(options ...Option) *MeterProvider { flush, sdown := conf.readerSignals() mp := &MeterProvider{ - pipes: newPipelines(conf.res, conf.readers, conf.views), + pipes: newPipelines(conf.res, conf.readers, conf.views, conf.exemplarFilter), forceFlush: flush, shutdown: sdown, } @@ -76,15 +76,17 @@ func (mp *MeterProvider) Meter(name string, options ...metric.MeterOption) metri c := metric.NewMeterConfig(options...) s := instrumentation.Scope{ - Name: name, - Version: c.InstrumentationVersion(), - SchemaURL: c.SchemaURL(), + Name: name, + Version: c.InstrumentationVersion(), + SchemaURL: c.SchemaURL(), + Attributes: c.InstrumentationAttributes(), } global.Info("Meter created", "Name", s.Name, "Version", s.Version, "SchemaURL", s.SchemaURL, + "Attributes", s.Attributes, ) return mp.meters.Lookup(s, func() *meter { diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/version.go b/vendor/go.opentelemetry.io/otel/sdk/metric/version.go index fa43f8469c..6347060bf4 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/metric/version.go +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/version.go @@ -5,5 +5,5 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" // version is the current release version of the metric SDK in use. func version() string { - return "1.31.0" + return "1.32.0" } diff --git a/vendor/go.opentelemetry.io/otel/sdk/metric/view.go b/vendor/go.opentelemetry.io/otel/sdk/metric/view.go index cd08c67324..630890f426 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/metric/view.go +++ b/vendor/go.opentelemetry.io/otel/sdk/metric/view.go @@ -96,11 +96,12 @@ func NewView(criteria Instrument, mask Stream) View { return func(i Instrument) (Stream, bool) { if matchFunc(i) { return Stream{ - Name: nonZero(mask.Name, i.Name), - Description: nonZero(mask.Description, i.Description), - Unit: nonZero(mask.Unit, i.Unit), - Aggregation: agg, - AttributeFilter: mask.AttributeFilter, + Name: nonZero(mask.Name, i.Name), + Description: nonZero(mask.Description, i.Description), + Unit: nonZero(mask.Unit, i.Unit), + Aggregation: agg, + AttributeFilter: mask.AttributeFilter, + ExemplarReservoirProviderSelector: mask.ExemplarReservoirProviderSelector, }, true } return Stream{}, false diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/auto.go b/vendor/go.opentelemetry.io/otel/sdk/resource/auto.go index 95a61d61d4..c02aeefdde 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/auto.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/auto.go @@ -7,7 +7,6 @@ import ( "context" "errors" "fmt" - "strings" ) // ErrPartialResource is returned by a detector when complete source @@ -57,62 +56,37 @@ func Detect(ctx context.Context, detectors ...Detector) (*Resource, error) { // these errors will be returned. Otherwise, nil is returned. func detect(ctx context.Context, res *Resource, detectors []Detector) error { var ( - r *Resource - errs detectErrs - err error + r *Resource + err error + e error ) for _, detector := range detectors { if detector == nil { continue } - r, err = detector.Detect(ctx) - if err != nil { - errs = append(errs, err) - if !errors.Is(err, ErrPartialResource) { + r, e = detector.Detect(ctx) + if e != nil { + err = errors.Join(err, e) + if !errors.Is(e, ErrPartialResource) { continue } } - r, err = Merge(res, r) - if err != nil { - errs = append(errs, err) + r, e = Merge(res, r) + if e != nil { + err = errors.Join(err, e) } *res = *r } - if len(errs) == 0 { - return nil - } - if errors.Is(errs, ErrSchemaURLConflict) { - // If there has been a merge conflict, ensure the resource has no - // schema URL. - res.schemaURL = "" - } - return errs -} - -type detectErrs []error - -func (e detectErrs) Error() string { - errStr := make([]string, len(e)) - for i, err := range e { - errStr[i] = fmt.Sprintf("* %s", err) - } - - format := "%d errors occurred detecting resource:\n\t%s" - return fmt.Sprintf(format, len(e), strings.Join(errStr, "\n\t")) -} + if err != nil { + if errors.Is(err, ErrSchemaURLConflict) { + // If there has been a merge conflict, ensure the resource has no + // schema URL. + res.schemaURL = "" + } -func (e detectErrs) Unwrap() error { - switch len(e) { - case 0: - return nil - case 1: - return e[0] + err = fmt.Errorf("error detecting resource: %w", err) } - return e[1:] -} - -func (e detectErrs) Is(target error) bool { - return len(e) != 0 && errors.Is(e[0], target) + return err } diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/builtin.go b/vendor/go.opentelemetry.io/otel/sdk/resource/builtin.go index 6ac1cdbf7b..cf3c88e15c 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/builtin.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/builtin.go @@ -20,15 +20,13 @@ type ( // telemetrySDK is a Detector that provides information about // the OpenTelemetry SDK used. This Detector is included as a // builtin. If these resource attributes are not wanted, use - // the WithTelemetrySDK(nil) or WithoutBuiltin() options to - // explicitly disable them. + // resource.New() to explicitly disable them. telemetrySDK struct{} // host is a Detector that provides information about the host // being run on. This Detector is included as a builtin. If // these resource attributes are not wanted, use the - // WithHost(nil) or WithoutBuiltin() options to explicitly - // disable them. + // resource.New() to explicitly disable them. host struct{} stringDetector struct { diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/batch_span_processor.go b/vendor/go.opentelemetry.io/otel/sdk/trace/batch_span_processor.go index 4ce757dfd6..ccc97e1b66 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/batch_span_processor.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/batch_span_processor.go @@ -280,6 +280,7 @@ func (bsp *batchSpanProcessor) exportSpans(ctx context.Context) error { // // It is up to the exporter to implement any type of retry logic if a batch is failing // to be exported, since it is specific to the protocol and backend being sent to. + clear(bsp.batch) // Erase elements to let GC collect objects bsp.batch = bsp.batch[:0] if err != nil { diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/provider.go b/vendor/go.opentelemetry.io/otel/sdk/trace/provider.go index 14c2e5bebd..185aa7c08f 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/provider.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/provider.go @@ -139,9 +139,10 @@ func (p *TracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.T name = defaultTracerName } is := instrumentation.Scope{ - Name: name, - Version: c.InstrumentationVersion(), - SchemaURL: c.SchemaURL(), + Name: name, + Version: c.InstrumentationVersion(), + SchemaURL: c.SchemaURL(), + Attributes: c.InstrumentationAttributes(), } t, ok := func() (trace.Tracer, bool) { @@ -168,7 +169,7 @@ func (p *TracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.T // slowing down all tracing consumers. // - Logging code may be instrumented with tracing and deadlock because it could try // acquiring the same non-reentrant mutex. - global.Info("Tracer created", "name", name, "version", is.Version, "schemaURL", is.SchemaURL) + global.Info("Tracer created", "name", name, "version", is.Version, "schemaURL", is.SchemaURL, "attributes", is.Attributes) } return t } diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/span.go b/vendor/go.opentelemetry.io/otel/sdk/trace/span.go index 730fb85c3e..17f883c2c8 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/span.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/span.go @@ -639,10 +639,7 @@ func (s *recordingSpan) dedupeAttrsFromRecord(record map[attribute.Key]int) { record[a.Key] = len(unique) - 1 } } - // s.attributes have element types of attribute.KeyValue. These types are - // not pointers and they themselves do not contain pointer fields, - // therefore the duplicate values do not need to be zeroed for them to be - // garbage collected. + clear(s.attributes[len(unique):]) // Erase unneeded elements to let GC collect objects. s.attributes = unique } diff --git a/vendor/go.opentelemetry.io/otel/sdk/version.go b/vendor/go.opentelemetry.io/otel/sdk/version.go index dc1eaa8e9d..0b214d3fe9 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/version.go +++ b/vendor/go.opentelemetry.io/otel/sdk/version.go @@ -5,5 +5,5 @@ package sdk // import "go.opentelemetry.io/otel/sdk" // Version is the current release version of the OpenTelemetry SDK in use. func Version() string { - return "1.31.0" + return "1.32.0" } diff --git a/vendor/modules.txt b/vendor/modules.txt index 12b610671b..fae1bdf15e 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -49,7 +49,7 @@ github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v6 # github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry v1.2.0 ## explicit; go 1.18 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry -# github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6 v6.2.0 +# github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6 v6.3.0 ## explicit; go 1.18 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6 # github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault v1.4.0 @@ -369,7 +369,7 @@ github.com/munnerz/goautoneg # github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f ## explicit github.com/mxk/go-flowrate/flowrate -# github.com/onsi/ginkgo/v2 v2.21.0 +# github.com/onsi/ginkgo/v2 v2.22.0 ## explicit; go 1.22.0 github.com/onsi/ginkgo/v2 github.com/onsi/ginkgo/v2/config @@ -391,7 +391,7 @@ github.com/onsi/ginkgo/v2/internal/parallel_support github.com/onsi/ginkgo/v2/internal/testingtproxy github.com/onsi/ginkgo/v2/reporters github.com/onsi/ginkgo/v2/types -# github.com/onsi/gomega v1.35.1 +# github.com/onsi/gomega v1.36.0 ## explicit; go 1.22 github.com/onsi/gomega github.com/onsi/gomega/format @@ -399,6 +399,7 @@ github.com/onsi/gomega/gcustom github.com/onsi/gomega/internal github.com/onsi/gomega/internal/gutil github.com/onsi/gomega/matchers +github.com/onsi/gomega/matchers/internal/miter github.com/onsi/gomega/matchers/support/goraph/bipartitegraph github.com/onsi/gomega/matchers/support/goraph/edge github.com/onsi/gomega/matchers/support/goraph/node @@ -435,7 +436,7 @@ github.com/prometheus/client_golang/prometheus/testutil/promlint/validations # github.com/prometheus/client_model v0.6.1 ## explicit; go 1.19 github.com/prometheus/client_model/go -# github.com/prometheus/common v0.60.0 +# github.com/prometheus/common v0.60.1 ## explicit; go 1.21 github.com/prometheus/common/expfmt github.com/prometheus/common/model @@ -453,9 +454,10 @@ github.com/spf13/pflag # github.com/stoewer/go-strcase v1.3.0 ## explicit; go 1.11 github.com/stoewer/go-strcase -# github.com/stretchr/testify v1.9.0 +# github.com/stretchr/testify v1.10.0 ## explicit; go 1.17 github.com/stretchr/testify/assert +github.com/stretchr/testify/assert/yaml github.com/stretchr/testify/require # github.com/x448/float16 v0.8.4 ## explicit; go 1.11 @@ -519,7 +521,7 @@ go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/retry -# go.opentelemetry.io/otel/exporters/prometheus v0.53.0 +# go.opentelemetry.io/otel/exporters/prometheus v0.54.0 ## explicit; go 1.22 go.opentelemetry.io/otel/exporters/prometheus # go.opentelemetry.io/otel/metric v1.32.0 @@ -527,7 +529,7 @@ go.opentelemetry.io/otel/exporters/prometheus go.opentelemetry.io/otel/metric go.opentelemetry.io/otel/metric/embedded go.opentelemetry.io/otel/metric/noop -# go.opentelemetry.io/otel/sdk v1.31.0 +# go.opentelemetry.io/otel/sdk v1.32.0 ## explicit; go 1.22 go.opentelemetry.io/otel/sdk go.opentelemetry.io/otel/sdk/instrumentation @@ -535,7 +537,7 @@ go.opentelemetry.io/otel/sdk/internal/env go.opentelemetry.io/otel/sdk/internal/x go.opentelemetry.io/otel/sdk/resource go.opentelemetry.io/otel/sdk/trace -# go.opentelemetry.io/otel/sdk/metric v1.31.0 +# go.opentelemetry.io/otel/sdk/metric v1.32.0 ## explicit; go 1.22 go.opentelemetry.io/otel/sdk/metric go.opentelemetry.io/otel/sdk/metric/exemplar @@ -819,7 +821,7 @@ gopkg.in/yaml.v2 # gopkg.in/yaml.v3 v3.0.1 ## explicit gopkg.in/yaml.v3 -# k8s.io/api v0.31.2 => k8s.io/api v0.31.2 +# k8s.io/api v0.31.3 => k8s.io/api v0.31.2 ## explicit; go 1.22.0 k8s.io/api/admission/v1 k8s.io/api/admission/v1beta1 @@ -884,7 +886,7 @@ k8s.io/api/storagemigration/v1alpha1 k8s.io/apiextensions-apiserver/pkg/apis/apiextensions k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1 k8s.io/apiextensions-apiserver/pkg/features -# k8s.io/apimachinery v0.31.2 => k8s.io/apimachinery v0.31.2 +# k8s.io/apimachinery v0.31.3 => k8s.io/apimachinery v0.31.2 ## explicit; go 1.22.0 k8s.io/apimachinery/pkg/api/equality k8s.io/apimachinery/pkg/api/errors @@ -951,7 +953,7 @@ k8s.io/apimachinery/pkg/watch k8s.io/apimachinery/third_party/forked/golang/json k8s.io/apimachinery/third_party/forked/golang/netutil k8s.io/apimachinery/third_party/forked/golang/reflect -# k8s.io/apiserver v0.31.2 => k8s.io/apiserver v0.31.2 +# k8s.io/apiserver v0.31.3 => k8s.io/apiserver v0.31.2 ## explicit; go 1.22.0 k8s.io/apiserver/pkg/admission k8s.io/apiserver/pkg/admission/configuration @@ -1102,7 +1104,7 @@ k8s.io/apiserver/plugin/pkg/audit/webhook k8s.io/apiserver/plugin/pkg/authenticator/token/webhook k8s.io/apiserver/plugin/pkg/authorizer/webhook k8s.io/apiserver/plugin/pkg/authorizer/webhook/metrics -# k8s.io/client-go v0.31.2 => k8s.io/client-go v0.31.2 +# k8s.io/client-go v0.31.3 => k8s.io/client-go v0.31.2 ## explicit; go 1.22.0 k8s.io/client-go/applyconfigurations k8s.io/client-go/applyconfigurations/admissionregistration/v1 @@ -1444,7 +1446,7 @@ k8s.io/client-go/util/keyutil k8s.io/client-go/util/retry k8s.io/client-go/util/watchlist k8s.io/client-go/util/workqueue -# k8s.io/cloud-provider v0.31.2 => k8s.io/cloud-provider v0.31.2 +# k8s.io/cloud-provider v0.31.3 => k8s.io/cloud-provider v0.31.2 ## explicit; go 1.22.0 k8s.io/cloud-provider k8s.io/cloud-provider/api @@ -1464,7 +1466,7 @@ k8s.io/cloud-provider/service/helpers k8s.io/cloud-provider/volume k8s.io/cloud-provider/volume/errors k8s.io/cloud-provider/volume/helpers -# k8s.io/component-base v0.31.2 => k8s.io/component-base v0.31.2 +# k8s.io/component-base v0.31.3 => k8s.io/component-base v0.31.2 ## explicit; go 1.22.0 k8s.io/component-base/cli/flag k8s.io/component-base/config @@ -1487,13 +1489,13 @@ k8s.io/component-base/metrics/testutil k8s.io/component-base/tracing k8s.io/component-base/tracing/api/v1 k8s.io/component-base/version -# k8s.io/component-helpers v0.31.2 => k8s.io/component-helpers v0.31.2 +# k8s.io/component-helpers v0.31.3 => k8s.io/component-helpers v0.31.2 ## explicit; go 1.22.0 k8s.io/component-helpers/node/util k8s.io/component-helpers/node/util/sysctl k8s.io/component-helpers/scheduling/corev1 k8s.io/component-helpers/scheduling/corev1/nodeaffinity -# k8s.io/controller-manager v0.31.2 => k8s.io/controller-manager v0.31.2 +# k8s.io/controller-manager v0.31.3 => k8s.io/controller-manager v0.31.2 ## explicit; go 1.22.0 k8s.io/controller-manager/config k8s.io/controller-manager/config/v1 @@ -1547,7 +1549,7 @@ k8s.io/kube-openapi/pkg/validation/strfmt/bson ## explicit; go 1.22.0 k8s.io/kubectl/pkg/scale k8s.io/kubectl/pkg/util/podutils -# k8s.io/kubelet v0.31.2 => k8s.io/kubelet v0.31.2 +# k8s.io/kubelet v0.31.3 => k8s.io/kubelet v0.31.2 ## explicit; go 1.22.0 k8s.io/kubelet/pkg/apis # k8s.io/kubernetes v1.31.2 @@ -1648,7 +1650,7 @@ sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/client sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/client/metrics sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/common/metrics sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client -# sigs.k8s.io/cloud-provider-azure v1.29.1-0.20241111034044-6ebb6c3c3260 +# sigs.k8s.io/cloud-provider-azure v1.29.1-0.20241203125659-88ef46cb15b8 ## explicit; go 1.23.1 sigs.k8s.io/cloud-provider-azure/pkg/azureclients sigs.k8s.io/cloud-provider-azure/pkg/azureclients/armauth @@ -1665,8 +1667,6 @@ sigs.k8s.io/cloud-provider-azure/pkg/azureclients/privatednszonegroupclient sigs.k8s.io/cloud-provider-azure/pkg/azureclients/privateendpointclient sigs.k8s.io/cloud-provider-azure/pkg/azureclients/publicipclient sigs.k8s.io/cloud-provider-azure/pkg/azureclients/publicipclient/mockpublicipclient -sigs.k8s.io/cloud-provider-azure/pkg/azureclients/routetableclient -sigs.k8s.io/cloud-provider-azure/pkg/azureclients/routetableclient/mockroutetableclient sigs.k8s.io/cloud-provider-azure/pkg/azureclients/storageaccountclient sigs.k8s.io/cloud-provider-azure/pkg/azureclients/subnetclient sigs.k8s.io/cloud-provider-azure/pkg/azureclients/subnetclient/mocksubnetclient @@ -1686,6 +1686,7 @@ sigs.k8s.io/cloud-provider-azure/pkg/provider sigs.k8s.io/cloud-provider-azure/pkg/provider/config sigs.k8s.io/cloud-provider-azure/pkg/provider/loadbalancer sigs.k8s.io/cloud-provider-azure/pkg/provider/privatelinkservice +sigs.k8s.io/cloud-provider-azure/pkg/provider/routetable sigs.k8s.io/cloud-provider-azure/pkg/provider/securitygroup sigs.k8s.io/cloud-provider-azure/pkg/provider/subnet sigs.k8s.io/cloud-provider-azure/pkg/provider/virtualmachine @@ -1698,29 +1699,42 @@ sigs.k8s.io/cloud-provider-azure/pkg/util/collectionutil sigs.k8s.io/cloud-provider-azure/pkg/util/deepcopy sigs.k8s.io/cloud-provider-azure/pkg/util/errutils sigs.k8s.io/cloud-provider-azure/pkg/util/iputil +sigs.k8s.io/cloud-provider-azure/pkg/util/lockmap sigs.k8s.io/cloud-provider-azure/pkg/util/sets sigs.k8s.io/cloud-provider-azure/pkg/util/string sigs.k8s.io/cloud-provider-azure/pkg/util/taints sigs.k8s.io/cloud-provider-azure/pkg/util/vm sigs.k8s.io/cloud-provider-azure/pkg/version -# sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.1.17 +# sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.2.2 ## explicit; go 1.23.1 sigs.k8s.io/cloud-provider-azure/pkg/azclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient/mock_accountclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/armauth sigs.k8s.io/cloud-provider-azure/pkg/azclient/availabilitysetclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/availabilitysetclient/mock_availabilitysetclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobcontainerclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobcontainerclient/mock_blobcontainerclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobservicepropertiesclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobservicepropertiesclient/mock_blobservicepropertiesclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/deploymentclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/deploymentclient/mock_deploymentclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/diskclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/diskclient/mock_diskclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileservicepropertiesclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileservicepropertiesclient/mock_fileservicepropertiesclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/mock_fileshareclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/identityclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/identityclient/mock_identityclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/interfaceclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/interfaceclient/mock_interfaceclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/ipgroupclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/ipgroupclient/mock_ipgroupclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/loadbalancerclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/loadbalancerclient/mock_loadbalancerclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/managedclusterclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/managedclusterclient/mock_managedclusterclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/metrics sigs.k8s.io/cloud-provider-azure/pkg/azclient/mock_azclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/policy/etag @@ -1728,35 +1742,53 @@ sigs.k8s.io/cloud-provider-azure/pkg/azclient/policy/ratelimit sigs.k8s.io/cloud-provider-azure/pkg/azclient/policy/ratelimit/flowcontrol sigs.k8s.io/cloud-provider-azure/pkg/azclient/policy/retryrepectthrottled sigs.k8s.io/cloud-provider-azure/pkg/azclient/policy/useragent +sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatednszonegroupclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatednszonegroupclient/mock_privatednszonegroupclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/privateendpointclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/privateendpointclient/mock_privateendpointclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatelinkserviceclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatelinkserviceclient/mock_privatelinkserviceclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatezoneclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatezoneclient/mock_privatezoneclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/providerclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/providerclient/mock_providerclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipaddressclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipaddressclient/mock_publicipaddressclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipprefixclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipprefixclient/mock_publicipprefixclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/registryclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/registryclient/mock_registryclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/resourcegroupclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/resourcegroupclient/mock_resourcegroupclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/roleassignmentclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/roleassignmentclient/mock_roleassignmentclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/routetableclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/routetableclient/mock_routetableclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/secretclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/secretclient/mock_secretclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/securitygroupclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/securitygroupclient/mock_securitygroupclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/snapshotclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/snapshotclient/mock_snapshotclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/sshpublickeyresourceclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/sshpublickeyresourceclient/mock_sshpublickeyresourceclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/subnetclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/subnetclient/mock_subnetclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/armbalancer sigs.k8s.io/cloud-provider-azure/pkg/azclient/vaultclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/vaultclient/mock_vaultclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachineclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachineclient/mock_virtualmachineclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetclient/mock_virtualmachinescalesetclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetvmclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetvmclient/mock_virtualmachinescalesetvmclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworkclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworkclient/mock_virtualnetworkclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworklinkclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworklinkclient/mock_virtualnetworklinkclient -# sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.1.3 +# sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.1.8 ## explicit; go 1.23.1 sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader # sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/Makefile b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/Makefile index 0fdd6f3632..5b19682d4c 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/Makefile +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/Makefile @@ -92,6 +92,7 @@ generatecode: build ## Generate client $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6 --package-alias armnetwork --resource Interface --client-name InterfacesClient --verbs get,createorupdate,delete,list --expand --ratelimitkey interfaceRateLimit $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6 --package-alias armnetwork --resource LoadBalancer --client-name LoadBalancersClient --verbs get,createorupdate,delete,list --expand --ratelimitkey loadBalancerRateLimit $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6 --package-alias armnetwork --resource PrivateEndpoint --client-name PrivateEndpointsClient --verbs get,createorupdate --expand --ratelimitkey privateEndpointRateLimit + $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6 --package-alias armnetwork --resource PrivateEndpoint --subresource PrivateDNSZoneGroup --client-name PrivateDNSZoneGroupsClient --verbs get,createorupdate,delete $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6 --package-alias armnetwork --resource PublicIPAddress --client-name PublicIPAddressesClient --verbs get,createorupdate,delete,list --expand --ratelimitkey publicIPAddressRateLimit $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6 --package-alias armnetwork --resource PublicIPPrefix --client-name PublicIPPrefixesClient --verbs get,createorupdate,delete,list --expand $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6 --package-alias armnetwork --resource RouteTable --client-name RouteTablesClient --verbs get,createorupdate,delete,list --ratelimitkey routeTableRateLimit diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient/custom.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient/custom.go index c94acad9aa..2b73ed9b32 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient/custom.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient/custom.go @@ -38,6 +38,17 @@ func (client *Client) Create(ctx context.Context, resourceGroupName string, reso return nil, nil } +func (client *Client) Update(ctx context.Context, resourceGroupName string, resourceName string, parameters *armstorage.AccountUpdateParameters) (*armstorage.Account, error) { + if parameters == nil { + parameters = &armstorage.AccountUpdateParameters{} + } + resp, err := client.AccountsClient.Update(ctx, resourceGroupName, resourceName, *parameters, nil) + if err != nil { + return nil, err + } + return &resp.Account, nil +} + func (client *Client) GetProperties(ctx context.Context, resourceGroupName string, accountName string, options *armstorage.AccountsClientGetPropertiesOptions) (*armstorage.Account, error) { resp, err := client.AccountsClient.GetProperties(ctx, resourceGroupName, accountName, options) if err != nil { diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient/interface.go index 94a40439eb..1d646c1ff8 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient/interface.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient/interface.go @@ -29,6 +29,7 @@ import ( type Interface interface { utils.ListFunc[armstorage.Account] Create(ctx context.Context, resourceGroupName string, accountName string, resource *armstorage.AccountCreateParameters) (*armstorage.Account, error) + Update(ctx context.Context, resourceGroupName string, accountName string, parameters *armstorage.AccountUpdateParameters) (*armstorage.Account, error) GetProperties(ctx context.Context, resourceGroupName string, accountName string, options *armstorage.AccountsClientGetPropertiesOptions) (*armstorage.Account, error) Delete(ctx context.Context, resourceGroupName string, accountName string) error ListKeys(ctx context.Context, resourceGroupName string, accountName string) ([]*armstorage.AccountKey, error) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient/interface_gomock.go new file mode 100644 index 0000000000..3a80f03d84 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package accountclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient/mock_accountclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_accountclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient/mock_accountclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient/mock_accountclient/interface.go new file mode 100644 index 0000000000..af1a33c9e1 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient/mock_accountclient/interface.go @@ -0,0 +1,294 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ +// + +// Code generated by MockGen. DO NOT EDIT. +// Source: accountclient/interface.go +// +// Generated by this command: +// +// mockgen -package mock_accountclient -source accountclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt +// + +// Package mock_accountclient is a generated GoMock package. +package mock_accountclient + +import ( + context "context" + reflect "reflect" + + armstorage "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" + gomock "go.uber.org/mock/gomock" +) + +//go:generate mockgen -package mock_accountclient -source accountclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + +// MockInterface is a mock of Interface interface. +type MockInterface struct { + ctrl *gomock.Controller + recorder *MockInterfaceMockRecorder + isgomock struct{} +} + +// MockInterfaceMockRecorder is the mock recorder for MockInterface. +type MockInterfaceMockRecorder struct { + mock *MockInterface +} + +// NewMockInterface creates a new mock instance. +func NewMockInterface(ctrl *gomock.Controller) *MockInterface { + mock := &MockInterface{ctrl: ctrl} + mock.recorder = &MockInterfaceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockInterface) EXPECT() *MockInterfaceMockRecorder { + return m.recorder +} + +// Create mocks base method. +func (m *MockInterface) Create(ctx context.Context, resourceGroupName, accountName string, resource *armstorage.AccountCreateParameters) (*armstorage.Account, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Create", ctx, resourceGroupName, accountName, resource) + ret0, _ := ret[0].(*armstorage.Account) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Create indicates an expected call of Create. +func (mr *MockInterfaceMockRecorder) Create(ctx, resourceGroupName, accountName, resource any) *MockInterfaceCreateCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockInterface)(nil).Create), ctx, resourceGroupName, accountName, resource) + return &MockInterfaceCreateCall{Call: call} +} + +// MockInterfaceCreateCall wrap *gomock.Call +type MockInterfaceCreateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceCreateCall) Return(arg0 *armstorage.Account, arg1 error) *MockInterfaceCreateCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceCreateCall) Do(f func(context.Context, string, string, *armstorage.AccountCreateParameters) (*armstorage.Account, error)) *MockInterfaceCreateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceCreateCall) DoAndReturn(f func(context.Context, string, string, *armstorage.AccountCreateParameters) (*armstorage.Account, error)) *MockInterfaceCreateCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Delete mocks base method. +func (m *MockInterface) Delete(ctx context.Context, resourceGroupName, accountName string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", ctx, resourceGroupName, accountName) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete. +func (mr *MockInterfaceMockRecorder) Delete(ctx, resourceGroupName, accountName any) *MockInterfaceDeleteCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockInterface)(nil).Delete), ctx, resourceGroupName, accountName) + return &MockInterfaceDeleteCall{Call: call} +} + +// MockInterfaceDeleteCall wrap *gomock.Call +type MockInterfaceDeleteCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceDeleteCall) Return(arg0 error) *MockInterfaceDeleteCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceDeleteCall) Do(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceDeleteCall) DoAndReturn(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetProperties mocks base method. +func (m *MockInterface) GetProperties(ctx context.Context, resourceGroupName, accountName string, options *armstorage.AccountsClientGetPropertiesOptions) (*armstorage.Account, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetProperties", ctx, resourceGroupName, accountName, options) + ret0, _ := ret[0].(*armstorage.Account) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetProperties indicates an expected call of GetProperties. +func (mr *MockInterfaceMockRecorder) GetProperties(ctx, resourceGroupName, accountName, options any) *MockInterfaceGetPropertiesCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetProperties", reflect.TypeOf((*MockInterface)(nil).GetProperties), ctx, resourceGroupName, accountName, options) + return &MockInterfaceGetPropertiesCall{Call: call} +} + +// MockInterfaceGetPropertiesCall wrap *gomock.Call +type MockInterfaceGetPropertiesCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetPropertiesCall) Return(arg0 *armstorage.Account, arg1 error) *MockInterfaceGetPropertiesCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetPropertiesCall) Do(f func(context.Context, string, string, *armstorage.AccountsClientGetPropertiesOptions) (*armstorage.Account, error)) *MockInterfaceGetPropertiesCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetPropertiesCall) DoAndReturn(f func(context.Context, string, string, *armstorage.AccountsClientGetPropertiesOptions) (*armstorage.Account, error)) *MockInterfaceGetPropertiesCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// List mocks base method. +func (m *MockInterface) List(ctx context.Context, resourceGroupName string) ([]*armstorage.Account, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "List", ctx, resourceGroupName) + ret0, _ := ret[0].([]*armstorage.Account) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// List indicates an expected call of List. +func (mr *MockInterfaceMockRecorder) List(ctx, resourceGroupName any) *MockInterfaceListCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockInterface)(nil).List), ctx, resourceGroupName) + return &MockInterfaceListCall{Call: call} +} + +// MockInterfaceListCall wrap *gomock.Call +type MockInterfaceListCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceListCall) Return(result []*armstorage.Account, rerr error) *MockInterfaceListCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceListCall) Do(f func(context.Context, string) ([]*armstorage.Account, error)) *MockInterfaceListCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceListCall) DoAndReturn(f func(context.Context, string) ([]*armstorage.Account, error)) *MockInterfaceListCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ListKeys mocks base method. +func (m *MockInterface) ListKeys(ctx context.Context, resourceGroupName, accountName string) ([]*armstorage.AccountKey, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListKeys", ctx, resourceGroupName, accountName) + ret0, _ := ret[0].([]*armstorage.AccountKey) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListKeys indicates an expected call of ListKeys. +func (mr *MockInterfaceMockRecorder) ListKeys(ctx, resourceGroupName, accountName any) *MockInterfaceListKeysCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListKeys", reflect.TypeOf((*MockInterface)(nil).ListKeys), ctx, resourceGroupName, accountName) + return &MockInterfaceListKeysCall{Call: call} +} + +// MockInterfaceListKeysCall wrap *gomock.Call +type MockInterfaceListKeysCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceListKeysCall) Return(arg0 []*armstorage.AccountKey, arg1 error) *MockInterfaceListKeysCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceListKeysCall) Do(f func(context.Context, string, string) ([]*armstorage.AccountKey, error)) *MockInterfaceListKeysCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceListKeysCall) DoAndReturn(f func(context.Context, string, string) ([]*armstorage.AccountKey, error)) *MockInterfaceListKeysCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Update mocks base method. +func (m *MockInterface) Update(ctx context.Context, resourceGroupName, accountName string, parameters *armstorage.AccountUpdateParameters) (*armstorage.Account, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Update", ctx, resourceGroupName, accountName, parameters) + ret0, _ := ret[0].(*armstorage.Account) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Update indicates an expected call of Update. +func (mr *MockInterfaceMockRecorder) Update(ctx, resourceGroupName, accountName, parameters any) *MockInterfaceUpdateCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockInterface)(nil).Update), ctx, resourceGroupName, accountName, parameters) + return &MockInterfaceUpdateCall{Call: call} +} + +// MockInterfaceUpdateCall wrap *gomock.Call +type MockInterfaceUpdateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceUpdateCall) Return(arg0 *armstorage.Account, arg1 error) *MockInterfaceUpdateCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceUpdateCall) Do(f func(context.Context, string, string, *armstorage.AccountUpdateParameters) (*armstorage.Account, error)) *MockInterfaceUpdateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceUpdateCall) DoAndReturn(f func(context.Context, string, string, *armstorage.AccountUpdateParameters) (*armstorage.Account, error)) *MockInterfaceUpdateCall { + c.Call = c.Call.DoAndReturn(f) + return c +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/availabilitysetclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/availabilitysetclient/interface_gomock.go new file mode 100644 index 0000000000..17c76a9e3f --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/availabilitysetclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package availabilitysetclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/availabilitysetclient/mock_availabilitysetclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_availabilitysetclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/availabilitysetclient/mock_availabilitysetclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/availabilitysetclient/mock_availabilitysetclient/interface.go new file mode 100644 index 0000000000..e21b97d9b8 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/availabilitysetclient/mock_availabilitysetclient/interface.go @@ -0,0 +1,139 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ +// + +// Code generated by MockGen. DO NOT EDIT. +// Source: availabilitysetclient/interface.go +// +// Generated by this command: +// +// mockgen -package mock_availabilitysetclient -source availabilitysetclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt +// + +// Package mock_availabilitysetclient is a generated GoMock package. +package mock_availabilitysetclient + +import ( + context "context" + reflect "reflect" + + armcompute "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v6" + gomock "go.uber.org/mock/gomock" +) + +//go:generate mockgen -package mock_availabilitysetclient -source availabilitysetclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + +// MockInterface is a mock of Interface interface. +type MockInterface struct { + ctrl *gomock.Controller + recorder *MockInterfaceMockRecorder + isgomock struct{} +} + +// MockInterfaceMockRecorder is the mock recorder for MockInterface. +type MockInterfaceMockRecorder struct { + mock *MockInterface +} + +// NewMockInterface creates a new mock instance. +func NewMockInterface(ctrl *gomock.Controller) *MockInterface { + mock := &MockInterface{ctrl: ctrl} + mock.recorder = &MockInterfaceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockInterface) EXPECT() *MockInterfaceMockRecorder { + return m.recorder +} + +// Get mocks base method. +func (m *MockInterface) Get(ctx context.Context, resourceGroupName, resourceName string) (*armcompute.AvailabilitySet, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", ctx, resourceGroupName, resourceName) + ret0, _ := ret[0].(*armcompute.AvailabilitySet) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, resourceName any) *MockInterfaceGetCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, resourceName) + return &MockInterfaceGetCall{Call: call} +} + +// MockInterfaceGetCall wrap *gomock.Call +type MockInterfaceGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetCall) Return(result *armcompute.AvailabilitySet, rerr error) *MockInterfaceGetCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string) (*armcompute.AvailabilitySet, error)) *MockInterfaceGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string) (*armcompute.AvailabilitySet, error)) *MockInterfaceGetCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// List mocks base method. +func (m *MockInterface) List(ctx context.Context, resourceGroupName string) ([]*armcompute.AvailabilitySet, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "List", ctx, resourceGroupName) + ret0, _ := ret[0].([]*armcompute.AvailabilitySet) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// List indicates an expected call of List. +func (mr *MockInterfaceMockRecorder) List(ctx, resourceGroupName any) *MockInterfaceListCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockInterface)(nil).List), ctx, resourceGroupName) + return &MockInterfaceListCall{Call: call} +} + +// MockInterfaceListCall wrap *gomock.Call +type MockInterfaceListCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceListCall) Return(result []*armcompute.AvailabilitySet, rerr error) *MockInterfaceListCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceListCall) Do(f func(context.Context, string) ([]*armcompute.AvailabilitySet, error)) *MockInterfaceListCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceListCall) DoAndReturn(f func(context.Context, string) ([]*armcompute.AvailabilitySet, error)) *MockInterfaceListCall { + c.Call = c.Call.DoAndReturn(f) + return c +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobcontainerclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobcontainerclient/interface_gomock.go new file mode 100644 index 0000000000..8e0b42b523 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobcontainerclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package blobcontainerclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobcontainerclient/mock_blobcontainerclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_blobcontainerclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobcontainerclient/mock_blobcontainerclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobcontainerclient/mock_blobcontainerclient/interface.go new file mode 100644 index 0000000000..b36ffeb6a6 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobcontainerclient/mock_blobcontainerclient/interface.go @@ -0,0 +1,216 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ +// + +// Code generated by MockGen. DO NOT EDIT. +// Source: blobcontainerclient/interface.go +// +// Generated by this command: +// +// mockgen -package mock_blobcontainerclient -source blobcontainerclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt +// + +// Package mock_blobcontainerclient is a generated GoMock package. +package mock_blobcontainerclient + +import ( + context "context" + reflect "reflect" + + armstorage "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" + gomock "go.uber.org/mock/gomock" +) + +//go:generate mockgen -package mock_blobcontainerclient -source blobcontainerclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + +// MockInterface is a mock of Interface interface. +type MockInterface struct { + ctrl *gomock.Controller + recorder *MockInterfaceMockRecorder + isgomock struct{} +} + +// MockInterfaceMockRecorder is the mock recorder for MockInterface. +type MockInterfaceMockRecorder struct { + mock *MockInterface +} + +// NewMockInterface creates a new mock instance. +func NewMockInterface(ctrl *gomock.Controller) *MockInterface { + mock := &MockInterface{ctrl: ctrl} + mock.recorder = &MockInterfaceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockInterface) EXPECT() *MockInterfaceMockRecorder { + return m.recorder +} + +// CreateContainer mocks base method. +func (m *MockInterface) CreateContainer(ctx context.Context, resourceGroupName, accountName, containerName string, parameters armstorage.BlobContainer) (*armstorage.BlobContainer, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateContainer", ctx, resourceGroupName, accountName, containerName, parameters) + ret0, _ := ret[0].(*armstorage.BlobContainer) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateContainer indicates an expected call of CreateContainer. +func (mr *MockInterfaceMockRecorder) CreateContainer(ctx, resourceGroupName, accountName, containerName, parameters any) *MockInterfaceCreateContainerCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateContainer", reflect.TypeOf((*MockInterface)(nil).CreateContainer), ctx, resourceGroupName, accountName, containerName, parameters) + return &MockInterfaceCreateContainerCall{Call: call} +} + +// MockInterfaceCreateContainerCall wrap *gomock.Call +type MockInterfaceCreateContainerCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceCreateContainerCall) Return(arg0 *armstorage.BlobContainer, arg1 error) *MockInterfaceCreateContainerCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceCreateContainerCall) Do(f func(context.Context, string, string, string, armstorage.BlobContainer) (*armstorage.BlobContainer, error)) *MockInterfaceCreateContainerCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceCreateContainerCall) DoAndReturn(f func(context.Context, string, string, string, armstorage.BlobContainer) (*armstorage.BlobContainer, error)) *MockInterfaceCreateContainerCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// DeleteContainer mocks base method. +func (m *MockInterface) DeleteContainer(ctx context.Context, resourceGroupName, accountName, containerName string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteContainer", ctx, resourceGroupName, accountName, containerName) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteContainer indicates an expected call of DeleteContainer. +func (mr *MockInterfaceMockRecorder) DeleteContainer(ctx, resourceGroupName, accountName, containerName any) *MockInterfaceDeleteContainerCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteContainer", reflect.TypeOf((*MockInterface)(nil).DeleteContainer), ctx, resourceGroupName, accountName, containerName) + return &MockInterfaceDeleteContainerCall{Call: call} +} + +// MockInterfaceDeleteContainerCall wrap *gomock.Call +type MockInterfaceDeleteContainerCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceDeleteContainerCall) Return(arg0 error) *MockInterfaceDeleteContainerCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceDeleteContainerCall) Do(f func(context.Context, string, string, string) error) *MockInterfaceDeleteContainerCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceDeleteContainerCall) DoAndReturn(f func(context.Context, string, string, string) error) *MockInterfaceDeleteContainerCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Get mocks base method. +func (m *MockInterface) Get(ctx context.Context, resourceGroupName, parentResourceName, resourceName string) (*armstorage.BlobContainer, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", ctx, resourceGroupName, parentResourceName, resourceName) + ret0, _ := ret[0].(*armstorage.BlobContainer) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, parentResourceName, resourceName any) *MockInterfaceGetCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, parentResourceName, resourceName) + return &MockInterfaceGetCall{Call: call} +} + +// MockInterfaceGetCall wrap *gomock.Call +type MockInterfaceGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetCall) Return(result *armstorage.BlobContainer, rerr error) *MockInterfaceGetCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string, string) (*armstorage.BlobContainer, error)) *MockInterfaceGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string, string) (*armstorage.BlobContainer, error)) *MockInterfaceGetCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// List mocks base method. +func (m *MockInterface) List(ctx context.Context, resourceGroupName, parentResourceName string) ([]*armstorage.ListContainerItem, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "List", ctx, resourceGroupName, parentResourceName) + ret0, _ := ret[0].([]*armstorage.ListContainerItem) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// List indicates an expected call of List. +func (mr *MockInterfaceMockRecorder) List(ctx, resourceGroupName, parentResourceName any) *MockInterfaceListCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockInterface)(nil).List), ctx, resourceGroupName, parentResourceName) + return &MockInterfaceListCall{Call: call} +} + +// MockInterfaceListCall wrap *gomock.Call +type MockInterfaceListCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceListCall) Return(result []*armstorage.ListContainerItem, rerr error) *MockInterfaceListCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceListCall) Do(f func(context.Context, string, string) ([]*armstorage.ListContainerItem, error)) *MockInterfaceListCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceListCall) DoAndReturn(f func(context.Context, string, string) ([]*armstorage.ListContainerItem, error)) *MockInterfaceListCall { + c.Call = c.Call.DoAndReturn(f) + return c +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobservicepropertiesclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobservicepropertiesclient/interface_gomock.go new file mode 100644 index 0000000000..dd99120360 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobservicepropertiesclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package blobservicepropertiesclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobservicepropertiesclient/mock_blobservicepropertiesclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_blobservicepropertiesclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobservicepropertiesclient/mock_blobservicepropertiesclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobservicepropertiesclient/mock_blobservicepropertiesclient/interface.go new file mode 100644 index 0000000000..75268c672d --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobservicepropertiesclient/mock_blobservicepropertiesclient/interface.go @@ -0,0 +1,139 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ +// + +// Code generated by MockGen. DO NOT EDIT. +// Source: blobservicepropertiesclient/interface.go +// +// Generated by this command: +// +// mockgen -package mock_blobservicepropertiesclient -source blobservicepropertiesclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt +// + +// Package mock_blobservicepropertiesclient is a generated GoMock package. +package mock_blobservicepropertiesclient + +import ( + context "context" + reflect "reflect" + + armstorage "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" + gomock "go.uber.org/mock/gomock" +) + +//go:generate mockgen -package mock_blobservicepropertiesclient -source blobservicepropertiesclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + +// MockInterface is a mock of Interface interface. +type MockInterface struct { + ctrl *gomock.Controller + recorder *MockInterfaceMockRecorder + isgomock struct{} +} + +// MockInterfaceMockRecorder is the mock recorder for MockInterface. +type MockInterfaceMockRecorder struct { + mock *MockInterface +} + +// NewMockInterface creates a new mock instance. +func NewMockInterface(ctrl *gomock.Controller) *MockInterface { + mock := &MockInterface{ctrl: ctrl} + mock.recorder = &MockInterfaceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockInterface) EXPECT() *MockInterfaceMockRecorder { + return m.recorder +} + +// Get mocks base method. +func (m *MockInterface) Get(ctx context.Context, resourceGroupName, resourceName string) (*armstorage.BlobServiceProperties, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", ctx, resourceGroupName, resourceName) + ret0, _ := ret[0].(*armstorage.BlobServiceProperties) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, resourceName any) *MockInterfaceGetCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, resourceName) + return &MockInterfaceGetCall{Call: call} +} + +// MockInterfaceGetCall wrap *gomock.Call +type MockInterfaceGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetCall) Return(arg0 *armstorage.BlobServiceProperties, arg1 error) *MockInterfaceGetCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string) (*armstorage.BlobServiceProperties, error)) *MockInterfaceGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string) (*armstorage.BlobServiceProperties, error)) *MockInterfaceGetCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Set mocks base method. +func (m *MockInterface) Set(ctx context.Context, resourceGroupName, resourceName string, parameters armstorage.BlobServiceProperties) (*armstorage.BlobServiceProperties, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Set", ctx, resourceGroupName, resourceName, parameters) + ret0, _ := ret[0].(*armstorage.BlobServiceProperties) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Set indicates an expected call of Set. +func (mr *MockInterfaceMockRecorder) Set(ctx, resourceGroupName, resourceName, parameters any) *MockInterfaceSetCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Set", reflect.TypeOf((*MockInterface)(nil).Set), ctx, resourceGroupName, resourceName, parameters) + return &MockInterfaceSetCall{Call: call} +} + +// MockInterfaceSetCall wrap *gomock.Call +type MockInterfaceSetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceSetCall) Return(arg0 *armstorage.BlobServiceProperties, arg1 error) *MockInterfaceSetCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceSetCall) Do(f func(context.Context, string, string, armstorage.BlobServiceProperties) (*armstorage.BlobServiceProperties, error)) *MockInterfaceSetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceSetCall) DoAndReturn(f func(context.Context, string, string, armstorage.BlobServiceProperties) (*armstorage.BlobServiceProperties, error)) *MockInterfaceSetCall { + c.Call = c.Call.DoAndReturn(f) + return c +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader/load.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader/load.go index efa79c52be..63d6b18896 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader/load.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader/load.go @@ -56,22 +56,22 @@ func Load[Type any](ctx context.Context, secretLoaderConfig *K8sSecretLoaderConf var err error if fileLoaderConfig != nil { loadConfigloader := newEmptyLoader[ConfigMergeConfig](&ConfigMergeConfig{CloudConfigType: CloudConfigTypeMerge}) - loadConfigloader = newFileLoader(fileLoaderConfig.FilePath, loadConfigloader, newYamlByteLoader[ConfigMergeConfig]) + loadConfigloader = newFileLoader(fileLoaderConfig.FilePath, loadConfigloader, NewYamlByteLoader[ConfigMergeConfig]) //by default the config load type is merge loadConfig, err = loadConfigloader.Load(ctx) if err != nil { return nil, err } - configloader = newFileLoader(fileLoaderConfig.FilePath, nil, newYamlByteLoader[Type]) + configloader = newFileLoader(fileLoaderConfig.FilePath, nil, NewYamlByteLoader[Type]) if strings.EqualFold(string(loadConfig.CloudConfigType), string(CloudConfigTypeFile)) { return configloader.Load(ctx) } } if secretLoaderConfig != nil { if loadConfig != nil && strings.EqualFold(string(loadConfig.CloudConfigType), string(CloudConfigTypeSecret)) { - configloader = newK8sSecretLoader(&secretLoaderConfig.K8sSecretConfig, secretLoaderConfig.KubeClient, nil, newYamlByteLoader[Type]) + configloader = newK8sSecretLoader(&secretLoaderConfig.K8sSecretConfig, secretLoaderConfig.KubeClient, nil, NewYamlByteLoader[Type]) } else { - configloader = newK8sSecretLoader(&secretLoaderConfig.K8sSecretConfig, secretLoaderConfig.KubeClient, configloader, newYamlByteLoader[Type]) + configloader = newK8sSecretLoader(&secretLoaderConfig.K8sSecretConfig, secretLoaderConfig.KubeClient, configloader, NewYamlByteLoader[Type]) } } return configloader.Load(ctx) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader/loader_yaml.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader/loader_yaml.go index c5a8a1f30b..3460258349 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader/loader_yaml.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader/loader_yaml.go @@ -23,14 +23,14 @@ import ( "sigs.k8s.io/yaml" ) -// yamlByteLoader is a FactoryConfigLoader that loads a YAML file from a byte array. -type yamlByteLoader[Type any] struct { +// YamlByteLoader is a FactoryConfigLoader that loads a YAML file from a byte array. +type YamlByteLoader[Type any] struct { content []byte configLoader[Type] } // Load loads the YAML file from the byte array and returns the client factory config. -func (s *yamlByteLoader[Type]) Load(ctx context.Context) (*Type, error) { +func (s *YamlByteLoader[Type]) Load(ctx context.Context) (*Type, error) { if s.configLoader == nil { s.configLoader = newEmptyLoader[Type](nil) } @@ -45,9 +45,9 @@ func (s *yamlByteLoader[Type]) Load(ctx context.Context) (*Type, error) { return config, nil } -// newYamlByteLoader creates a YamlByteLoader with the specified content and loader. -func newYamlByteLoader[Type any](content []byte, loader configLoader[Type]) configLoader[Type] { - return &yamlByteLoader[Type]{ +// NewYamlByteLoader creates a YamlByteLoader with the specified content and loader. +func NewYamlByteLoader[Type any](content []byte, loader configLoader[Type]) configLoader[Type] { + return &YamlByteLoader[Type]{ content: content, configLoader: loader, } diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/deploymentclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/deploymentclient/interface_gomock.go new file mode 100644 index 0000000000..8c112807ce --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/deploymentclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package deploymentclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/deploymentclient/mock_deploymentclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_deploymentclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/deploymentclient/mock_deploymentclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/deploymentclient/mock_deploymentclient/interface.go new file mode 100644 index 0000000000..5459710e7d --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/deploymentclient/mock_deploymentclient/interface.go @@ -0,0 +1,216 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ +// + +// Code generated by MockGen. DO NOT EDIT. +// Source: deploymentclient/interface.go +// +// Generated by this command: +// +// mockgen -package mock_deploymentclient -source deploymentclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt +// + +// Package mock_deploymentclient is a generated GoMock package. +package mock_deploymentclient + +import ( + context "context" + reflect "reflect" + + armresources "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" + gomock "go.uber.org/mock/gomock" +) + +//go:generate mockgen -package mock_deploymentclient -source deploymentclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + +// MockInterface is a mock of Interface interface. +type MockInterface struct { + ctrl *gomock.Controller + recorder *MockInterfaceMockRecorder + isgomock struct{} +} + +// MockInterfaceMockRecorder is the mock recorder for MockInterface. +type MockInterfaceMockRecorder struct { + mock *MockInterface +} + +// NewMockInterface creates a new mock instance. +func NewMockInterface(ctrl *gomock.Controller) *MockInterface { + mock := &MockInterface{ctrl: ctrl} + mock.recorder = &MockInterfaceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockInterface) EXPECT() *MockInterfaceMockRecorder { + return m.recorder +} + +// CreateOrUpdate mocks base method. +func (m *MockInterface) CreateOrUpdate(ctx context.Context, resourceGroupName, resourceName string, resourceParam armresources.Deployment) (*armresources.DeploymentExtended, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateOrUpdate", ctx, resourceGroupName, resourceName, resourceParam) + ret0, _ := ret[0].(*armresources.DeploymentExtended) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateOrUpdate indicates an expected call of CreateOrUpdate. +func (mr *MockInterfaceMockRecorder) CreateOrUpdate(ctx, resourceGroupName, resourceName, resourceParam any) *MockInterfaceCreateOrUpdateCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockInterface)(nil).CreateOrUpdate), ctx, resourceGroupName, resourceName, resourceParam) + return &MockInterfaceCreateOrUpdateCall{Call: call} +} + +// MockInterfaceCreateOrUpdateCall wrap *gomock.Call +type MockInterfaceCreateOrUpdateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceCreateOrUpdateCall) Return(arg0 *armresources.DeploymentExtended, arg1 error) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceCreateOrUpdateCall) Do(f func(context.Context, string, string, armresources.Deployment) (*armresources.DeploymentExtended, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceCreateOrUpdateCall) DoAndReturn(f func(context.Context, string, string, armresources.Deployment) (*armresources.DeploymentExtended, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Delete mocks base method. +func (m *MockInterface) Delete(ctx context.Context, resourceGroupName, resourceName string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", ctx, resourceGroupName, resourceName) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete. +func (mr *MockInterfaceMockRecorder) Delete(ctx, resourceGroupName, resourceName any) *MockInterfaceDeleteCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockInterface)(nil).Delete), ctx, resourceGroupName, resourceName) + return &MockInterfaceDeleteCall{Call: call} +} + +// MockInterfaceDeleteCall wrap *gomock.Call +type MockInterfaceDeleteCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceDeleteCall) Return(arg0 error) *MockInterfaceDeleteCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceDeleteCall) Do(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceDeleteCall) DoAndReturn(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Get mocks base method. +func (m *MockInterface) Get(ctx context.Context, resourceGroupName, resourceName string) (*armresources.DeploymentExtended, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", ctx, resourceGroupName, resourceName) + ret0, _ := ret[0].(*armresources.DeploymentExtended) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, resourceName any) *MockInterfaceGetCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, resourceName) + return &MockInterfaceGetCall{Call: call} +} + +// MockInterfaceGetCall wrap *gomock.Call +type MockInterfaceGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetCall) Return(result *armresources.DeploymentExtended, rerr error) *MockInterfaceGetCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string) (*armresources.DeploymentExtended, error)) *MockInterfaceGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string) (*armresources.DeploymentExtended, error)) *MockInterfaceGetCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// List mocks base method. +func (m *MockInterface) List(ctx context.Context, resourceGroupName string) ([]*armresources.DeploymentExtended, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "List", ctx, resourceGroupName) + ret0, _ := ret[0].([]*armresources.DeploymentExtended) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// List indicates an expected call of List. +func (mr *MockInterfaceMockRecorder) List(ctx, resourceGroupName any) *MockInterfaceListCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockInterface)(nil).List), ctx, resourceGroupName) + return &MockInterfaceListCall{Call: call} +} + +// MockInterfaceListCall wrap *gomock.Call +type MockInterfaceListCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceListCall) Return(result []*armresources.DeploymentExtended, rerr error) *MockInterfaceListCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceListCall) Do(f func(context.Context, string) ([]*armresources.DeploymentExtended, error)) *MockInterfaceListCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceListCall) DoAndReturn(f func(context.Context, string) ([]*armresources.DeploymentExtended, error)) *MockInterfaceListCall { + c.Call = c.Call.DoAndReturn(f) + return c +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/diskclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/diskclient/interface_gomock.go new file mode 100644 index 0000000000..8985b35882 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/diskclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package diskclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/diskclient/mock_diskclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_diskclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/diskclient/mock_diskclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/diskclient/mock_diskclient/interface.go index df59562432..cd8261d309 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/diskclient/mock_diskclient/interface.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/diskclient/mock_diskclient/interface.go @@ -20,7 +20,7 @@ // // Generated by this command: // -// mockgen -package mock_diskclient -source diskclient/interface.go -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt +// mockgen -package mock_diskclient -source diskclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt // // Package mock_diskclient is a generated GoMock package. @@ -34,6 +34,8 @@ import ( gomock "go.uber.org/mock/gomock" ) +//go:generate mockgen -package mock_diskclient -source diskclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + // MockInterface is a mock of Interface interface. type MockInterface struct { ctrl *gomock.Controller @@ -68,9 +70,33 @@ func (m *MockInterface) CreateOrUpdate(ctx context.Context, resourceGroupName, r } // CreateOrUpdate indicates an expected call of CreateOrUpdate. -func (mr *MockInterfaceMockRecorder) CreateOrUpdate(ctx, resourceGroupName, resourceName, resourceParam any) *gomock.Call { +func (mr *MockInterfaceMockRecorder) CreateOrUpdate(ctx, resourceGroupName, resourceName, resourceParam any) *MockInterfaceCreateOrUpdateCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockInterface)(nil).CreateOrUpdate), ctx, resourceGroupName, resourceName, resourceParam) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockInterface)(nil).CreateOrUpdate), ctx, resourceGroupName, resourceName, resourceParam) + return &MockInterfaceCreateOrUpdateCall{Call: call} +} + +// MockInterfaceCreateOrUpdateCall wrap *gomock.Call +type MockInterfaceCreateOrUpdateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceCreateOrUpdateCall) Return(arg0 *armcompute.Disk, arg1 error) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceCreateOrUpdateCall) Do(f func(context.Context, string, string, armcompute.Disk) (*armcompute.Disk, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceCreateOrUpdateCall) DoAndReturn(f func(context.Context, string, string, armcompute.Disk) (*armcompute.Disk, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.DoAndReturn(f) + return c } // Delete mocks base method. @@ -82,9 +108,33 @@ func (m *MockInterface) Delete(ctx context.Context, resourceGroupName, resourceN } // Delete indicates an expected call of Delete. -func (mr *MockInterfaceMockRecorder) Delete(ctx, resourceGroupName, resourceName any) *gomock.Call { +func (mr *MockInterfaceMockRecorder) Delete(ctx, resourceGroupName, resourceName any) *MockInterfaceDeleteCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockInterface)(nil).Delete), ctx, resourceGroupName, resourceName) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockInterface)(nil).Delete), ctx, resourceGroupName, resourceName) + return &MockInterfaceDeleteCall{Call: call} +} + +// MockInterfaceDeleteCall wrap *gomock.Call +type MockInterfaceDeleteCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceDeleteCall) Return(arg0 error) *MockInterfaceDeleteCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceDeleteCall) Do(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceDeleteCall) DoAndReturn(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.DoAndReturn(f) + return c } // Get mocks base method. @@ -97,9 +147,33 @@ func (m *MockInterface) Get(ctx context.Context, resourceGroupName, resourceName } // Get indicates an expected call of Get. -func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, resourceName any) *gomock.Call { +func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, resourceName any) *MockInterfaceGetCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, resourceName) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, resourceName) + return &MockInterfaceGetCall{Call: call} +} + +// MockInterfaceGetCall wrap *gomock.Call +type MockInterfaceGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetCall) Return(result *armcompute.Disk, rerr error) *MockInterfaceGetCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string) (*armcompute.Disk, error)) *MockInterfaceGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string) (*armcompute.Disk, error)) *MockInterfaceGetCall { + c.Call = c.Call.DoAndReturn(f) + return c } // List mocks base method. @@ -112,9 +186,33 @@ func (m *MockInterface) List(ctx context.Context, resourceGroupName string) ([]* } // List indicates an expected call of List. -func (mr *MockInterfaceMockRecorder) List(ctx, resourceGroupName any) *gomock.Call { +func (mr *MockInterfaceMockRecorder) List(ctx, resourceGroupName any) *MockInterfaceListCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockInterface)(nil).List), ctx, resourceGroupName) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockInterface)(nil).List), ctx, resourceGroupName) + return &MockInterfaceListCall{Call: call} +} + +// MockInterfaceListCall wrap *gomock.Call +type MockInterfaceListCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceListCall) Return(result []*armcompute.Disk, rerr error) *MockInterfaceListCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceListCall) Do(f func(context.Context, string) ([]*armcompute.Disk, error)) *MockInterfaceListCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceListCall) DoAndReturn(f func(context.Context, string) ([]*armcompute.Disk, error)) *MockInterfaceListCall { + c.Call = c.Call.DoAndReturn(f) + return c } // Patch mocks base method. @@ -127,7 +225,31 @@ func (m *MockInterface) Patch(ctx context.Context, resourceGroupName, resourceNa } // Patch indicates an expected call of Patch. -func (mr *MockInterfaceMockRecorder) Patch(ctx, resourceGroupName, resourceName, parameters any) *gomock.Call { +func (mr *MockInterfaceMockRecorder) Patch(ctx, resourceGroupName, resourceName, parameters any) *MockInterfacePatchCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Patch", reflect.TypeOf((*MockInterface)(nil).Patch), ctx, resourceGroupName, resourceName, parameters) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Patch", reflect.TypeOf((*MockInterface)(nil).Patch), ctx, resourceGroupName, resourceName, parameters) + return &MockInterfacePatchCall{Call: call} +} + +// MockInterfacePatchCall wrap *gomock.Call +type MockInterfacePatchCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfacePatchCall) Return(result *armcompute.Disk, err error) *MockInterfacePatchCall { + c.Call = c.Call.Return(result, err) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfacePatchCall) Do(f func(context.Context, string, string, armcompute.DiskUpdate) (*armcompute.Disk, error)) *MockInterfacePatchCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfacePatchCall) DoAndReturn(f func(context.Context, string, string, armcompute.DiskUpdate) (*armcompute.Disk, error)) *MockInterfacePatchCall { + c.Call = c.Call.DoAndReturn(f) + return c } diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/factory.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/factory.go index d7c3ee4710..d648910681 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/factory.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/factory.go @@ -31,6 +31,7 @@ import ( "sigs.k8s.io/cloud-provider-azure/pkg/azclient/ipgroupclient" "sigs.k8s.io/cloud-provider-azure/pkg/azclient/loadbalancerclient" "sigs.k8s.io/cloud-provider-azure/pkg/azclient/managedclusterclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatednszonegroupclient" "sigs.k8s.io/cloud-provider-azure/pkg/azclient/privateendpointclient" "sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatelinkserviceclient" "sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatezoneclient" @@ -74,6 +75,7 @@ type ClientFactory interface { GetIPGroupClient() ipgroupclient.Interface GetLoadBalancerClient() loadbalancerclient.Interface GetManagedClusterClient() managedclusterclient.Interface + GetPrivateDNSZoneGroupClient() privatednszonegroupclient.Interface GetPrivateEndpointClient() privateendpointclient.Interface GetPrivateLinkServiceClient() privatelinkserviceclient.Interface GetPrivateZoneClient() privatezoneclient.Interface diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/factory_gen.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/factory_gen.go index e4f6076cbe..435fde8019 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/factory_gen.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/factory_gen.go @@ -39,6 +39,7 @@ import ( "sigs.k8s.io/cloud-provider-azure/pkg/azclient/loadbalancerclient" "sigs.k8s.io/cloud-provider-azure/pkg/azclient/managedclusterclient" "sigs.k8s.io/cloud-provider-azure/pkg/azclient/policy/ratelimit" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatednszonegroupclient" "sigs.k8s.io/cloud-provider-azure/pkg/azclient/privateendpointclient" "sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatelinkserviceclient" "sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatezoneclient" @@ -81,6 +82,7 @@ type ClientFactoryImpl struct { ipgroupclientInterface ipgroupclient.Interface loadbalancerclientInterface loadbalancerclient.Interface managedclusterclientInterface managedclusterclient.Interface + privatednszonegroupclientInterface privatednszonegroupclient.Interface privateendpointclientInterface privateendpointclient.Interface privatelinkserviceclientInterface privatelinkserviceclient.Interface privatezoneclientInterface privatezoneclient.Interface @@ -199,6 +201,12 @@ func NewClientFactory(config *ClientFactoryConfig, armConfig *ARMClientConfig, c return nil, err } + //initialize privatednszonegroupclient + factory.privatednszonegroupclientInterface, err = factory.createPrivateDNSZoneGroupClient(config.SubscriptionID) + if err != nil { + return nil, err + } + //initialize privateendpointclient factory.privateendpointclientInterface, err = factory.createPrivateEndpointClient(config.SubscriptionID) if err != nil { @@ -752,6 +760,25 @@ func (factory *ClientFactoryImpl) GetManagedClusterClient() managedclusterclient return factory.managedclusterclientInterface } +func (factory *ClientFactoryImpl) createPrivateDNSZoneGroupClient(subscription string) (privatednszonegroupclient.Interface, error) { + //initialize privatednszonegroupclient + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + if err != nil { + return nil, err + } + + for _, optionMutFn := range factory.clientOptionsMutFn { + if optionMutFn != nil { + optionMutFn(options) + } + } + return privatednszonegroupclient.New(subscription, factory.cred, options) +} + +func (factory *ClientFactoryImpl) GetPrivateDNSZoneGroupClient() privatednszonegroupclient.Interface { + return factory.privatednszonegroupclientInterface +} + func (factory *ClientFactoryImpl) createPrivateEndpointClient(subscription string) (privateendpointclient.Interface, error) { //initialize privateendpointclient options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileservicepropertiesclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileservicepropertiesclient/interface_gomock.go new file mode 100644 index 0000000000..62dffee506 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileservicepropertiesclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package fileservicepropertiesclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileservicepropertiesclient/mock_fileservicepropertiesclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_fileservicepropertiesclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileservicepropertiesclient/mock_fileservicepropertiesclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileservicepropertiesclient/mock_fileservicepropertiesclient/interface.go new file mode 100644 index 0000000000..a172bc1bc9 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileservicepropertiesclient/mock_fileservicepropertiesclient/interface.go @@ -0,0 +1,139 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ +// + +// Code generated by MockGen. DO NOT EDIT. +// Source: fileservicepropertiesclient/interface.go +// +// Generated by this command: +// +// mockgen -package mock_fileservicepropertiesclient -source fileservicepropertiesclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt +// + +// Package mock_fileservicepropertiesclient is a generated GoMock package. +package mock_fileservicepropertiesclient + +import ( + context "context" + reflect "reflect" + + armstorage "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" + gomock "go.uber.org/mock/gomock" +) + +//go:generate mockgen -package mock_fileservicepropertiesclient -source fileservicepropertiesclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + +// MockInterface is a mock of Interface interface. +type MockInterface struct { + ctrl *gomock.Controller + recorder *MockInterfaceMockRecorder + isgomock struct{} +} + +// MockInterfaceMockRecorder is the mock recorder for MockInterface. +type MockInterfaceMockRecorder struct { + mock *MockInterface +} + +// NewMockInterface creates a new mock instance. +func NewMockInterface(ctrl *gomock.Controller) *MockInterface { + mock := &MockInterface{ctrl: ctrl} + mock.recorder = &MockInterfaceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockInterface) EXPECT() *MockInterfaceMockRecorder { + return m.recorder +} + +// Get mocks base method. +func (m *MockInterface) Get(ctx context.Context, resourceGroupName, resourceName string) (*armstorage.FileServiceProperties, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", ctx, resourceGroupName, resourceName) + ret0, _ := ret[0].(*armstorage.FileServiceProperties) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, resourceName any) *MockInterfaceGetCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, resourceName) + return &MockInterfaceGetCall{Call: call} +} + +// MockInterfaceGetCall wrap *gomock.Call +type MockInterfaceGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetCall) Return(arg0 *armstorage.FileServiceProperties, arg1 error) *MockInterfaceGetCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string) (*armstorage.FileServiceProperties, error)) *MockInterfaceGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string) (*armstorage.FileServiceProperties, error)) *MockInterfaceGetCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Set mocks base method. +func (m *MockInterface) Set(ctx context.Context, resourceGroupName, resourceName string, parameters armstorage.FileServiceProperties) (*armstorage.FileServiceProperties, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Set", ctx, resourceGroupName, resourceName, parameters) + ret0, _ := ret[0].(*armstorage.FileServiceProperties) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Set indicates an expected call of Set. +func (mr *MockInterfaceMockRecorder) Set(ctx, resourceGroupName, resourceName, parameters any) *MockInterfaceSetCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Set", reflect.TypeOf((*MockInterface)(nil).Set), ctx, resourceGroupName, resourceName, parameters) + return &MockInterfaceSetCall{Call: call} +} + +// MockInterfaceSetCall wrap *gomock.Call +type MockInterfaceSetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceSetCall) Return(arg0 *armstorage.FileServiceProperties, arg1 error) *MockInterfaceSetCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceSetCall) Do(f func(context.Context, string, string, armstorage.FileServiceProperties) (*armstorage.FileServiceProperties, error)) *MockInterfaceSetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceSetCall) DoAndReturn(f func(context.Context, string, string, armstorage.FileServiceProperties) (*armstorage.FileServiceProperties, error)) *MockInterfaceSetCall { + c.Call = c.Call.DoAndReturn(f) + return c +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/interface_gomock.go new file mode 100644 index 0000000000..e413d15887 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package fileshareclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/mock_fileshareclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_fileshareclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/mock_fileshareclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/mock_fileshareclient/interface.go new file mode 100644 index 0000000000..b316fa7cab --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/mock_fileshareclient/interface.go @@ -0,0 +1,216 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ +// + +// Code generated by MockGen. DO NOT EDIT. +// Source: fileshareclient/interface.go +// +// Generated by this command: +// +// mockgen -package mock_fileshareclient -source fileshareclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt +// + +// Package mock_fileshareclient is a generated GoMock package. +package mock_fileshareclient + +import ( + context "context" + reflect "reflect" + + armstorage "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" + gomock "go.uber.org/mock/gomock" +) + +//go:generate mockgen -package mock_fileshareclient -source fileshareclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + +// MockInterface is a mock of Interface interface. +type MockInterface struct { + ctrl *gomock.Controller + recorder *MockInterfaceMockRecorder + isgomock struct{} +} + +// MockInterfaceMockRecorder is the mock recorder for MockInterface. +type MockInterfaceMockRecorder struct { + mock *MockInterface +} + +// NewMockInterface creates a new mock instance. +func NewMockInterface(ctrl *gomock.Controller) *MockInterface { + mock := &MockInterface{ctrl: ctrl} + mock.recorder = &MockInterfaceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockInterface) EXPECT() *MockInterfaceMockRecorder { + return m.recorder +} + +// Create mocks base method. +func (m *MockInterface) Create(ctx context.Context, resourceGroupName, resourceName, parentResourceName string, resource armstorage.FileShare) (*armstorage.FileShare, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Create", ctx, resourceGroupName, resourceName, parentResourceName, resource) + ret0, _ := ret[0].(*armstorage.FileShare) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Create indicates an expected call of Create. +func (mr *MockInterfaceMockRecorder) Create(ctx, resourceGroupName, resourceName, parentResourceName, resource any) *MockInterfaceCreateCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockInterface)(nil).Create), ctx, resourceGroupName, resourceName, parentResourceName, resource) + return &MockInterfaceCreateCall{Call: call} +} + +// MockInterfaceCreateCall wrap *gomock.Call +type MockInterfaceCreateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceCreateCall) Return(arg0 *armstorage.FileShare, arg1 error) *MockInterfaceCreateCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceCreateCall) Do(f func(context.Context, string, string, string, armstorage.FileShare) (*armstorage.FileShare, error)) *MockInterfaceCreateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceCreateCall) DoAndReturn(f func(context.Context, string, string, string, armstorage.FileShare) (*armstorage.FileShare, error)) *MockInterfaceCreateCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Delete mocks base method. +func (m *MockInterface) Delete(ctx context.Context, resourceGroupName, parentResourceName, resourceName string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", ctx, resourceGroupName, parentResourceName, resourceName) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete. +func (mr *MockInterfaceMockRecorder) Delete(ctx, resourceGroupName, parentResourceName, resourceName any) *MockInterfaceDeleteCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockInterface)(nil).Delete), ctx, resourceGroupName, parentResourceName, resourceName) + return &MockInterfaceDeleteCall{Call: call} +} + +// MockInterfaceDeleteCall wrap *gomock.Call +type MockInterfaceDeleteCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceDeleteCall) Return(arg0 error) *MockInterfaceDeleteCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceDeleteCall) Do(f func(context.Context, string, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceDeleteCall) DoAndReturn(f func(context.Context, string, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Get mocks base method. +func (m *MockInterface) Get(ctx context.Context, resourceGroupName, parentResourceName, resourceName string) (*armstorage.FileShare, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", ctx, resourceGroupName, parentResourceName, resourceName) + ret0, _ := ret[0].(*armstorage.FileShare) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, parentResourceName, resourceName any) *MockInterfaceGetCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, parentResourceName, resourceName) + return &MockInterfaceGetCall{Call: call} +} + +// MockInterfaceGetCall wrap *gomock.Call +type MockInterfaceGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetCall) Return(result *armstorage.FileShare, rerr error) *MockInterfaceGetCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string, string) (*armstorage.FileShare, error)) *MockInterfaceGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string, string) (*armstorage.FileShare, error)) *MockInterfaceGetCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Update mocks base method. +func (m *MockInterface) Update(ctx context.Context, resourceGroupName, resourceName, parentResourceName string, resource armstorage.FileShare) (*armstorage.FileShare, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Update", ctx, resourceGroupName, resourceName, parentResourceName, resource) + ret0, _ := ret[0].(*armstorage.FileShare) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Update indicates an expected call of Update. +func (mr *MockInterfaceMockRecorder) Update(ctx, resourceGroupName, resourceName, parentResourceName, resource any) *MockInterfaceUpdateCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockInterface)(nil).Update), ctx, resourceGroupName, resourceName, parentResourceName, resource) + return &MockInterfaceUpdateCall{Call: call} +} + +// MockInterfaceUpdateCall wrap *gomock.Call +type MockInterfaceUpdateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceUpdateCall) Return(arg0 *armstorage.FileShare, arg1 error) *MockInterfaceUpdateCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceUpdateCall) Do(f func(context.Context, string, string, string, armstorage.FileShare) (*armstorage.FileShare, error)) *MockInterfaceUpdateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceUpdateCall) DoAndReturn(f func(context.Context, string, string, string, armstorage.FileShare) (*armstorage.FileShare, error)) *MockInterfaceUpdateCall { + c.Call = c.Call.DoAndReturn(f) + return c +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/identityclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/identityclient/interface_gomock.go new file mode 100644 index 0000000000..8d4e05335a --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/identityclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package identityclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/identityclient/mock_identityclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_identityclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azureclients/routetableclient/mockroutetableclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/identityclient/mock_identityclient/interface.go similarity index 50% rename from vendor/sigs.k8s.io/cloud-provider-azure/pkg/azureclients/routetableclient/mockroutetableclient/interface.go rename to vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/identityclient/mock_identityclient/interface.go index 200ff014c5..3a4452774a 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azureclients/routetableclient/mockroutetableclient/interface.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/identityclient/mock_identityclient/interface.go @@ -16,29 +16,31 @@ // // Code generated by MockGen. DO NOT EDIT. -// Source: pkg/azureclients/routetableclient/interface.go +// Source: identityclient/interface.go // // Generated by this command: // -// mockgen -copyright_file=/home/runner/work/cloud-provider-azure/cloud-provider-azure/hack/boilerplate/boilerplate.generatego.txt -source=pkg/azureclients/routetableclient/interface.go -package=mockroutetableclient Interface +// mockgen -package mock_identityclient -source identityclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt // -// Package mockroutetableclient is a generated GoMock package. -package mockroutetableclient +// Package mock_identityclient is a generated GoMock package. +package mock_identityclient import ( context "context" reflect "reflect" - network "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2022-07-01/network" + armmsi "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/msi/armmsi" gomock "go.uber.org/mock/gomock" - retry "sigs.k8s.io/cloud-provider-azure/pkg/retry" ) +//go:generate mockgen -package mock_identityclient -source identityclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + // MockInterface is a mock of Interface interface. type MockInterface struct { ctrl *gomock.Controller recorder *MockInterfaceMockRecorder + isgomock struct{} } // MockInterfaceMockRecorder is the mock recorder for MockInterface. @@ -58,31 +60,41 @@ func (m *MockInterface) EXPECT() *MockInterfaceMockRecorder { return m.recorder } -// CreateOrUpdate mocks base method. -func (m *MockInterface) CreateOrUpdate(ctx context.Context, resourceGroupName, routeTableName string, parameters network.RouteTable, etag string) *retry.Error { +// Get mocks base method. +func (m *MockInterface) Get(ctx context.Context, resourceGroupName, resourceName string) (*armmsi.Identity, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateOrUpdate", ctx, resourceGroupName, routeTableName, parameters, etag) - ret0, _ := ret[0].(*retry.Error) - return ret0 + ret := m.ctrl.Call(m, "Get", ctx, resourceGroupName, resourceName) + ret0, _ := ret[0].(*armmsi.Identity) + ret1, _ := ret[1].(error) + return ret0, ret1 } -// CreateOrUpdate indicates an expected call of CreateOrUpdate. -func (mr *MockInterfaceMockRecorder) CreateOrUpdate(ctx, resourceGroupName, routeTableName, parameters, etag any) *gomock.Call { +// Get indicates an expected call of Get. +func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, resourceName any) *MockInterfaceGetCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockInterface)(nil).CreateOrUpdate), ctx, resourceGroupName, routeTableName, parameters, etag) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, resourceName) + return &MockInterfaceGetCall{Call: call} } -// Get mocks base method. -func (m *MockInterface) Get(ctx context.Context, resourceGroupName, routeTableName, expand string) (network.RouteTable, *retry.Error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Get", ctx, resourceGroupName, routeTableName, expand) - ret0, _ := ret[0].(network.RouteTable) - ret1, _ := ret[1].(*retry.Error) - return ret0, ret1 +// MockInterfaceGetCall wrap *gomock.Call +type MockInterfaceGetCall struct { + *gomock.Call } -// Get indicates an expected call of Get. -func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, routeTableName, expand any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, routeTableName, expand) +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetCall) Return(result *armmsi.Identity, rerr error) *MockInterfaceGetCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string) (*armmsi.Identity, error)) *MockInterfaceGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string) (*armmsi.Identity, error)) *MockInterfaceGetCall { + c.Call = c.Call.DoAndReturn(f) + return c } diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/interfaceclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/interfaceclient/interface_gomock.go new file mode 100644 index 0000000000..9bf395377f --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/interfaceclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package interfaceclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/interfaceclient/mock_interfaceclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_interfaceclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/interfaceclient/mock_interfaceclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/interfaceclient/mock_interfaceclient/interface.go new file mode 100644 index 0000000000..d347026319 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/interfaceclient/mock_interfaceclient/interface.go @@ -0,0 +1,294 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ +// + +// Code generated by MockGen. DO NOT EDIT. +// Source: interfaceclient/interface.go +// +// Generated by this command: +// +// mockgen -package mock_interfaceclient -source interfaceclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt +// + +// Package mock_interfaceclient is a generated GoMock package. +package mock_interfaceclient + +import ( + context "context" + reflect "reflect" + + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" + gomock "go.uber.org/mock/gomock" +) + +//go:generate mockgen -package mock_interfaceclient -source interfaceclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + +// MockInterface is a mock of Interface interface. +type MockInterface struct { + ctrl *gomock.Controller + recorder *MockInterfaceMockRecorder + isgomock struct{} +} + +// MockInterfaceMockRecorder is the mock recorder for MockInterface. +type MockInterfaceMockRecorder struct { + mock *MockInterface +} + +// NewMockInterface creates a new mock instance. +func NewMockInterface(ctrl *gomock.Controller) *MockInterface { + mock := &MockInterface{ctrl: ctrl} + mock.recorder = &MockInterfaceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockInterface) EXPECT() *MockInterfaceMockRecorder { + return m.recorder +} + +// CreateOrUpdate mocks base method. +func (m *MockInterface) CreateOrUpdate(ctx context.Context, resourceGroupName, resourceName string, resourceParam armnetwork.Interface) (*armnetwork.Interface, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateOrUpdate", ctx, resourceGroupName, resourceName, resourceParam) + ret0, _ := ret[0].(*armnetwork.Interface) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateOrUpdate indicates an expected call of CreateOrUpdate. +func (mr *MockInterfaceMockRecorder) CreateOrUpdate(ctx, resourceGroupName, resourceName, resourceParam any) *MockInterfaceCreateOrUpdateCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockInterface)(nil).CreateOrUpdate), ctx, resourceGroupName, resourceName, resourceParam) + return &MockInterfaceCreateOrUpdateCall{Call: call} +} + +// MockInterfaceCreateOrUpdateCall wrap *gomock.Call +type MockInterfaceCreateOrUpdateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceCreateOrUpdateCall) Return(arg0 *armnetwork.Interface, arg1 error) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceCreateOrUpdateCall) Do(f func(context.Context, string, string, armnetwork.Interface) (*armnetwork.Interface, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceCreateOrUpdateCall) DoAndReturn(f func(context.Context, string, string, armnetwork.Interface) (*armnetwork.Interface, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Delete mocks base method. +func (m *MockInterface) Delete(ctx context.Context, resourceGroupName, resourceName string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", ctx, resourceGroupName, resourceName) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete. +func (mr *MockInterfaceMockRecorder) Delete(ctx, resourceGroupName, resourceName any) *MockInterfaceDeleteCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockInterface)(nil).Delete), ctx, resourceGroupName, resourceName) + return &MockInterfaceDeleteCall{Call: call} +} + +// MockInterfaceDeleteCall wrap *gomock.Call +type MockInterfaceDeleteCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceDeleteCall) Return(arg0 error) *MockInterfaceDeleteCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceDeleteCall) Do(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceDeleteCall) DoAndReturn(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Get mocks base method. +func (m *MockInterface) Get(ctx context.Context, resourceGroupName, resourceName string, expand *string) (*armnetwork.Interface, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", ctx, resourceGroupName, resourceName, expand) + ret0, _ := ret[0].(*armnetwork.Interface) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, resourceName, expand any) *MockInterfaceGetCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, resourceName, expand) + return &MockInterfaceGetCall{Call: call} +} + +// MockInterfaceGetCall wrap *gomock.Call +type MockInterfaceGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetCall) Return(result *armnetwork.Interface, rerr error) *MockInterfaceGetCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string, *string) (*armnetwork.Interface, error)) *MockInterfaceGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string, *string) (*armnetwork.Interface, error)) *MockInterfaceGetCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetVirtualMachineScaleSetNetworkInterface mocks base method. +func (m *MockInterface) GetVirtualMachineScaleSetNetworkInterface(ctx context.Context, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName string) (*armnetwork.Interface, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetVirtualMachineScaleSetNetworkInterface", ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName) + ret0, _ := ret[0].(*armnetwork.Interface) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetVirtualMachineScaleSetNetworkInterface indicates an expected call of GetVirtualMachineScaleSetNetworkInterface. +func (mr *MockInterfaceMockRecorder) GetVirtualMachineScaleSetNetworkInterface(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName any) *MockInterfaceGetVirtualMachineScaleSetNetworkInterfaceCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetVirtualMachineScaleSetNetworkInterface", reflect.TypeOf((*MockInterface)(nil).GetVirtualMachineScaleSetNetworkInterface), ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName) + return &MockInterfaceGetVirtualMachineScaleSetNetworkInterfaceCall{Call: call} +} + +// MockInterfaceGetVirtualMachineScaleSetNetworkInterfaceCall wrap *gomock.Call +type MockInterfaceGetVirtualMachineScaleSetNetworkInterfaceCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetVirtualMachineScaleSetNetworkInterfaceCall) Return(arg0 *armnetwork.Interface, arg1 error) *MockInterfaceGetVirtualMachineScaleSetNetworkInterfaceCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetVirtualMachineScaleSetNetworkInterfaceCall) Do(f func(context.Context, string, string, string, string) (*armnetwork.Interface, error)) *MockInterfaceGetVirtualMachineScaleSetNetworkInterfaceCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetVirtualMachineScaleSetNetworkInterfaceCall) DoAndReturn(f func(context.Context, string, string, string, string) (*armnetwork.Interface, error)) *MockInterfaceGetVirtualMachineScaleSetNetworkInterfaceCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// List mocks base method. +func (m *MockInterface) List(ctx context.Context, resourceGroupName string) ([]*armnetwork.Interface, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "List", ctx, resourceGroupName) + ret0, _ := ret[0].([]*armnetwork.Interface) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// List indicates an expected call of List. +func (mr *MockInterfaceMockRecorder) List(ctx, resourceGroupName any) *MockInterfaceListCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockInterface)(nil).List), ctx, resourceGroupName) + return &MockInterfaceListCall{Call: call} +} + +// MockInterfaceListCall wrap *gomock.Call +type MockInterfaceListCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceListCall) Return(result []*armnetwork.Interface, rerr error) *MockInterfaceListCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceListCall) Do(f func(context.Context, string) ([]*armnetwork.Interface, error)) *MockInterfaceListCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceListCall) DoAndReturn(f func(context.Context, string) ([]*armnetwork.Interface, error)) *MockInterfaceListCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ListVirtualMachineScaleSetNetworkInterfaces mocks base method. +func (m *MockInterface) ListVirtualMachineScaleSetNetworkInterfaces(ctx context.Context, resourceGroupName, virtualMachineScaleSetName string) ([]*armnetwork.Interface, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListVirtualMachineScaleSetNetworkInterfaces", ctx, resourceGroupName, virtualMachineScaleSetName) + ret0, _ := ret[0].([]*armnetwork.Interface) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListVirtualMachineScaleSetNetworkInterfaces indicates an expected call of ListVirtualMachineScaleSetNetworkInterfaces. +func (mr *MockInterfaceMockRecorder) ListVirtualMachineScaleSetNetworkInterfaces(ctx, resourceGroupName, virtualMachineScaleSetName any) *MockInterfaceListVirtualMachineScaleSetNetworkInterfacesCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListVirtualMachineScaleSetNetworkInterfaces", reflect.TypeOf((*MockInterface)(nil).ListVirtualMachineScaleSetNetworkInterfaces), ctx, resourceGroupName, virtualMachineScaleSetName) + return &MockInterfaceListVirtualMachineScaleSetNetworkInterfacesCall{Call: call} +} + +// MockInterfaceListVirtualMachineScaleSetNetworkInterfacesCall wrap *gomock.Call +type MockInterfaceListVirtualMachineScaleSetNetworkInterfacesCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceListVirtualMachineScaleSetNetworkInterfacesCall) Return(arg0 []*armnetwork.Interface, arg1 error) *MockInterfaceListVirtualMachineScaleSetNetworkInterfacesCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceListVirtualMachineScaleSetNetworkInterfacesCall) Do(f func(context.Context, string, string) ([]*armnetwork.Interface, error)) *MockInterfaceListVirtualMachineScaleSetNetworkInterfacesCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceListVirtualMachineScaleSetNetworkInterfacesCall) DoAndReturn(f func(context.Context, string, string) ([]*armnetwork.Interface, error)) *MockInterfaceListVirtualMachineScaleSetNetworkInterfacesCall { + c.Call = c.Call.DoAndReturn(f) + return c +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/ipgroupclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/ipgroupclient/interface_gomock.go new file mode 100644 index 0000000000..cd2ef99607 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/ipgroupclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package ipgroupclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/ipgroupclient/mock_ipgroupclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_ipgroupclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/ipgroupclient/mock_ipgroupclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/ipgroupclient/mock_ipgroupclient/interface.go new file mode 100644 index 0000000000..fbcb5b5336 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/ipgroupclient/mock_ipgroupclient/interface.go @@ -0,0 +1,216 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ +// + +// Code generated by MockGen. DO NOT EDIT. +// Source: ipgroupclient/interface.go +// +// Generated by this command: +// +// mockgen -package mock_ipgroupclient -source ipgroupclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt +// + +// Package mock_ipgroupclient is a generated GoMock package. +package mock_ipgroupclient + +import ( + context "context" + reflect "reflect" + + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" + gomock "go.uber.org/mock/gomock" +) + +//go:generate mockgen -package mock_ipgroupclient -source ipgroupclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + +// MockInterface is a mock of Interface interface. +type MockInterface struct { + ctrl *gomock.Controller + recorder *MockInterfaceMockRecorder + isgomock struct{} +} + +// MockInterfaceMockRecorder is the mock recorder for MockInterface. +type MockInterfaceMockRecorder struct { + mock *MockInterface +} + +// NewMockInterface creates a new mock instance. +func NewMockInterface(ctrl *gomock.Controller) *MockInterface { + mock := &MockInterface{ctrl: ctrl} + mock.recorder = &MockInterfaceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockInterface) EXPECT() *MockInterfaceMockRecorder { + return m.recorder +} + +// CreateOrUpdate mocks base method. +func (m *MockInterface) CreateOrUpdate(ctx context.Context, resourceGroupName, resourceName string, resourceParam armnetwork.IPGroup) (*armnetwork.IPGroup, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateOrUpdate", ctx, resourceGroupName, resourceName, resourceParam) + ret0, _ := ret[0].(*armnetwork.IPGroup) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateOrUpdate indicates an expected call of CreateOrUpdate. +func (mr *MockInterfaceMockRecorder) CreateOrUpdate(ctx, resourceGroupName, resourceName, resourceParam any) *MockInterfaceCreateOrUpdateCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockInterface)(nil).CreateOrUpdate), ctx, resourceGroupName, resourceName, resourceParam) + return &MockInterfaceCreateOrUpdateCall{Call: call} +} + +// MockInterfaceCreateOrUpdateCall wrap *gomock.Call +type MockInterfaceCreateOrUpdateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceCreateOrUpdateCall) Return(arg0 *armnetwork.IPGroup, arg1 error) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceCreateOrUpdateCall) Do(f func(context.Context, string, string, armnetwork.IPGroup) (*armnetwork.IPGroup, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceCreateOrUpdateCall) DoAndReturn(f func(context.Context, string, string, armnetwork.IPGroup) (*armnetwork.IPGroup, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Delete mocks base method. +func (m *MockInterface) Delete(ctx context.Context, resourceGroupName, resourceName string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", ctx, resourceGroupName, resourceName) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete. +func (mr *MockInterfaceMockRecorder) Delete(ctx, resourceGroupName, resourceName any) *MockInterfaceDeleteCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockInterface)(nil).Delete), ctx, resourceGroupName, resourceName) + return &MockInterfaceDeleteCall{Call: call} +} + +// MockInterfaceDeleteCall wrap *gomock.Call +type MockInterfaceDeleteCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceDeleteCall) Return(arg0 error) *MockInterfaceDeleteCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceDeleteCall) Do(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceDeleteCall) DoAndReturn(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Get mocks base method. +func (m *MockInterface) Get(ctx context.Context, resourceGroupName, resourceName string, expand *string) (*armnetwork.IPGroup, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", ctx, resourceGroupName, resourceName, expand) + ret0, _ := ret[0].(*armnetwork.IPGroup) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, resourceName, expand any) *MockInterfaceGetCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, resourceName, expand) + return &MockInterfaceGetCall{Call: call} +} + +// MockInterfaceGetCall wrap *gomock.Call +type MockInterfaceGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetCall) Return(result *armnetwork.IPGroup, rerr error) *MockInterfaceGetCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string, *string) (*armnetwork.IPGroup, error)) *MockInterfaceGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string, *string) (*armnetwork.IPGroup, error)) *MockInterfaceGetCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// List mocks base method. +func (m *MockInterface) List(ctx context.Context, resourceGroupName string) ([]*armnetwork.IPGroup, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "List", ctx, resourceGroupName) + ret0, _ := ret[0].([]*armnetwork.IPGroup) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// List indicates an expected call of List. +func (mr *MockInterfaceMockRecorder) List(ctx, resourceGroupName any) *MockInterfaceListCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockInterface)(nil).List), ctx, resourceGroupName) + return &MockInterfaceListCall{Call: call} +} + +// MockInterfaceListCall wrap *gomock.Call +type MockInterfaceListCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceListCall) Return(result []*armnetwork.IPGroup, rerr error) *MockInterfaceListCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceListCall) Do(f func(context.Context, string) ([]*armnetwork.IPGroup, error)) *MockInterfaceListCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceListCall) DoAndReturn(f func(context.Context, string) ([]*armnetwork.IPGroup, error)) *MockInterfaceListCall { + c.Call = c.Call.DoAndReturn(f) + return c +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/loadbalancerclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/loadbalancerclient/interface_gomock.go new file mode 100644 index 0000000000..ebf678922f --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/loadbalancerclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package loadbalancerclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/loadbalancerclient/mock_loadbalancerclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_loadbalancerclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/loadbalancerclient/mock_loadbalancerclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/loadbalancerclient/mock_loadbalancerclient/interface.go new file mode 100644 index 0000000000..c24530be1c --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/loadbalancerclient/mock_loadbalancerclient/interface.go @@ -0,0 +1,255 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ +// + +// Code generated by MockGen. DO NOT EDIT. +// Source: loadbalancerclient/interface.go +// +// Generated by this command: +// +// mockgen -package mock_loadbalancerclient -source loadbalancerclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt +// + +// Package mock_loadbalancerclient is a generated GoMock package. +package mock_loadbalancerclient + +import ( + context "context" + reflect "reflect" + + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" + gomock "go.uber.org/mock/gomock" +) + +//go:generate mockgen -package mock_loadbalancerclient -source loadbalancerclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + +// MockInterface is a mock of Interface interface. +type MockInterface struct { + ctrl *gomock.Controller + recorder *MockInterfaceMockRecorder + isgomock struct{} +} + +// MockInterfaceMockRecorder is the mock recorder for MockInterface. +type MockInterfaceMockRecorder struct { + mock *MockInterface +} + +// NewMockInterface creates a new mock instance. +func NewMockInterface(ctrl *gomock.Controller) *MockInterface { + mock := &MockInterface{ctrl: ctrl} + mock.recorder = &MockInterfaceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockInterface) EXPECT() *MockInterfaceMockRecorder { + return m.recorder +} + +// CreateOrUpdate mocks base method. +func (m *MockInterface) CreateOrUpdate(ctx context.Context, resourceGroupName, resourceName string, resourceParam armnetwork.LoadBalancer) (*armnetwork.LoadBalancer, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateOrUpdate", ctx, resourceGroupName, resourceName, resourceParam) + ret0, _ := ret[0].(*armnetwork.LoadBalancer) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateOrUpdate indicates an expected call of CreateOrUpdate. +func (mr *MockInterfaceMockRecorder) CreateOrUpdate(ctx, resourceGroupName, resourceName, resourceParam any) *MockInterfaceCreateOrUpdateCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockInterface)(nil).CreateOrUpdate), ctx, resourceGroupName, resourceName, resourceParam) + return &MockInterfaceCreateOrUpdateCall{Call: call} +} + +// MockInterfaceCreateOrUpdateCall wrap *gomock.Call +type MockInterfaceCreateOrUpdateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceCreateOrUpdateCall) Return(arg0 *armnetwork.LoadBalancer, arg1 error) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceCreateOrUpdateCall) Do(f func(context.Context, string, string, armnetwork.LoadBalancer) (*armnetwork.LoadBalancer, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceCreateOrUpdateCall) DoAndReturn(f func(context.Context, string, string, armnetwork.LoadBalancer) (*armnetwork.LoadBalancer, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Delete mocks base method. +func (m *MockInterface) Delete(ctx context.Context, resourceGroupName, resourceName string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", ctx, resourceGroupName, resourceName) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete. +func (mr *MockInterfaceMockRecorder) Delete(ctx, resourceGroupName, resourceName any) *MockInterfaceDeleteCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockInterface)(nil).Delete), ctx, resourceGroupName, resourceName) + return &MockInterfaceDeleteCall{Call: call} +} + +// MockInterfaceDeleteCall wrap *gomock.Call +type MockInterfaceDeleteCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceDeleteCall) Return(arg0 error) *MockInterfaceDeleteCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceDeleteCall) Do(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceDeleteCall) DoAndReturn(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Get mocks base method. +func (m *MockInterface) Get(ctx context.Context, resourceGroupName, resourceName string, expand *string) (*armnetwork.LoadBalancer, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", ctx, resourceGroupName, resourceName, expand) + ret0, _ := ret[0].(*armnetwork.LoadBalancer) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, resourceName, expand any) *MockInterfaceGetCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, resourceName, expand) + return &MockInterfaceGetCall{Call: call} +} + +// MockInterfaceGetCall wrap *gomock.Call +type MockInterfaceGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetCall) Return(result *armnetwork.LoadBalancer, rerr error) *MockInterfaceGetCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string, *string) (*armnetwork.LoadBalancer, error)) *MockInterfaceGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string, *string) (*armnetwork.LoadBalancer, error)) *MockInterfaceGetCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// List mocks base method. +func (m *MockInterface) List(ctx context.Context, resourceGroupName string) ([]*armnetwork.LoadBalancer, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "List", ctx, resourceGroupName) + ret0, _ := ret[0].([]*armnetwork.LoadBalancer) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// List indicates an expected call of List. +func (mr *MockInterfaceMockRecorder) List(ctx, resourceGroupName any) *MockInterfaceListCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockInterface)(nil).List), ctx, resourceGroupName) + return &MockInterfaceListCall{Call: call} +} + +// MockInterfaceListCall wrap *gomock.Call +type MockInterfaceListCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceListCall) Return(result []*armnetwork.LoadBalancer, rerr error) *MockInterfaceListCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceListCall) Do(f func(context.Context, string) ([]*armnetwork.LoadBalancer, error)) *MockInterfaceListCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceListCall) DoAndReturn(f func(context.Context, string) ([]*armnetwork.LoadBalancer, error)) *MockInterfaceListCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// MigrateToIPBased mocks base method. +func (m *MockInterface) MigrateToIPBased(ctx context.Context, groupName, loadBalancerName string, options *armnetwork.LoadBalancersClientMigrateToIPBasedOptions) (armnetwork.LoadBalancersClientMigrateToIPBasedResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "MigrateToIPBased", ctx, groupName, loadBalancerName, options) + ret0, _ := ret[0].(armnetwork.LoadBalancersClientMigrateToIPBasedResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// MigrateToIPBased indicates an expected call of MigrateToIPBased. +func (mr *MockInterfaceMockRecorder) MigrateToIPBased(ctx, groupName, loadBalancerName, options any) *MockInterfaceMigrateToIPBasedCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MigrateToIPBased", reflect.TypeOf((*MockInterface)(nil).MigrateToIPBased), ctx, groupName, loadBalancerName, options) + return &MockInterfaceMigrateToIPBasedCall{Call: call} +} + +// MockInterfaceMigrateToIPBasedCall wrap *gomock.Call +type MockInterfaceMigrateToIPBasedCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceMigrateToIPBasedCall) Return(arg0 armnetwork.LoadBalancersClientMigrateToIPBasedResponse, arg1 error) *MockInterfaceMigrateToIPBasedCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceMigrateToIPBasedCall) Do(f func(context.Context, string, string, *armnetwork.LoadBalancersClientMigrateToIPBasedOptions) (armnetwork.LoadBalancersClientMigrateToIPBasedResponse, error)) *MockInterfaceMigrateToIPBasedCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceMigrateToIPBasedCall) DoAndReturn(f func(context.Context, string, string, *armnetwork.LoadBalancersClientMigrateToIPBasedOptions) (armnetwork.LoadBalancersClientMigrateToIPBasedResponse, error)) *MockInterfaceMigrateToIPBasedCall { + c.Call = c.Call.DoAndReturn(f) + return c +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/managedclusterclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/managedclusterclient/interface_gomock.go new file mode 100644 index 0000000000..7906605ac5 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/managedclusterclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package managedclusterclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/managedclusterclient/mock_managedclusterclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_managedclusterclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/managedclusterclient/mock_managedclusterclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/managedclusterclient/mock_managedclusterclient/interface.go new file mode 100644 index 0000000000..9628f45778 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/managedclusterclient/mock_managedclusterclient/interface.go @@ -0,0 +1,216 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ +// + +// Code generated by MockGen. DO NOT EDIT. +// Source: managedclusterclient/interface.go +// +// Generated by this command: +// +// mockgen -package mock_managedclusterclient -source managedclusterclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt +// + +// Package mock_managedclusterclient is a generated GoMock package. +package mock_managedclusterclient + +import ( + context "context" + reflect "reflect" + + armcontainerservice "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6" + gomock "go.uber.org/mock/gomock" +) + +//go:generate mockgen -package mock_managedclusterclient -source managedclusterclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + +// MockInterface is a mock of Interface interface. +type MockInterface struct { + ctrl *gomock.Controller + recorder *MockInterfaceMockRecorder + isgomock struct{} +} + +// MockInterfaceMockRecorder is the mock recorder for MockInterface. +type MockInterfaceMockRecorder struct { + mock *MockInterface +} + +// NewMockInterface creates a new mock instance. +func NewMockInterface(ctrl *gomock.Controller) *MockInterface { + mock := &MockInterface{ctrl: ctrl} + mock.recorder = &MockInterfaceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockInterface) EXPECT() *MockInterfaceMockRecorder { + return m.recorder +} + +// CreateOrUpdate mocks base method. +func (m *MockInterface) CreateOrUpdate(ctx context.Context, resourceGroupName, resourceName string, resourceParam armcontainerservice.ManagedCluster) (*armcontainerservice.ManagedCluster, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateOrUpdate", ctx, resourceGroupName, resourceName, resourceParam) + ret0, _ := ret[0].(*armcontainerservice.ManagedCluster) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateOrUpdate indicates an expected call of CreateOrUpdate. +func (mr *MockInterfaceMockRecorder) CreateOrUpdate(ctx, resourceGroupName, resourceName, resourceParam any) *MockInterfaceCreateOrUpdateCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockInterface)(nil).CreateOrUpdate), ctx, resourceGroupName, resourceName, resourceParam) + return &MockInterfaceCreateOrUpdateCall{Call: call} +} + +// MockInterfaceCreateOrUpdateCall wrap *gomock.Call +type MockInterfaceCreateOrUpdateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceCreateOrUpdateCall) Return(arg0 *armcontainerservice.ManagedCluster, arg1 error) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceCreateOrUpdateCall) Do(f func(context.Context, string, string, armcontainerservice.ManagedCluster) (*armcontainerservice.ManagedCluster, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceCreateOrUpdateCall) DoAndReturn(f func(context.Context, string, string, armcontainerservice.ManagedCluster) (*armcontainerservice.ManagedCluster, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Delete mocks base method. +func (m *MockInterface) Delete(ctx context.Context, resourceGroupName, resourceName string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", ctx, resourceGroupName, resourceName) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete. +func (mr *MockInterfaceMockRecorder) Delete(ctx, resourceGroupName, resourceName any) *MockInterfaceDeleteCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockInterface)(nil).Delete), ctx, resourceGroupName, resourceName) + return &MockInterfaceDeleteCall{Call: call} +} + +// MockInterfaceDeleteCall wrap *gomock.Call +type MockInterfaceDeleteCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceDeleteCall) Return(arg0 error) *MockInterfaceDeleteCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceDeleteCall) Do(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceDeleteCall) DoAndReturn(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Get mocks base method. +func (m *MockInterface) Get(ctx context.Context, resourceGroupName, resourceName string) (*armcontainerservice.ManagedCluster, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", ctx, resourceGroupName, resourceName) + ret0, _ := ret[0].(*armcontainerservice.ManagedCluster) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, resourceName any) *MockInterfaceGetCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, resourceName) + return &MockInterfaceGetCall{Call: call} +} + +// MockInterfaceGetCall wrap *gomock.Call +type MockInterfaceGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetCall) Return(result *armcontainerservice.ManagedCluster, rerr error) *MockInterfaceGetCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string) (*armcontainerservice.ManagedCluster, error)) *MockInterfaceGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string) (*armcontainerservice.ManagedCluster, error)) *MockInterfaceGetCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// List mocks base method. +func (m *MockInterface) List(ctx context.Context, resourceGroupName string) ([]*armcontainerservice.ManagedCluster, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "List", ctx, resourceGroupName) + ret0, _ := ret[0].([]*armcontainerservice.ManagedCluster) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// List indicates an expected call of List. +func (mr *MockInterfaceMockRecorder) List(ctx, resourceGroupName any) *MockInterfaceListCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockInterface)(nil).List), ctx, resourceGroupName) + return &MockInterfaceListCall{Call: call} +} + +// MockInterfaceListCall wrap *gomock.Call +type MockInterfaceListCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceListCall) Return(result []*armcontainerservice.ManagedCluster, rerr error) *MockInterfaceListCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceListCall) Do(f func(context.Context, string) ([]*armcontainerservice.ManagedCluster, error)) *MockInterfaceListCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceListCall) DoAndReturn(f func(context.Context, string) ([]*armcontainerservice.ManagedCluster, error)) *MockInterfaceListCall { + c.Call = c.Call.DoAndReturn(f) + return c +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/mock_azclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/mock_azclient/interface.go index 2120e1ab8f..f79f885c0d 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/mock_azclient/interface.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/mock_azclient/interface.go @@ -44,6 +44,7 @@ import ( ipgroupclient "sigs.k8s.io/cloud-provider-azure/pkg/azclient/ipgroupclient" loadbalancerclient "sigs.k8s.io/cloud-provider-azure/pkg/azclient/loadbalancerclient" managedclusterclient "sigs.k8s.io/cloud-provider-azure/pkg/azclient/managedclusterclient" + privatednszonegroupclient "sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatednszonegroupclient" privateendpointclient "sigs.k8s.io/cloud-provider-azure/pkg/azclient/privateendpointclient" privatelinkserviceclient "sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatelinkserviceclient" privatezoneclient "sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatezoneclient" @@ -363,6 +364,20 @@ func (mr *MockClientFactoryMockRecorder) GetManagedClusterClient() *gomock.Call return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetManagedClusterClient", reflect.TypeOf((*MockClientFactory)(nil).GetManagedClusterClient)) } +// GetPrivateDNSZoneGroupClient mocks base method. +func (m *MockClientFactory) GetPrivateDNSZoneGroupClient() privatednszonegroupclient.Interface { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetPrivateDNSZoneGroupClient") + ret0, _ := ret[0].(privatednszonegroupclient.Interface) + return ret0 +} + +// GetPrivateDNSZoneGroupClient indicates an expected call of GetPrivateDNSZoneGroupClient. +func (mr *MockClientFactoryMockRecorder) GetPrivateDNSZoneGroupClient() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPrivateDNSZoneGroupClient", reflect.TypeOf((*MockClientFactory)(nil).GetPrivateDNSZoneGroupClient)) +} + // GetPrivateEndpointClient mocks base method. func (m *MockClientFactory) GetPrivateEndpointClient() privateendpointclient.Interface { m.ctrl.T.Helper() diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatednszonegroupclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatednszonegroupclient/interface.go new file mode 100644 index 0000000000..dda5cbc0fb --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatednszonegroupclient/interface.go @@ -0,0 +1,31 @@ +/* +Copyright 2024 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +azure:enableclientgen:=true +package privatednszonegroupclient + +import ( + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +// +azure:client:verbs=get;createorupdate;delete,resource=PrivateEndpoint,subResource=PrivateDNSZoneGroup,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6,packageAlias=armnetwork,clientName=PrivateDNSZoneGroupsClient,expand=false +type Interface interface { + utils.SubResourceGetFunc[armnetwork.PrivateDNSZoneGroup] + utils.SubResourceCreateOrUpdateFunc[armnetwork.PrivateDNSZoneGroup] + utils.SubResourceDeleteFunc[armnetwork.PrivateDNSZoneGroup] +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatednszonegroupclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatednszonegroupclient/interface_gomock.go new file mode 100644 index 0000000000..fa2abd8048 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatednszonegroupclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package privatednszonegroupclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatednszonegroupclient/mock_privatednszonegroupclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_privatednszonegroupclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatednszonegroupclient/mock_privatednszonegroupclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatednszonegroupclient/mock_privatednszonegroupclient/interface.go new file mode 100644 index 0000000000..4614720c86 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatednszonegroupclient/mock_privatednszonegroupclient/interface.go @@ -0,0 +1,177 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ +// + +// Code generated by MockGen. DO NOT EDIT. +// Source: privatednszonegroupclient/interface.go +// +// Generated by this command: +// +// mockgen -package mock_privatednszonegroupclient -source privatednszonegroupclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt +// + +// Package mock_privatednszonegroupclient is a generated GoMock package. +package mock_privatednszonegroupclient + +import ( + context "context" + reflect "reflect" + + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" + gomock "go.uber.org/mock/gomock" +) + +//go:generate mockgen -package mock_privatednszonegroupclient -source privatednszonegroupclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + +// MockInterface is a mock of Interface interface. +type MockInterface struct { + ctrl *gomock.Controller + recorder *MockInterfaceMockRecorder + isgomock struct{} +} + +// MockInterfaceMockRecorder is the mock recorder for MockInterface. +type MockInterfaceMockRecorder struct { + mock *MockInterface +} + +// NewMockInterface creates a new mock instance. +func NewMockInterface(ctrl *gomock.Controller) *MockInterface { + mock := &MockInterface{ctrl: ctrl} + mock.recorder = &MockInterfaceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockInterface) EXPECT() *MockInterfaceMockRecorder { + return m.recorder +} + +// CreateOrUpdate mocks base method. +func (m *MockInterface) CreateOrUpdate(ctx context.Context, resourceGroupName, parentResourceName, resourceName string, resourceParam armnetwork.PrivateDNSZoneGroup) (*armnetwork.PrivateDNSZoneGroup, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateOrUpdate", ctx, resourceGroupName, parentResourceName, resourceName, resourceParam) + ret0, _ := ret[0].(*armnetwork.PrivateDNSZoneGroup) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateOrUpdate indicates an expected call of CreateOrUpdate. +func (mr *MockInterfaceMockRecorder) CreateOrUpdate(ctx, resourceGroupName, parentResourceName, resourceName, resourceParam any) *MockInterfaceCreateOrUpdateCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockInterface)(nil).CreateOrUpdate), ctx, resourceGroupName, parentResourceName, resourceName, resourceParam) + return &MockInterfaceCreateOrUpdateCall{Call: call} +} + +// MockInterfaceCreateOrUpdateCall wrap *gomock.Call +type MockInterfaceCreateOrUpdateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceCreateOrUpdateCall) Return(arg0 *armnetwork.PrivateDNSZoneGroup, arg1 error) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceCreateOrUpdateCall) Do(f func(context.Context, string, string, string, armnetwork.PrivateDNSZoneGroup) (*armnetwork.PrivateDNSZoneGroup, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceCreateOrUpdateCall) DoAndReturn(f func(context.Context, string, string, string, armnetwork.PrivateDNSZoneGroup) (*armnetwork.PrivateDNSZoneGroup, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Delete mocks base method. +func (m *MockInterface) Delete(ctx context.Context, resourceGroupName, parentResourceName, resourceName string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", ctx, resourceGroupName, parentResourceName, resourceName) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete. +func (mr *MockInterfaceMockRecorder) Delete(ctx, resourceGroupName, parentResourceName, resourceName any) *MockInterfaceDeleteCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockInterface)(nil).Delete), ctx, resourceGroupName, parentResourceName, resourceName) + return &MockInterfaceDeleteCall{Call: call} +} + +// MockInterfaceDeleteCall wrap *gomock.Call +type MockInterfaceDeleteCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceDeleteCall) Return(arg0 error) *MockInterfaceDeleteCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceDeleteCall) Do(f func(context.Context, string, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceDeleteCall) DoAndReturn(f func(context.Context, string, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Get mocks base method. +func (m *MockInterface) Get(ctx context.Context, resourceGroupName, parentResourceName, resourceName string) (*armnetwork.PrivateDNSZoneGroup, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", ctx, resourceGroupName, parentResourceName, resourceName) + ret0, _ := ret[0].(*armnetwork.PrivateDNSZoneGroup) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, parentResourceName, resourceName any) *MockInterfaceGetCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, parentResourceName, resourceName) + return &MockInterfaceGetCall{Call: call} +} + +// MockInterfaceGetCall wrap *gomock.Call +type MockInterfaceGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetCall) Return(result *armnetwork.PrivateDNSZoneGroup, rerr error) *MockInterfaceGetCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string, string) (*armnetwork.PrivateDNSZoneGroup, error)) *MockInterfaceGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string, string) (*armnetwork.PrivateDNSZoneGroup, error)) *MockInterfaceGetCall { + c.Call = c.Call.DoAndReturn(f) + return c +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatednszonegroupclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatednszonegroupclient/zz_generated_client.go new file mode 100644 index 0000000000..964dd5b80b --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatednszonegroupclient/zz_generated_client.go @@ -0,0 +1,101 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package privatednszonegroupclient + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/tracing" + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/metrics" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +type Client struct { + *armnetwork.PrivateDNSZoneGroupsClient + subscriptionID string + tracer tracing.Tracer +} + +func New(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (Interface, error) { + if options == nil { + options = utils.GetDefaultOption() + } + tr := options.TracingProvider.NewTracer(utils.ModuleName, utils.ModuleVersion) + + client, err := armnetwork.NewPrivateDNSZoneGroupsClient(subscriptionID, credential, options) + if err != nil { + return nil, err + } + return &Client{ + PrivateDNSZoneGroupsClient: client, + subscriptionID: subscriptionID, + tracer: tr, + }, nil +} + +const GetOperationName = "PrivateDNSZoneGroupsClient.Get" + +// Get gets the PrivateDNSZoneGroup +func (client *Client) Get(ctx context.Context, resourceGroupName string, parentResourceName string, resourceName string) (result *armnetwork.PrivateDNSZoneGroup, err error) { + + metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "PrivateDNSZoneGroup", "get") + defer func() { metricsCtx.Observe(ctx, err) }() + ctx, endSpan := runtime.StartSpan(ctx, GetOperationName, client.tracer, nil) + defer endSpan(err) + resp, err := client.PrivateDNSZoneGroupsClient.Get(ctx, resourceGroupName, parentResourceName, resourceName, nil) + if err != nil { + return nil, err + } + //handle statuscode + return &resp.PrivateDNSZoneGroup, nil +} + +const CreateOrUpdateOperationName = "PrivateDNSZoneGroupsClient.Create" + +// CreateOrUpdate creates or updates a PrivateDNSZoneGroup. +func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parentResourceName string, resource armnetwork.PrivateDNSZoneGroup) (result *armnetwork.PrivateDNSZoneGroup, err error) { + metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "PrivateDNSZoneGroup", "create_or_update") + defer func() { metricsCtx.Observe(ctx, err) }() + ctx, endSpan := runtime.StartSpan(ctx, CreateOrUpdateOperationName, client.tracer, nil) + defer endSpan(err) + resp, err := utils.NewPollerWrapper(client.PrivateDNSZoneGroupsClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, parentResourceName, resource, nil)).WaitforPollerResp(ctx) + if err != nil { + return nil, err + } + if resp != nil { + return &resp.PrivateDNSZoneGroup, nil + } + return nil, nil +} + +const DeleteOperationName = "PrivateDNSZoneGroupsClient.Delete" + +// Delete deletes a PrivateDNSZoneGroup by name. +func (client *Client) Delete(ctx context.Context, resourceGroupName string, parentResourceName string, resourceName string) (err error) { + metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "PrivateDNSZoneGroup", "delete") + defer func() { metricsCtx.Observe(ctx, err) }() + ctx, endSpan := runtime.StartSpan(ctx, DeleteOperationName, client.tracer, nil) + defer endSpan(err) + _, err = utils.NewPollerWrapper(client.BeginDelete(ctx, resourceGroupName, parentResourceName, resourceName, nil)).WaitforPollerResp(ctx) + return err +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privateendpointclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privateendpointclient/interface_gomock.go new file mode 100644 index 0000000000..eacb4a6f9b --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privateendpointclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package privateendpointclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/privateendpointclient/mock_privateendpointclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_privateendpointclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privateendpointclient/mock_privateendpointclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privateendpointclient/mock_privateendpointclient/interface.go new file mode 100644 index 0000000000..7f0ab8b852 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privateendpointclient/mock_privateendpointclient/interface.go @@ -0,0 +1,139 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ +// + +// Code generated by MockGen. DO NOT EDIT. +// Source: privateendpointclient/interface.go +// +// Generated by this command: +// +// mockgen -package mock_privateendpointclient -source privateendpointclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt +// + +// Package mock_privateendpointclient is a generated GoMock package. +package mock_privateendpointclient + +import ( + context "context" + reflect "reflect" + + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" + gomock "go.uber.org/mock/gomock" +) + +//go:generate mockgen -package mock_privateendpointclient -source privateendpointclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + +// MockInterface is a mock of Interface interface. +type MockInterface struct { + ctrl *gomock.Controller + recorder *MockInterfaceMockRecorder + isgomock struct{} +} + +// MockInterfaceMockRecorder is the mock recorder for MockInterface. +type MockInterfaceMockRecorder struct { + mock *MockInterface +} + +// NewMockInterface creates a new mock instance. +func NewMockInterface(ctrl *gomock.Controller) *MockInterface { + mock := &MockInterface{ctrl: ctrl} + mock.recorder = &MockInterfaceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockInterface) EXPECT() *MockInterfaceMockRecorder { + return m.recorder +} + +// CreateOrUpdate mocks base method. +func (m *MockInterface) CreateOrUpdate(ctx context.Context, resourceGroupName, resourceName string, resourceParam armnetwork.PrivateEndpoint) (*armnetwork.PrivateEndpoint, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateOrUpdate", ctx, resourceGroupName, resourceName, resourceParam) + ret0, _ := ret[0].(*armnetwork.PrivateEndpoint) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateOrUpdate indicates an expected call of CreateOrUpdate. +func (mr *MockInterfaceMockRecorder) CreateOrUpdate(ctx, resourceGroupName, resourceName, resourceParam any) *MockInterfaceCreateOrUpdateCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockInterface)(nil).CreateOrUpdate), ctx, resourceGroupName, resourceName, resourceParam) + return &MockInterfaceCreateOrUpdateCall{Call: call} +} + +// MockInterfaceCreateOrUpdateCall wrap *gomock.Call +type MockInterfaceCreateOrUpdateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceCreateOrUpdateCall) Return(arg0 *armnetwork.PrivateEndpoint, arg1 error) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceCreateOrUpdateCall) Do(f func(context.Context, string, string, armnetwork.PrivateEndpoint) (*armnetwork.PrivateEndpoint, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceCreateOrUpdateCall) DoAndReturn(f func(context.Context, string, string, armnetwork.PrivateEndpoint) (*armnetwork.PrivateEndpoint, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Get mocks base method. +func (m *MockInterface) Get(ctx context.Context, resourceGroupName, resourceName string, expand *string) (*armnetwork.PrivateEndpoint, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", ctx, resourceGroupName, resourceName, expand) + ret0, _ := ret[0].(*armnetwork.PrivateEndpoint) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, resourceName, expand any) *MockInterfaceGetCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, resourceName, expand) + return &MockInterfaceGetCall{Call: call} +} + +// MockInterfaceGetCall wrap *gomock.Call +type MockInterfaceGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetCall) Return(result *armnetwork.PrivateEndpoint, rerr error) *MockInterfaceGetCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string, *string) (*armnetwork.PrivateEndpoint, error)) *MockInterfaceGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string, *string) (*armnetwork.PrivateEndpoint, error)) *MockInterfaceGetCall { + c.Call = c.Call.DoAndReturn(f) + return c +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatelinkserviceclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatelinkserviceclient/interface_gomock.go new file mode 100644 index 0000000000..26169fcef0 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatelinkserviceclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package privatelinkserviceclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatelinkserviceclient/mock_privatelinkserviceclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_privatelinkserviceclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatelinkserviceclient/mock_privatelinkserviceclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatelinkserviceclient/mock_privatelinkserviceclient/interface.go new file mode 100644 index 0000000000..2c92793036 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatelinkserviceclient/mock_privatelinkserviceclient/interface.go @@ -0,0 +1,254 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ +// + +// Code generated by MockGen. DO NOT EDIT. +// Source: privatelinkserviceclient/interface.go +// +// Generated by this command: +// +// mockgen -package mock_privatelinkserviceclient -source privatelinkserviceclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt +// + +// Package mock_privatelinkserviceclient is a generated GoMock package. +package mock_privatelinkserviceclient + +import ( + context "context" + reflect "reflect" + + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" + gomock "go.uber.org/mock/gomock" +) + +//go:generate mockgen -package mock_privatelinkserviceclient -source privatelinkserviceclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + +// MockInterface is a mock of Interface interface. +type MockInterface struct { + ctrl *gomock.Controller + recorder *MockInterfaceMockRecorder + isgomock struct{} +} + +// MockInterfaceMockRecorder is the mock recorder for MockInterface. +type MockInterfaceMockRecorder struct { + mock *MockInterface +} + +// NewMockInterface creates a new mock instance. +func NewMockInterface(ctrl *gomock.Controller) *MockInterface { + mock := &MockInterface{ctrl: ctrl} + mock.recorder = &MockInterfaceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockInterface) EXPECT() *MockInterfaceMockRecorder { + return m.recorder +} + +// CreateOrUpdate mocks base method. +func (m *MockInterface) CreateOrUpdate(ctx context.Context, resourceGroupName, resourceName string, resourceParam armnetwork.PrivateLinkService) (*armnetwork.PrivateLinkService, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateOrUpdate", ctx, resourceGroupName, resourceName, resourceParam) + ret0, _ := ret[0].(*armnetwork.PrivateLinkService) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateOrUpdate indicates an expected call of CreateOrUpdate. +func (mr *MockInterfaceMockRecorder) CreateOrUpdate(ctx, resourceGroupName, resourceName, resourceParam any) *MockInterfaceCreateOrUpdateCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockInterface)(nil).CreateOrUpdate), ctx, resourceGroupName, resourceName, resourceParam) + return &MockInterfaceCreateOrUpdateCall{Call: call} +} + +// MockInterfaceCreateOrUpdateCall wrap *gomock.Call +type MockInterfaceCreateOrUpdateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceCreateOrUpdateCall) Return(arg0 *armnetwork.PrivateLinkService, arg1 error) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceCreateOrUpdateCall) Do(f func(context.Context, string, string, armnetwork.PrivateLinkService) (*armnetwork.PrivateLinkService, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceCreateOrUpdateCall) DoAndReturn(f func(context.Context, string, string, armnetwork.PrivateLinkService) (*armnetwork.PrivateLinkService, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Delete mocks base method. +func (m *MockInterface) Delete(ctx context.Context, resourceGroupName, resourceName string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", ctx, resourceGroupName, resourceName) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete. +func (mr *MockInterfaceMockRecorder) Delete(ctx, resourceGroupName, resourceName any) *MockInterfaceDeleteCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockInterface)(nil).Delete), ctx, resourceGroupName, resourceName) + return &MockInterfaceDeleteCall{Call: call} +} + +// MockInterfaceDeleteCall wrap *gomock.Call +type MockInterfaceDeleteCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceDeleteCall) Return(arg0 error) *MockInterfaceDeleteCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceDeleteCall) Do(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceDeleteCall) DoAndReturn(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// DeletePrivateEndpointConnection mocks base method. +func (m *MockInterface) DeletePrivateEndpointConnection(ctx context.Context, resourceGroupName, serviceName, peConnectionName string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeletePrivateEndpointConnection", ctx, resourceGroupName, serviceName, peConnectionName) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeletePrivateEndpointConnection indicates an expected call of DeletePrivateEndpointConnection. +func (mr *MockInterfaceMockRecorder) DeletePrivateEndpointConnection(ctx, resourceGroupName, serviceName, peConnectionName any) *MockInterfaceDeletePrivateEndpointConnectionCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeletePrivateEndpointConnection", reflect.TypeOf((*MockInterface)(nil).DeletePrivateEndpointConnection), ctx, resourceGroupName, serviceName, peConnectionName) + return &MockInterfaceDeletePrivateEndpointConnectionCall{Call: call} +} + +// MockInterfaceDeletePrivateEndpointConnectionCall wrap *gomock.Call +type MockInterfaceDeletePrivateEndpointConnectionCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceDeletePrivateEndpointConnectionCall) Return(arg0 error) *MockInterfaceDeletePrivateEndpointConnectionCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceDeletePrivateEndpointConnectionCall) Do(f func(context.Context, string, string, string) error) *MockInterfaceDeletePrivateEndpointConnectionCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceDeletePrivateEndpointConnectionCall) DoAndReturn(f func(context.Context, string, string, string) error) *MockInterfaceDeletePrivateEndpointConnectionCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Get mocks base method. +func (m *MockInterface) Get(ctx context.Context, resourceGroupName, resourceName string, expand *string) (*armnetwork.PrivateLinkService, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", ctx, resourceGroupName, resourceName, expand) + ret0, _ := ret[0].(*armnetwork.PrivateLinkService) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, resourceName, expand any) *MockInterfaceGetCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, resourceName, expand) + return &MockInterfaceGetCall{Call: call} +} + +// MockInterfaceGetCall wrap *gomock.Call +type MockInterfaceGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetCall) Return(result *armnetwork.PrivateLinkService, rerr error) *MockInterfaceGetCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string, *string) (*armnetwork.PrivateLinkService, error)) *MockInterfaceGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string, *string) (*armnetwork.PrivateLinkService, error)) *MockInterfaceGetCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// List mocks base method. +func (m *MockInterface) List(ctx context.Context, resourceGroupName string) ([]*armnetwork.PrivateLinkService, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "List", ctx, resourceGroupName) + ret0, _ := ret[0].([]*armnetwork.PrivateLinkService) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// List indicates an expected call of List. +func (mr *MockInterfaceMockRecorder) List(ctx, resourceGroupName any) *MockInterfaceListCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockInterface)(nil).List), ctx, resourceGroupName) + return &MockInterfaceListCall{Call: call} +} + +// MockInterfaceListCall wrap *gomock.Call +type MockInterfaceListCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceListCall) Return(result []*armnetwork.PrivateLinkService, rerr error) *MockInterfaceListCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceListCall) Do(f func(context.Context, string) ([]*armnetwork.PrivateLinkService, error)) *MockInterfaceListCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceListCall) DoAndReturn(f func(context.Context, string) ([]*armnetwork.PrivateLinkService, error)) *MockInterfaceListCall { + c.Call = c.Call.DoAndReturn(f) + return c +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatezoneclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatezoneclient/interface_gomock.go new file mode 100644 index 0000000000..23609063f7 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatezoneclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package privatezoneclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatezoneclient/mock_privatezoneclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_privatezoneclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatezoneclient/mock_privatezoneclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatezoneclient/mock_privatezoneclient/interface.go index 6adaeeab59..a094705654 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatezoneclient/mock_privatezoneclient/interface.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatezoneclient/mock_privatezoneclient/interface.go @@ -20,7 +20,7 @@ // // Generated by this command: // -// mockgen -package mock_privatezoneclient -source privatezoneclient/interface.go -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt +// mockgen -package mock_privatezoneclient -source privatezoneclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt // // Package mock_privatezoneclient is a generated GoMock package. @@ -34,6 +34,8 @@ import ( gomock "go.uber.org/mock/gomock" ) +//go:generate mockgen -package mock_privatezoneclient -source privatezoneclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + // MockInterface is a mock of Interface interface. type MockInterface struct { ctrl *gomock.Controller @@ -68,9 +70,33 @@ func (m *MockInterface) CreateOrUpdate(ctx context.Context, resourceGroupName, r } // CreateOrUpdate indicates an expected call of CreateOrUpdate. -func (mr *MockInterfaceMockRecorder) CreateOrUpdate(ctx, resourceGroupName, resourceName, resourceParam any) *gomock.Call { +func (mr *MockInterfaceMockRecorder) CreateOrUpdate(ctx, resourceGroupName, resourceName, resourceParam any) *MockInterfaceCreateOrUpdateCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockInterface)(nil).CreateOrUpdate), ctx, resourceGroupName, resourceName, resourceParam) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockInterface)(nil).CreateOrUpdate), ctx, resourceGroupName, resourceName, resourceParam) + return &MockInterfaceCreateOrUpdateCall{Call: call} +} + +// MockInterfaceCreateOrUpdateCall wrap *gomock.Call +type MockInterfaceCreateOrUpdateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceCreateOrUpdateCall) Return(arg0 *armprivatedns.PrivateZone, arg1 error) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceCreateOrUpdateCall) Do(f func(context.Context, string, string, armprivatedns.PrivateZone) (*armprivatedns.PrivateZone, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceCreateOrUpdateCall) DoAndReturn(f func(context.Context, string, string, armprivatedns.PrivateZone) (*armprivatedns.PrivateZone, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.DoAndReturn(f) + return c } // Get mocks base method. @@ -83,7 +109,31 @@ func (m *MockInterface) Get(ctx context.Context, resourceGroupName, resourceName } // Get indicates an expected call of Get. -func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, resourceName any) *gomock.Call { +func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, resourceName any) *MockInterfaceGetCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, resourceName) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, resourceName) + return &MockInterfaceGetCall{Call: call} +} + +// MockInterfaceGetCall wrap *gomock.Call +type MockInterfaceGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetCall) Return(result *armprivatedns.PrivateZone, rerr error) *MockInterfaceGetCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string) (*armprivatedns.PrivateZone, error)) *MockInterfaceGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string) (*armprivatedns.PrivateZone, error)) *MockInterfaceGetCall { + c.Call = c.Call.DoAndReturn(f) + return c } diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/providerclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/providerclient/interface_gomock.go new file mode 100644 index 0000000000..2f0eb7eaed --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/providerclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package providerclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/providerclient/mock_providerclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_providerclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/providerclient/mock_providerclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/providerclient/mock_providerclient/interface.go new file mode 100644 index 0000000000..606008edf3 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/providerclient/mock_providerclient/interface.go @@ -0,0 +1,178 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ +// + +// Code generated by MockGen. DO NOT EDIT. +// Source: providerclient/interface.go +// +// Generated by this command: +// +// mockgen -package mock_providerclient -source providerclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt +// + +// Package mock_providerclient is a generated GoMock package. +package mock_providerclient + +import ( + context "context" + reflect "reflect" + + armresources "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" + gomock "go.uber.org/mock/gomock" +) + +//go:generate mockgen -package mock_providerclient -source providerclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + +// MockInterface is a mock of Interface interface. +type MockInterface struct { + ctrl *gomock.Controller + recorder *MockInterfaceMockRecorder + isgomock struct{} +} + +// MockInterfaceMockRecorder is the mock recorder for MockInterface. +type MockInterfaceMockRecorder struct { + mock *MockInterface +} + +// NewMockInterface creates a new mock instance. +func NewMockInterface(ctrl *gomock.Controller) *MockInterface { + mock := &MockInterface{ctrl: ctrl} + mock.recorder = &MockInterfaceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockInterface) EXPECT() *MockInterfaceMockRecorder { + return m.recorder +} + +// GetProvider mocks base method. +func (m *MockInterface) GetProvider(ctx context.Context, resourceProviderNamespace string) (*armresources.Provider, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetProvider", ctx, resourceProviderNamespace) + ret0, _ := ret[0].(*armresources.Provider) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetProvider indicates an expected call of GetProvider. +func (mr *MockInterfaceMockRecorder) GetProvider(ctx, resourceProviderNamespace any) *MockInterfaceGetProviderCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetProvider", reflect.TypeOf((*MockInterface)(nil).GetProvider), ctx, resourceProviderNamespace) + return &MockInterfaceGetProviderCall{Call: call} +} + +// MockInterfaceGetProviderCall wrap *gomock.Call +type MockInterfaceGetProviderCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetProviderCall) Return(arg0 *armresources.Provider, arg1 error) *MockInterfaceGetProviderCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetProviderCall) Do(f func(context.Context, string) (*armresources.Provider, error)) *MockInterfaceGetProviderCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetProviderCall) DoAndReturn(f func(context.Context, string) (*armresources.Provider, error)) *MockInterfaceGetProviderCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetVirtualMachineSupportedZones mocks base method. +func (m *MockInterface) GetVirtualMachineSupportedZones(ctx context.Context) (map[string][]*string, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetVirtualMachineSupportedZones", ctx) + ret0, _ := ret[0].(map[string][]*string) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetVirtualMachineSupportedZones indicates an expected call of GetVirtualMachineSupportedZones. +func (mr *MockInterfaceMockRecorder) GetVirtualMachineSupportedZones(ctx any) *MockInterfaceGetVirtualMachineSupportedZonesCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetVirtualMachineSupportedZones", reflect.TypeOf((*MockInterface)(nil).GetVirtualMachineSupportedZones), ctx) + return &MockInterfaceGetVirtualMachineSupportedZonesCall{Call: call} +} + +// MockInterfaceGetVirtualMachineSupportedZonesCall wrap *gomock.Call +type MockInterfaceGetVirtualMachineSupportedZonesCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetVirtualMachineSupportedZonesCall) Return(arg0 map[string][]*string, arg1 error) *MockInterfaceGetVirtualMachineSupportedZonesCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetVirtualMachineSupportedZonesCall) Do(f func(context.Context) (map[string][]*string, error)) *MockInterfaceGetVirtualMachineSupportedZonesCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetVirtualMachineSupportedZonesCall) DoAndReturn(f func(context.Context) (map[string][]*string, error)) *MockInterfaceGetVirtualMachineSupportedZonesCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ListProviders mocks base method. +func (m *MockInterface) ListProviders(ctx context.Context) ([]*armresources.Provider, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListProviders", ctx) + ret0, _ := ret[0].([]*armresources.Provider) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListProviders indicates an expected call of ListProviders. +func (mr *MockInterfaceMockRecorder) ListProviders(ctx any) *MockInterfaceListProvidersCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListProviders", reflect.TypeOf((*MockInterface)(nil).ListProviders), ctx) + return &MockInterfaceListProvidersCall{Call: call} +} + +// MockInterfaceListProvidersCall wrap *gomock.Call +type MockInterfaceListProvidersCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceListProvidersCall) Return(arg0 []*armresources.Provider, arg1 error) *MockInterfaceListProvidersCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceListProvidersCall) Do(f func(context.Context) ([]*armresources.Provider, error)) *MockInterfaceListProvidersCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceListProvidersCall) DoAndReturn(f func(context.Context) ([]*armresources.Provider, error)) *MockInterfaceListProvidersCall { + c.Call = c.Call.DoAndReturn(f) + return c +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipaddressclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipaddressclient/interface_gomock.go new file mode 100644 index 0000000000..80f936a119 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipaddressclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package publicipaddressclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipaddressclient/mock_publicipaddressclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_publicipaddressclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipaddressclient/mock_publicipaddressclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipaddressclient/mock_publicipaddressclient/interface.go new file mode 100644 index 0000000000..593ba718dd --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipaddressclient/mock_publicipaddressclient/interface.go @@ -0,0 +1,216 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ +// + +// Code generated by MockGen. DO NOT EDIT. +// Source: publicipaddressclient/interface.go +// +// Generated by this command: +// +// mockgen -package mock_publicipaddressclient -source publicipaddressclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt +// + +// Package mock_publicipaddressclient is a generated GoMock package. +package mock_publicipaddressclient + +import ( + context "context" + reflect "reflect" + + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" + gomock "go.uber.org/mock/gomock" +) + +//go:generate mockgen -package mock_publicipaddressclient -source publicipaddressclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + +// MockInterface is a mock of Interface interface. +type MockInterface struct { + ctrl *gomock.Controller + recorder *MockInterfaceMockRecorder + isgomock struct{} +} + +// MockInterfaceMockRecorder is the mock recorder for MockInterface. +type MockInterfaceMockRecorder struct { + mock *MockInterface +} + +// NewMockInterface creates a new mock instance. +func NewMockInterface(ctrl *gomock.Controller) *MockInterface { + mock := &MockInterface{ctrl: ctrl} + mock.recorder = &MockInterfaceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockInterface) EXPECT() *MockInterfaceMockRecorder { + return m.recorder +} + +// CreateOrUpdate mocks base method. +func (m *MockInterface) CreateOrUpdate(ctx context.Context, resourceGroupName, resourceName string, resourceParam armnetwork.PublicIPAddress) (*armnetwork.PublicIPAddress, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateOrUpdate", ctx, resourceGroupName, resourceName, resourceParam) + ret0, _ := ret[0].(*armnetwork.PublicIPAddress) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateOrUpdate indicates an expected call of CreateOrUpdate. +func (mr *MockInterfaceMockRecorder) CreateOrUpdate(ctx, resourceGroupName, resourceName, resourceParam any) *MockInterfaceCreateOrUpdateCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockInterface)(nil).CreateOrUpdate), ctx, resourceGroupName, resourceName, resourceParam) + return &MockInterfaceCreateOrUpdateCall{Call: call} +} + +// MockInterfaceCreateOrUpdateCall wrap *gomock.Call +type MockInterfaceCreateOrUpdateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceCreateOrUpdateCall) Return(arg0 *armnetwork.PublicIPAddress, arg1 error) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceCreateOrUpdateCall) Do(f func(context.Context, string, string, armnetwork.PublicIPAddress) (*armnetwork.PublicIPAddress, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceCreateOrUpdateCall) DoAndReturn(f func(context.Context, string, string, armnetwork.PublicIPAddress) (*armnetwork.PublicIPAddress, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Delete mocks base method. +func (m *MockInterface) Delete(ctx context.Context, resourceGroupName, resourceName string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", ctx, resourceGroupName, resourceName) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete. +func (mr *MockInterfaceMockRecorder) Delete(ctx, resourceGroupName, resourceName any) *MockInterfaceDeleteCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockInterface)(nil).Delete), ctx, resourceGroupName, resourceName) + return &MockInterfaceDeleteCall{Call: call} +} + +// MockInterfaceDeleteCall wrap *gomock.Call +type MockInterfaceDeleteCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceDeleteCall) Return(arg0 error) *MockInterfaceDeleteCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceDeleteCall) Do(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceDeleteCall) DoAndReturn(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Get mocks base method. +func (m *MockInterface) Get(ctx context.Context, resourceGroupName, resourceName string, expand *string) (*armnetwork.PublicIPAddress, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", ctx, resourceGroupName, resourceName, expand) + ret0, _ := ret[0].(*armnetwork.PublicIPAddress) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, resourceName, expand any) *MockInterfaceGetCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, resourceName, expand) + return &MockInterfaceGetCall{Call: call} +} + +// MockInterfaceGetCall wrap *gomock.Call +type MockInterfaceGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetCall) Return(result *armnetwork.PublicIPAddress, rerr error) *MockInterfaceGetCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string, *string) (*armnetwork.PublicIPAddress, error)) *MockInterfaceGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string, *string) (*armnetwork.PublicIPAddress, error)) *MockInterfaceGetCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// List mocks base method. +func (m *MockInterface) List(ctx context.Context, resourceGroupName string) ([]*armnetwork.PublicIPAddress, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "List", ctx, resourceGroupName) + ret0, _ := ret[0].([]*armnetwork.PublicIPAddress) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// List indicates an expected call of List. +func (mr *MockInterfaceMockRecorder) List(ctx, resourceGroupName any) *MockInterfaceListCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockInterface)(nil).List), ctx, resourceGroupName) + return &MockInterfaceListCall{Call: call} +} + +// MockInterfaceListCall wrap *gomock.Call +type MockInterfaceListCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceListCall) Return(result []*armnetwork.PublicIPAddress, rerr error) *MockInterfaceListCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceListCall) Do(f func(context.Context, string) ([]*armnetwork.PublicIPAddress, error)) *MockInterfaceListCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceListCall) DoAndReturn(f func(context.Context, string) ([]*armnetwork.PublicIPAddress, error)) *MockInterfaceListCall { + c.Call = c.Call.DoAndReturn(f) + return c +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipprefixclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipprefixclient/interface_gomock.go new file mode 100644 index 0000000000..7574354976 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipprefixclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package publicipprefixclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipprefixclient/mock_publicipprefixclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_publicipprefixclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipprefixclient/mock_publicipprefixclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipprefixclient/mock_publicipprefixclient/interface.go new file mode 100644 index 0000000000..268b806a66 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipprefixclient/mock_publicipprefixclient/interface.go @@ -0,0 +1,216 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ +// + +// Code generated by MockGen. DO NOT EDIT. +// Source: publicipprefixclient/interface.go +// +// Generated by this command: +// +// mockgen -package mock_publicipprefixclient -source publicipprefixclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt +// + +// Package mock_publicipprefixclient is a generated GoMock package. +package mock_publicipprefixclient + +import ( + context "context" + reflect "reflect" + + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" + gomock "go.uber.org/mock/gomock" +) + +//go:generate mockgen -package mock_publicipprefixclient -source publicipprefixclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + +// MockInterface is a mock of Interface interface. +type MockInterface struct { + ctrl *gomock.Controller + recorder *MockInterfaceMockRecorder + isgomock struct{} +} + +// MockInterfaceMockRecorder is the mock recorder for MockInterface. +type MockInterfaceMockRecorder struct { + mock *MockInterface +} + +// NewMockInterface creates a new mock instance. +func NewMockInterface(ctrl *gomock.Controller) *MockInterface { + mock := &MockInterface{ctrl: ctrl} + mock.recorder = &MockInterfaceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockInterface) EXPECT() *MockInterfaceMockRecorder { + return m.recorder +} + +// CreateOrUpdate mocks base method. +func (m *MockInterface) CreateOrUpdate(ctx context.Context, resourceGroupName, resourceName string, resourceParam armnetwork.PublicIPPrefix) (*armnetwork.PublicIPPrefix, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateOrUpdate", ctx, resourceGroupName, resourceName, resourceParam) + ret0, _ := ret[0].(*armnetwork.PublicIPPrefix) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateOrUpdate indicates an expected call of CreateOrUpdate. +func (mr *MockInterfaceMockRecorder) CreateOrUpdate(ctx, resourceGroupName, resourceName, resourceParam any) *MockInterfaceCreateOrUpdateCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockInterface)(nil).CreateOrUpdate), ctx, resourceGroupName, resourceName, resourceParam) + return &MockInterfaceCreateOrUpdateCall{Call: call} +} + +// MockInterfaceCreateOrUpdateCall wrap *gomock.Call +type MockInterfaceCreateOrUpdateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceCreateOrUpdateCall) Return(arg0 *armnetwork.PublicIPPrefix, arg1 error) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceCreateOrUpdateCall) Do(f func(context.Context, string, string, armnetwork.PublicIPPrefix) (*armnetwork.PublicIPPrefix, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceCreateOrUpdateCall) DoAndReturn(f func(context.Context, string, string, armnetwork.PublicIPPrefix) (*armnetwork.PublicIPPrefix, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Delete mocks base method. +func (m *MockInterface) Delete(ctx context.Context, resourceGroupName, resourceName string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", ctx, resourceGroupName, resourceName) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete. +func (mr *MockInterfaceMockRecorder) Delete(ctx, resourceGroupName, resourceName any) *MockInterfaceDeleteCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockInterface)(nil).Delete), ctx, resourceGroupName, resourceName) + return &MockInterfaceDeleteCall{Call: call} +} + +// MockInterfaceDeleteCall wrap *gomock.Call +type MockInterfaceDeleteCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceDeleteCall) Return(arg0 error) *MockInterfaceDeleteCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceDeleteCall) Do(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceDeleteCall) DoAndReturn(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Get mocks base method. +func (m *MockInterface) Get(ctx context.Context, resourceGroupName, resourceName string, expand *string) (*armnetwork.PublicIPPrefix, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", ctx, resourceGroupName, resourceName, expand) + ret0, _ := ret[0].(*armnetwork.PublicIPPrefix) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, resourceName, expand any) *MockInterfaceGetCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, resourceName, expand) + return &MockInterfaceGetCall{Call: call} +} + +// MockInterfaceGetCall wrap *gomock.Call +type MockInterfaceGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetCall) Return(result *armnetwork.PublicIPPrefix, rerr error) *MockInterfaceGetCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string, *string) (*armnetwork.PublicIPPrefix, error)) *MockInterfaceGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string, *string) (*armnetwork.PublicIPPrefix, error)) *MockInterfaceGetCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// List mocks base method. +func (m *MockInterface) List(ctx context.Context, resourceGroupName string) ([]*armnetwork.PublicIPPrefix, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "List", ctx, resourceGroupName) + ret0, _ := ret[0].([]*armnetwork.PublicIPPrefix) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// List indicates an expected call of List. +func (mr *MockInterfaceMockRecorder) List(ctx, resourceGroupName any) *MockInterfaceListCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockInterface)(nil).List), ctx, resourceGroupName) + return &MockInterfaceListCall{Call: call} +} + +// MockInterfaceListCall wrap *gomock.Call +type MockInterfaceListCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceListCall) Return(result []*armnetwork.PublicIPPrefix, rerr error) *MockInterfaceListCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceListCall) Do(f func(context.Context, string) ([]*armnetwork.PublicIPPrefix, error)) *MockInterfaceListCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceListCall) DoAndReturn(f func(context.Context, string) ([]*armnetwork.PublicIPPrefix, error)) *MockInterfaceListCall { + c.Call = c.Call.DoAndReturn(f) + return c +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/registryclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/registryclient/interface_gomock.go new file mode 100644 index 0000000000..ff776271ab --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/registryclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package registryclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/registryclient/mock_registryclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_registryclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/registryclient/mock_registryclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/registryclient/mock_registryclient/interface.go new file mode 100644 index 0000000000..2a0b448ba5 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/registryclient/mock_registryclient/interface.go @@ -0,0 +1,254 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ +// + +// Code generated by MockGen. DO NOT EDIT. +// Source: registryclient/interface.go +// +// Generated by this command: +// +// mockgen -package mock_registryclient -source registryclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt +// + +// Package mock_registryclient is a generated GoMock package. +package mock_registryclient + +import ( + context "context" + reflect "reflect" + + armcontainerregistry "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry" + gomock "go.uber.org/mock/gomock" +) + +//go:generate mockgen -package mock_registryclient -source registryclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + +// MockInterface is a mock of Interface interface. +type MockInterface struct { + ctrl *gomock.Controller + recorder *MockInterfaceMockRecorder + isgomock struct{} +} + +// MockInterfaceMockRecorder is the mock recorder for MockInterface. +type MockInterfaceMockRecorder struct { + mock *MockInterface +} + +// NewMockInterface creates a new mock instance. +func NewMockInterface(ctrl *gomock.Controller) *MockInterface { + mock := &MockInterface{ctrl: ctrl} + mock.recorder = &MockInterfaceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockInterface) EXPECT() *MockInterfaceMockRecorder { + return m.recorder +} + +// Create mocks base method. +func (m *MockInterface) Create(ctx context.Context, resourceGroupName, resourceName string, resourceParam armcontainerregistry.Registry) (*armcontainerregistry.Registry, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Create", ctx, resourceGroupName, resourceName, resourceParam) + ret0, _ := ret[0].(*armcontainerregistry.Registry) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Create indicates an expected call of Create. +func (mr *MockInterfaceMockRecorder) Create(ctx, resourceGroupName, resourceName, resourceParam any) *MockInterfaceCreateCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockInterface)(nil).Create), ctx, resourceGroupName, resourceName, resourceParam) + return &MockInterfaceCreateCall{Call: call} +} + +// MockInterfaceCreateCall wrap *gomock.Call +type MockInterfaceCreateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceCreateCall) Return(arg0 *armcontainerregistry.Registry, arg1 error) *MockInterfaceCreateCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceCreateCall) Do(f func(context.Context, string, string, armcontainerregistry.Registry) (*armcontainerregistry.Registry, error)) *MockInterfaceCreateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceCreateCall) DoAndReturn(f func(context.Context, string, string, armcontainerregistry.Registry) (*armcontainerregistry.Registry, error)) *MockInterfaceCreateCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Delete mocks base method. +func (m *MockInterface) Delete(ctx context.Context, resourceGroupName, resourceName string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", ctx, resourceGroupName, resourceName) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete. +func (mr *MockInterfaceMockRecorder) Delete(ctx, resourceGroupName, resourceName any) *MockInterfaceDeleteCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockInterface)(nil).Delete), ctx, resourceGroupName, resourceName) + return &MockInterfaceDeleteCall{Call: call} +} + +// MockInterfaceDeleteCall wrap *gomock.Call +type MockInterfaceDeleteCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceDeleteCall) Return(arg0 error) *MockInterfaceDeleteCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceDeleteCall) Do(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceDeleteCall) DoAndReturn(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Get mocks base method. +func (m *MockInterface) Get(ctx context.Context, resourceGroupName, resourceName string) (*armcontainerregistry.Registry, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", ctx, resourceGroupName, resourceName) + ret0, _ := ret[0].(*armcontainerregistry.Registry) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, resourceName any) *MockInterfaceGetCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, resourceName) + return &MockInterfaceGetCall{Call: call} +} + +// MockInterfaceGetCall wrap *gomock.Call +type MockInterfaceGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetCall) Return(result *armcontainerregistry.Registry, rerr error) *MockInterfaceGetCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string) (*armcontainerregistry.Registry, error)) *MockInterfaceGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string) (*armcontainerregistry.Registry, error)) *MockInterfaceGetCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ImportImage mocks base method. +func (m *MockInterface) ImportImage(ctx context.Context, resourceGroup, resourceName string, param armcontainerregistry.ImportImageParameters) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ImportImage", ctx, resourceGroup, resourceName, param) + ret0, _ := ret[0].(error) + return ret0 +} + +// ImportImage indicates an expected call of ImportImage. +func (mr *MockInterfaceMockRecorder) ImportImage(ctx, resourceGroup, resourceName, param any) *MockInterfaceImportImageCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ImportImage", reflect.TypeOf((*MockInterface)(nil).ImportImage), ctx, resourceGroup, resourceName, param) + return &MockInterfaceImportImageCall{Call: call} +} + +// MockInterfaceImportImageCall wrap *gomock.Call +type MockInterfaceImportImageCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceImportImageCall) Return(arg0 error) *MockInterfaceImportImageCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceImportImageCall) Do(f func(context.Context, string, string, armcontainerregistry.ImportImageParameters) error) *MockInterfaceImportImageCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceImportImageCall) DoAndReturn(f func(context.Context, string, string, armcontainerregistry.ImportImageParameters) error) *MockInterfaceImportImageCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// List mocks base method. +func (m *MockInterface) List(ctx context.Context, resourceGroupName string) ([]*armcontainerregistry.Registry, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "List", ctx, resourceGroupName) + ret0, _ := ret[0].([]*armcontainerregistry.Registry) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// List indicates an expected call of List. +func (mr *MockInterfaceMockRecorder) List(ctx, resourceGroupName any) *MockInterfaceListCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockInterface)(nil).List), ctx, resourceGroupName) + return &MockInterfaceListCall{Call: call} +} + +// MockInterfaceListCall wrap *gomock.Call +type MockInterfaceListCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceListCall) Return(result []*armcontainerregistry.Registry, rerr error) *MockInterfaceListCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceListCall) Do(f func(context.Context, string) ([]*armcontainerregistry.Registry, error)) *MockInterfaceListCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceListCall) DoAndReturn(f func(context.Context, string) ([]*armcontainerregistry.Registry, error)) *MockInterfaceListCall { + c.Call = c.Call.DoAndReturn(f) + return c +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/resourcegroupclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/resourcegroupclient/interface_gomock.go new file mode 100644 index 0000000000..6ab6ad89b8 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/resourcegroupclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package resourcegroupclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/resourcegroupclient/mock_resourcegroupclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_resourcegroupclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/resourcegroupclient/mock_resourcegroupclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/resourcegroupclient/mock_resourcegroupclient/interface.go new file mode 100644 index 0000000000..ca3f296f8c --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/resourcegroupclient/mock_resourcegroupclient/interface.go @@ -0,0 +1,216 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ +// + +// Code generated by MockGen. DO NOT EDIT. +// Source: resourcegroupclient/interface.go +// +// Generated by this command: +// +// mockgen -package mock_resourcegroupclient -source resourcegroupclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt +// + +// Package mock_resourcegroupclient is a generated GoMock package. +package mock_resourcegroupclient + +import ( + context "context" + reflect "reflect" + + armresources "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" + gomock "go.uber.org/mock/gomock" +) + +//go:generate mockgen -package mock_resourcegroupclient -source resourcegroupclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + +// MockInterface is a mock of Interface interface. +type MockInterface struct { + ctrl *gomock.Controller + recorder *MockInterfaceMockRecorder + isgomock struct{} +} + +// MockInterfaceMockRecorder is the mock recorder for MockInterface. +type MockInterfaceMockRecorder struct { + mock *MockInterface +} + +// NewMockInterface creates a new mock instance. +func NewMockInterface(ctrl *gomock.Controller) *MockInterface { + mock := &MockInterface{ctrl: ctrl} + mock.recorder = &MockInterfaceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockInterface) EXPECT() *MockInterfaceMockRecorder { + return m.recorder +} + +// CreateOrUpdate mocks base method. +func (m *MockInterface) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceParam armresources.ResourceGroup) (*armresources.ResourceGroup, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateOrUpdate", ctx, resourceGroupName, resourceParam) + ret0, _ := ret[0].(*armresources.ResourceGroup) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateOrUpdate indicates an expected call of CreateOrUpdate. +func (mr *MockInterfaceMockRecorder) CreateOrUpdate(ctx, resourceGroupName, resourceParam any) *MockInterfaceCreateOrUpdateCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockInterface)(nil).CreateOrUpdate), ctx, resourceGroupName, resourceParam) + return &MockInterfaceCreateOrUpdateCall{Call: call} +} + +// MockInterfaceCreateOrUpdateCall wrap *gomock.Call +type MockInterfaceCreateOrUpdateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceCreateOrUpdateCall) Return(arg0 *armresources.ResourceGroup, arg1 error) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceCreateOrUpdateCall) Do(f func(context.Context, string, armresources.ResourceGroup) (*armresources.ResourceGroup, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceCreateOrUpdateCall) DoAndReturn(f func(context.Context, string, armresources.ResourceGroup) (*armresources.ResourceGroup, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Delete mocks base method. +func (m *MockInterface) Delete(ctx context.Context, resourceGroupName string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", ctx, resourceGroupName) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete. +func (mr *MockInterfaceMockRecorder) Delete(ctx, resourceGroupName any) *MockInterfaceDeleteCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockInterface)(nil).Delete), ctx, resourceGroupName) + return &MockInterfaceDeleteCall{Call: call} +} + +// MockInterfaceDeleteCall wrap *gomock.Call +type MockInterfaceDeleteCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceDeleteCall) Return(arg0 error) *MockInterfaceDeleteCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceDeleteCall) Do(f func(context.Context, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceDeleteCall) DoAndReturn(f func(context.Context, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Get mocks base method. +func (m *MockInterface) Get(ctx context.Context, resourceGroupName string) (*armresources.ResourceGroup, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", ctx, resourceGroupName) + ret0, _ := ret[0].(*armresources.ResourceGroup) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName any) *MockInterfaceGetCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName) + return &MockInterfaceGetCall{Call: call} +} + +// MockInterfaceGetCall wrap *gomock.Call +type MockInterfaceGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetCall) Return(result *armresources.ResourceGroup, rerr error) *MockInterfaceGetCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetCall) Do(f func(context.Context, string) (*armresources.ResourceGroup, error)) *MockInterfaceGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string) (*armresources.ResourceGroup, error)) *MockInterfaceGetCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// List mocks base method. +func (m *MockInterface) List(ctx context.Context) ([]*armresources.ResourceGroup, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "List", ctx) + ret0, _ := ret[0].([]*armresources.ResourceGroup) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// List indicates an expected call of List. +func (mr *MockInterfaceMockRecorder) List(ctx any) *MockInterfaceListCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockInterface)(nil).List), ctx) + return &MockInterfaceListCall{Call: call} +} + +// MockInterfaceListCall wrap *gomock.Call +type MockInterfaceListCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceListCall) Return(result []*armresources.ResourceGroup, rerr error) *MockInterfaceListCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceListCall) Do(f func(context.Context) ([]*armresources.ResourceGroup, error)) *MockInterfaceListCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceListCall) DoAndReturn(f func(context.Context) ([]*armresources.ResourceGroup, error)) *MockInterfaceListCall { + c.Call = c.Call.DoAndReturn(f) + return c +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/roleassignmentclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/roleassignmentclient/interface_gomock.go new file mode 100644 index 0000000000..80f01eeb72 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/roleassignmentclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package roleassignmentclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/roleassignmentclient/mock_roleassignmentclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_roleassignmentclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/roleassignmentclient/mock_roleassignmentclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/roleassignmentclient/mock_roleassignmentclient/interface.go new file mode 100644 index 0000000000..598b473b82 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/roleassignmentclient/mock_roleassignmentclient/interface.go @@ -0,0 +1,178 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ +// + +// Code generated by MockGen. DO NOT EDIT. +// Source: roleassignmentclient/interface.go +// +// Generated by this command: +// +// mockgen -package mock_roleassignmentclient -source roleassignmentclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt +// + +// Package mock_roleassignmentclient is a generated GoMock package. +package mock_roleassignmentclient + +import ( + context "context" + reflect "reflect" + + armauthorization "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" + gomock "go.uber.org/mock/gomock" +) + +//go:generate mockgen -package mock_roleassignmentclient -source roleassignmentclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + +// MockInterface is a mock of Interface interface. +type MockInterface struct { + ctrl *gomock.Controller + recorder *MockInterfaceMockRecorder + isgomock struct{} +} + +// MockInterfaceMockRecorder is the mock recorder for MockInterface. +type MockInterfaceMockRecorder struct { + mock *MockInterface +} + +// NewMockInterface creates a new mock instance. +func NewMockInterface(ctrl *gomock.Controller) *MockInterface { + mock := &MockInterface{ctrl: ctrl} + mock.recorder = &MockInterfaceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockInterface) EXPECT() *MockInterfaceMockRecorder { + return m.recorder +} + +// Create mocks base method. +func (m *MockInterface) Create(ctx context.Context, scope, roleAssignmentName string, parameters armauthorization.RoleAssignmentCreateParameters) (*armauthorization.RoleAssignment, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Create", ctx, scope, roleAssignmentName, parameters) + ret0, _ := ret[0].(*armauthorization.RoleAssignment) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Create indicates an expected call of Create. +func (mr *MockInterfaceMockRecorder) Create(ctx, scope, roleAssignmentName, parameters any) *MockInterfaceCreateCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockInterface)(nil).Create), ctx, scope, roleAssignmentName, parameters) + return &MockInterfaceCreateCall{Call: call} +} + +// MockInterfaceCreateCall wrap *gomock.Call +type MockInterfaceCreateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceCreateCall) Return(arg0 *armauthorization.RoleAssignment, arg1 error) *MockInterfaceCreateCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceCreateCall) Do(f func(context.Context, string, string, armauthorization.RoleAssignmentCreateParameters) (*armauthorization.RoleAssignment, error)) *MockInterfaceCreateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceCreateCall) DoAndReturn(f func(context.Context, string, string, armauthorization.RoleAssignmentCreateParameters) (*armauthorization.RoleAssignment, error)) *MockInterfaceCreateCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Delete mocks base method. +func (m *MockInterface) Delete(ctx context.Context, scope, roleAssignmentName string, options *armauthorization.RoleAssignmentsClientDeleteOptions) (*armauthorization.RoleAssignment, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", ctx, scope, roleAssignmentName, options) + ret0, _ := ret[0].(*armauthorization.RoleAssignment) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Delete indicates an expected call of Delete. +func (mr *MockInterfaceMockRecorder) Delete(ctx, scope, roleAssignmentName, options any) *MockInterfaceDeleteCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockInterface)(nil).Delete), ctx, scope, roleAssignmentName, options) + return &MockInterfaceDeleteCall{Call: call} +} + +// MockInterfaceDeleteCall wrap *gomock.Call +type MockInterfaceDeleteCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceDeleteCall) Return(arg0 *armauthorization.RoleAssignment, arg1 error) *MockInterfaceDeleteCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceDeleteCall) Do(f func(context.Context, string, string, *armauthorization.RoleAssignmentsClientDeleteOptions) (*armauthorization.RoleAssignment, error)) *MockInterfaceDeleteCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceDeleteCall) DoAndReturn(f func(context.Context, string, string, *armauthorization.RoleAssignmentsClientDeleteOptions) (*armauthorization.RoleAssignment, error)) *MockInterfaceDeleteCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Get mocks base method. +func (m *MockInterface) Get(ctx context.Context, scope, roleAssignmentName string, options *armauthorization.RoleAssignmentsClientGetOptions) (*armauthorization.RoleAssignment, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", ctx, scope, roleAssignmentName, options) + ret0, _ := ret[0].(*armauthorization.RoleAssignment) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockInterfaceMockRecorder) Get(ctx, scope, roleAssignmentName, options any) *MockInterfaceGetCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, scope, roleAssignmentName, options) + return &MockInterfaceGetCall{Call: call} +} + +// MockInterfaceGetCall wrap *gomock.Call +type MockInterfaceGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetCall) Return(arg0 *armauthorization.RoleAssignment, arg1 error) *MockInterfaceGetCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string, *armauthorization.RoleAssignmentsClientGetOptions) (*armauthorization.RoleAssignment, error)) *MockInterfaceGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string, *armauthorization.RoleAssignmentsClientGetOptions) (*armauthorization.RoleAssignment, error)) *MockInterfaceGetCall { + c.Call = c.Call.DoAndReturn(f) + return c +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/routetableclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/routetableclient/interface_gomock.go new file mode 100644 index 0000000000..3b71ff5363 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/routetableclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package routetableclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/routetableclient/mock_routetableclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_routetableclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/routetableclient/mock_routetableclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/routetableclient/mock_routetableclient/interface.go new file mode 100644 index 0000000000..2d592c0850 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/routetableclient/mock_routetableclient/interface.go @@ -0,0 +1,216 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ +// + +// Code generated by MockGen. DO NOT EDIT. +// Source: routetableclient/interface.go +// +// Generated by this command: +// +// mockgen -package mock_routetableclient -source routetableclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt +// + +// Package mock_routetableclient is a generated GoMock package. +package mock_routetableclient + +import ( + context "context" + reflect "reflect" + + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" + gomock "go.uber.org/mock/gomock" +) + +//go:generate mockgen -package mock_routetableclient -source routetableclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + +// MockInterface is a mock of Interface interface. +type MockInterface struct { + ctrl *gomock.Controller + recorder *MockInterfaceMockRecorder + isgomock struct{} +} + +// MockInterfaceMockRecorder is the mock recorder for MockInterface. +type MockInterfaceMockRecorder struct { + mock *MockInterface +} + +// NewMockInterface creates a new mock instance. +func NewMockInterface(ctrl *gomock.Controller) *MockInterface { + mock := &MockInterface{ctrl: ctrl} + mock.recorder = &MockInterfaceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockInterface) EXPECT() *MockInterfaceMockRecorder { + return m.recorder +} + +// CreateOrUpdate mocks base method. +func (m *MockInterface) CreateOrUpdate(ctx context.Context, resourceGroupName, resourceName string, resourceParam armnetwork.RouteTable) (*armnetwork.RouteTable, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateOrUpdate", ctx, resourceGroupName, resourceName, resourceParam) + ret0, _ := ret[0].(*armnetwork.RouteTable) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateOrUpdate indicates an expected call of CreateOrUpdate. +func (mr *MockInterfaceMockRecorder) CreateOrUpdate(ctx, resourceGroupName, resourceName, resourceParam any) *MockInterfaceCreateOrUpdateCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockInterface)(nil).CreateOrUpdate), ctx, resourceGroupName, resourceName, resourceParam) + return &MockInterfaceCreateOrUpdateCall{Call: call} +} + +// MockInterfaceCreateOrUpdateCall wrap *gomock.Call +type MockInterfaceCreateOrUpdateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceCreateOrUpdateCall) Return(arg0 *armnetwork.RouteTable, arg1 error) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceCreateOrUpdateCall) Do(f func(context.Context, string, string, armnetwork.RouteTable) (*armnetwork.RouteTable, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceCreateOrUpdateCall) DoAndReturn(f func(context.Context, string, string, armnetwork.RouteTable) (*armnetwork.RouteTable, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Delete mocks base method. +func (m *MockInterface) Delete(ctx context.Context, resourceGroupName, resourceName string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", ctx, resourceGroupName, resourceName) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete. +func (mr *MockInterfaceMockRecorder) Delete(ctx, resourceGroupName, resourceName any) *MockInterfaceDeleteCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockInterface)(nil).Delete), ctx, resourceGroupName, resourceName) + return &MockInterfaceDeleteCall{Call: call} +} + +// MockInterfaceDeleteCall wrap *gomock.Call +type MockInterfaceDeleteCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceDeleteCall) Return(arg0 error) *MockInterfaceDeleteCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceDeleteCall) Do(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceDeleteCall) DoAndReturn(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Get mocks base method. +func (m *MockInterface) Get(ctx context.Context, resourceGroupName, resourceName string) (*armnetwork.RouteTable, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", ctx, resourceGroupName, resourceName) + ret0, _ := ret[0].(*armnetwork.RouteTable) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, resourceName any) *MockInterfaceGetCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, resourceName) + return &MockInterfaceGetCall{Call: call} +} + +// MockInterfaceGetCall wrap *gomock.Call +type MockInterfaceGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetCall) Return(result *armnetwork.RouteTable, rerr error) *MockInterfaceGetCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string) (*armnetwork.RouteTable, error)) *MockInterfaceGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string) (*armnetwork.RouteTable, error)) *MockInterfaceGetCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// List mocks base method. +func (m *MockInterface) List(ctx context.Context, resourceGroupName string) ([]*armnetwork.RouteTable, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "List", ctx, resourceGroupName) + ret0, _ := ret[0].([]*armnetwork.RouteTable) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// List indicates an expected call of List. +func (mr *MockInterfaceMockRecorder) List(ctx, resourceGroupName any) *MockInterfaceListCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockInterface)(nil).List), ctx, resourceGroupName) + return &MockInterfaceListCall{Call: call} +} + +// MockInterfaceListCall wrap *gomock.Call +type MockInterfaceListCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceListCall) Return(result []*armnetwork.RouteTable, rerr error) *MockInterfaceListCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceListCall) Do(f func(context.Context, string) ([]*armnetwork.RouteTable, error)) *MockInterfaceListCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceListCall) DoAndReturn(f func(context.Context, string) ([]*armnetwork.RouteTable, error)) *MockInterfaceListCall { + c.Call = c.Call.DoAndReturn(f) + return c +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/secretclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/secretclient/interface_gomock.go new file mode 100644 index 0000000000..30663b1e4e --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/secretclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package secretclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/secretclient/mock_secretclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_secretclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/secretclient/mock_secretclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/secretclient/mock_secretclient/interface.go new file mode 100644 index 0000000000..47cde41910 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/secretclient/mock_secretclient/interface.go @@ -0,0 +1,178 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ +// + +// Code generated by MockGen. DO NOT EDIT. +// Source: secretclient/interface.go +// +// Generated by this command: +// +// mockgen -package mock_secretclient -source secretclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt +// + +// Package mock_secretclient is a generated GoMock package. +package mock_secretclient + +import ( + context "context" + reflect "reflect" + + armkeyvault "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault" + gomock "go.uber.org/mock/gomock" +) + +//go:generate mockgen -package mock_secretclient -source secretclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + +// MockInterface is a mock of Interface interface. +type MockInterface struct { + ctrl *gomock.Controller + recorder *MockInterfaceMockRecorder + isgomock struct{} +} + +// MockInterfaceMockRecorder is the mock recorder for MockInterface. +type MockInterfaceMockRecorder struct { + mock *MockInterface +} + +// NewMockInterface creates a new mock instance. +func NewMockInterface(ctrl *gomock.Controller) *MockInterface { + mock := &MockInterface{ctrl: ctrl} + mock.recorder = &MockInterfaceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockInterface) EXPECT() *MockInterfaceMockRecorder { + return m.recorder +} + +// CreateOrUpdate mocks base method. +func (m *MockInterface) CreateOrUpdate(ctx context.Context, resourceGroupName, resourceName, parentResourceName string, resource armkeyvault.SecretCreateOrUpdateParameters) (*armkeyvault.Secret, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateOrUpdate", ctx, resourceGroupName, resourceName, parentResourceName, resource) + ret0, _ := ret[0].(*armkeyvault.Secret) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateOrUpdate indicates an expected call of CreateOrUpdate. +func (mr *MockInterfaceMockRecorder) CreateOrUpdate(ctx, resourceGroupName, resourceName, parentResourceName, resource any) *MockInterfaceCreateOrUpdateCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockInterface)(nil).CreateOrUpdate), ctx, resourceGroupName, resourceName, parentResourceName, resource) + return &MockInterfaceCreateOrUpdateCall{Call: call} +} + +// MockInterfaceCreateOrUpdateCall wrap *gomock.Call +type MockInterfaceCreateOrUpdateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceCreateOrUpdateCall) Return(arg0 *armkeyvault.Secret, arg1 error) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceCreateOrUpdateCall) Do(f func(context.Context, string, string, string, armkeyvault.SecretCreateOrUpdateParameters) (*armkeyvault.Secret, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceCreateOrUpdateCall) DoAndReturn(f func(context.Context, string, string, string, armkeyvault.SecretCreateOrUpdateParameters) (*armkeyvault.Secret, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Get mocks base method. +func (m *MockInterface) Get(ctx context.Context, resourceGroupName, parentResourceName, resourceName string) (*armkeyvault.Secret, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", ctx, resourceGroupName, parentResourceName, resourceName) + ret0, _ := ret[0].(*armkeyvault.Secret) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, parentResourceName, resourceName any) *MockInterfaceGetCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, parentResourceName, resourceName) + return &MockInterfaceGetCall{Call: call} +} + +// MockInterfaceGetCall wrap *gomock.Call +type MockInterfaceGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetCall) Return(result *armkeyvault.Secret, rerr error) *MockInterfaceGetCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string, string) (*armkeyvault.Secret, error)) *MockInterfaceGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string, string) (*armkeyvault.Secret, error)) *MockInterfaceGetCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// List mocks base method. +func (m *MockInterface) List(ctx context.Context, resourceGroupName, parentResourceName string) ([]*armkeyvault.Secret, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "List", ctx, resourceGroupName, parentResourceName) + ret0, _ := ret[0].([]*armkeyvault.Secret) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// List indicates an expected call of List. +func (mr *MockInterfaceMockRecorder) List(ctx, resourceGroupName, parentResourceName any) *MockInterfaceListCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockInterface)(nil).List), ctx, resourceGroupName, parentResourceName) + return &MockInterfaceListCall{Call: call} +} + +// MockInterfaceListCall wrap *gomock.Call +type MockInterfaceListCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceListCall) Return(result []*armkeyvault.Secret, rerr error) *MockInterfaceListCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceListCall) Do(f func(context.Context, string, string) ([]*armkeyvault.Secret, error)) *MockInterfaceListCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceListCall) DoAndReturn(f func(context.Context, string, string) ([]*armkeyvault.Secret, error)) *MockInterfaceListCall { + c.Call = c.Call.DoAndReturn(f) + return c +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/securitygroupclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/securitygroupclient/interface_gomock.go new file mode 100644 index 0000000000..ac36fe6a19 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/securitygroupclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package securitygroupclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/securitygroupclient/mock_securitygroupclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_securitygroupclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/securitygroupclient/mock_securitygroupclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/securitygroupclient/mock_securitygroupclient/interface.go index a9d719f7ad..41d0354af5 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/securitygroupclient/mock_securitygroupclient/interface.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/securitygroupclient/mock_securitygroupclient/interface.go @@ -20,7 +20,7 @@ // // Generated by this command: // -// mockgen -package mock_securitygroupclient -source securitygroupclient/interface.go -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt +// mockgen -package mock_securitygroupclient -source securitygroupclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt // // Package mock_securitygroupclient is a generated GoMock package. @@ -34,6 +34,8 @@ import ( gomock "go.uber.org/mock/gomock" ) +//go:generate mockgen -package mock_securitygroupclient -source securitygroupclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + // MockInterface is a mock of Interface interface. type MockInterface struct { ctrl *gomock.Controller @@ -68,9 +70,33 @@ func (m *MockInterface) CreateOrUpdate(ctx context.Context, resourceGroupName, r } // CreateOrUpdate indicates an expected call of CreateOrUpdate. -func (mr *MockInterfaceMockRecorder) CreateOrUpdate(ctx, resourceGroupName, resourceName, resourceParam any) *gomock.Call { +func (mr *MockInterfaceMockRecorder) CreateOrUpdate(ctx, resourceGroupName, resourceName, resourceParam any) *MockInterfaceCreateOrUpdateCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockInterface)(nil).CreateOrUpdate), ctx, resourceGroupName, resourceName, resourceParam) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockInterface)(nil).CreateOrUpdate), ctx, resourceGroupName, resourceName, resourceParam) + return &MockInterfaceCreateOrUpdateCall{Call: call} +} + +// MockInterfaceCreateOrUpdateCall wrap *gomock.Call +type MockInterfaceCreateOrUpdateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceCreateOrUpdateCall) Return(arg0 *armnetwork.SecurityGroup, arg1 error) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceCreateOrUpdateCall) Do(f func(context.Context, string, string, armnetwork.SecurityGroup) (*armnetwork.SecurityGroup, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceCreateOrUpdateCall) DoAndReturn(f func(context.Context, string, string, armnetwork.SecurityGroup) (*armnetwork.SecurityGroup, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.DoAndReturn(f) + return c } // Delete mocks base method. @@ -82,9 +108,33 @@ func (m *MockInterface) Delete(ctx context.Context, resourceGroupName, resourceN } // Delete indicates an expected call of Delete. -func (mr *MockInterfaceMockRecorder) Delete(ctx, resourceGroupName, resourceName any) *gomock.Call { +func (mr *MockInterfaceMockRecorder) Delete(ctx, resourceGroupName, resourceName any) *MockInterfaceDeleteCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockInterface)(nil).Delete), ctx, resourceGroupName, resourceName) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockInterface)(nil).Delete), ctx, resourceGroupName, resourceName) + return &MockInterfaceDeleteCall{Call: call} +} + +// MockInterfaceDeleteCall wrap *gomock.Call +type MockInterfaceDeleteCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceDeleteCall) Return(arg0 error) *MockInterfaceDeleteCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceDeleteCall) Do(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceDeleteCall) DoAndReturn(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.DoAndReturn(f) + return c } // Get mocks base method. @@ -97,9 +147,33 @@ func (m *MockInterface) Get(ctx context.Context, resourceGroupName, resourceName } // Get indicates an expected call of Get. -func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, resourceName any) *gomock.Call { +func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, resourceName any) *MockInterfaceGetCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, resourceName) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, resourceName) + return &MockInterfaceGetCall{Call: call} +} + +// MockInterfaceGetCall wrap *gomock.Call +type MockInterfaceGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetCall) Return(result *armnetwork.SecurityGroup, rerr error) *MockInterfaceGetCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string) (*armnetwork.SecurityGroup, error)) *MockInterfaceGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string) (*armnetwork.SecurityGroup, error)) *MockInterfaceGetCall { + c.Call = c.Call.DoAndReturn(f) + return c } // List mocks base method. @@ -112,7 +186,31 @@ func (m *MockInterface) List(ctx context.Context, resourceGroupName string) ([]* } // List indicates an expected call of List. -func (mr *MockInterfaceMockRecorder) List(ctx, resourceGroupName any) *gomock.Call { +func (mr *MockInterfaceMockRecorder) List(ctx, resourceGroupName any) *MockInterfaceListCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockInterface)(nil).List), ctx, resourceGroupName) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockInterface)(nil).List), ctx, resourceGroupName) + return &MockInterfaceListCall{Call: call} +} + +// MockInterfaceListCall wrap *gomock.Call +type MockInterfaceListCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceListCall) Return(result []*armnetwork.SecurityGroup, rerr error) *MockInterfaceListCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceListCall) Do(f func(context.Context, string) ([]*armnetwork.SecurityGroup, error)) *MockInterfaceListCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceListCall) DoAndReturn(f func(context.Context, string) ([]*armnetwork.SecurityGroup, error)) *MockInterfaceListCall { + c.Call = c.Call.DoAndReturn(f) + return c } diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/snapshotclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/snapshotclient/interface_gomock.go new file mode 100644 index 0000000000..1f09f3f10c --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/snapshotclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package snapshotclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/snapshotclient/mock_snapshotclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_snapshotclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/snapshotclient/mock_snapshotclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/snapshotclient/mock_snapshotclient/interface.go index 4cb330d9e0..5256b11027 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/snapshotclient/mock_snapshotclient/interface.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/snapshotclient/mock_snapshotclient/interface.go @@ -20,7 +20,7 @@ // // Generated by this command: // -// mockgen -package mock_snapshotclient -source snapshotclient/interface.go -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt +// mockgen -package mock_snapshotclient -source snapshotclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt // // Package mock_snapshotclient is a generated GoMock package. @@ -34,6 +34,8 @@ import ( gomock "go.uber.org/mock/gomock" ) +//go:generate mockgen -package mock_snapshotclient -source snapshotclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + // MockInterface is a mock of Interface interface. type MockInterface struct { ctrl *gomock.Controller @@ -68,9 +70,33 @@ func (m *MockInterface) CreateOrUpdate(ctx context.Context, resourceGroupName, r } // CreateOrUpdate indicates an expected call of CreateOrUpdate. -func (mr *MockInterfaceMockRecorder) CreateOrUpdate(ctx, resourceGroupName, resourceName, resourceParam any) *gomock.Call { +func (mr *MockInterfaceMockRecorder) CreateOrUpdate(ctx, resourceGroupName, resourceName, resourceParam any) *MockInterfaceCreateOrUpdateCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockInterface)(nil).CreateOrUpdate), ctx, resourceGroupName, resourceName, resourceParam) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockInterface)(nil).CreateOrUpdate), ctx, resourceGroupName, resourceName, resourceParam) + return &MockInterfaceCreateOrUpdateCall{Call: call} +} + +// MockInterfaceCreateOrUpdateCall wrap *gomock.Call +type MockInterfaceCreateOrUpdateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceCreateOrUpdateCall) Return(arg0 *armcompute.Snapshot, arg1 error) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceCreateOrUpdateCall) Do(f func(context.Context, string, string, armcompute.Snapshot) (*armcompute.Snapshot, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceCreateOrUpdateCall) DoAndReturn(f func(context.Context, string, string, armcompute.Snapshot) (*armcompute.Snapshot, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.DoAndReturn(f) + return c } // Delete mocks base method. @@ -82,9 +108,33 @@ func (m *MockInterface) Delete(ctx context.Context, resourceGroupName, resourceN } // Delete indicates an expected call of Delete. -func (mr *MockInterfaceMockRecorder) Delete(ctx, resourceGroupName, resourceName any) *gomock.Call { +func (mr *MockInterfaceMockRecorder) Delete(ctx, resourceGroupName, resourceName any) *MockInterfaceDeleteCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockInterface)(nil).Delete), ctx, resourceGroupName, resourceName) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockInterface)(nil).Delete), ctx, resourceGroupName, resourceName) + return &MockInterfaceDeleteCall{Call: call} +} + +// MockInterfaceDeleteCall wrap *gomock.Call +type MockInterfaceDeleteCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceDeleteCall) Return(arg0 error) *MockInterfaceDeleteCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceDeleteCall) Do(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceDeleteCall) DoAndReturn(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.DoAndReturn(f) + return c } // Get mocks base method. @@ -97,9 +147,33 @@ func (m *MockInterface) Get(ctx context.Context, resourceGroupName, resourceName } // Get indicates an expected call of Get. -func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, resourceName any) *gomock.Call { +func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, resourceName any) *MockInterfaceGetCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, resourceName) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, resourceName) + return &MockInterfaceGetCall{Call: call} +} + +// MockInterfaceGetCall wrap *gomock.Call +type MockInterfaceGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetCall) Return(result *armcompute.Snapshot, rerr error) *MockInterfaceGetCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string) (*armcompute.Snapshot, error)) *MockInterfaceGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string) (*armcompute.Snapshot, error)) *MockInterfaceGetCall { + c.Call = c.Call.DoAndReturn(f) + return c } // List mocks base method. @@ -112,7 +186,31 @@ func (m *MockInterface) List(ctx context.Context, resourceGroupName string) ([]* } // List indicates an expected call of List. -func (mr *MockInterfaceMockRecorder) List(ctx, resourceGroupName any) *gomock.Call { +func (mr *MockInterfaceMockRecorder) List(ctx, resourceGroupName any) *MockInterfaceListCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockInterface)(nil).List), ctx, resourceGroupName) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockInterface)(nil).List), ctx, resourceGroupName) + return &MockInterfaceListCall{Call: call} +} + +// MockInterfaceListCall wrap *gomock.Call +type MockInterfaceListCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceListCall) Return(result []*armcompute.Snapshot, rerr error) *MockInterfaceListCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceListCall) Do(f func(context.Context, string) ([]*armcompute.Snapshot, error)) *MockInterfaceListCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceListCall) DoAndReturn(f func(context.Context, string) ([]*armcompute.Snapshot, error)) *MockInterfaceListCall { + c.Call = c.Call.DoAndReturn(f) + return c } diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/sshpublickeyresourceclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/sshpublickeyresourceclient/interface_gomock.go new file mode 100644 index 0000000000..928acc039b --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/sshpublickeyresourceclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package sshpublickeyresourceclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/sshpublickeyresourceclient/mock_sshpublickeyresourceclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_sshpublickeyresourceclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/sshpublickeyresourceclient/mock_sshpublickeyresourceclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/sshpublickeyresourceclient/mock_sshpublickeyresourceclient/interface.go new file mode 100644 index 0000000000..35951393b6 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/sshpublickeyresourceclient/mock_sshpublickeyresourceclient/interface.go @@ -0,0 +1,294 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ +// + +// Code generated by MockGen. DO NOT EDIT. +// Source: sshpublickeyresourceclient/interface.go +// +// Generated by this command: +// +// mockgen -package mock_sshpublickeyresourceclient -source sshpublickeyresourceclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt +// + +// Package mock_sshpublickeyresourceclient is a generated GoMock package. +package mock_sshpublickeyresourceclient + +import ( + context "context" + reflect "reflect" + + armcompute "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v6" + gomock "go.uber.org/mock/gomock" +) + +//go:generate mockgen -package mock_sshpublickeyresourceclient -source sshpublickeyresourceclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + +// MockInterface is a mock of Interface interface. +type MockInterface struct { + ctrl *gomock.Controller + recorder *MockInterfaceMockRecorder + isgomock struct{} +} + +// MockInterfaceMockRecorder is the mock recorder for MockInterface. +type MockInterfaceMockRecorder struct { + mock *MockInterface +} + +// NewMockInterface creates a new mock instance. +func NewMockInterface(ctrl *gomock.Controller) *MockInterface { + mock := &MockInterface{ctrl: ctrl} + mock.recorder = &MockInterfaceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockInterface) EXPECT() *MockInterfaceMockRecorder { + return m.recorder +} + +// Create mocks base method. +func (m *MockInterface) Create(ctx context.Context, resourceGroupName, sshPublicKeyName string, parameters armcompute.SSHPublicKeyResource) (*armcompute.SSHPublicKeyResource, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Create", ctx, resourceGroupName, sshPublicKeyName, parameters) + ret0, _ := ret[0].(*armcompute.SSHPublicKeyResource) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Create indicates an expected call of Create. +func (mr *MockInterfaceMockRecorder) Create(ctx, resourceGroupName, sshPublicKeyName, parameters any) *MockInterfaceCreateCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockInterface)(nil).Create), ctx, resourceGroupName, sshPublicKeyName, parameters) + return &MockInterfaceCreateCall{Call: call} +} + +// MockInterfaceCreateCall wrap *gomock.Call +type MockInterfaceCreateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceCreateCall) Return(arg0 *armcompute.SSHPublicKeyResource, arg1 error) *MockInterfaceCreateCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceCreateCall) Do(f func(context.Context, string, string, armcompute.SSHPublicKeyResource) (*armcompute.SSHPublicKeyResource, error)) *MockInterfaceCreateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceCreateCall) DoAndReturn(f func(context.Context, string, string, armcompute.SSHPublicKeyResource) (*armcompute.SSHPublicKeyResource, error)) *MockInterfaceCreateCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Delete mocks base method. +func (m *MockInterface) Delete(ctx context.Context, resourceGroupName, resourceName string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", ctx, resourceGroupName, resourceName) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete. +func (mr *MockInterfaceMockRecorder) Delete(ctx, resourceGroupName, resourceName any) *MockInterfaceDeleteCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockInterface)(nil).Delete), ctx, resourceGroupName, resourceName) + return &MockInterfaceDeleteCall{Call: call} +} + +// MockInterfaceDeleteCall wrap *gomock.Call +type MockInterfaceDeleteCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceDeleteCall) Return(arg0 error) *MockInterfaceDeleteCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceDeleteCall) Do(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceDeleteCall) DoAndReturn(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GenerateKeyPair mocks base method. +func (m *MockInterface) GenerateKeyPair(ctx context.Context, resourceGroupName, sshPublicKeyName string) (*armcompute.SSHPublicKeyGenerateKeyPairResult, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GenerateKeyPair", ctx, resourceGroupName, sshPublicKeyName) + ret0, _ := ret[0].(*armcompute.SSHPublicKeyGenerateKeyPairResult) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GenerateKeyPair indicates an expected call of GenerateKeyPair. +func (mr *MockInterfaceMockRecorder) GenerateKeyPair(ctx, resourceGroupName, sshPublicKeyName any) *MockInterfaceGenerateKeyPairCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GenerateKeyPair", reflect.TypeOf((*MockInterface)(nil).GenerateKeyPair), ctx, resourceGroupName, sshPublicKeyName) + return &MockInterfaceGenerateKeyPairCall{Call: call} +} + +// MockInterfaceGenerateKeyPairCall wrap *gomock.Call +type MockInterfaceGenerateKeyPairCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGenerateKeyPairCall) Return(arg0 *armcompute.SSHPublicKeyGenerateKeyPairResult, arg1 error) *MockInterfaceGenerateKeyPairCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGenerateKeyPairCall) Do(f func(context.Context, string, string) (*armcompute.SSHPublicKeyGenerateKeyPairResult, error)) *MockInterfaceGenerateKeyPairCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGenerateKeyPairCall) DoAndReturn(f func(context.Context, string, string) (*armcompute.SSHPublicKeyGenerateKeyPairResult, error)) *MockInterfaceGenerateKeyPairCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Get mocks base method. +func (m *MockInterface) Get(ctx context.Context, resourceGroupName, resourceName string) (*armcompute.SSHPublicKeyResource, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", ctx, resourceGroupName, resourceName) + ret0, _ := ret[0].(*armcompute.SSHPublicKeyResource) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, resourceName any) *MockInterfaceGetCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, resourceName) + return &MockInterfaceGetCall{Call: call} +} + +// MockInterfaceGetCall wrap *gomock.Call +type MockInterfaceGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetCall) Return(result *armcompute.SSHPublicKeyResource, rerr error) *MockInterfaceGetCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string) (*armcompute.SSHPublicKeyResource, error)) *MockInterfaceGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string) (*armcompute.SSHPublicKeyResource, error)) *MockInterfaceGetCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// List mocks base method. +func (m *MockInterface) List(ctx context.Context, resourceGroupName string) ([]*armcompute.SSHPublicKeyResource, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "List", ctx, resourceGroupName) + ret0, _ := ret[0].([]*armcompute.SSHPublicKeyResource) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// List indicates an expected call of List. +func (mr *MockInterfaceMockRecorder) List(ctx, resourceGroupName any) *MockInterfaceListCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockInterface)(nil).List), ctx, resourceGroupName) + return &MockInterfaceListCall{Call: call} +} + +// MockInterfaceListCall wrap *gomock.Call +type MockInterfaceListCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceListCall) Return(result []*armcompute.SSHPublicKeyResource, rerr error) *MockInterfaceListCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceListCall) Do(f func(context.Context, string) ([]*armcompute.SSHPublicKeyResource, error)) *MockInterfaceListCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceListCall) DoAndReturn(f func(context.Context, string) ([]*armcompute.SSHPublicKeyResource, error)) *MockInterfaceListCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Update mocks base method. +func (m *MockInterface) Update(ctx context.Context, resourceGroupName, sshPublicKeyName string, parameters armcompute.SSHPublicKeyUpdateResource) (*armcompute.SSHPublicKeyResource, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Update", ctx, resourceGroupName, sshPublicKeyName, parameters) + ret0, _ := ret[0].(*armcompute.SSHPublicKeyResource) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Update indicates an expected call of Update. +func (mr *MockInterfaceMockRecorder) Update(ctx, resourceGroupName, sshPublicKeyName, parameters any) *MockInterfaceUpdateCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockInterface)(nil).Update), ctx, resourceGroupName, sshPublicKeyName, parameters) + return &MockInterfaceUpdateCall{Call: call} +} + +// MockInterfaceUpdateCall wrap *gomock.Call +type MockInterfaceUpdateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceUpdateCall) Return(arg0 *armcompute.SSHPublicKeyResource, arg1 error) *MockInterfaceUpdateCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceUpdateCall) Do(f func(context.Context, string, string, armcompute.SSHPublicKeyUpdateResource) (*armcompute.SSHPublicKeyResource, error)) *MockInterfaceUpdateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceUpdateCall) DoAndReturn(f func(context.Context, string, string, armcompute.SSHPublicKeyUpdateResource) (*armcompute.SSHPublicKeyResource, error)) *MockInterfaceUpdateCall { + c.Call = c.Call.DoAndReturn(f) + return c +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/subnetclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/subnetclient/interface_gomock.go new file mode 100644 index 0000000000..abb330f43e --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/subnetclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package subnetclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/subnetclient/mock_subnetclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_subnetclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/subnetclient/mock_subnetclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/subnetclient/mock_subnetclient/interface.go index ab770ef46d..c7a36d6e97 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/subnetclient/mock_subnetclient/interface.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/subnetclient/mock_subnetclient/interface.go @@ -20,7 +20,7 @@ // // Generated by this command: // -// mockgen -package mock_subnetclient -source subnetclient/interface.go -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt +// mockgen -package mock_subnetclient -source subnetclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt // // Package mock_subnetclient is a generated GoMock package. @@ -34,6 +34,8 @@ import ( gomock "go.uber.org/mock/gomock" ) +//go:generate mockgen -package mock_subnetclient -source subnetclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + // MockInterface is a mock of Interface interface. type MockInterface struct { ctrl *gomock.Controller @@ -68,9 +70,33 @@ func (m *MockInterface) CreateOrUpdate(ctx context.Context, resourceGroupName, p } // CreateOrUpdate indicates an expected call of CreateOrUpdate. -func (mr *MockInterfaceMockRecorder) CreateOrUpdate(ctx, resourceGroupName, parentResourceName, resourceName, resourceParam any) *gomock.Call { +func (mr *MockInterfaceMockRecorder) CreateOrUpdate(ctx, resourceGroupName, parentResourceName, resourceName, resourceParam any) *MockInterfaceCreateOrUpdateCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockInterface)(nil).CreateOrUpdate), ctx, resourceGroupName, parentResourceName, resourceName, resourceParam) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockInterface)(nil).CreateOrUpdate), ctx, resourceGroupName, parentResourceName, resourceName, resourceParam) + return &MockInterfaceCreateOrUpdateCall{Call: call} +} + +// MockInterfaceCreateOrUpdateCall wrap *gomock.Call +type MockInterfaceCreateOrUpdateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceCreateOrUpdateCall) Return(arg0 *armnetwork.Subnet, arg1 error) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceCreateOrUpdateCall) Do(f func(context.Context, string, string, string, armnetwork.Subnet) (*armnetwork.Subnet, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceCreateOrUpdateCall) DoAndReturn(f func(context.Context, string, string, string, armnetwork.Subnet) (*armnetwork.Subnet, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.DoAndReturn(f) + return c } // Delete mocks base method. @@ -82,9 +108,33 @@ func (m *MockInterface) Delete(ctx context.Context, resourceGroupName, parentRes } // Delete indicates an expected call of Delete. -func (mr *MockInterfaceMockRecorder) Delete(ctx, resourceGroupName, parentResourceName, resourceName any) *gomock.Call { +func (mr *MockInterfaceMockRecorder) Delete(ctx, resourceGroupName, parentResourceName, resourceName any) *MockInterfaceDeleteCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockInterface)(nil).Delete), ctx, resourceGroupName, parentResourceName, resourceName) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockInterface)(nil).Delete), ctx, resourceGroupName, parentResourceName, resourceName) + return &MockInterfaceDeleteCall{Call: call} +} + +// MockInterfaceDeleteCall wrap *gomock.Call +type MockInterfaceDeleteCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceDeleteCall) Return(arg0 error) *MockInterfaceDeleteCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceDeleteCall) Do(f func(context.Context, string, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceDeleteCall) DoAndReturn(f func(context.Context, string, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.DoAndReturn(f) + return c } // Get mocks base method. @@ -97,9 +147,33 @@ func (m *MockInterface) Get(ctx context.Context, resourceGroupName, parentResour } // Get indicates an expected call of Get. -func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, parentResourceName, resourceName, expand any) *gomock.Call { +func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, parentResourceName, resourceName, expand any) *MockInterfaceGetCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, parentResourceName, resourceName, expand) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, parentResourceName, resourceName, expand) + return &MockInterfaceGetCall{Call: call} +} + +// MockInterfaceGetCall wrap *gomock.Call +type MockInterfaceGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetCall) Return(result *armnetwork.Subnet, rerr error) *MockInterfaceGetCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string, string, *string) (*armnetwork.Subnet, error)) *MockInterfaceGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string, string, *string) (*armnetwork.Subnet, error)) *MockInterfaceGetCall { + c.Call = c.Call.DoAndReturn(f) + return c } // List mocks base method. @@ -112,7 +186,31 @@ func (m *MockInterface) List(ctx context.Context, resourceGroupName, parentResou } // List indicates an expected call of List. -func (mr *MockInterfaceMockRecorder) List(ctx, resourceGroupName, parentResourceName any) *gomock.Call { +func (mr *MockInterfaceMockRecorder) List(ctx, resourceGroupName, parentResourceName any) *MockInterfaceListCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockInterface)(nil).List), ctx, resourceGroupName, parentResourceName) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockInterface)(nil).List), ctx, resourceGroupName, parentResourceName) + return &MockInterfaceListCall{Call: call} +} + +// MockInterfaceListCall wrap *gomock.Call +type MockInterfaceListCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceListCall) Return(result []*armnetwork.Subnet, rerr error) *MockInterfaceListCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceListCall) Do(f func(context.Context, string, string) ([]*armnetwork.Subnet, error)) *MockInterfaceListCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceListCall) DoAndReturn(f func(context.Context, string, string) ([]*armnetwork.Subnet, error)) *MockInterfaceListCall { + c.Call = c.Call.DoAndReturn(f) + return c } diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/vaultclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/vaultclient/interface_gomock.go new file mode 100644 index 0000000000..11b252abf7 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/vaultclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package vaultclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/vaultclient/mock_vaultclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_vaultclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/vaultclient/mock_vaultclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/vaultclient/mock_vaultclient/interface.go new file mode 100644 index 0000000000..998924f36e --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/vaultclient/mock_vaultclient/interface.go @@ -0,0 +1,254 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ +// + +// Code generated by MockGen. DO NOT EDIT. +// Source: vaultclient/interface.go +// +// Generated by this command: +// +// mockgen -package mock_vaultclient -source vaultclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt +// + +// Package mock_vaultclient is a generated GoMock package. +package mock_vaultclient + +import ( + context "context" + reflect "reflect" + + armkeyvault "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault" + gomock "go.uber.org/mock/gomock" +) + +//go:generate mockgen -package mock_vaultclient -source vaultclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + +// MockInterface is a mock of Interface interface. +type MockInterface struct { + ctrl *gomock.Controller + recorder *MockInterfaceMockRecorder + isgomock struct{} +} + +// MockInterfaceMockRecorder is the mock recorder for MockInterface. +type MockInterfaceMockRecorder struct { + mock *MockInterface +} + +// NewMockInterface creates a new mock instance. +func NewMockInterface(ctrl *gomock.Controller) *MockInterface { + mock := &MockInterface{ctrl: ctrl} + mock.recorder = &MockInterfaceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockInterface) EXPECT() *MockInterfaceMockRecorder { + return m.recorder +} + +// CreateOrUpdate mocks base method. +func (m *MockInterface) CreateOrUpdate(ctx context.Context, resourceGroupName, resourceName string, resource armkeyvault.VaultCreateOrUpdateParameters) (*armkeyvault.Vault, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateOrUpdate", ctx, resourceGroupName, resourceName, resource) + ret0, _ := ret[0].(*armkeyvault.Vault) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateOrUpdate indicates an expected call of CreateOrUpdate. +func (mr *MockInterfaceMockRecorder) CreateOrUpdate(ctx, resourceGroupName, resourceName, resource any) *MockInterfaceCreateOrUpdateCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockInterface)(nil).CreateOrUpdate), ctx, resourceGroupName, resourceName, resource) + return &MockInterfaceCreateOrUpdateCall{Call: call} +} + +// MockInterfaceCreateOrUpdateCall wrap *gomock.Call +type MockInterfaceCreateOrUpdateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceCreateOrUpdateCall) Return(arg0 *armkeyvault.Vault, arg1 error) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceCreateOrUpdateCall) Do(f func(context.Context, string, string, armkeyvault.VaultCreateOrUpdateParameters) (*armkeyvault.Vault, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceCreateOrUpdateCall) DoAndReturn(f func(context.Context, string, string, armkeyvault.VaultCreateOrUpdateParameters) (*armkeyvault.Vault, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Delete mocks base method. +func (m *MockInterface) Delete(ctx context.Context, resourceGroupName, resourceName string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", ctx, resourceGroupName, resourceName) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete. +func (mr *MockInterfaceMockRecorder) Delete(ctx, resourceGroupName, resourceName any) *MockInterfaceDeleteCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockInterface)(nil).Delete), ctx, resourceGroupName, resourceName) + return &MockInterfaceDeleteCall{Call: call} +} + +// MockInterfaceDeleteCall wrap *gomock.Call +type MockInterfaceDeleteCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceDeleteCall) Return(arg0 error) *MockInterfaceDeleteCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceDeleteCall) Do(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceDeleteCall) DoAndReturn(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Get mocks base method. +func (m *MockInterface) Get(ctx context.Context, resourceGroupName, resourceName string) (*armkeyvault.Vault, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", ctx, resourceGroupName, resourceName) + ret0, _ := ret[0].(*armkeyvault.Vault) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, resourceName any) *MockInterfaceGetCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, resourceName) + return &MockInterfaceGetCall{Call: call} +} + +// MockInterfaceGetCall wrap *gomock.Call +type MockInterfaceGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetCall) Return(result *armkeyvault.Vault, rerr error) *MockInterfaceGetCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string) (*armkeyvault.Vault, error)) *MockInterfaceGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string) (*armkeyvault.Vault, error)) *MockInterfaceGetCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// List mocks base method. +func (m *MockInterface) List(ctx context.Context, resourceGroupName string) ([]*armkeyvault.Vault, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "List", ctx, resourceGroupName) + ret0, _ := ret[0].([]*armkeyvault.Vault) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// List indicates an expected call of List. +func (mr *MockInterfaceMockRecorder) List(ctx, resourceGroupName any) *MockInterfaceListCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockInterface)(nil).List), ctx, resourceGroupName) + return &MockInterfaceListCall{Call: call} +} + +// MockInterfaceListCall wrap *gomock.Call +type MockInterfaceListCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceListCall) Return(result []*armkeyvault.Vault, rerr error) *MockInterfaceListCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceListCall) Do(f func(context.Context, string) ([]*armkeyvault.Vault, error)) *MockInterfaceListCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceListCall) DoAndReturn(f func(context.Context, string) ([]*armkeyvault.Vault, error)) *MockInterfaceListCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// PurgeDeleted mocks base method. +func (m *MockInterface) PurgeDeleted(ctx context.Context, vaultName, location string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PurgeDeleted", ctx, vaultName, location) + ret0, _ := ret[0].(error) + return ret0 +} + +// PurgeDeleted indicates an expected call of PurgeDeleted. +func (mr *MockInterfaceMockRecorder) PurgeDeleted(ctx, vaultName, location any) *MockInterfacePurgeDeletedCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PurgeDeleted", reflect.TypeOf((*MockInterface)(nil).PurgeDeleted), ctx, vaultName, location) + return &MockInterfacePurgeDeletedCall{Call: call} +} + +// MockInterfacePurgeDeletedCall wrap *gomock.Call +type MockInterfacePurgeDeletedCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfacePurgeDeletedCall) Return(arg0 error) *MockInterfacePurgeDeletedCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfacePurgeDeletedCall) Do(f func(context.Context, string, string) error) *MockInterfacePurgeDeletedCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfacePurgeDeletedCall) DoAndReturn(f func(context.Context, string, string) error) *MockInterfacePurgeDeletedCall { + c.Call = c.Call.DoAndReturn(f) + return c +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachineclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachineclient/interface_gomock.go new file mode 100644 index 0000000000..fbb45f0d16 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachineclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package virtualmachineclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachineclient/mock_virtualmachineclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_virtualmachineclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachineclient/mock_virtualmachineclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachineclient/mock_virtualmachineclient/interface.go new file mode 100644 index 0000000000..09d24627fe --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachineclient/mock_virtualmachineclient/interface.go @@ -0,0 +1,373 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ +// + +// Code generated by MockGen. DO NOT EDIT. +// Source: virtualmachineclient/interface.go +// +// Generated by this command: +// +// mockgen -package mock_virtualmachineclient -source virtualmachineclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt +// + +// Package mock_virtualmachineclient is a generated GoMock package. +package mock_virtualmachineclient + +import ( + context "context" + reflect "reflect" + + runtime "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + armcompute "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v6" + gomock "go.uber.org/mock/gomock" +) + +//go:generate mockgen -package mock_virtualmachineclient -source virtualmachineclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + +// MockInterface is a mock of Interface interface. +type MockInterface struct { + ctrl *gomock.Controller + recorder *MockInterfaceMockRecorder + isgomock struct{} +} + +// MockInterfaceMockRecorder is the mock recorder for MockInterface. +type MockInterfaceMockRecorder struct { + mock *MockInterface +} + +// NewMockInterface creates a new mock instance. +func NewMockInterface(ctrl *gomock.Controller) *MockInterface { + mock := &MockInterface{ctrl: ctrl} + mock.recorder = &MockInterfaceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockInterface) EXPECT() *MockInterfaceMockRecorder { + return m.recorder +} + +// BeginAttachDetachDataDisks mocks base method. +func (m *MockInterface) BeginAttachDetachDataDisks(ctx context.Context, resourceGroupName, vmName string, parameters armcompute.AttachDetachDataDisksRequest, options *armcompute.VirtualMachinesClientBeginAttachDetachDataDisksOptions) (*runtime.Poller[armcompute.VirtualMachinesClientAttachDetachDataDisksResponse], error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BeginAttachDetachDataDisks", ctx, resourceGroupName, vmName, parameters, options) + ret0, _ := ret[0].(*runtime.Poller[armcompute.VirtualMachinesClientAttachDetachDataDisksResponse]) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// BeginAttachDetachDataDisks indicates an expected call of BeginAttachDetachDataDisks. +func (mr *MockInterfaceMockRecorder) BeginAttachDetachDataDisks(ctx, resourceGroupName, vmName, parameters, options any) *MockInterfaceBeginAttachDetachDataDisksCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BeginAttachDetachDataDisks", reflect.TypeOf((*MockInterface)(nil).BeginAttachDetachDataDisks), ctx, resourceGroupName, vmName, parameters, options) + return &MockInterfaceBeginAttachDetachDataDisksCall{Call: call} +} + +// MockInterfaceBeginAttachDetachDataDisksCall wrap *gomock.Call +type MockInterfaceBeginAttachDetachDataDisksCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceBeginAttachDetachDataDisksCall) Return(arg0 *runtime.Poller[armcompute.VirtualMachinesClientAttachDetachDataDisksResponse], arg1 error) *MockInterfaceBeginAttachDetachDataDisksCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceBeginAttachDetachDataDisksCall) Do(f func(context.Context, string, string, armcompute.AttachDetachDataDisksRequest, *armcompute.VirtualMachinesClientBeginAttachDetachDataDisksOptions) (*runtime.Poller[armcompute.VirtualMachinesClientAttachDetachDataDisksResponse], error)) *MockInterfaceBeginAttachDetachDataDisksCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceBeginAttachDetachDataDisksCall) DoAndReturn(f func(context.Context, string, string, armcompute.AttachDetachDataDisksRequest, *armcompute.VirtualMachinesClientBeginAttachDetachDataDisksOptions) (*runtime.Poller[armcompute.VirtualMachinesClientAttachDetachDataDisksResponse], error)) *MockInterfaceBeginAttachDetachDataDisksCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// BeginUpdate mocks base method. +func (m *MockInterface) BeginUpdate(ctx context.Context, resourceGroupName, vmName string, parameters armcompute.VirtualMachineUpdate, options *armcompute.VirtualMachinesClientBeginUpdateOptions) (*runtime.Poller[armcompute.VirtualMachinesClientUpdateResponse], error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BeginUpdate", ctx, resourceGroupName, vmName, parameters, options) + ret0, _ := ret[0].(*runtime.Poller[armcompute.VirtualMachinesClientUpdateResponse]) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// BeginUpdate indicates an expected call of BeginUpdate. +func (mr *MockInterfaceMockRecorder) BeginUpdate(ctx, resourceGroupName, vmName, parameters, options any) *MockInterfaceBeginUpdateCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BeginUpdate", reflect.TypeOf((*MockInterface)(nil).BeginUpdate), ctx, resourceGroupName, vmName, parameters, options) + return &MockInterfaceBeginUpdateCall{Call: call} +} + +// MockInterfaceBeginUpdateCall wrap *gomock.Call +type MockInterfaceBeginUpdateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceBeginUpdateCall) Return(arg0 *runtime.Poller[armcompute.VirtualMachinesClientUpdateResponse], arg1 error) *MockInterfaceBeginUpdateCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceBeginUpdateCall) Do(f func(context.Context, string, string, armcompute.VirtualMachineUpdate, *armcompute.VirtualMachinesClientBeginUpdateOptions) (*runtime.Poller[armcompute.VirtualMachinesClientUpdateResponse], error)) *MockInterfaceBeginUpdateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceBeginUpdateCall) DoAndReturn(f func(context.Context, string, string, armcompute.VirtualMachineUpdate, *armcompute.VirtualMachinesClientBeginUpdateOptions) (*runtime.Poller[armcompute.VirtualMachinesClientUpdateResponse], error)) *MockInterfaceBeginUpdateCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// CreateOrUpdate mocks base method. +func (m *MockInterface) CreateOrUpdate(ctx context.Context, resourceGroupName, resourceName string, resourceParam armcompute.VirtualMachine) (*armcompute.VirtualMachine, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateOrUpdate", ctx, resourceGroupName, resourceName, resourceParam) + ret0, _ := ret[0].(*armcompute.VirtualMachine) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateOrUpdate indicates an expected call of CreateOrUpdate. +func (mr *MockInterfaceMockRecorder) CreateOrUpdate(ctx, resourceGroupName, resourceName, resourceParam any) *MockInterfaceCreateOrUpdateCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockInterface)(nil).CreateOrUpdate), ctx, resourceGroupName, resourceName, resourceParam) + return &MockInterfaceCreateOrUpdateCall{Call: call} +} + +// MockInterfaceCreateOrUpdateCall wrap *gomock.Call +type MockInterfaceCreateOrUpdateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceCreateOrUpdateCall) Return(arg0 *armcompute.VirtualMachine, arg1 error) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceCreateOrUpdateCall) Do(f func(context.Context, string, string, armcompute.VirtualMachine) (*armcompute.VirtualMachine, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceCreateOrUpdateCall) DoAndReturn(f func(context.Context, string, string, armcompute.VirtualMachine) (*armcompute.VirtualMachine, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Delete mocks base method. +func (m *MockInterface) Delete(ctx context.Context, resourceGroupName, resourceName string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", ctx, resourceGroupName, resourceName) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete. +func (mr *MockInterfaceMockRecorder) Delete(ctx, resourceGroupName, resourceName any) *MockInterfaceDeleteCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockInterface)(nil).Delete), ctx, resourceGroupName, resourceName) + return &MockInterfaceDeleteCall{Call: call} +} + +// MockInterfaceDeleteCall wrap *gomock.Call +type MockInterfaceDeleteCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceDeleteCall) Return(arg0 error) *MockInterfaceDeleteCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceDeleteCall) Do(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceDeleteCall) DoAndReturn(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Get mocks base method. +func (m *MockInterface) Get(ctx context.Context, resourceGroupName, resourceName string, expand *string) (*armcompute.VirtualMachine, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", ctx, resourceGroupName, resourceName, expand) + ret0, _ := ret[0].(*armcompute.VirtualMachine) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, resourceName, expand any) *MockInterfaceGetCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, resourceName, expand) + return &MockInterfaceGetCall{Call: call} +} + +// MockInterfaceGetCall wrap *gomock.Call +type MockInterfaceGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetCall) Return(result *armcompute.VirtualMachine, rerr error) *MockInterfaceGetCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string, *string) (*armcompute.VirtualMachine, error)) *MockInterfaceGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string, *string) (*armcompute.VirtualMachine, error)) *MockInterfaceGetCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// InstanceView mocks base method. +func (m *MockInterface) InstanceView(ctx context.Context, resourceGroupName, vmName string) (*armcompute.VirtualMachineInstanceView, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "InstanceView", ctx, resourceGroupName, vmName) + ret0, _ := ret[0].(*armcompute.VirtualMachineInstanceView) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// InstanceView indicates an expected call of InstanceView. +func (mr *MockInterfaceMockRecorder) InstanceView(ctx, resourceGroupName, vmName any) *MockInterfaceInstanceViewCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InstanceView", reflect.TypeOf((*MockInterface)(nil).InstanceView), ctx, resourceGroupName, vmName) + return &MockInterfaceInstanceViewCall{Call: call} +} + +// MockInterfaceInstanceViewCall wrap *gomock.Call +type MockInterfaceInstanceViewCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceInstanceViewCall) Return(arg0 *armcompute.VirtualMachineInstanceView, arg1 error) *MockInterfaceInstanceViewCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceInstanceViewCall) Do(f func(context.Context, string, string) (*armcompute.VirtualMachineInstanceView, error)) *MockInterfaceInstanceViewCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceInstanceViewCall) DoAndReturn(f func(context.Context, string, string) (*armcompute.VirtualMachineInstanceView, error)) *MockInterfaceInstanceViewCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// List mocks base method. +func (m *MockInterface) List(ctx context.Context, resourceGroupName string) ([]*armcompute.VirtualMachine, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "List", ctx, resourceGroupName) + ret0, _ := ret[0].([]*armcompute.VirtualMachine) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// List indicates an expected call of List. +func (mr *MockInterfaceMockRecorder) List(ctx, resourceGroupName any) *MockInterfaceListCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockInterface)(nil).List), ctx, resourceGroupName) + return &MockInterfaceListCall{Call: call} +} + +// MockInterfaceListCall wrap *gomock.Call +type MockInterfaceListCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceListCall) Return(result []*armcompute.VirtualMachine, rerr error) *MockInterfaceListCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceListCall) Do(f func(context.Context, string) ([]*armcompute.VirtualMachine, error)) *MockInterfaceListCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceListCall) DoAndReturn(f func(context.Context, string) ([]*armcompute.VirtualMachine, error)) *MockInterfaceListCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ListVMInstanceView mocks base method. +func (m *MockInterface) ListVMInstanceView(ctx context.Context, resourceGroupName string) ([]*armcompute.VirtualMachine, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListVMInstanceView", ctx, resourceGroupName) + ret0, _ := ret[0].([]*armcompute.VirtualMachine) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListVMInstanceView indicates an expected call of ListVMInstanceView. +func (mr *MockInterfaceMockRecorder) ListVMInstanceView(ctx, resourceGroupName any) *MockInterfaceListVMInstanceViewCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListVMInstanceView", reflect.TypeOf((*MockInterface)(nil).ListVMInstanceView), ctx, resourceGroupName) + return &MockInterfaceListVMInstanceViewCall{Call: call} +} + +// MockInterfaceListVMInstanceViewCall wrap *gomock.Call +type MockInterfaceListVMInstanceViewCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceListVMInstanceViewCall) Return(result []*armcompute.VirtualMachine, rerr error) *MockInterfaceListVMInstanceViewCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceListVMInstanceViewCall) Do(f func(context.Context, string) ([]*armcompute.VirtualMachine, error)) *MockInterfaceListVMInstanceViewCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceListVMInstanceViewCall) DoAndReturn(f func(context.Context, string) ([]*armcompute.VirtualMachine, error)) *MockInterfaceListVMInstanceViewCall { + c.Call = c.Call.DoAndReturn(f) + return c +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetclient/interface_gomock.go new file mode 100644 index 0000000000..870b77be47 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package virtualmachinescalesetclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetclient/mock_virtualmachinescalesetclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_virtualmachinescalesetclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetclient/mock_virtualmachinescalesetclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetclient/mock_virtualmachinescalesetclient/interface.go new file mode 100644 index 0000000000..32c30dfb13 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetclient/mock_virtualmachinescalesetclient/interface.go @@ -0,0 +1,216 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ +// + +// Code generated by MockGen. DO NOT EDIT. +// Source: virtualmachinescalesetclient/interface.go +// +// Generated by this command: +// +// mockgen -package mock_virtualmachinescalesetclient -source virtualmachinescalesetclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt +// + +// Package mock_virtualmachinescalesetclient is a generated GoMock package. +package mock_virtualmachinescalesetclient + +import ( + context "context" + reflect "reflect" + + armcompute "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v6" + gomock "go.uber.org/mock/gomock" +) + +//go:generate mockgen -package mock_virtualmachinescalesetclient -source virtualmachinescalesetclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + +// MockInterface is a mock of Interface interface. +type MockInterface struct { + ctrl *gomock.Controller + recorder *MockInterfaceMockRecorder + isgomock struct{} +} + +// MockInterfaceMockRecorder is the mock recorder for MockInterface. +type MockInterfaceMockRecorder struct { + mock *MockInterface +} + +// NewMockInterface creates a new mock instance. +func NewMockInterface(ctrl *gomock.Controller) *MockInterface { + mock := &MockInterface{ctrl: ctrl} + mock.recorder = &MockInterfaceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockInterface) EXPECT() *MockInterfaceMockRecorder { + return m.recorder +} + +// CreateOrUpdate mocks base method. +func (m *MockInterface) CreateOrUpdate(ctx context.Context, resourceGroupName, resourceName string, resourceParam armcompute.VirtualMachineScaleSet) (*armcompute.VirtualMachineScaleSet, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateOrUpdate", ctx, resourceGroupName, resourceName, resourceParam) + ret0, _ := ret[0].(*armcompute.VirtualMachineScaleSet) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateOrUpdate indicates an expected call of CreateOrUpdate. +func (mr *MockInterfaceMockRecorder) CreateOrUpdate(ctx, resourceGroupName, resourceName, resourceParam any) *MockInterfaceCreateOrUpdateCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockInterface)(nil).CreateOrUpdate), ctx, resourceGroupName, resourceName, resourceParam) + return &MockInterfaceCreateOrUpdateCall{Call: call} +} + +// MockInterfaceCreateOrUpdateCall wrap *gomock.Call +type MockInterfaceCreateOrUpdateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceCreateOrUpdateCall) Return(arg0 *armcompute.VirtualMachineScaleSet, arg1 error) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceCreateOrUpdateCall) Do(f func(context.Context, string, string, armcompute.VirtualMachineScaleSet) (*armcompute.VirtualMachineScaleSet, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceCreateOrUpdateCall) DoAndReturn(f func(context.Context, string, string, armcompute.VirtualMachineScaleSet) (*armcompute.VirtualMachineScaleSet, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Delete mocks base method. +func (m *MockInterface) Delete(ctx context.Context, resourceGroupName, resourceName string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", ctx, resourceGroupName, resourceName) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete. +func (mr *MockInterfaceMockRecorder) Delete(ctx, resourceGroupName, resourceName any) *MockInterfaceDeleteCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockInterface)(nil).Delete), ctx, resourceGroupName, resourceName) + return &MockInterfaceDeleteCall{Call: call} +} + +// MockInterfaceDeleteCall wrap *gomock.Call +type MockInterfaceDeleteCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceDeleteCall) Return(arg0 error) *MockInterfaceDeleteCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceDeleteCall) Do(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceDeleteCall) DoAndReturn(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Get mocks base method. +func (m *MockInterface) Get(ctx context.Context, resourceGroupName, resourceName string, expand *armcompute.ExpandTypesForGetVMScaleSets) (*armcompute.VirtualMachineScaleSet, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", ctx, resourceGroupName, resourceName, expand) + ret0, _ := ret[0].(*armcompute.VirtualMachineScaleSet) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, resourceName, expand any) *MockInterfaceGetCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, resourceName, expand) + return &MockInterfaceGetCall{Call: call} +} + +// MockInterfaceGetCall wrap *gomock.Call +type MockInterfaceGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetCall) Return(result *armcompute.VirtualMachineScaleSet, rerr error) *MockInterfaceGetCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string, *armcompute.ExpandTypesForGetVMScaleSets) (*armcompute.VirtualMachineScaleSet, error)) *MockInterfaceGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string, *armcompute.ExpandTypesForGetVMScaleSets) (*armcompute.VirtualMachineScaleSet, error)) *MockInterfaceGetCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// List mocks base method. +func (m *MockInterface) List(ctx context.Context, resourceGroupName string) ([]*armcompute.VirtualMachineScaleSet, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "List", ctx, resourceGroupName) + ret0, _ := ret[0].([]*armcompute.VirtualMachineScaleSet) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// List indicates an expected call of List. +func (mr *MockInterfaceMockRecorder) List(ctx, resourceGroupName any) *MockInterfaceListCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockInterface)(nil).List), ctx, resourceGroupName) + return &MockInterfaceListCall{Call: call} +} + +// MockInterfaceListCall wrap *gomock.Call +type MockInterfaceListCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceListCall) Return(result []*armcompute.VirtualMachineScaleSet, rerr error) *MockInterfaceListCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceListCall) Do(f func(context.Context, string) ([]*armcompute.VirtualMachineScaleSet, error)) *MockInterfaceListCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceListCall) DoAndReturn(f func(context.Context, string) ([]*armcompute.VirtualMachineScaleSet, error)) *MockInterfaceListCall { + c.Call = c.Call.DoAndReturn(f) + return c +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetvmclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetvmclient/interface_gomock.go new file mode 100644 index 0000000000..97696c95dd --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetvmclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package virtualmachinescalesetvmclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetvmclient/mock_virtualmachinescalesetvmclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_virtualmachinescalesetvmclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetvmclient/mock_virtualmachinescalesetvmclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetvmclient/mock_virtualmachinescalesetvmclient/interface.go new file mode 100644 index 0000000000..20c1ff6b8b --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetvmclient/mock_virtualmachinescalesetvmclient/interface.go @@ -0,0 +1,334 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ +// + +// Code generated by MockGen. DO NOT EDIT. +// Source: virtualmachinescalesetvmclient/interface.go +// +// Generated by this command: +// +// mockgen -package mock_virtualmachinescalesetvmclient -source virtualmachinescalesetvmclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt +// + +// Package mock_virtualmachinescalesetvmclient is a generated GoMock package. +package mock_virtualmachinescalesetvmclient + +import ( + context "context" + reflect "reflect" + + runtime "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + armcompute "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v6" + gomock "go.uber.org/mock/gomock" +) + +//go:generate mockgen -package mock_virtualmachinescalesetvmclient -source virtualmachinescalesetvmclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + +// MockInterface is a mock of Interface interface. +type MockInterface struct { + ctrl *gomock.Controller + recorder *MockInterfaceMockRecorder + isgomock struct{} +} + +// MockInterfaceMockRecorder is the mock recorder for MockInterface. +type MockInterfaceMockRecorder struct { + mock *MockInterface +} + +// NewMockInterface creates a new mock instance. +func NewMockInterface(ctrl *gomock.Controller) *MockInterface { + mock := &MockInterface{ctrl: ctrl} + mock.recorder = &MockInterfaceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockInterface) EXPECT() *MockInterfaceMockRecorder { + return m.recorder +} + +// BeginUpdate mocks base method. +func (m *MockInterface) BeginUpdate(ctx context.Context, resourceGroupName, vmScaleSetName, instanceID string, parameters armcompute.VirtualMachineScaleSetVM, options *armcompute.VirtualMachineScaleSetVMsClientBeginUpdateOptions) (*runtime.Poller[armcompute.VirtualMachineScaleSetVMsClientUpdateResponse], error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BeginUpdate", ctx, resourceGroupName, vmScaleSetName, instanceID, parameters, options) + ret0, _ := ret[0].(*runtime.Poller[armcompute.VirtualMachineScaleSetVMsClientUpdateResponse]) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// BeginUpdate indicates an expected call of BeginUpdate. +func (mr *MockInterfaceMockRecorder) BeginUpdate(ctx, resourceGroupName, vmScaleSetName, instanceID, parameters, options any) *MockInterfaceBeginUpdateCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BeginUpdate", reflect.TypeOf((*MockInterface)(nil).BeginUpdate), ctx, resourceGroupName, vmScaleSetName, instanceID, parameters, options) + return &MockInterfaceBeginUpdateCall{Call: call} +} + +// MockInterfaceBeginUpdateCall wrap *gomock.Call +type MockInterfaceBeginUpdateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceBeginUpdateCall) Return(arg0 *runtime.Poller[armcompute.VirtualMachineScaleSetVMsClientUpdateResponse], arg1 error) *MockInterfaceBeginUpdateCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceBeginUpdateCall) Do(f func(context.Context, string, string, string, armcompute.VirtualMachineScaleSetVM, *armcompute.VirtualMachineScaleSetVMsClientBeginUpdateOptions) (*runtime.Poller[armcompute.VirtualMachineScaleSetVMsClientUpdateResponse], error)) *MockInterfaceBeginUpdateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceBeginUpdateCall) DoAndReturn(f func(context.Context, string, string, string, armcompute.VirtualMachineScaleSetVM, *armcompute.VirtualMachineScaleSetVMsClientBeginUpdateOptions) (*runtime.Poller[armcompute.VirtualMachineScaleSetVMsClientUpdateResponse], error)) *MockInterfaceBeginUpdateCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Delete mocks base method. +func (m *MockInterface) Delete(ctx context.Context, resourceGroupName, parentResourceName, resourceName string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", ctx, resourceGroupName, parentResourceName, resourceName) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete. +func (mr *MockInterfaceMockRecorder) Delete(ctx, resourceGroupName, parentResourceName, resourceName any) *MockInterfaceDeleteCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockInterface)(nil).Delete), ctx, resourceGroupName, parentResourceName, resourceName) + return &MockInterfaceDeleteCall{Call: call} +} + +// MockInterfaceDeleteCall wrap *gomock.Call +type MockInterfaceDeleteCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceDeleteCall) Return(arg0 error) *MockInterfaceDeleteCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceDeleteCall) Do(f func(context.Context, string, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceDeleteCall) DoAndReturn(f func(context.Context, string, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Get mocks base method. +func (m *MockInterface) Get(ctx context.Context, resourceGroupName, parentResourceName, resourceName string) (*armcompute.VirtualMachineScaleSetVM, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", ctx, resourceGroupName, parentResourceName, resourceName) + ret0, _ := ret[0].(*armcompute.VirtualMachineScaleSetVM) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, parentResourceName, resourceName any) *MockInterfaceGetCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, parentResourceName, resourceName) + return &MockInterfaceGetCall{Call: call} +} + +// MockInterfaceGetCall wrap *gomock.Call +type MockInterfaceGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetCall) Return(result *armcompute.VirtualMachineScaleSetVM, rerr error) *MockInterfaceGetCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string, string) (*armcompute.VirtualMachineScaleSetVM, error)) *MockInterfaceGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string, string) (*armcompute.VirtualMachineScaleSetVM, error)) *MockInterfaceGetCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetInstanceView mocks base method. +func (m *MockInterface) GetInstanceView(ctx context.Context, resourceGroupName, vmScaleSetName, instanceID string) (*armcompute.VirtualMachineScaleSetVMInstanceView, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetInstanceView", ctx, resourceGroupName, vmScaleSetName, instanceID) + ret0, _ := ret[0].(*armcompute.VirtualMachineScaleSetVMInstanceView) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetInstanceView indicates an expected call of GetInstanceView. +func (mr *MockInterfaceMockRecorder) GetInstanceView(ctx, resourceGroupName, vmScaleSetName, instanceID any) *MockInterfaceGetInstanceViewCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetInstanceView", reflect.TypeOf((*MockInterface)(nil).GetInstanceView), ctx, resourceGroupName, vmScaleSetName, instanceID) + return &MockInterfaceGetInstanceViewCall{Call: call} +} + +// MockInterfaceGetInstanceViewCall wrap *gomock.Call +type MockInterfaceGetInstanceViewCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetInstanceViewCall) Return(arg0 *armcompute.VirtualMachineScaleSetVMInstanceView, arg1 error) *MockInterfaceGetInstanceViewCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetInstanceViewCall) Do(f func(context.Context, string, string, string) (*armcompute.VirtualMachineScaleSetVMInstanceView, error)) *MockInterfaceGetInstanceViewCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetInstanceViewCall) DoAndReturn(f func(context.Context, string, string, string) (*armcompute.VirtualMachineScaleSetVMInstanceView, error)) *MockInterfaceGetInstanceViewCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// List mocks base method. +func (m *MockInterface) List(ctx context.Context, resourceGroupName, parentResourceName string) ([]*armcompute.VirtualMachineScaleSetVM, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "List", ctx, resourceGroupName, parentResourceName) + ret0, _ := ret[0].([]*armcompute.VirtualMachineScaleSetVM) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// List indicates an expected call of List. +func (mr *MockInterfaceMockRecorder) List(ctx, resourceGroupName, parentResourceName any) *MockInterfaceListCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockInterface)(nil).List), ctx, resourceGroupName, parentResourceName) + return &MockInterfaceListCall{Call: call} +} + +// MockInterfaceListCall wrap *gomock.Call +type MockInterfaceListCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceListCall) Return(result []*armcompute.VirtualMachineScaleSetVM, rerr error) *MockInterfaceListCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceListCall) Do(f func(context.Context, string, string) ([]*armcompute.VirtualMachineScaleSetVM, error)) *MockInterfaceListCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceListCall) DoAndReturn(f func(context.Context, string, string) ([]*armcompute.VirtualMachineScaleSetVM, error)) *MockInterfaceListCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ListVMInstanceView mocks base method. +func (m *MockInterface) ListVMInstanceView(ctx context.Context, resourceGroupName, parentResourceName string) ([]*armcompute.VirtualMachineScaleSetVM, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListVMInstanceView", ctx, resourceGroupName, parentResourceName) + ret0, _ := ret[0].([]*armcompute.VirtualMachineScaleSetVM) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListVMInstanceView indicates an expected call of ListVMInstanceView. +func (mr *MockInterfaceMockRecorder) ListVMInstanceView(ctx, resourceGroupName, parentResourceName any) *MockInterfaceListVMInstanceViewCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListVMInstanceView", reflect.TypeOf((*MockInterface)(nil).ListVMInstanceView), ctx, resourceGroupName, parentResourceName) + return &MockInterfaceListVMInstanceViewCall{Call: call} +} + +// MockInterfaceListVMInstanceViewCall wrap *gomock.Call +type MockInterfaceListVMInstanceViewCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceListVMInstanceViewCall) Return(result []*armcompute.VirtualMachineScaleSetVM, rerr error) *MockInterfaceListVMInstanceViewCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceListVMInstanceViewCall) Do(f func(context.Context, string, string) ([]*armcompute.VirtualMachineScaleSetVM, error)) *MockInterfaceListVMInstanceViewCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceListVMInstanceViewCall) DoAndReturn(f func(context.Context, string, string) ([]*armcompute.VirtualMachineScaleSetVM, error)) *MockInterfaceListVMInstanceViewCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Update mocks base method. +func (m *MockInterface) Update(ctx context.Context, resourceGroupName, VMScaleSetName, instanceID string, parameters armcompute.VirtualMachineScaleSetVM) (*armcompute.VirtualMachineScaleSetVM, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Update", ctx, resourceGroupName, VMScaleSetName, instanceID, parameters) + ret0, _ := ret[0].(*armcompute.VirtualMachineScaleSetVM) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Update indicates an expected call of Update. +func (mr *MockInterfaceMockRecorder) Update(ctx, resourceGroupName, VMScaleSetName, instanceID, parameters any) *MockInterfaceUpdateCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockInterface)(nil).Update), ctx, resourceGroupName, VMScaleSetName, instanceID, parameters) + return &MockInterfaceUpdateCall{Call: call} +} + +// MockInterfaceUpdateCall wrap *gomock.Call +type MockInterfaceUpdateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceUpdateCall) Return(arg0 *armcompute.VirtualMachineScaleSetVM, arg1 error) *MockInterfaceUpdateCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceUpdateCall) Do(f func(context.Context, string, string, string, armcompute.VirtualMachineScaleSetVM) (*armcompute.VirtualMachineScaleSetVM, error)) *MockInterfaceUpdateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceUpdateCall) DoAndReturn(f func(context.Context, string, string, string, armcompute.VirtualMachineScaleSetVM) (*armcompute.VirtualMachineScaleSetVM, error)) *MockInterfaceUpdateCall { + c.Call = c.Call.DoAndReturn(f) + return c +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworkclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworkclient/interface_gomock.go new file mode 100644 index 0000000000..698e3ea4fb --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworkclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package virtualnetworkclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworkclient/mock_virtualnetworkclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_virtualnetworkclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworkclient/mock_virtualnetworkclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworkclient/mock_virtualnetworkclient/interface.go new file mode 100644 index 0000000000..327d4f9f76 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworkclient/mock_virtualnetworkclient/interface.go @@ -0,0 +1,255 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ +// + +// Code generated by MockGen. DO NOT EDIT. +// Source: virtualnetworkclient/interface.go +// +// Generated by this command: +// +// mockgen -package mock_virtualnetworkclient -source virtualnetworkclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt +// + +// Package mock_virtualnetworkclient is a generated GoMock package. +package mock_virtualnetworkclient + +import ( + context "context" + reflect "reflect" + + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" + gomock "go.uber.org/mock/gomock" +) + +//go:generate mockgen -package mock_virtualnetworkclient -source virtualnetworkclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + +// MockInterface is a mock of Interface interface. +type MockInterface struct { + ctrl *gomock.Controller + recorder *MockInterfaceMockRecorder + isgomock struct{} +} + +// MockInterfaceMockRecorder is the mock recorder for MockInterface. +type MockInterfaceMockRecorder struct { + mock *MockInterface +} + +// NewMockInterface creates a new mock instance. +func NewMockInterface(ctrl *gomock.Controller) *MockInterface { + mock := &MockInterface{ctrl: ctrl} + mock.recorder = &MockInterfaceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockInterface) EXPECT() *MockInterfaceMockRecorder { + return m.recorder +} + +// CheckIPAddressAvailability mocks base method. +func (m *MockInterface) CheckIPAddressAvailability(ctx context.Context, resourceGroupName, virtualNetworkName, ipAddress string) (*armnetwork.IPAddressAvailabilityResult, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CheckIPAddressAvailability", ctx, resourceGroupName, virtualNetworkName, ipAddress) + ret0, _ := ret[0].(*armnetwork.IPAddressAvailabilityResult) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CheckIPAddressAvailability indicates an expected call of CheckIPAddressAvailability. +func (mr *MockInterfaceMockRecorder) CheckIPAddressAvailability(ctx, resourceGroupName, virtualNetworkName, ipAddress any) *MockInterfaceCheckIPAddressAvailabilityCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CheckIPAddressAvailability", reflect.TypeOf((*MockInterface)(nil).CheckIPAddressAvailability), ctx, resourceGroupName, virtualNetworkName, ipAddress) + return &MockInterfaceCheckIPAddressAvailabilityCall{Call: call} +} + +// MockInterfaceCheckIPAddressAvailabilityCall wrap *gomock.Call +type MockInterfaceCheckIPAddressAvailabilityCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceCheckIPAddressAvailabilityCall) Return(arg0 *armnetwork.IPAddressAvailabilityResult, arg1 error) *MockInterfaceCheckIPAddressAvailabilityCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceCheckIPAddressAvailabilityCall) Do(f func(context.Context, string, string, string) (*armnetwork.IPAddressAvailabilityResult, error)) *MockInterfaceCheckIPAddressAvailabilityCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceCheckIPAddressAvailabilityCall) DoAndReturn(f func(context.Context, string, string, string) (*armnetwork.IPAddressAvailabilityResult, error)) *MockInterfaceCheckIPAddressAvailabilityCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// CreateOrUpdate mocks base method. +func (m *MockInterface) CreateOrUpdate(ctx context.Context, resourceGroupName, resourceName string, resourceParam armnetwork.VirtualNetwork) (*armnetwork.VirtualNetwork, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateOrUpdate", ctx, resourceGroupName, resourceName, resourceParam) + ret0, _ := ret[0].(*armnetwork.VirtualNetwork) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateOrUpdate indicates an expected call of CreateOrUpdate. +func (mr *MockInterfaceMockRecorder) CreateOrUpdate(ctx, resourceGroupName, resourceName, resourceParam any) *MockInterfaceCreateOrUpdateCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockInterface)(nil).CreateOrUpdate), ctx, resourceGroupName, resourceName, resourceParam) + return &MockInterfaceCreateOrUpdateCall{Call: call} +} + +// MockInterfaceCreateOrUpdateCall wrap *gomock.Call +type MockInterfaceCreateOrUpdateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceCreateOrUpdateCall) Return(arg0 *armnetwork.VirtualNetwork, arg1 error) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceCreateOrUpdateCall) Do(f func(context.Context, string, string, armnetwork.VirtualNetwork) (*armnetwork.VirtualNetwork, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceCreateOrUpdateCall) DoAndReturn(f func(context.Context, string, string, armnetwork.VirtualNetwork) (*armnetwork.VirtualNetwork, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Delete mocks base method. +func (m *MockInterface) Delete(ctx context.Context, resourceGroupName, resourceName string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", ctx, resourceGroupName, resourceName) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete. +func (mr *MockInterfaceMockRecorder) Delete(ctx, resourceGroupName, resourceName any) *MockInterfaceDeleteCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockInterface)(nil).Delete), ctx, resourceGroupName, resourceName) + return &MockInterfaceDeleteCall{Call: call} +} + +// MockInterfaceDeleteCall wrap *gomock.Call +type MockInterfaceDeleteCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceDeleteCall) Return(arg0 error) *MockInterfaceDeleteCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceDeleteCall) Do(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceDeleteCall) DoAndReturn(f func(context.Context, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Get mocks base method. +func (m *MockInterface) Get(ctx context.Context, resourceGroupName, resourceName string, expand *string) (*armnetwork.VirtualNetwork, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", ctx, resourceGroupName, resourceName, expand) + ret0, _ := ret[0].(*armnetwork.VirtualNetwork) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, resourceName, expand any) *MockInterfaceGetCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, resourceName, expand) + return &MockInterfaceGetCall{Call: call} +} + +// MockInterfaceGetCall wrap *gomock.Call +type MockInterfaceGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetCall) Return(result *armnetwork.VirtualNetwork, rerr error) *MockInterfaceGetCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string, *string) (*armnetwork.VirtualNetwork, error)) *MockInterfaceGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string, *string) (*armnetwork.VirtualNetwork, error)) *MockInterfaceGetCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// List mocks base method. +func (m *MockInterface) List(ctx context.Context, resourceGroupName string) ([]*armnetwork.VirtualNetwork, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "List", ctx, resourceGroupName) + ret0, _ := ret[0].([]*armnetwork.VirtualNetwork) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// List indicates an expected call of List. +func (mr *MockInterfaceMockRecorder) List(ctx, resourceGroupName any) *MockInterfaceListCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockInterface)(nil).List), ctx, resourceGroupName) + return &MockInterfaceListCall{Call: call} +} + +// MockInterfaceListCall wrap *gomock.Call +type MockInterfaceListCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceListCall) Return(result []*armnetwork.VirtualNetwork, rerr error) *MockInterfaceListCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceListCall) Do(f func(context.Context, string) ([]*armnetwork.VirtualNetwork, error)) *MockInterfaceListCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceListCall) DoAndReturn(f func(context.Context, string) ([]*armnetwork.VirtualNetwork, error)) *MockInterfaceListCall { + c.Call = c.Call.DoAndReturn(f) + return c +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworklinkclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworklinkclient/interface.go index 3f4af5908c..fce7d42874 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworklinkclient/interface.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworklinkclient/interface.go @@ -23,8 +23,9 @@ import ( "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" ) -// +azure:client:verbs=get;createorupdate,resource=PrivateZone,subResource=VirtualNetworkLink,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns,packageAlias=armprivatedns,clientName=VirtualNetworkLinksClient,expand=false,rateLimitKey=virtualNetworkRateLimit +// +azure:client:verbs=get;createorupdate;delete,resource=PrivateZone,subResource=VirtualNetworkLink,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns,packageAlias=armprivatedns,clientName=VirtualNetworkLinksClient,expand=false,rateLimitKey=virtualNetworkRateLimit type Interface interface { utils.SubResourceGetFunc[armprivatedns.VirtualNetworkLink] utils.SubResourceCreateOrUpdateFunc[armprivatedns.VirtualNetworkLink] + utils.SubResourceDeleteFunc[armprivatedns.VirtualNetworkLink] } diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworklinkclient/interface_gomock.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworklinkclient/interface_gomock.go new file mode 100644 index 0000000000..c40e360568 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworklinkclient/interface_gomock.go @@ -0,0 +1,25 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ + +// Code generated by client-gen. DO NOT EDIT. +package virtualnetworklinkclient + +import ( + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworklinkclient/mock_virtualnetworklinkclient" +) + +// Code generated by MockGen. DO NOT EDIT. +var _ Interface = &mock_virtualnetworklinkclient.MockInterface{} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworklinkclient/mock_virtualnetworklinkclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworklinkclient/mock_virtualnetworklinkclient/interface.go index a603655a6a..043fa15bfa 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworklinkclient/mock_virtualnetworklinkclient/interface.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworklinkclient/mock_virtualnetworklinkclient/interface.go @@ -20,7 +20,7 @@ // // Generated by this command: // -// mockgen -package mock_virtualnetworklinkclient -source virtualnetworklinkclient/interface.go -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt +// mockgen -package mock_virtualnetworklinkclient -source virtualnetworklinkclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt // // Package mock_virtualnetworklinkclient is a generated GoMock package. @@ -34,6 +34,8 @@ import ( gomock "go.uber.org/mock/gomock" ) +//go:generate mockgen -package mock_virtualnetworklinkclient -source virtualnetworklinkclient/interface.go -typed -write_generate_directive -copyright_file ../../hack/boilerplate/boilerplate.generatego.txt + // MockInterface is a mock of Interface interface. type MockInterface struct { ctrl *gomock.Controller @@ -68,9 +70,71 @@ func (m *MockInterface) CreateOrUpdate(ctx context.Context, resourceGroupName, p } // CreateOrUpdate indicates an expected call of CreateOrUpdate. -func (mr *MockInterfaceMockRecorder) CreateOrUpdate(ctx, resourceGroupName, parentResourceName, resourceName, resourceParam any) *gomock.Call { +func (mr *MockInterfaceMockRecorder) CreateOrUpdate(ctx, resourceGroupName, parentResourceName, resourceName, resourceParam any) *MockInterfaceCreateOrUpdateCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockInterface)(nil).CreateOrUpdate), ctx, resourceGroupName, parentResourceName, resourceName, resourceParam) + return &MockInterfaceCreateOrUpdateCall{Call: call} +} + +// MockInterfaceCreateOrUpdateCall wrap *gomock.Call +type MockInterfaceCreateOrUpdateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceCreateOrUpdateCall) Return(arg0 *armprivatedns.VirtualNetworkLink, arg1 error) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceCreateOrUpdateCall) Do(f func(context.Context, string, string, string, armprivatedns.VirtualNetworkLink) (*armprivatedns.VirtualNetworkLink, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceCreateOrUpdateCall) DoAndReturn(f func(context.Context, string, string, string, armprivatedns.VirtualNetworkLink) (*armprivatedns.VirtualNetworkLink, error)) *MockInterfaceCreateOrUpdateCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Delete mocks base method. +func (m *MockInterface) Delete(ctx context.Context, resourceGroupName, parentResourceName, resourceName string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", ctx, resourceGroupName, parentResourceName, resourceName) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete. +func (mr *MockInterfaceMockRecorder) Delete(ctx, resourceGroupName, parentResourceName, resourceName any) *MockInterfaceDeleteCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockInterface)(nil).CreateOrUpdate), ctx, resourceGroupName, parentResourceName, resourceName, resourceParam) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockInterface)(nil).Delete), ctx, resourceGroupName, parentResourceName, resourceName) + return &MockInterfaceDeleteCall{Call: call} +} + +// MockInterfaceDeleteCall wrap *gomock.Call +type MockInterfaceDeleteCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceDeleteCall) Return(arg0 error) *MockInterfaceDeleteCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceDeleteCall) Do(f func(context.Context, string, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceDeleteCall) DoAndReturn(f func(context.Context, string, string, string) error) *MockInterfaceDeleteCall { + c.Call = c.Call.DoAndReturn(f) + return c } // Get mocks base method. @@ -83,7 +147,31 @@ func (m *MockInterface) Get(ctx context.Context, resourceGroupName, parentResour } // Get indicates an expected call of Get. -func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, parentResourceName, resourceName any) *gomock.Call { +func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, parentResourceName, resourceName any) *MockInterfaceGetCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, parentResourceName, resourceName) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, parentResourceName, resourceName) + return &MockInterfaceGetCall{Call: call} +} + +// MockInterfaceGetCall wrap *gomock.Call +type MockInterfaceGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockInterfaceGetCall) Return(result *armprivatedns.VirtualNetworkLink, rerr error) *MockInterfaceGetCall { + c.Call = c.Call.Return(result, rerr) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string, string) (*armprivatedns.VirtualNetworkLink, error)) *MockInterfaceGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string, string) (*armprivatedns.VirtualNetworkLink, error)) *MockInterfaceGetCall { + c.Call = c.Call.DoAndReturn(f) + return c } diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworklinkclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworklinkclient/zz_generated_client.go index ff6151c961..8e578f7b15 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworklinkclient/zz_generated_client.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworklinkclient/zz_generated_client.go @@ -87,3 +87,15 @@ func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName stri } return nil, nil } + +const DeleteOperationName = "VirtualNetworkLinksClient.Delete" + +// Delete deletes a VirtualNetworkLink by name. +func (client *Client) Delete(ctx context.Context, resourceGroupName string, parentResourceName string, resourceName string) (err error) { + metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "VirtualNetworkLink", "delete") + defer func() { metricsCtx.Observe(ctx, err) }() + ctx, endSpan := runtime.StartSpan(ctx, DeleteOperationName, client.tracer, nil) + defer endSpan(err) + _, err = utils.NewPollerWrapper(client.BeginDelete(ctx, resourceGroupName, parentResourceName, resourceName, nil)).WaitforPollerResp(ctx) + return err +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azureclients/routetableclient/azure_routetableclient.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azureclients/routetableclient/azure_routetableclient.go deleted file mode 100644 index 1eea86106d..0000000000 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azureclients/routetableclient/azure_routetableclient.go +++ /dev/null @@ -1,219 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package routetableclient - -import ( - "context" - "net/http" - "strings" - "time" - - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2022-07-01/network" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - - "k8s.io/client-go/util/flowcontrol" - "k8s.io/klog/v2" - - azclients "sigs.k8s.io/cloud-provider-azure/pkg/azureclients" - "sigs.k8s.io/cloud-provider-azure/pkg/azureclients/armclient" - "sigs.k8s.io/cloud-provider-azure/pkg/metrics" - "sigs.k8s.io/cloud-provider-azure/pkg/retry" -) - -var _ Interface = &Client{} - -const routeTablesResourceType = "Microsoft.Network/routeTables" - -// Client implements RouteTable client Interface. -type Client struct { - armClient armclient.Interface - subscriptionID string - cloudName string - - // Rate limiting configures. - rateLimiterReader flowcontrol.RateLimiter - rateLimiterWriter flowcontrol.RateLimiter - - // ARM throttling configures. - RetryAfterReader time.Time - RetryAfterWriter time.Time -} - -// New creates a new RouteTable client with ratelimiting. -func New(config *azclients.ClientConfig) *Client { - baseURI := config.ResourceManagerEndpoint - authorizer := config.Authorizer - apiVersion := APIVersion - if strings.EqualFold(config.CloudName, AzureStackCloudName) && !config.DisableAzureStackCloud { - apiVersion = AzureStackCloudAPIVersion - } - armClient := armclient.New(authorizer, *config, baseURI, apiVersion) - rateLimiterReader, rateLimiterWriter := azclients.NewRateLimiter(config.RateLimitConfig) - - if azclients.RateLimitEnabled(config.RateLimitConfig) { - klog.V(2).Infof("Azure RouteTablesClient (read ops) using rate limit config: QPS=%g, bucket=%d", - config.RateLimitConfig.CloudProviderRateLimitQPS, - config.RateLimitConfig.CloudProviderRateLimitBucket) - klog.V(2).Infof("Azure RouteTablesClient (write ops) using rate limit config: QPS=%g, bucket=%d", - config.RateLimitConfig.CloudProviderRateLimitQPSWrite, - config.RateLimitConfig.CloudProviderRateLimitBucketWrite) - } - - client := &Client{ - armClient: armClient, - rateLimiterReader: rateLimiterReader, - rateLimiterWriter: rateLimiterWriter, - subscriptionID: config.SubscriptionID, - cloudName: config.CloudName, - } - - return client -} - -// Get gets a RouteTable. -func (c *Client) Get(ctx context.Context, resourceGroupName string, routeTableName string, expand string) (network.RouteTable, *retry.Error) { - mc := metrics.NewMetricContext("route_tables", "get", resourceGroupName, c.subscriptionID, "") - - // Report errors if the client is rate limited. - if !c.rateLimiterReader.TryAccept() { - mc.RateLimitedCount() - return network.RouteTable{}, retry.GetRateLimitError(false, "RouteTableGet") - } - - // Report errors if the client is throttled. - if c.RetryAfterReader.After(time.Now()) { - mc.ThrottledCount() - rerr := retry.GetThrottlingError("RouteTableGet", "client throttled", c.RetryAfterReader) - return network.RouteTable{}, rerr - } - - result, rerr := c.getRouteTable(ctx, resourceGroupName, routeTableName, expand) - mc.Observe(rerr) - if rerr != nil { - if rerr.IsThrottled() { - // Update RetryAfterReader so that no more requests would be sent until RetryAfter expires. - c.RetryAfterReader = rerr.RetryAfter - } - - return result, rerr - } - - return result, nil -} - -// getRouteTable gets a RouteTable. -func (c *Client) getRouteTable(ctx context.Context, resourceGroupName string, routeTableName string, expand string) (network.RouteTable, *retry.Error) { - resourceID := armclient.GetResourceID( - c.subscriptionID, - resourceGroupName, - routeTablesResourceType, - routeTableName, - ) - result := network.RouteTable{} - - response, rerr := c.armClient.GetResourceWithExpandQuery(ctx, resourceID, expand) - defer c.armClient.CloseResponse(ctx, response) - if rerr != nil { - klog.V(5).Infof("Received error in %s: resourceID: %s, error: %s", "routetable.get.request", resourceID, rerr.Error()) - return result, rerr - } - - err := autorest.Respond( - response, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result)) - if err != nil { - klog.V(5).Infof("Received error in %s: resourceID: %s, error: %s", "routetable.get.respond", resourceID, err) - return result, retry.GetError(response, err) - } - - result.Response = autorest.Response{Response: response} - return result, nil -} - -// CreateOrUpdate creates or updates a RouteTable. -func (c *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, routeTableName string, parameters network.RouteTable, etag string) *retry.Error { - mc := metrics.NewMetricContext("route_tables", "create_or_update", resourceGroupName, c.subscriptionID, "") - - // Report errors if the client is rate limited. - if !c.rateLimiterWriter.TryAccept() { - mc.RateLimitedCount() - return retry.GetRateLimitError(true, "RouteTableCreateOrUpdate") - } - - // Report errors if the client is throttled. - if c.RetryAfterWriter.After(time.Now()) { - mc.ThrottledCount() - rerr := retry.GetThrottlingError("RouteTableCreateOrUpdate", "client throttled", c.RetryAfterWriter) - return rerr - } - - rerr := c.createOrUpdateRouteTable(ctx, resourceGroupName, routeTableName, parameters, etag) - mc.Observe(rerr) - if rerr != nil { - if rerr.IsThrottled() { - // Update RetryAfterReader so that no more requests would be sent until RetryAfter expires. - c.RetryAfterWriter = rerr.RetryAfter - } - - return rerr - } - - return nil -} - -// createOrUpdateRouteTable creates or updates a RouteTable. -func (c *Client) createOrUpdateRouteTable(ctx context.Context, resourceGroupName string, routeTableName string, parameters network.RouteTable, etag string) *retry.Error { - resourceID := armclient.GetResourceID( - c.subscriptionID, - resourceGroupName, - routeTablesResourceType, - routeTableName, - ) - decorators := []autorest.PrepareDecorator{} - if etag != "" { - decorators = append(decorators, autorest.WithHeader("If-Match", autorest.String(etag))) - } - - response, rerr := c.armClient.PutResource(ctx, resourceID, parameters, decorators...) - defer c.armClient.CloseResponse(ctx, response) - if rerr != nil { - klog.V(5).Infof("Received error in %s: resourceID: %s, error: %s", "routetable.put.request", resourceID, rerr.Error()) - return rerr - } - - if response != nil && response.StatusCode != http.StatusNoContent { - _, rerr = c.createOrUpdateResponder(response) - if rerr != nil { - klog.V(5).Infof("Received error in %s: resourceID: %s, error: %s", "routetable.put.respond", resourceID, rerr.Error()) - return rerr - } - } - - return nil -} - -func (c *Client) createOrUpdateResponder(resp *http.Response) (*network.RouteTable, *retry.Error) { - result := &network.RouteTable{} - err := autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result)) - result.Response = autorest.Response{Response: resp} - return result, retry.GetError(resp, err) -} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azureclients/routetableclient/doc.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azureclients/routetableclient/doc.go deleted file mode 100644 index 49d8ed616f..0000000000 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azureclients/routetableclient/doc.go +++ /dev/null @@ -1,18 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Package routetableclient implements the client for RouteTable. -package routetableclient // import "sigs.k8s.io/cloud-provider-azure/pkg/azureclients/routetableclient" diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azureclients/routetableclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azureclients/routetableclient/interface.go deleted file mode 100644 index 1ef8cfc08a..0000000000 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azureclients/routetableclient/interface.go +++ /dev/null @@ -1,44 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package routetableclient - -import ( - "context" - - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2022-07-01/network" - - "sigs.k8s.io/cloud-provider-azure/pkg/retry" -) - -const ( - // APIVersion is the API version for network. - APIVersion = "2022-07-01" - // AzureStackCloudAPIVersion is the API version for Azure Stack - AzureStackCloudAPIVersion = "2018-11-01" - // AzureStackCloudName is the cloud name of Azure Stack - AzureStackCloudName = "AZURESTACKCLOUD" -) - -// Interface is the client interface for RouteTable. -// Don't forget to run "hack/update-mock-clients.sh" command to generate the mock client. -type Interface interface { - // Get gets a RouteTable. - Get(ctx context.Context, resourceGroupName string, routeTableName string, expand string) (result network.RouteTable, rerr *retry.Error) - - // CreateOrUpdate creates or updates a RouteTable. - CreateOrUpdate(ctx context.Context, resourceGroupName string, routeTableName string, parameters network.RouteTable, etag string) *retry.Error -} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azureclients/routetableclient/mockroutetableclient/doc.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azureclients/routetableclient/mockroutetableclient/doc.go deleted file mode 100644 index c2aa4cc399..0000000000 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azureclients/routetableclient/mockroutetableclient/doc.go +++ /dev/null @@ -1,18 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Package mockroutetableclient implements the mock client for RouteTable. -package mockroutetableclient // import "sigs.k8s.io/cloud-provider-azure/pkg/azureclients/routetableclient/mockroutetableclient" diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure.go index 677bb2ea13..2a000d7acc 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure.go @@ -20,7 +20,6 @@ import ( "context" "errors" "fmt" - "io" "net/http" "os" "strings" @@ -33,7 +32,6 @@ import ( "github.com/Azure/go-autorest/autorest/azure" v1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/client-go/informers" @@ -60,7 +58,6 @@ import ( "sigs.k8s.io/cloud-provider-azure/pkg/azureclients/privatednszonegroupclient" "sigs.k8s.io/cloud-provider-azure/pkg/azureclients/privateendpointclient" "sigs.k8s.io/cloud-provider-azure/pkg/azureclients/publicipclient" - "sigs.k8s.io/cloud-provider-azure/pkg/azureclients/routetableclient" "sigs.k8s.io/cloud-provider-azure/pkg/azureclients/storageaccountclient" "sigs.k8s.io/cloud-provider-azure/pkg/azureclients/subnetclient" "sigs.k8s.io/cloud-provider-azure/pkg/azureclients/vmasclient" @@ -68,17 +65,19 @@ import ( "sigs.k8s.io/cloud-provider-azure/pkg/azureclients/vmsizeclient" "sigs.k8s.io/cloud-provider-azure/pkg/azureclients/vmssclient" "sigs.k8s.io/cloud-provider-azure/pkg/azureclients/vmssvmclient" + "sigs.k8s.io/cloud-provider-azure/pkg/provider/config" "sigs.k8s.io/cloud-provider-azure/pkg/provider/privatelinkservice" + "sigs.k8s.io/cloud-provider-azure/pkg/provider/routetable" + "sigs.k8s.io/cloud-provider-azure/pkg/provider/securitygroup" "sigs.k8s.io/cloud-provider-azure/pkg/provider/subnet" "sigs.k8s.io/cloud-provider-azure/pkg/provider/zone" - - "sigs.k8s.io/yaml" + "sigs.k8s.io/cloud-provider-azure/pkg/version" azcache "sigs.k8s.io/cloud-provider-azure/pkg/cache" "sigs.k8s.io/cloud-provider-azure/pkg/consts" - ratelimitconfig "sigs.k8s.io/cloud-provider-azure/pkg/provider/config" - "sigs.k8s.io/cloud-provider-azure/pkg/provider/securitygroup" + azureconfig "sigs.k8s.io/cloud-provider-azure/pkg/provider/config" "sigs.k8s.io/cloud-provider-azure/pkg/retry" + "sigs.k8s.io/cloud-provider-azure/pkg/util/lockmap" utilsets "sigs.k8s.io/cloud-provider-azure/pkg/util/sets" "sigs.k8s.io/cloud-provider-azure/pkg/util/taints" ) @@ -100,249 +99,6 @@ var ( } ) -// Config holds the configuration parsed from the --cloud-config flag -// All fields are required unless otherwise specified -// NOTE: Cloud config files should follow the same Kubernetes deprecation policy as -// flags or CLIs. Config fields should not change behavior in incompatible ways and -// should be deprecated for at least 2 release prior to removing. -// See https://kubernetes.io/docs/reference/using-api/deprecation-policy/#deprecating-a-flag-or-cli -// for more details. -type Config struct { - ratelimitconfig.AzureAuthConfig `json:",inline" yaml:",inline"` - ratelimitconfig.CloudProviderRateLimitConfig `json:",inline" yaml:",inline"` - - // The cloud configure type for Azure cloud provider. Supported values are file, secret and merge. - CloudConfigType configloader.CloudConfigType `json:"cloudConfigType,omitempty" yaml:"cloudConfigType,omitempty"` - - // The name of the resource group that the cluster is deployed in - ResourceGroup string `json:"resourceGroup,omitempty" yaml:"resourceGroup,omitempty"` - // The location of the resource group that the cluster is deployed in - Location string `json:"location,omitempty" yaml:"location,omitempty"` - // The name of site where the cluster will be deployed to that is more granular than the region specified by the "location" field. - // Currently only public ip, load balancer and managed disks support this. - ExtendedLocationName string `json:"extendedLocationName,omitempty" yaml:"extendedLocationName,omitempty"` - // The type of site that is being targeted. - // Currently only public ip, load balancer and managed disks support this. - ExtendedLocationType string `json:"extendedLocationType,omitempty" yaml:"extendedLocationType,omitempty"` - // The name of the VNet that the cluster is deployed in - VnetName string `json:"vnetName,omitempty" yaml:"vnetName,omitempty"` - // The name of the resource group that the Vnet is deployed in - VnetResourceGroup string `json:"vnetResourceGroup,omitempty" yaml:"vnetResourceGroup,omitempty"` - // The name of the subnet that the cluster is deployed in - SubnetName string `json:"subnetName,omitempty" yaml:"subnetName,omitempty"` - // The name of the security group attached to the cluster's subnet - SecurityGroupName string `json:"securityGroupName,omitempty" yaml:"securityGroupName,omitempty"` - // The name of the resource group that the security group is deployed in - SecurityGroupResourceGroup string `json:"securityGroupResourceGroup,omitempty" yaml:"securityGroupResourceGroup,omitempty"` - // (Optional in 1.6) The name of the route table attached to the subnet that the cluster is deployed in - RouteTableName string `json:"routeTableName,omitempty" yaml:"routeTableName,omitempty"` - // The name of the resource group that the RouteTable is deployed in - RouteTableResourceGroup string `json:"routeTableResourceGroup,omitempty" yaml:"routeTableResourceGroup,omitempty"` - // (Optional) The name of the availability set that should be used as the load balancer backend - // If this is set, the Azure cloudprovider will only add nodes from that availability set to the load - // balancer backend pool. If this is not set, and multiple agent pools (availability sets) are used, then - // the cloudprovider will try to add all nodes to a single backend pool which is forbidden. - // In other words, if you use multiple agent pools (availability sets), you MUST set this field. - PrimaryAvailabilitySetName string `json:"primaryAvailabilitySetName,omitempty" yaml:"primaryAvailabilitySetName,omitempty"` - // The type of azure nodes. Candidate values are: vmss, standard and vmssflex. - // If not set, it will be default to vmss. - VMType string `json:"vmType,omitempty" yaml:"vmType,omitempty"` - // The name of the scale set that should be used as the load balancer backend. - // If this is set, the Azure cloudprovider will only add nodes from that scale set to the load - // balancer backend pool. If this is not set, and multiple agent pools (scale sets) are used, then - // the cloudprovider will try to add all nodes to a single backend pool which is forbidden in the basic sku. - // In other words, if you use multiple agent pools (scale sets), and loadBalancerSku is set to basic, you MUST set this field. - PrimaryScaleSetName string `json:"primaryScaleSetName,omitempty" yaml:"primaryScaleSetName,omitempty"` - // Tags determines what tags shall be applied to the shared resources managed by controller manager, which - // includes load balancer, security group and route table. The supported format is `a=b,c=d,...`. After updated - // this config, the old tags would be replaced by the new ones. - // Because special characters are not supported in "tags" configuration, "tags" support would be removed in a future release, - // please consider migrating the config to "tagsMap". - Tags string `json:"tags,omitempty" yaml:"tags,omitempty"` - // TagsMap is similar to Tags but holds tags with special characters such as `=` and `,`. - TagsMap map[string]string `json:"tagsMap,omitempty" yaml:"tagsMap,omitempty"` - // SystemTags determines the tag keys managed by cloud provider. If it is not set, no tags would be deleted if - // the `Tags` is changed. However, the old tags would be deleted if they are neither included in `Tags` nor - // in `SystemTags` after the update of `Tags`. - SystemTags string `json:"systemTags,omitempty" yaml:"systemTags,omitempty"` - // Sku of Load Balancer and Public IP. Candidate values are: basic and standard. - // If not set, it will be default to basic. - LoadBalancerSku string `json:"loadBalancerSku,omitempty" yaml:"loadBalancerSku,omitempty"` - // LoadBalancerName determines the specific name of the load balancer user want to use, working with - // LoadBalancerResourceGroup - LoadBalancerName string `json:"loadBalancerName,omitempty" yaml:"loadBalancerName,omitempty"` - // LoadBalancerResourceGroup determines the specific resource group of the load balancer user want to use, working - // with LoadBalancerName - LoadBalancerResourceGroup string `json:"loadBalancerResourceGroup,omitempty" yaml:"loadBalancerResourceGroup,omitempty"` - // PreConfiguredBackendPoolLoadBalancerTypes determines whether the LoadBalancer BackendPool has been preconfigured. - // Candidate values are: - // "": exactly with today (not pre-configured for any LBs) - // "internal": for internal LoadBalancer - // "external": for external LoadBalancer - // "all": for both internal and external LoadBalancer - PreConfiguredBackendPoolLoadBalancerTypes string `json:"preConfiguredBackendPoolLoadBalancerTypes,omitempty" yaml:"preConfiguredBackendPoolLoadBalancerTypes,omitempty"` - - // DisableAvailabilitySetNodes disables VMAS nodes support when "VMType" is set to "vmss". - DisableAvailabilitySetNodes bool `json:"disableAvailabilitySetNodes,omitempty" yaml:"disableAvailabilitySetNodes,omitempty"` - // EnableVmssFlexNodes enables vmss flex nodes support when "VMType" is set to "vmss". - EnableVmssFlexNodes bool `json:"enableVmssFlexNodes,omitempty" yaml:"enableVmssFlexNodes,omitempty"` - // DisableAzureStackCloud disables AzureStackCloud support. It should be used - // when setting AzureAuthConfig.Cloud with "AZURESTACKCLOUD" to customize ARM endpoints - // while the cluster is not running on AzureStack. - DisableAzureStackCloud bool `json:"disableAzureStackCloud,omitempty" yaml:"disableAzureStackCloud,omitempty"` - // Enable exponential backoff to manage resource request retries - CloudProviderBackoff bool `json:"cloudProviderBackoff,omitempty" yaml:"cloudProviderBackoff,omitempty"` - // Use instance metadata service where possible - UseInstanceMetadata bool `json:"useInstanceMetadata,omitempty" yaml:"useInstanceMetadata,omitempty"` - - // Backoff exponent - CloudProviderBackoffExponent float64 `json:"cloudProviderBackoffExponent,omitempty" yaml:"cloudProviderBackoffExponent,omitempty"` - // Backoff jitter - CloudProviderBackoffJitter float64 `json:"cloudProviderBackoffJitter,omitempty" yaml:"cloudProviderBackoffJitter,omitempty"` - - // ExcludeMasterFromStandardLB excludes master nodes from standard load balancer. - // If not set, it will be default to true. - ExcludeMasterFromStandardLB *bool `json:"excludeMasterFromStandardLB,omitempty" yaml:"excludeMasterFromStandardLB,omitempty"` - // DisableOutboundSNAT disables the outbound SNAT for public load balancer rules. - // It should only be set when loadBalancerSku is standard. If not set, it will be default to false. - DisableOutboundSNAT *bool `json:"disableOutboundSNAT,omitempty" yaml:"disableOutboundSNAT,omitempty"` - - // Maximum allowed LoadBalancer Rule Count is the limit enforced by Azure Load balancer - MaximumLoadBalancerRuleCount int `json:"maximumLoadBalancerRuleCount,omitempty" yaml:"maximumLoadBalancerRuleCount,omitempty"` - // Backoff retry limit - CloudProviderBackoffRetries int `json:"cloudProviderBackoffRetries,omitempty" yaml:"cloudProviderBackoffRetries,omitempty"` - // Backoff duration - CloudProviderBackoffDuration int `json:"cloudProviderBackoffDuration,omitempty" yaml:"cloudProviderBackoffDuration,omitempty"` - // NonVmssUniformNodesCacheTTLInSeconds sets the Cache TTL for NonVmssUniformNodesCacheTTLInSeconds - // if not set, will use default value - NonVmssUniformNodesCacheTTLInSeconds int `json:"nonVmssUniformNodesCacheTTLInSeconds,omitempty" yaml:"nonVmssUniformNodesCacheTTLInSeconds,omitempty"` - // VmssCacheTTLInSeconds sets the cache TTL for VMSS - VmssCacheTTLInSeconds int `json:"vmssCacheTTLInSeconds,omitempty" yaml:"vmssCacheTTLInSeconds,omitempty"` - // VmssVirtualMachinesCacheTTLInSeconds sets the cache TTL for vmssVirtualMachines - VmssVirtualMachinesCacheTTLInSeconds int `json:"vmssVirtualMachinesCacheTTLInSeconds,omitempty" yaml:"vmssVirtualMachinesCacheTTLInSeconds,omitempty"` - - // VmssFlexCacheTTLInSeconds sets the cache TTL for VMSS Flex - VmssFlexCacheTTLInSeconds int `json:"vmssFlexCacheTTLInSeconds,omitempty" yaml:"vmssFlexCacheTTLInSeconds,omitempty"` - // VmssFlexVMCacheTTLInSeconds sets the cache TTL for vmss flex vms - VmssFlexVMCacheTTLInSeconds int `json:"vmssFlexVMCacheTTLInSeconds,omitempty" yaml:"vmssFlexVMCacheTTLInSeconds,omitempty"` - - // VmCacheTTLInSeconds sets the cache TTL for vm - VMCacheTTLInSeconds int `json:"vmCacheTTLInSeconds,omitempty" yaml:"vmCacheTTLInSeconds,omitempty"` - // LoadBalancerCacheTTLInSeconds sets the cache TTL for load balancer - LoadBalancerCacheTTLInSeconds int `json:"loadBalancerCacheTTLInSeconds,omitempty" yaml:"loadBalancerCacheTTLInSeconds,omitempty"` - // NsgCacheTTLInSeconds sets the cache TTL for network security group - NsgCacheTTLInSeconds int `json:"nsgCacheTTLInSeconds,omitempty" yaml:"nsgCacheTTLInSeconds,omitempty"` - // RouteTableCacheTTLInSeconds sets the cache TTL for route table - RouteTableCacheTTLInSeconds int `json:"routeTableCacheTTLInSeconds,omitempty" yaml:"routeTableCacheTTLInSeconds,omitempty"` - // PlsCacheTTLInSeconds sets the cache TTL for private link service resource - PlsCacheTTLInSeconds int `json:"plsCacheTTLInSeconds,omitempty" yaml:"plsCacheTTLInSeconds,omitempty"` - // AvailabilitySetsCacheTTLInSeconds sets the cache TTL for VMAS - AvailabilitySetsCacheTTLInSeconds int `json:"availabilitySetsCacheTTLInSeconds,omitempty" yaml:"availabilitySetsCacheTTLInSeconds,omitempty"` - // PublicIPCacheTTLInSeconds sets the cache TTL for public ip - PublicIPCacheTTLInSeconds int `json:"publicIPCacheTTLInSeconds,omitempty" yaml:"publicIPCacheTTLInSeconds,omitempty"` - // RouteUpdateWaitingInSeconds is the delay time for waiting route updates to take effect. This waiting delay is added - // because the routes are not taken effect when the async route updating operation returns success. Default is 30 seconds. - RouteUpdateWaitingInSeconds int `json:"routeUpdateWaitingInSeconds,omitempty" yaml:"routeUpdateWaitingInSeconds,omitempty"` - // The user agent for Azure customer usage attribution - UserAgent string `json:"userAgent,omitempty" yaml:"userAgent,omitempty"` - // LoadBalancerBackendPoolConfigurationType defines how vms join the load balancer backend pools. Supported values - // are `nodeIPConfiguration`, `nodeIP` and `podIP`. - // `nodeIPConfiguration`: vm network interfaces will be attached to the inbound backend pool of the load balancer (default); - // `nodeIP`: vm private IPs will be attached to the inbound backend pool of the load balancer; - // `podIP`: pod IPs will be attached to the inbound backend pool of the load balancer (not supported yet). - LoadBalancerBackendPoolConfigurationType string `json:"loadBalancerBackendPoolConfigurationType,omitempty" yaml:"loadBalancerBackendPoolConfigurationType,omitempty"` - // PutVMSSVMBatchSize defines how many requests the client send concurrently when putting the VMSS VMs. - // If it is smaller than or equal to zero, the request will be sent one by one in sequence (default). - PutVMSSVMBatchSize int `json:"putVMSSVMBatchSize" yaml:"putVMSSVMBatchSize"` - // PrivateLinkServiceResourceGroup determines the specific resource group of the private link services user want to use - PrivateLinkServiceResourceGroup string `json:"privateLinkServiceResourceGroup,omitempty" yaml:"privateLinkServiceResourceGroup,omitempty"` - - // EnableMigrateToIPBasedBackendPoolAPI uses the migration API to migrate from NIC-based to IP-based backend pool. - // The migration API can provide a migration from NIC-based to IP-based backend pool without service downtime. - // If the API is not used, the migration will be done by decoupling all nodes on the backend pool and then re-attaching - // node IPs, which will introduce service downtime. The downtime increases with the number of nodes in the backend pool. - EnableMigrateToIPBasedBackendPoolAPI bool `json:"enableMigrateToIPBasedBackendPoolAPI" yaml:"enableMigrateToIPBasedBackendPoolAPI"` - - // MultipleStandardLoadBalancerConfigurations stores the properties regarding multiple standard load balancers. - // It will be ignored if LoadBalancerBackendPoolConfigurationType is nodeIPConfiguration. - // If the length is not 0, it is assumed the multiple standard load balancers mode is on. In this case, - // there must be one configuration named "" or an error will be reported. - MultipleStandardLoadBalancerConfigurations []MultipleStandardLoadBalancerConfiguration `json:"multipleStandardLoadBalancerConfigurations,omitempty" yaml:"multipleStandardLoadBalancerConfigurations,omitempty"` - - // DisableAPICallCache disables the cache for Azure API calls. It is for ARG support and not all resources will be disabled. - DisableAPICallCache bool `json:"disableAPICallCache,omitempty" yaml:"disableAPICallCache,omitempty"` - - // RouteUpdateIntervalInSeconds is the interval for updating routes. Default is 30 seconds. - RouteUpdateIntervalInSeconds int `json:"routeUpdateIntervalInSeconds,omitempty" yaml:"routeUpdateIntervalInSeconds,omitempty"` - // LoadBalancerBackendPoolUpdateIntervalInSeconds is the interval for updating load balancer backend pool of local services. Default is 30 seconds. - LoadBalancerBackendPoolUpdateIntervalInSeconds int `json:"loadBalancerBackendPoolUpdateIntervalInSeconds,omitempty" yaml:"loadBalancerBackendPoolUpdateIntervalInSeconds,omitempty"` - - // ClusterServiceLoadBalancerHealthProbeMode determines the health probe mode for cluster service load balancer. - // Supported values are `shared` and `servicenodeport`. - // `servicenodeport`: the health probe will be created against each port of each service by watching the backend application (default). - // `shared`: all cluster services shares one HTTP probe targeting the kube-proxy on the node (/healthz:10256). - ClusterServiceLoadBalancerHealthProbeMode string `json:"clusterServiceLoadBalancerHealthProbeMode,omitempty" yaml:"clusterServiceLoadBalancerHealthProbeMode,omitempty"` - // ClusterServiceSharedLoadBalancerHealthProbePort defines the target port of the shared health probe. Default to 10256. - ClusterServiceSharedLoadBalancerHealthProbePort int32 `json:"clusterServiceSharedLoadBalancerHealthProbePort,omitempty" yaml:"clusterServiceSharedLoadBalancerHealthProbePort,omitempty"` - // ClusterServiceSharedLoadBalancerHealthProbePath defines the target path of the shared health probe. Default to `/healthz`. - ClusterServiceSharedLoadBalancerHealthProbePath string `json:"clusterServiceSharedLoadBalancerHealthProbePath,omitempty" yaml:"clusterServiceSharedLoadBalancerHealthProbePath,omitempty"` -} - -// MultipleStandardLoadBalancerConfiguration stores the properties regarding multiple standard load balancers. -type MultipleStandardLoadBalancerConfiguration struct { - // Name of the public load balancer. There will be an internal load balancer - // created if needed, and the name will be `-internal`. The internal lb - // shares the same configurations as the external one. The internal lbs - // are not needed to be included in `MultipleStandardLoadBalancerConfigurations`. - // There must be a name of "" in the load balancer configuration list. - Name string `json:"name" yaml:"name"` - - MultipleStandardLoadBalancerConfigurationSpec - - MultipleStandardLoadBalancerConfigurationStatus -} - -// MultipleStandardLoadBalancerConfigurationSpec stores the properties regarding multiple standard load balancers. -type MultipleStandardLoadBalancerConfigurationSpec struct { - // This load balancer can have services placed on it. Defaults to true, - // can be set to false to drain and eventually remove a load balancer. - // This only affects services that will be using the LB. For services - // that is currently using the LB, they will not be affected. - AllowServicePlacement *bool `json:"allowServicePlacement" yaml:"allowServicePlacement"` - - // A string value that must specify the name of an existing vmSet. - // All nodes in the given vmSet will always be added to this load balancer. - // A vmSet can only be the primary vmSet for a single load balancer. - PrimaryVMSet string `json:"primaryVMSet" yaml:"primaryVMSet"` - - // Services that must match this selector can be placed on this load balancer. If not supplied, - // services with any labels can be created on the load balancer. - ServiceLabelSelector *metav1.LabelSelector `json:"serviceLabelSelector" yaml:"serviceLabelSelector"` - - // Services created in namespaces with the supplied label will be allowed to select that load balancer. - // If not supplied, services created in any namespaces can be created on that load balancer. - ServiceNamespaceSelector *metav1.LabelSelector `json:"serviceNamespaceSelector" yaml:"serviceNamespaceSelector"` - - // Nodes matching this selector will be preferentially added to the load balancers that - // they match selectors for. NodeSelector does not override primaryAgentPool for node allocation. - NodeSelector *metav1.LabelSelector `json:"nodeSelector" yaml:"nodeSelector"` -} - -// MultipleStandardLoadBalancerConfigurationStatus stores the properties regarding multiple standard load balancers. -type MultipleStandardLoadBalancerConfigurationStatus struct { - // ActiveServices stores the services that are supposed to use the load balancer. - ActiveServices *utilsets.IgnoreCaseSet `json:"activeServices" yaml:"activeServices"` - - // ActiveNodes stores the nodes that are supposed to be in the load balancer. - // It will be used in EnsureHostsInPool to make sure the given ones are in the backend pool. - ActiveNodes *utilsets.IgnoreCaseSet `json:"activeNodes" yaml:"activeNodes"` -} - -// HasExtendedLocation returns true if extendedlocation prop are specified. -func (config *Config) HasExtendedLocation() bool { - return config.ExtendedLocationName != "" && config.ExtendedLocationType != "" -} - var ( _ cloudprovider.Interface = (*Cloud)(nil) _ cloudprovider.Instances = (*Cloud)(nil) @@ -353,12 +109,11 @@ var ( // Cloud holds the config and clients type Cloud struct { - Config + azureconfig.Config Environment azure.Environment SubnetsClient subnetclient.Interface InterfacesClient interfaceclient.Interface - RouteTablesClient routetableclient.Interface LoadBalancerClient loadbalancerclient.Interface PublicIPAddressesClient publicipclient.Interface VirtualMachinesClient vmclient.Interface @@ -415,13 +170,13 @@ type Cloud struct { routeUpdater batchProcessor backendPoolUpdater batchProcessor - vmCache azcache.Resource - lbCache azcache.Resource - nsgRepo securitygroup.Repository - zoneRepo zone.Repository - plsRepo privatelinkservice.Repository - subnetRepo subnet.Repository - rtCache azcache.Resource + vmCache azcache.Resource + lbCache azcache.Resource + nsgRepo securitygroup.Repository + zoneRepo zone.Repository + plsRepo privatelinkservice.Repository + subnetRepo subnet.Repository + routeTableRepo routetable.Repository // public ip cache // key: [resourceGroupName] // Value: sync.Map of [pipName]*PublicIPAddress @@ -436,7 +191,7 @@ type Cloud struct { // node-sync-loop routine and service-reconcile routine should not update LoadBalancer at the same time serviceReconcileLock sync.Mutex - lockMap *LockMap + lockMap *lockmap.LockMap // multipleStandardLoadBalancerConfigurationsSynced make sure the `reconcileMultipleStandardLoadBalancerConfigurations` // runs only once every time the cloud provide restarts. multipleStandardLoadBalancerConfigurationsSynced bool @@ -451,7 +206,7 @@ type Cloud struct { } // NewCloud returns a Cloud with initialized clients -func NewCloud(ctx context.Context, clientBuilder cloudprovider.ControllerClientBuilder, config *Config, callFromCCM bool) (cloudprovider.Interface, error) { +func NewCloud(ctx context.Context, clientBuilder cloudprovider.ControllerClientBuilder, config *azureconfig.Config, callFromCCM bool) (cloudprovider.Interface, error) { az := &Cloud{ nodeNames: utilsets.NewString(), nodeZones: map[string]*utilsets.IgnoreCaseSet{}, @@ -470,7 +225,7 @@ func NewCloud(ctx context.Context, clientBuilder cloudprovider.ControllerClientB az.ipv6DualStackEnabled = true if az.lockMap == nil { - az.lockMap = newLockMap() + az.lockMap = lockmap.NewLockMap() } if clientBuilder != nil { @@ -493,17 +248,17 @@ func NewCloudFromConfigFile(ctx context.Context, clientBuilder cloudprovider.Con err error ) - var configValue *Config + var configValue *azureconfig.Config if configFilePath != "" { - var config *os.File - config, err = os.Open(configFilePath) + var configFile *os.File + configFile, err = os.Open(configFilePath) if err != nil { klog.Fatalf("Couldn't open cloud provider configuration %s: %#v", configFilePath, err) } - defer config.Close() - configValue, err = ParseConfig(config) + defer configFile.Close() + configValue, err = config.ParseConfig(configFile) if err != nil { klog.Fatalf("Failed to parse Azure cloud provider config: %v", err) } @@ -520,7 +275,7 @@ func NewCloudFromConfigFile(ctx context.Context, clientBuilder cloudprovider.Con } func NewCloudFromSecret(ctx context.Context, clientBuilder cloudprovider.ControllerClientBuilder, secretName, secretNamespace, cloudConfigKey string) (cloudprovider.Interface, error) { - config, err := configloader.Load[Config](ctx, &configloader.K8sSecretLoaderConfig{ + config, err := configloader.Load[azureconfig.Config](ctx, &configloader.K8sSecretLoaderConfig{ K8sSecretConfig: configloader.K8sSecretConfig{ SecretName: secretName, SecretNamespace: secretNamespace, @@ -541,7 +296,7 @@ func NewCloudFromSecret(ctx context.Context, clientBuilder cloudprovider.Control } // InitializeCloudFromConfig initializes the Cloud from config. -func (az *Cloud) InitializeCloudFromConfig(ctx context.Context, config *Config, fromSecret, callFromCCM bool) error { +func (az *Cloud) InitializeCloudFromConfig(ctx context.Context, config *config.Config, fromSecret, callFromCCM bool) error { if config == nil { // should not reach here return fmt.Errorf("InitializeCloudFromConfig: cannot initialize from nil config") @@ -617,13 +372,13 @@ func (az *Cloud) InitializeCloudFromConfig(ctx context.Context, config *Config, config.ClusterServiceSharedLoadBalancerHealthProbePath = consts.ClusterServiceLoadBalancerHealthProbeDefaultPath } - env, err := ratelimitconfig.ParseAzureEnvironment(config.Cloud, config.ResourceManagerEndpoint, config.IdentitySystem) + env, err := azureconfig.ParseAzureEnvironment(config.Cloud, config.ResourceManagerEndpoint, config.IdentitySystem) if err != nil { return err } // Initialize rate limiting config options. - ratelimitconfig.InitializeCloudProviderRateLimitConfig(&config.CloudProviderRateLimitConfig) + azureconfig.InitializeCloudProviderRateLimitConfig(&config.CloudProviderRateLimitConfig) resourceRequestBackoff := az.setCloudProviderBackoffDefaults(config) @@ -632,7 +387,7 @@ func (az *Cloud) InitializeCloudFromConfig(ctx context.Context, config *Config, return err } - az.lockMap = newLockMap() + az.lockMap = lockmap.NewLockMap() az.Config = *config az.Environment = *env az.ResourceRequestBackoff = resourceRequestBackoff @@ -662,19 +417,19 @@ func (az *Cloud) InitializeCloudFromConfig(ctx context.Context, config *Config, } } - if az.isLBBackendPoolTypeNodeIPConfig() { + if az.IsLBBackendPoolTypeNodeIPConfig() { az.LoadBalancerBackendPool = newBackendPoolTypeNodeIPConfig(az) - } else if az.isLBBackendPoolTypeNodeIP() { + } else if az.IsLBBackendPoolTypeNodeIP() { az.LoadBalancerBackendPool = newBackendPoolTypeNodeIP(az) } - if az.useMultipleStandardLoadBalancers() { + if az.UseMultipleStandardLoadBalancers() { if err := az.checkEnableMultipleStandardLoadBalancers(); err != nil { return err } } - servicePrincipalToken, err := ratelimitconfig.GetServicePrincipalToken(&config.AzureAuthConfig, env, env.ServiceManagementEndpoint) - if errors.Is(err, ratelimitconfig.ErrorNoAuth) { + servicePrincipalToken, err := azureconfig.GetServicePrincipalToken(&config.AzureClientConfig, env, env.ServiceManagementEndpoint) + if errors.Is(err, azureconfig.ErrorNoAuth) { // Only controller-manager would lazy-initialize from secret, and credentials are required for such case. if fromSecret { err := fmt.Errorf("no credentials provided for Azure cloud provider") @@ -700,7 +455,7 @@ func (az *Cloud) InitializeCloudFromConfig(ctx context.Context, config *Config, } var authProvider *azclient.AuthProvider - authProvider, err = azclient.NewAuthProvider(&az.ARMClientConfig, &az.AzureAuthConfig.AzureAuthConfig) + authProvider, err = azclient.NewAuthProvider(&az.ARMClientConfig, &az.AzureClientConfig.AzureAuthConfig) if err != nil { return err } @@ -713,6 +468,11 @@ func (az *Cloud) InitializeCloudFromConfig(ctx context.Context, config *Config, az.configAzureClients(servicePrincipalToken, multiTenantServicePrincipalToken, networkResourceServicePrincipalToken) if az.ComputeClientFactory == nil { + if az.ARMClientConfig.UserAgent == "" { + k8sVersion := version.Get().GitVersion + az.ARMClientConfig.UserAgent = fmt.Sprintf("kubernetes-cloudprovider/%s", k8sVersion) + } + var cred azcore.TokenCredential if authProvider.IsMultiTenantModeEnabled() { multiTenantCred := authProvider.GetMultiTenantIdentity() @@ -752,10 +512,16 @@ func (az *Cloud) InitializeCloudFromConfig(ctx context.Context, config *Config, if err != nil { return err } + az.subnetRepo, err = subnet.NewRepo(networkClientFactory.GetSubnetClient()) if err != nil { return err } + + az.routeTableRepo, err = routetable.NewRepo(networkClientFactory.GetRouteTableClient(), az.RouteTableResourceGroup, time.Duration(az.RouteTableCacheTTLInSeconds)*time.Second, az.DisableAPICallCache) + if err != nil { + return err + } } err = az.initCaches() if err != nil { @@ -764,8 +530,8 @@ func (az *Cloud) InitializeCloudFromConfig(ctx context.Context, config *Config, // Common controller contains the function // needed by both blob disk and managed disk controllers - qps := float32(ratelimitconfig.DefaultAtachDetachDiskQPS) - bucket := ratelimitconfig.DefaultAtachDetachDiskBucket + qps := float32(azureconfig.DefaultAtachDetachDiskQPS) + bucket := azureconfig.DefaultAtachDetachDiskBucket if az.Config.AttachDetachDiskRateLimit != nil { qps = az.Config.AttachDetachDiskRateLimit.CloudProviderRateLimitQPSWrite bucket = az.Config.AttachDetachDiskRateLimit.CloudProviderRateLimitBucketWrite @@ -782,14 +548,14 @@ func (az *Cloud) InitializeCloudFromConfig(ctx context.Context, config *Config, go az.routeUpdater.run(ctx) // start backend pool updater. - if az.useMultipleStandardLoadBalancers() { + if az.UseMultipleStandardLoadBalancers() { az.backendPoolUpdater = newLoadBalancerBackendPoolUpdater(az, time.Duration(az.LoadBalancerBackendPoolUpdateIntervalInSeconds)*time.Second) go az.backendPoolUpdater.run(ctx) } // Azure Stack does not support zone at the moment // https://docs.microsoft.com/en-us/azure-stack/user/azure-stack-network-differences?view=azs-2102 - if !az.isStackCloud() { + if !az.IsStackCloud() { // wait for the success first time of syncing zones err = az.syncRegionZonesMap(ctx) if err != nil { @@ -804,17 +570,9 @@ func (az *Cloud) InitializeCloudFromConfig(ctx context.Context, config *Config, return nil } -func (az *Cloud) useMultipleStandardLoadBalancers() bool { - return az.useStandardLoadBalancer() && len(az.MultipleStandardLoadBalancerConfigurations) > 0 -} - -func (az *Cloud) useSingleStandardLoadBalancer() bool { - return az.useStandardLoadBalancer() && len(az.MultipleStandardLoadBalancerConfigurations) == 0 -} - // Multiple standard load balancer mode only supports IP-based load balancers. func (az *Cloud) checkEnableMultipleStandardLoadBalancers() error { - if az.isLBBackendPoolTypeNodeIPConfig() { + if az.IsLBBackendPoolTypeNodeIPConfig() { return fmt.Errorf("multiple standard load balancers cannot be used with backend pool type %s", consts.LoadBalancerBackendPoolConfigurationTypeNodeIPConfiguration) } @@ -842,18 +600,6 @@ func (az *Cloud) checkEnableMultipleStandardLoadBalancers() error { return nil } -func (az *Cloud) isLBBackendPoolTypeNodeIPConfig() bool { - return strings.EqualFold(az.LoadBalancerBackendPoolConfigurationType, consts.LoadBalancerBackendPoolConfigurationTypeNodeIPConfiguration) -} - -func (az *Cloud) isLBBackendPoolTypeNodeIP() bool { - return strings.EqualFold(az.LoadBalancerBackendPoolConfigurationType, consts.LoadBalancerBackendPoolConfigurationTypeNodeIP) -} - -func (az *Cloud) getPutVMSSVMBatchSize() int { - return az.PutVMSSVMBatchSize -} - func (az *Cloud) initCaches() (err error) { if az.Config.DisableAPICallCache { klog.Infof("API call cache is disabled, ignore logs about cache operations") @@ -869,11 +615,6 @@ func (az *Cloud) initCaches() (err error) { return err } - az.rtCache, err = az.newRouteTableCache() - if err != nil { - return err - } - az.pipCache, err = az.newPIPCache() if err != nil { return err @@ -889,7 +630,7 @@ func (az *Cloud) initCaches() (err error) { return nil } -func (az *Cloud) setLBDefaults(config *Config) error { +func (az *Cloud) setLBDefaults(config *azureconfig.Config) error { if config.LoadBalancerSku == "" { config.LoadBalancerSku = consts.LoadBalancerSkuStandard } @@ -917,11 +658,11 @@ func (az *Cloud) getAuthTokenInMultiTenantEnv(_ *adal.ServicePrincipalToken, aut var multiTenantOAuthToken adal.MultitenantOAuthTokenProvider var networkResourceServicePrincipalToken adal.OAuthTokenProvider if az.Config.UsesNetworkResourceInDifferentTenant() { - multiTenantOAuthToken, err = ratelimitconfig.GetMultiTenantServicePrincipalToken(&az.Config.AzureAuthConfig, &az.Environment, authProvider) + multiTenantOAuthToken, err = azureconfig.GetMultiTenantServicePrincipalToken(&az.Config.AzureClientConfig, &az.Environment, authProvider) if err != nil { return nil, nil, err } - networkResourceServicePrincipalToken, err = ratelimitconfig.GetNetworkResourceServicePrincipalToken(&az.Config.AzureAuthConfig, &az.Environment, authProvider) + networkResourceServicePrincipalToken, err = azureconfig.GetNetworkResourceServicePrincipalToken(&az.Config.AzureClientConfig, &az.Environment, authProvider) if err != nil { return nil, nil, err } @@ -929,7 +670,7 @@ func (az *Cloud) getAuthTokenInMultiTenantEnv(_ *adal.ServicePrincipalToken, aut return multiTenantOAuthToken, networkResourceServicePrincipalToken, nil } -func (az *Cloud) setCloudProviderBackoffDefaults(config *Config) wait.Backoff { +func (az *Cloud) setCloudProviderBackoffDefaults(config *azureconfig.Config) wait.Backoff { // Conditionally configure resource request backoff resourceRequestBackoff := wait.Backoff{ Steps: 1, @@ -1033,7 +774,6 @@ func (az *Cloud) configAzureClients( az.VirtualMachineScaleSetsClient = vmssclient.New(vmssClientConfig) az.VirtualMachineScaleSetVMsClient = vmssvmclient.New(vmssVMClientConfig) az.SubnetsClient = subnetclient.New(subnetClientConfig) - az.RouteTablesClient = routetableclient.New(routeTableClientConfig) az.LoadBalancerClient = loadbalancerclient.New(loadBalancerClientConfig) az.PublicIPAddressesClient = publicipclient.New(publicIPClientConfig) az.FileClient = fileclient.New(fileClientConfig) @@ -1074,45 +814,6 @@ func (az *Cloud) getAzureClientConfig(servicePrincipalToken *adal.ServicePrincip return azClientConfig } -// ParseConfig returns a parsed configuration for an Azure cloudprovider config file -func ParseConfig(configReader io.Reader) (*Config, error) { - var config Config - if configReader == nil { - return nil, nil - } - - configContents, err := io.ReadAll(configReader) - if err != nil { - return nil, err - } - - err = yaml.Unmarshal(configContents, &config) - if err != nil { - return nil, err - } - - // The resource group name may be in different cases from different Azure APIs, hence it is converted to lower here. - // See more context at https://github.com/kubernetes/kubernetes/issues/71994. - config.ResourceGroup = strings.ToLower(config.ResourceGroup) - - // these environment variables are injected by workload identity webhook - if tenantID := os.Getenv("AZURE_TENANT_ID"); tenantID != "" { - config.TenantID = tenantID - } - if clientID := os.Getenv("AZURE_CLIENT_ID"); clientID != "" { - config.AADClientID = clientID - } - if federatedTokenFile := os.Getenv("AZURE_FEDERATED_TOKEN_FILE"); federatedTokenFile != "" { - config.AADFederatedTokenFile = federatedTokenFile - config.UseFederatedWorkloadIdentityExtension = true - } - return &config, nil -} - -func (az *Cloud) isStackCloud() bool { - return strings.EqualFold(az.Config.Cloud, consts.AzureStackCloudName) && !az.Config.DisableAzureStackCloud -} - // Initialize passes a Kubernetes clientBuilder interface to the cloud provider func (az *Cloud) Initialize(clientBuilder cloudprovider.ControllerClientBuilder, _ <-chan struct{}) { az.KubeClient = clientBuilder.ClientOrDie("azure-cloud-provider") @@ -1143,7 +844,7 @@ func (az *Cloud) InstancesV2() (cloudprovider.InstancesV2, bool) { // DEPRECATED: Zones is deprecated in favor of retrieving zone/region information from InstancesV2. // This interface will not be called if InstancesV2 is enabled. func (az *Cloud) Zones() (cloudprovider.Zones, bool) { - if az.isStackCloud() { + if az.IsStackCloud() { // Azure stack does not support zones at this point // https://docs.microsoft.com/en-us/azure-stack/user/azure-stack-network-differences?view=azs-2102 return nil, false diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_fakes.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_fakes.go index 030128a85b..50c8b34a4d 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_fakes.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_fakes.go @@ -36,7 +36,6 @@ import ( "sigs.k8s.io/cloud-provider-azure/pkg/azureclients/interfaceclient/mockinterfaceclient" "sigs.k8s.io/cloud-provider-azure/pkg/azureclients/loadbalancerclient/mockloadbalancerclient" "sigs.k8s.io/cloud-provider-azure/pkg/azureclients/publicipclient/mockpublicipclient" - "sigs.k8s.io/cloud-provider-azure/pkg/azureclients/routetableclient/mockroutetableclient" "sigs.k8s.io/cloud-provider-azure/pkg/azureclients/subnetclient/mocksubnetclient" "sigs.k8s.io/cloud-provider-azure/pkg/azureclients/vmclient/mockvmclient" "sigs.k8s.io/cloud-provider-azure/pkg/azureclients/vmssclient/mockvmssclient" @@ -45,8 +44,10 @@ import ( "sigs.k8s.io/cloud-provider-azure/pkg/consts" "sigs.k8s.io/cloud-provider-azure/pkg/provider/config" "sigs.k8s.io/cloud-provider-azure/pkg/provider/privatelinkservice" + "sigs.k8s.io/cloud-provider-azure/pkg/provider/routetable" "sigs.k8s.io/cloud-provider-azure/pkg/provider/securitygroup" "sigs.k8s.io/cloud-provider-azure/pkg/provider/subnet" + "sigs.k8s.io/cloud-provider-azure/pkg/util/lockmap" utilsets "sigs.k8s.io/cloud-provider-azure/pkg/util/sets" ) @@ -78,8 +79,8 @@ func NewTestFlexScaleSet(ctrl *gomock.Controller) (*FlexScaleSet, error) { // GetTestCloud returns a fake azure cloud for unit tests in Azure related CSI drivers func GetTestCloud(ctrl *gomock.Controller) (az *Cloud) { az = &Cloud{ - Config: Config{ - AzureAuthConfig: config.AzureAuthConfig{ + Config: config.Config{ + AzureClientConfig: config.AzureClientConfig{ ARMClientConfig: azclient.ARMClientConfig{ TenantID: "TenantID", }, @@ -110,13 +111,12 @@ func GetTestCloud(ctrl *gomock.Controller) (az *Cloud) { nodePrivateIPs: map[string]*utilsets.IgnoreCaseSet{}, routeCIDRs: map[string]string{}, eventRecorder: &record.FakeRecorder{}, - lockMap: newLockMap(), + lockMap: lockmap.NewLockMap(), } az.DisksClient = mockdiskclient.NewMockInterface(ctrl) az.InterfacesClient = mockinterfaceclient.NewMockInterface(ctrl) az.LoadBalancerClient = mockloadbalancerclient.NewMockInterface(ctrl) az.PublicIPAddressesClient = mockpublicipclient.NewMockInterface(ctrl) - az.RouteTablesClient = mockroutetableclient.NewMockInterface(ctrl) az.SubnetsClient = mocksubnetclient.NewMockInterface(ctrl) az.VirtualMachineScaleSetsClient = mockvmssclient.NewMockInterface(ctrl) az.VirtualMachineScaleSetVMsClient = mockvmssvmclient.NewMockInterface(ctrl) @@ -140,11 +140,11 @@ func GetTestCloud(ctrl *gomock.Controller) (az *Cloud) { az.lbCache, _ = az.newLBCache() az.nsgRepo, _ = securitygroup.NewSecurityGroupRepo(az.SecurityGroupResourceGroup, az.SecurityGroupName, az.NsgCacheTTLInSeconds, az.Config.DisableAPICallCache, securtyGrouptrack2Client) az.subnetRepo = subnet.NewMockRepository(ctrl) - az.rtCache, _ = az.newRouteTableCache() az.pipCache, _ = az.newPIPCache() az.LoadBalancerBackendPool = NewMockBackendPool(ctrl) az.plsRepo = privatelinkservice.NewMockRepository(ctrl) + az.routeTableRepo = routetable.NewMockRepository(ctrl) getter := func(_ context.Context, _ string) (interface{}, error) { return nil, nil } az.storageAccountCache, _ = azcache.NewTimedCache(time.Minute, getter, az.Config.DisableAPICallCache) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_loadbalancer.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_loadbalancer.go index c846ff1785..88ce01229c 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_loadbalancer.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_loadbalancer.go @@ -45,6 +45,7 @@ import ( "sigs.k8s.io/cloud-provider-azure/pkg/consts" "sigs.k8s.io/cloud-provider-azure/pkg/log" "sigs.k8s.io/cloud-provider-azure/pkg/metrics" + "sigs.k8s.io/cloud-provider-azure/pkg/provider/config" "sigs.k8s.io/cloud-provider-azure/pkg/provider/loadbalancer" "sigs.k8s.io/cloud-provider-azure/pkg/retry" "sigs.k8s.io/cloud-provider-azure/pkg/trace" @@ -177,11 +178,11 @@ func (az *Cloud) reconcileService(ctx context.Context, clusterName string, servi lbName := strings.ToLower(ptr.Deref(lb.Name, "")) key := strings.ToLower(getServiceName(service)) - if az.useMultipleStandardLoadBalancers() && isLocalService(service) { + if az.UseMultipleStandardLoadBalancers() && isLocalService(service) { az.localServiceNameToServiceInfoMap.Store(key, newServiceInfo(getServiceIPFamily(service), lbName)) // There are chances that the endpointslice changes after EnsureHostsInPool, so // need to check endpointslice for a second time. - if err := az.checkAndApplyLocalServiceBackendPoolUpdates(ctx, *lb, service); err != nil { + if err := az.checkAndApplyLocalServiceBackendPoolUpdates(*lb, service); err != nil { logger.Error(err, "Failed to checkAndApplyLocalServiceBackendPoolUpdates") return nil, err } @@ -488,7 +489,7 @@ func (az *Cloud) EnsureLoadBalancerDeleted(ctx context.Context, clusterName stri return err } - if az.useMultipleStandardLoadBalancers() && isLocalService(service) { + if az.UseMultipleStandardLoadBalancers() && isLocalService(service) { key := strings.ToLower(svcName) az.localServiceNameToServiceInfoMap.Delete(key) } @@ -519,7 +520,7 @@ func (az *Cloud) shouldChangeLoadBalancer(service *v1.Service, currLBName, clust // The load balancer can be changed in two cases: // 1. Using multiple standard load balancers. // 2. Migrate from multiple standard load balancers to single standard load balancer. - if az.useStandardLoadBalancer() { + if az.UseStandardLoadBalancer() { if currLBName != expectedLBName { klog.V(2).Infof("shouldChangeLoadBalancer(%s, %s, %s): change the LB to another one %s", service.Name, currLBName, clusterName, expectedLBName) return true @@ -711,15 +712,12 @@ func (az *Cloud) cleanOrphanedLoadBalancer(ctx context.Context, lb *network.Load } // safeDeleteLoadBalancer deletes the load balancer after decoupling it from the vmSet -func (az *Cloud) safeDeleteLoadBalancer(ctx context.Context, lb network.LoadBalancer, clusterName, vmSetName string, service *v1.Service) *retry.Error { - lbBackendPoolIDs := az.getBackendPoolIDs(clusterName, ptr.Deref(lb.Name, "")) +func (az *Cloud) safeDeleteLoadBalancer(ctx context.Context, lb network.LoadBalancer, _, vmSetName string, service *v1.Service) *retry.Error { lbBackendPoolIDsToDelete := []string{} - v4Enabled, v6Enabled := getIPFamiliesEnabled(service) - if v4Enabled { - lbBackendPoolIDsToDelete = append(lbBackendPoolIDsToDelete, lbBackendPoolIDs[consts.IPVersionIPv4]) - } - if v6Enabled { - lbBackendPoolIDsToDelete = append(lbBackendPoolIDsToDelete, lbBackendPoolIDs[consts.IPVersionIPv6]) + if lb.LoadBalancerPropertiesFormat != nil && lb.BackendAddressPools != nil { + for _, bp := range *lb.BackendAddressPools { + lbBackendPoolIDsToDelete = append(lbBackendPoolIDsToDelete, ptr.Deref(bp.ID, "")) + } } if _, err := az.VMSet.EnsureBackendPoolDeleted(ctx, service, lbBackendPoolIDsToDelete, vmSetName, lb.BackendAddressPools, true); err != nil { return retry.NewError(false, fmt.Errorf("safeDeleteLoadBalancer: failed to EnsureBackendPoolDeleted: %w", err)) @@ -829,7 +827,7 @@ func (az *Cloud) getServiceLoadBalancer( ptr.Deref(existingLB.Name, ""), ) - if isLocalService(service) && az.useMultipleStandardLoadBalancers() { + if isLocalService(service) && az.UseMultipleStandardLoadBalancers() { // No need for the endpoint slice informer to update the backend pool // for the service because the main loop will delete the old backend pool // and create a new one in the new load balancer. @@ -857,7 +855,7 @@ func (az *Cloud) getServiceLoadBalancer( // Service does not have a load balancer, select one. // Single standard load balancer doesn't need this because // all backends nodes should be added to same LB. - if wantLb && !az.useStandardLoadBalancer() { + if wantLb && !az.UseStandardLoadBalancer() { // select new load balancer for service selectedLB, exists, err := az.selectLoadBalancer(ctx, clusterName, service, existingLBs, nodes) if err != nil { @@ -884,7 +882,7 @@ func (az *Cloud) getServiceLoadBalancer( Location: &az.Location, LoadBalancerPropertiesFormat: &network.LoadBalancerPropertiesFormat{}, } - if az.useStandardLoadBalancer() { + if az.UseStandardLoadBalancer() { defaultLB.Sku = &network.LoadBalancerSku{ Name: network.LoadBalancerSkuNameStandard, } @@ -932,7 +930,7 @@ func (az *Cloud) selectLoadBalancer(ctx context.Context, clusterName string, ser // select this LB as this is a new LB and will have minimum rules // create tmp lb struct to hold metadata for the new load-balancer var loadBalancerSKU network.LoadBalancerSkuName - if az.useStandardLoadBalancer() { + if az.UseStandardLoadBalancer() { loadBalancerSKU = network.LoadBalancerSkuNameStandard } else { loadBalancerSKU = network.LoadBalancerSkuNameBasic @@ -1206,7 +1204,7 @@ func (az *Cloud) ensurePublicIPExists(ctx context.Context, service *v1.Service, return nil, err } - if az.useStandardLoadBalancer() { + if az.UseStandardLoadBalancer() { pip.Sku = &network.PublicIPAddressSku{ Name: network.PublicIPAddressSkuNameStandard, } @@ -1280,7 +1278,7 @@ func (az *Cloud) reconcileIPSettings(pip *network.PublicIPAddress, service *v1.S changed = true } - if az.useStandardLoadBalancer() { + if az.UseStandardLoadBalancer() { // standard sku must have static allocation method for ipv6 if !strings.EqualFold(string(pip.PublicIPAddressPropertiesFormat.PublicIPAllocationMethod), string(network.Static)) { pip.PublicIPAddressPropertiesFormat.PublicIPAllocationMethod = network.Static @@ -1507,7 +1505,7 @@ func (az *Cloud) isFrontendIPChanged( if fipIPVersion != "" { isIPv6 = fipIPVersion == network.IPv6 } else { - if isIPv6, err = az.isFIPIPv6(service, pipRG, &config); err != nil { + if isIPv6, err = az.isFIPIPv6(service, &config); err != nil { return false, err } } @@ -1657,7 +1655,6 @@ func (az *Cloud) findFrontendIPConfigsOfService( service *v1.Service, ) (map[bool]*network.FrontendIPConfiguration, error) { fipsOfServiceMap := map[bool]*network.FrontendIPConfiguration{} - pipRG := az.getPublicIPAddressResourceGroup(service) for _, config := range *fipConfigs { config := config owns, _, fipIPVersion := az.serviceOwnsFrontendIP(ctx, config, service) @@ -1667,7 +1664,7 @@ func (az *Cloud) findFrontendIPConfigsOfService( if fipIPVersion != "" { fipIsIPv6 = fipIPVersion == network.IPv6 } else { - if fipIsIPv6, err = az.isFIPIPv6(service, pipRG, &config); err != nil { + if fipIsIPv6, err = az.isFIPIPv6(service, &config); err != nil { return nil, err } } @@ -1692,7 +1689,7 @@ func (az *Cloud) reconcileMultipleStandardLoadBalancerConfigurations( existingLBs *[]network.LoadBalancer, nodes []*v1.Node, ) (err error) { - if !az.useMultipleStandardLoadBalancers() { + if !az.UseMultipleStandardLoadBalancers() { return nil } @@ -1781,7 +1778,7 @@ func (az *Cloud) reconcileLoadBalancer(ctx context.Context, clusterName string, // Delete backend pools for local service if: // 1. the cluster is migrating from multi-slb to single-slb, // 2. the service is changed from local to cluster. - if !az.useMultipleStandardLoadBalancers() || !isLocalService(service) { + if !az.UseMultipleStandardLoadBalancers() || !isLocalService(service) { existingLBs, err = az.cleanupLocalServiceBackendPool(ctx, service, nodes, existingLBs, clusterName) if err != nil { klog.Errorf("reconcileLoadBalancer: failed to cleanup local service backend pool for service %q, error: %s", serviceName, err.Error()) @@ -1843,7 +1840,6 @@ func (az *Cloud) reconcileLoadBalancer(ctx context.Context, clusterName string, } // update probes/rules - pipRG := az.getPublicIPAddressResourceGroup(service) for _, ownedFIPConfig := range ownedFIPConfigs { if ownedFIPConfig == nil { continue @@ -1858,7 +1854,7 @@ func (az *Cloud) reconcileLoadBalancer(ctx context.Context, clusterName string, if fipIPVersion != "" { isIPv6 = fipIPVersion == network.IPv6 } else { - if isIPv6, err = az.isFIPIPv6(service, pipRG, ownedFIPConfig); err != nil { + if isIPv6, err = az.isFIPIPv6(service, ownedFIPConfig); err != nil { return nil, err } } @@ -1962,7 +1958,7 @@ func (az *Cloud) reconcileLoadBalancer(ctx context.Context, clusterName string, _ = az.lbCache.Delete(lbName) }() - if az.useMultipleStandardLoadBalancers() { + if az.UseMultipleStandardLoadBalancers() { err := az.reconcileMultipleStandardLoadBalancerBackendNodes(ctx, clusterName, lbName, existingLBs, service, nodes, false) if err != nil { return nil, err @@ -1975,7 +1971,7 @@ func (az *Cloud) reconcileLoadBalancer(ctx context.Context, clusterName string, // change in one reconciliation loop. var lbToReconcile []network.LoadBalancer lbToReconcile = append(lbToReconcile, *lb) - if az.useMultipleStandardLoadBalancers() { + if az.UseMultipleStandardLoadBalancers() { lbToReconcile = *existingLBs } lb, err = az.reconcileBackendPoolHosts(ctx, lb, lbToReconcile, service, nodes, clusterName, vmSetName, lbBackendPoolIDs) @@ -2519,8 +2515,6 @@ func (az *Cloud) reconcileFrontendIPConfigs( } } - pipRG := az.getPublicIPAddressResourceGroup(service) - for i := len(newConfigs) - 1; i >= 0; i-- { config := newConfigs[i] isServiceOwnsFrontendIP, _, fipIPVersion := az.serviceOwnsFrontendIP(ctx, config, service) @@ -2534,7 +2528,7 @@ func (az *Cloud) reconcileFrontendIPConfigs( if fipIPVersion != "" { isIPv6 = fipIPVersion == network.IPv6 } else { - if isIPv6, err = az.isFIPIPv6(service, pipRG, &config); err != nil { + if isIPv6, err = az.isFIPIPv6(service, &config); err != nil { return nil, toDeleteConfigs, false, err } } @@ -2669,7 +2663,7 @@ func (az *Cloud) getFrontendZones( if err != nil { return err } - if az.useStandardLoadBalancer() && len(zones) > 0 && !az.HasExtendedLocation() { + if az.UseStandardLoadBalancer() && len(zones) > 0 && !az.HasExtendedLocation() { fipConfig.Zones = &zones } } else { @@ -2833,7 +2827,7 @@ func (az *Cloud) getExpectedLBRules( // In HA mode, lb forward traffic of all port to backend // HA mode is only supported on standard loadbalancer SKU in internal mode if consts.IsK8sServiceUsingInternalLoadBalancer(service) && - az.useStandardLoadBalancer() && + az.UseStandardLoadBalancer() && consts.IsK8sServiceHasHAModeEnabled(service) { lbRuleName := az.getloadbalancerHAmodeRuleName(service, isIPv6) @@ -2889,7 +2883,7 @@ func (az *Cloud) getExpectedLBRules( klog.V(2).Infof("getExpectedLBRules lb name (%s) rule name (%s) no lb rule required", lbName, lbRuleName) continue } - if port.Protocol == v1.ProtocolSCTP && !(az.useStandardLoadBalancer() && consts.IsK8sServiceUsingInternalLoadBalancer(service)) { + if port.Protocol == v1.ProtocolSCTP && !(az.UseStandardLoadBalancer() && consts.IsK8sServiceUsingInternalLoadBalancer(service)) { return expectedProbes, expectedRules, fmt.Errorf("SCTP is only supported on standard loadbalancer in internal mode") } @@ -2977,7 +2971,7 @@ func (az *Cloud) getExpectedLoadBalancingRulePropertiesForPort( Protocol: transportProto, FrontendPort: ptr.To(servicePort.Port), BackendPort: ptr.To(servicePort.Port), - DisableOutboundSnat: ptr.To(az.disableLoadBalancerOutboundSNAT()), + DisableOutboundSnat: ptr.To(az.DisableLoadBalancerOutboundSNAT()), EnableFloatingIP: ptr.To(true), LoadDistribution: loadDistribution, FrontendIPConfiguration: &network.SubResource{ @@ -2988,7 +2982,7 @@ func (az *Cloud) getExpectedLoadBalancingRulePropertiesForPort( }, IdleTimeoutInMinutes: lbIdleTimeout, } - if strings.EqualFold(string(transportProto), string(network.TransportProtocolTCP)) && az.useStandardLoadBalancer() { + if strings.EqualFold(string(transportProto), string(network.TransportProtocolTCP)) && az.UseStandardLoadBalancer() { props.EnableTCPReset = ptr.To(!consts.IsTCPResetDisabled(service.Annotations)) } @@ -3670,7 +3664,7 @@ func ipInSubnet(ip string, subnet *network.Subnet) bool { // if anything else it returns the unique VM set names after trimming spaces. func (az *Cloud) getServiceLoadBalancerMode(service *v1.Service) (bool, bool, string) { mode, hasMode := service.Annotations[consts.ServiceAnnotationLoadBalancerMode] - if az.useStandardLoadBalancer() && hasMode { + if az.UseStandardLoadBalancer() && hasMode { klog.Warningf("single standard load balancer doesn't work with annotation %q, would ignore it", consts.ServiceAnnotationLoadBalancerMode) } mode = strings.TrimSpace(mode) @@ -3916,14 +3910,14 @@ func (az *Cloud) getAzureLoadBalancerName( // The LB name prefix is set to the name of the cluster when: // 1. the LB belongs to the primary agent pool. // 2. using the single SLB. - if strings.EqualFold(vmSetName, az.VMSet.GetPrimaryVMSetName()) || az.useSingleStandardLoadBalancer() { + if strings.EqualFold(vmSetName, az.VMSet.GetPrimaryVMSetName()) || az.UseSingleStandardLoadBalancer() { lbNamePrefix = clusterName } // For multiple standard load balancers scenario: // 1. Filter out the eligible load balancers. // 2. Choose the most eligible load balancer. - if az.useMultipleStandardLoadBalancers() { + if az.UseMultipleStandardLoadBalancers() { eligibleLBs, err := az.getEligibleLoadBalancersForService(ctx, service) if err != nil { return "", err @@ -4015,7 +4009,7 @@ func (az *Cloud) getServiceCurrentLoadBalancerName(service *v1.Service) string { // 5. If there is no label/namespace selector on the LB, it can be a valid placement target if and only if the service has no other choice. func (az *Cloud) getEligibleLoadBalancersForService(ctx context.Context, service *v1.Service) ([]string, error) { var ( - eligibleLBs []MultipleStandardLoadBalancerConfiguration + eligibleLBs []config.MultipleStandardLoadBalancerConfiguration eligibleLBNames []string lbSelectedByAnnotation []string lbFailedLabelSelector []string @@ -4166,7 +4160,7 @@ func (az *Cloud) getEligibleLoadBalancersForService(ctx context.Context, service return eligibleLBNames, nil } -func (az *Cloud) isLoadBalancerInUseByService(service *v1.Service, lbConfig MultipleStandardLoadBalancerConfiguration) bool { +func (az *Cloud) isLoadBalancerInUseByService(service *v1.Service, lbConfig config.MultipleStandardLoadBalancerConfiguration) bool { az.multipleStandardLoadBalancersActiveServicesLock.Lock() defer az.multipleStandardLoadBalancersActiveServicesLock.Unlock() diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_loadbalancer_backendpool.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_loadbalancer_backendpool.go index d0f6f09f95..38364f0f64 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_loadbalancer_backendpool.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_loadbalancer_backendpool.go @@ -202,7 +202,7 @@ func (bc *backendPoolTypeNodeIPConfig) ReconcileBackendPools( if bp.BackendAddressPoolPropertiesFormat != nil && bp.LoadBalancerBackendAddresses != nil && len(*bp.LoadBalancerBackendAddresses) > 0 { - if removeNodeIPAddressesFromBackendPool(bp, []string{}, true, false) { + if removeNodeIPAddressesFromBackendPool(bp, []string{}, true, false, false) { isMigration = true bp.VirtualNetwork = nil if err := bc.CreateOrUpdateLBBackendPool(ctx, lbName, bp); err != nil { @@ -410,9 +410,8 @@ func (bi *backendPoolTypeNodeIP) EnsureHostsInPool(ctx context.Context, service changed bool numOfAdd, numOfDelete int activeNodes *utilsets.IgnoreCaseSet - err error ) - if bi.useMultipleStandardLoadBalancers() { + if bi.UseMultipleStandardLoadBalancers() { if !isLocalService(service) { activeNodes = bi.getActiveNodesByLoadBalancerName(lbName) } else { @@ -425,10 +424,12 @@ func (bi *backendPoolTypeNodeIP) EnsureHostsInPool(ctx context.Context, service "current load balancer", si.lbName) return nil } - activeNodes, err = bi.getLocalServiceEndpointsNodeNames(ctx, service) - if err != nil { - return err - } + activeNodes = bi.getLocalServiceEndpointsNodeNames(service) + } + + if isNICPool(backendPool) { + klog.V(4).InfoS("EnsureHostsInPool: skipping NIC-based backend pool", "backendPoolName", ptr.Deref(backendPool.Name, "")) + return nil } } @@ -462,8 +463,8 @@ func (bi *backendPoolTypeNodeIP) EnsureHostsInPool(ctx context.Context, service nodePrivateIPsSet.Insert(privateIP) } - if bi.useMultipleStandardLoadBalancers() { - if !activeNodes.Has(node.Name) { + if bi.UseMultipleStandardLoadBalancers() { + if activeNodes != nil && !activeNodes.Has(node.Name) { klog.V(4).Infof("bi.EnsureHostsInPool: node %s should not be in load balancer %q", node.Name, lbName) continue } @@ -486,7 +487,7 @@ func (bi *backendPoolTypeNodeIP) EnsureHostsInPool(ctx context.Context, service nodeIPsToBeDeleted = append(nodeIPsToBeDeleted, ip) changed = true numOfDelete++ - } else if bi.useMultipleStandardLoadBalancers() && activeNodes != nil { + } else if bi.UseMultipleStandardLoadBalancers() && activeNodes != nil { nodeName, ok := bi.nodePrivateIPToNodeNameMap[ip] if !ok { klog.Warningf("bi.EnsureHostsInPool: cannot find node name for private IP %s", ip) @@ -500,7 +501,7 @@ func (bi *backendPoolTypeNodeIP) EnsureHostsInPool(ctx context.Context, service } } } - removeNodeIPAddressesFromBackendPool(backendPool, nodeIPsToBeDeleted, false, bi.useMultipleStandardLoadBalancers()) + removeNodeIPAddressesFromBackendPool(backendPool, nodeIPsToBeDeleted, false, bi.UseMultipleStandardLoadBalancers(), true) } if changed { klog.V(2).Infof("bi.EnsureHostsInPool: updating backend pool %s of load balancer %s to add %d nodes and remove %d nodes", lbBackendPoolName, lbName, numOfAdd, numOfDelete) @@ -633,7 +634,7 @@ func (bi *backendPoolTypeNodeIP) ReconcileBackendPools(ctx context.Context, clus if isMigration && bi.EnableMigrateToIPBasedBackendPoolAPI { var backendPoolNames []string for _, id := range lbBackendPoolIDsSlice { - name, err := getLBNameFromBackendPoolID(id) + name, err := getBackendPoolNameFromBackendPoolID(id) if err != nil { klog.Errorf("bi.ReconcileBackendPools for service (%s): failed to get LB name from backend pool ID: %s", serviceName, err.Error()) return false, false, nil, err @@ -674,7 +675,7 @@ func (bi *backendPoolTypeNodeIP) ReconcileBackendPools(ctx context.Context, clus } } if len(nodeIPAddressesToBeDeleted) > 0 { - if removeNodeIPAddressesFromBackendPool(bp, nodeIPAddressesToBeDeleted, false, false) { + if removeNodeIPAddressesFromBackendPool(bp, nodeIPAddressesToBeDeleted, false, false, true) { updated = true } } @@ -871,11 +872,13 @@ func hasIPAddressInBackendPool(backendPool *network.BackendAddressPool, ipAddres func removeNodeIPAddressesFromBackendPool( backendPool network.BackendAddressPool, nodeIPAddresses []string, - removeAll, useMultipleStandardLoadBalancers bool, + removeAll, UseMultipleStandardLoadBalancers, isNodeIP bool, ) bool { changed := false nodeIPsSet := utilsets.NewString(nodeIPAddresses...) + logger := klog.Background().WithName("removeNodeIPAddressFromBackendPool") + if backendPool.BackendAddressPoolPropertiesFormat == nil || backendPool.LoadBalancerBackendAddresses == nil { return false @@ -886,7 +889,13 @@ func removeNodeIPAddressesFromBackendPool( if addresses[i].LoadBalancerBackendAddressPropertiesFormat != nil { ipAddress := ptr.Deref((*backendPool.LoadBalancerBackendAddresses)[i].IPAddress, "") if ipAddress == "" { - klog.V(4).Infof("removeNodeIPAddressFromBackendPool: LoadBalancerBackendAddress %s is not IP-based, skipping", ptr.Deref(addresses[i].Name, "")) + if isNodeIP { + logger.V(4).Info("LoadBalancerBackendAddress is not IP-based, removing", "LoadBalancerBackendAddress", ptr.Deref(addresses[i].Name, "")) + addresses = append(addresses[:i], addresses[i+1:]...) + changed = true + } else { + logger.V(4).Info("LoadBalancerBackendAddress is not IP-based, skipping", "LoadBalancerBackendAddress", ptr.Deref(addresses[i].Name, "")) + } continue } if removeAll || nodeIPsSet.Has(ipAddress) { @@ -904,7 +913,7 @@ func removeNodeIPAddressesFromBackendPool( // Allow the pool to be empty when EnsureHostsInPool for multiple standard load balancers clusters, // or one node could occur in multiple backend pools. - if len(addresses) == 0 && !useMultipleStandardLoadBalancers { + if len(addresses) == 0 && !UseMultipleStandardLoadBalancers { klog.V(2).Info("removeNodeIPAddressFromBackendPool: the pool is empty or will be empty after removing the unwanted IP addresses, skipping the removal") changed = false } else if changed { diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_loadbalancer_healthprobe.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_loadbalancer_healthprobe.go index ee32812940..281a8d94d9 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_loadbalancer_healthprobe.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_loadbalancer_healthprobe.go @@ -160,7 +160,7 @@ func (az *Cloud) buildHealthProbeRulesForPort(serviceManifest *v1.Service, port case strings.EqualFold(*protocol, string(network.ProtocolHTTPS)): //HTTPS probe is only supported in standard loadbalancer //For backward compatibility,when unsupported protocol is used, fall back to tcp protocol in basic lb mode instead - if !az.useStandardLoadBalancer() { + if !az.UseStandardLoadBalancer() { properties.Protocol = network.ProbeProtocolTCP } else { properties.Protocol = network.ProbeProtocolHTTPS diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_loadbalancer_repo.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_loadbalancer_repo.go index 15775bebab..9141db1ffc 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_loadbalancer_repo.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_loadbalancer_repo.go @@ -109,7 +109,7 @@ func (az *Cloud) ListManagedLBs(ctx context.Context, service *v1.Service, nodes } } - if az.useMultipleStandardLoadBalancers() { + if az.UseMultipleStandardLoadBalancers() { for _, multiSLBConfig := range az.MultipleStandardLoadBalancerConfigurations { managedLBNames.Insert(multiSLBConfig.Name, fmt.Sprintf("%s%s", multiSLBConfig.Name, consts.InternalLoadBalancerNameSuffix)) } @@ -297,7 +297,6 @@ func (az *Cloud) MigrateToIPBasedBackendPoolAndWaitForCompletion( } return true, nil }) - if err != nil { if errors.Is(err, wait.ErrWaitTimeout) { klog.Warningf("MigrateToIPBasedBackendPoolAndWaitForCompletion: Timeout waiting for migration to IP based backend pool for lb %s, backend pool %s", lbName, strings.Join(backendPoolNames, ",")) @@ -351,7 +350,7 @@ func (az *Cloud) getAzureLoadBalancer(ctx context.Context, name string, crt azca // If not same, the lbName for existingBackendPools would also be returned. func isBackendPoolOnSameLB(newBackendPoolID string, existingBackendPools []string) (bool, string, error) { matches := backendPoolIDRE.FindStringSubmatch(newBackendPoolID) - if len(matches) != 2 { + if len(matches) != 3 { return false, "", fmt.Errorf("new backendPoolID %q is in wrong format", newBackendPoolID) } @@ -359,7 +358,7 @@ func isBackendPoolOnSameLB(newBackendPoolID string, existingBackendPools []strin newLBNameTrimmed := trimSuffixIgnoreCase(newLBName, consts.InternalLoadBalancerNameSuffix) for _, backendPool := range existingBackendPools { matches := backendPoolIDRE.FindStringSubmatch(backendPool) - if len(matches) != 2 { + if len(matches) != 3 { return false, "", fmt.Errorf("existing backendPoolID %q is in wrong format", backendPool) } @@ -380,3 +379,18 @@ func (az *Cloud) serviceOwnsRule(service *v1.Service, rule string) bool { prefix := az.getRulePrefix(service) return strings.HasPrefix(strings.ToUpper(rule), strings.ToUpper(prefix)) } + +func isNICPool(bp network.BackendAddressPool) bool { + logger := klog.Background().WithName("isNICPool").WithValues("backendPoolName", ptr.Deref(bp.Name, "")) + if bp.BackendAddressPoolPropertiesFormat != nil && + bp.LoadBalancerBackendAddresses != nil { + for _, addr := range *bp.LoadBalancerBackendAddresses { + if ptr.Deref(addr.IPAddress, "") == "" { + logger.V(4).Info("The load balancer backend address has empty ip address, assuming it is a NIC pool", + "loadBalancerBackendAddress", ptr.Deref(addr.Name, "")) + return true + } + } + } + return false +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_local_services.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_local_services.go index ce92248659..0febc94edb 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_local_services.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_local_services.go @@ -27,7 +27,6 @@ import ( v1 "k8s.io/api/core/v1" discovery_v1 "k8s.io/api/discovery/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/client-go/informers" @@ -210,7 +209,7 @@ func (updater *loadBalancerBackendPoolUpdater) process(ctx context.Context) { lbOp := op.(*loadBalancerBackendPoolUpdateOperation) switch lbOp.kind { case consts.LoadBalancerBackendPoolUpdateOperationRemove: - removed := removeNodeIPAddressesFromBackendPool(bp, lbOp.nodeIPs, false, true) + removed := removeNodeIPAddressesFromBackendPool(bp, lbOp.nodeIPs, false, true, true) changed = changed || removed case consts.LoadBalancerBackendPoolUpdateOperationAdd: added := updater.az.addNodeIPAddressesToBackendPool(&bp, lbOp.nodeIPs) @@ -409,7 +408,7 @@ func getLocalServiceBackendPoolName(serviceName string, ipv6 bool) string { // getBackendPoolNameForService determine the expected backend pool name // by checking the external traffic policy of the service. func (az *Cloud) getBackendPoolNameForService(service *v1.Service, clusterName string, ipv6 bool) string { - if !isLocalService(service) || !az.useMultipleStandardLoadBalancers() { + if !isLocalService(service) || !az.UseMultipleStandardLoadBalancers() { return getBackendPoolName(clusterName, ipv6) } return getLocalServiceBackendPoolName(getServiceName(service), ipv6) @@ -418,7 +417,7 @@ func (az *Cloud) getBackendPoolNameForService(service *v1.Service, clusterName s // getBackendPoolNamesForService determine the expected backend pool names // by checking the external traffic policy of the service. func (az *Cloud) getBackendPoolNamesForService(service *v1.Service, clusterName string) map[bool]string { - if !isLocalService(service) || !az.useMultipleStandardLoadBalancers() { + if !isLocalService(service) || !az.UseMultipleStandardLoadBalancers() { return getBackendPoolNames(clusterName) } return map[bool]string{ @@ -430,7 +429,7 @@ func (az *Cloud) getBackendPoolNamesForService(service *v1.Service, clusterName // getBackendPoolIDsForService determine the expected backend pool IDs // by checking the external traffic policy of the service. func (az *Cloud) getBackendPoolIDsForService(service *v1.Service, clusterName, lbName string) map[bool]string { - if !isLocalService(service) || !az.useMultipleStandardLoadBalancers() { + if !isLocalService(service) || !az.UseMultipleStandardLoadBalancers() { return az.getBackendPoolIDs(clusterName, lbName) } return map[bool]string{ @@ -446,8 +445,10 @@ func (az *Cloud) getLocalServiceBackendPoolID(serviceName string, lbName string, // localServiceOwnsBackendPool checks if a backend pool is owned by a local service. func localServiceOwnsBackendPool(serviceName, bpName string) bool { - prefix := strings.Replace(serviceName, "/", "-", -1) - return strings.HasPrefix(strings.ToLower(bpName), strings.ToLower(prefix)) + if strings.HasSuffix(strings.ToLower(bpName), consts.IPVersionIPv6StringLower) { + return strings.EqualFold(getLocalServiceBackendPoolName(serviceName, true), bpName) + } + return strings.EqualFold(getLocalServiceBackendPoolName(serviceName, false), bpName) } type serviceInfo struct { @@ -463,50 +464,30 @@ func newServiceInfo(ipFamily, lbName string) *serviceInfo { } // getLocalServiceEndpointsNodeNames gets the node names that host all endpoints of the local service. -func (az *Cloud) getLocalServiceEndpointsNodeNames(ctx context.Context, service *v1.Service) (*utilsets.IgnoreCaseSet, error) { - var ( - ep *discovery_v1.EndpointSlice - foundInCache bool - ) +func (az *Cloud) getLocalServiceEndpointsNodeNames(service *v1.Service) *utilsets.IgnoreCaseSet { + var eps []*discovery_v1.EndpointSlice az.endpointSlicesCache.Range(func(_, value interface{}) bool { endpointSlice := value.(*discovery_v1.EndpointSlice) if strings.EqualFold(getServiceNameOfEndpointSlice(endpointSlice), service.Name) && strings.EqualFold(endpointSlice.Namespace, service.Namespace) { - ep = endpointSlice - foundInCache = true - return false + eps = append(eps, endpointSlice) } return true }) - if ep == nil { - klog.Infof("EndpointSlice for service %s/%s not found, try to list EndpointSlices", service.Namespace, service.Name) - eps, err := az.KubeClient.DiscoveryV1().EndpointSlices(service.Namespace).List(ctx, metav1.ListOptions{}) - if err != nil { - klog.Errorf("Failed to list EndpointSlices for service %s/%s: %s", service.Namespace, service.Name, err.Error()) - return nil, err - } - for _, endpointSlice := range eps.Items { - endpointSlice := endpointSlice - if strings.EqualFold(getServiceNameOfEndpointSlice(&endpointSlice), service.Name) { - ep = &endpointSlice - break - } - } - } - if ep == nil { - return nil, fmt.Errorf("failed to find EndpointSlice for service %s/%s", service.Namespace, service.Name) - } - if !foundInCache { - az.endpointSlicesCache.Store(strings.ToLower(fmt.Sprintf("%s/%s", ep.Namespace, ep.Name)), ep) + if len(eps) == 0 { + klog.Warningf("getLocalServiceEndpointsNodeNames: failed to find EndpointSlice for service %s/%s", service.Namespace, service.Name) + return nil } var nodeNames []string - for _, endpoint := range ep.Endpoints { - klog.V(4).Infof("EndpointSlice %s/%s has endpoint %s on node %s", ep.Namespace, ep.Name, endpoint.Addresses, ptr.Deref(endpoint.NodeName, "")) - nodeNames = append(nodeNames, ptr.Deref(endpoint.NodeName, "")) + for _, ep := range eps { + for _, endpoint := range ep.Endpoints { + klog.V(4).Infof("EndpointSlice %s/%s has endpoint %s on node %s", ep.Namespace, ep.Name, endpoint.Addresses, ptr.Deref(endpoint.NodeName, "")) + nodeNames = append(nodeNames, ptr.Deref(endpoint.NodeName, "")) + } } - return utilsets.NewString(nodeNames...), nil + return utilsets.NewString(nodeNames...) } // cleanupLocalServiceBackendPool cleans up the backend pool of @@ -548,12 +529,13 @@ func (az *Cloud) cleanupLocalServiceBackendPool( // checkAndApplyLocalServiceBackendPoolUpdates if the IPs in the backend pool are aligned // with the corresponding endpointslice, and update the backend pool if necessary. -func (az *Cloud) checkAndApplyLocalServiceBackendPoolUpdates(ctx context.Context, lb network.LoadBalancer, service *v1.Service) error { +func (az *Cloud) checkAndApplyLocalServiceBackendPoolUpdates(lb network.LoadBalancer, service *v1.Service) error { serviceName := getServiceName(service) - endpointsNodeNames, err := az.getLocalServiceEndpointsNodeNames(ctx, service) - if err != nil { - return err + endpointsNodeNames := az.getLocalServiceEndpointsNodeNames(service) + if endpointsNodeNames == nil { + return nil } + var expectedIPs []string for _, nodeName := range endpointsNodeNames.UnsortedList() { ips := az.nodePrivateIPs[strings.ToLower(nodeName)] diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_privatelinkservice.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_privatelinkservice.go index bc9a586077..a4c386268e 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_privatelinkservice.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_privatelinkservice.go @@ -49,7 +49,6 @@ func (az *Cloud) reconcilePrivateLinkService( wantPLS bool, ) error { isinternal := requiresInternalLoadBalancer(service) - pipRG := az.getPublicIPAddressResourceGroup(service) _, _, fipIPVersion := az.serviceOwnsFrontendIP(ctx, *fipConfig, service) serviceName := getServiceName(service) var isIPv6 bool @@ -57,7 +56,7 @@ func (az *Cloud) reconcilePrivateLinkService( if fipIPVersion != "" { isIPv6 = fipIPVersion == network.IPv6 } else { - if isIPv6, err = az.isFIPIPv6(service, pipRG, fipConfig); err != nil { + if isIPv6, err = az.isFIPIPv6(service, fipConfig); err != nil { klog.Errorf("reconcilePrivateLinkService for service(%s): failed to get FIP IP family: %v", serviceName, err) return err } diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_routes.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_routes.go index c32c7a3cc7..4527908ef8 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_routes.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_routes.go @@ -23,8 +23,7 @@ import ( "sync" "time" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2022-07-01/network" - + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/wait" cloudprovider "k8s.io/cloud-provider" @@ -53,7 +52,7 @@ const ( // delayedRouteOperation defines a delayed route operation which is used in delayedRouteUpdater. type delayedRouteOperation struct { - route network.Route + route *armnetwork.Route routeTableTags map[string]*string operation routeOperation result chan batchOperationResult @@ -119,24 +118,23 @@ func (d *delayedRouteUpdater) updateRoutes(ctx context.Context) { }() var ( - routeTable network.RouteTable - existsRouteTable bool + routeTable *armnetwork.RouteTable ) - routeTable, existsRouteTable, err = d.az.getRouteTable(ctx, azcache.CacheReadTypeDefault) + routeTable, err = d.az.routeTableRepo.Get(ctx, d.az.RouteTableName, azcache.CacheReadTypeDefault) if err != nil { klog.Errorf("getRouteTable() failed with error: %v", err) return } // create route table if it doesn't exists yet. - if !existsRouteTable { - err = d.az.createRouteTable() + if routeTable == nil { + err = d.az.createRouteTable(ctx) if err != nil { klog.Errorf("createRouteTable() failed with error: %v", err) return } - routeTable, _, err = d.az.getRouteTable(ctx, azcache.CacheReadTypeDefault) + routeTable, err = d.az.routeTableRepo.Get(ctx, d.az.RouteTableName, azcache.CacheReadTypeDefault) if err != nil { klog.Errorf("getRouteTable() failed with error: %v", err) return @@ -145,9 +143,9 @@ func (d *delayedRouteUpdater) updateRoutes(ctx context.Context) { // reconcile routes. dirty, onlyUpdateTags := false, true - routes := []network.Route{} - if routeTable.RouteTablePropertiesFormat != nil && routeTable.RouteTablePropertiesFormat.Routes != nil { - routes = *routeTable.Routes + var routes []*armnetwork.Route + if routeTable.Properties != nil { + routes = routeTable.Properties.Routes } routes, dirty = d.cleanupOutdatedRoutes(routes) @@ -169,10 +167,10 @@ func (d *delayedRouteUpdater) updateRoutes(ctx context.Context) { if strings.EqualFold(ptr.Deref(existingRoute.Name, ""), ptr.Deref(rt.route.Name, "")) { // delete the name-matched routes here (missing routes would be added later if the operation is add). routes = append(routes[:i], routes[i+1:]...) - if existingRoute.RoutePropertiesFormat != nil && - rt.route.RoutePropertiesFormat != nil && - strings.EqualFold(ptr.Deref(existingRoute.AddressPrefix, ""), ptr.Deref(rt.route.AddressPrefix, "")) && - strings.EqualFold(ptr.Deref(existingRoute.NextHopIPAddress, ""), ptr.Deref(rt.route.NextHopIPAddress, "")) { + if existingRoute.Properties != nil && + rt.route.Properties != nil && + strings.EqualFold(ptr.Deref(existingRoute.Properties.AddressPrefix, ""), ptr.Deref(rt.route.Properties.AddressPrefix, "")) && + strings.EqualFold(ptr.Deref(existingRoute.Properties.NextHopIPAddress, ""), ptr.Deref(rt.route.Properties.NextHopIPAddress, "")) { routeMatch = true } if rt.operation == routeOperationDelete { @@ -198,9 +196,9 @@ func (d *delayedRouteUpdater) updateRoutes(ctx context.Context) { if dirty { if !onlyUpdateTags { klog.V(2).Infof("updateRoutes: updating routes") - routeTable.Routes = &routes + routeTable.Properties.Routes = routes } - err = d.az.CreateOrUpdateRouteTable(routeTable) + _, err := d.az.routeTableRepo.CreateOrUpdate(ctx, *routeTable) if err != nil { klog.Errorf("CreateOrUpdateRouteTable() failed with error: %v", err) return @@ -213,7 +211,7 @@ func (d *delayedRouteUpdater) updateRoutes(ctx context.Context) { // cleanupOutdatedRoutes deletes all non-dualstack routes when dualstack is enabled, // and deletes all dualstack routes when dualstack is not enabled. -func (d *delayedRouteUpdater) cleanupOutdatedRoutes(existingRoutes []network.Route) (routes []network.Route, changed bool) { +func (d *delayedRouteUpdater) cleanupOutdatedRoutes(existingRoutes []*armnetwork.Route) (routes []*armnetwork.Route, changed bool) { for i := len(existingRoutes) - 1; i >= 0; i-- { existingRouteName := ptr.Deref(existingRoutes[i].Name, "") split := strings.Split(existingRouteName, consts.RouteNameSeparator) @@ -241,7 +239,7 @@ func (d *delayedRouteUpdater) cleanupOutdatedRoutes(existingRoutes []network.Rou return existingRoutes, changed } -func getAddRouteOperation(route network.Route) batchOperation { +func getAddRouteOperation(route *armnetwork.Route) batchOperation { return &delayedRouteOperation{ route: route, operation: routeOperationAdd, @@ -249,7 +247,7 @@ func getAddRouteOperation(route network.Route) batchOperation { } } -func getDeleteRouteOperation(route network.Route) batchOperation { +func getDeleteRouteOperation(route *armnetwork.Route) batchOperation { return &delayedRouteOperation{ route: route, operation: routeOperationDelete, @@ -280,8 +278,8 @@ func (d *delayedRouteUpdater) removeOperation(_ string) {} // implements cloudprovider.Routes.ListRoutes func (az *Cloud) ListRoutes(ctx context.Context, clusterName string) ([]*cloudprovider.Route, error) { klog.V(10).Infof("ListRoutes: START clusterName=%q", clusterName) - routeTable, existsRouteTable, err := az.getRouteTable(ctx, azcache.CacheReadTypeDefault) - routes, err := processRoutes(az.ipv6DualStackEnabled, routeTable, existsRouteTable, err) + routeTable, err := az.routeTableRepo.Get(ctx, az.RouteTableName, azcache.CacheReadTypeDefault) + routes, err := processRoutes(az.ipv6DualStackEnabled, routeTable, err) if err != nil { return nil, err } @@ -304,7 +302,7 @@ func (az *Cloud) ListRoutes(ctx context.Context, clusterName string) ([]*cloudpr } // ensure the route table is tagged as configured - tags, changed := az.ensureRouteTableTagged(&routeTable) + tags, changed := az.ensureRouteTableTagged(routeTable) if changed { klog.V(2).Infof("ListRoutes: updating tags on route table %s", ptr.Deref(routeTable.Name, "")) op := az.routeUpdater.addOperation(getUpdateRouteTableTagsOperation(tags)) @@ -321,20 +319,20 @@ func (az *Cloud) ListRoutes(ctx context.Context, clusterName string) ([]*cloudpr } // Injectable for testing -func processRoutes(ipv6DualStackEnabled bool, routeTable network.RouteTable, exists bool, err error) ([]*cloudprovider.Route, error) { +func processRoutes(ipv6DualStackEnabled bool, routeTable *armnetwork.RouteTable, err error) ([]*cloudprovider.Route, error) { if err != nil { return nil, err } - if !exists { + if routeTable == nil { return []*cloudprovider.Route{}, nil } var kubeRoutes []*cloudprovider.Route - if routeTable.RouteTablePropertiesFormat != nil && routeTable.Routes != nil { - kubeRoutes = make([]*cloudprovider.Route, len(*routeTable.Routes)) - for i, route := range *routeTable.Routes { + if routeTable.Properties != nil { + kubeRoutes = make([]*cloudprovider.Route, len(routeTable.Properties.Routes)) + for i, route := range routeTable.Properties.Routes { instance := MapRouteNameToNodeName(ipv6DualStackEnabled, *route.Name) - cidr := *route.AddressPrefix + cidr := *route.Properties.AddressPrefix klog.V(10).Infof("ListRoutes: * instance=%q, cidr=%q", instance, cidr) kubeRoutes[i] = &cloudprovider.Route{ @@ -349,22 +347,16 @@ func processRoutes(ipv6DualStackEnabled bool, routeTable network.RouteTable, exi return kubeRoutes, nil } -func (az *Cloud) createRouteTable() error { - routeTable := network.RouteTable{ - Name: ptr.To(az.RouteTableName), - Location: ptr.To(az.Location), - RouteTablePropertiesFormat: &network.RouteTablePropertiesFormat{}, +func (az *Cloud) createRouteTable(ctx context.Context) error { + routeTable := armnetwork.RouteTable{ + Name: ptr.To(az.RouteTableName), + Location: ptr.To(az.Location), + Properties: &armnetwork.RouteTablePropertiesFormat{}, } klog.V(3).Infof("createRouteTableIfNotExists: creating routetable. routeTableName=%q", az.RouteTableName) - err := az.CreateOrUpdateRouteTable(routeTable) - if err != nil { - return err - } - - // Invalidate the cache right after updating - _ = az.rtCache.Delete(az.RouteTableName) - return nil + _, err := az.routeTableRepo.CreateOrUpdate(ctx, routeTable) + return err } // CreateRoute creates the described managed route @@ -419,11 +411,11 @@ func (az *Cloud) CreateRoute(ctx context.Context, clusterName string, _ string, } } routeName := mapNodeNameToRouteName(az.ipv6DualStackEnabled, kubeRoute.TargetNode, kubeRoute.DestinationCIDR) - route := network.Route{ + route := &armnetwork.Route{ Name: ptr.To(routeName), - RoutePropertiesFormat: &network.RoutePropertiesFormat{ + Properties: &armnetwork.RoutePropertiesFormat{ AddressPrefix: ptr.To(kubeRoute.DestinationCIDR), - NextHopType: network.RouteNextHopTypeVirtualAppliance, + NextHopType: ptr.To(armnetwork.RouteNextHopTypeVirtualAppliance), NextHopIPAddress: ptr.To(targetIP), }, } @@ -470,9 +462,9 @@ func (az *Cloud) DeleteRoute(_ context.Context, clusterName string, kubeRoute *c routeName := mapNodeNameToRouteName(az.ipv6DualStackEnabled, kubeRoute.TargetNode, kubeRoute.DestinationCIDR) klog.V(2).Infof("DeleteRoute: deleting route. clusterName=%q instance=%q cidr=%q routeName=%q", clusterName, kubeRoute.TargetNode, kubeRoute.DestinationCIDR, routeName) - route := network.Route{ - Name: ptr.To(routeName), - RoutePropertiesFormat: &network.RoutePropertiesFormat{}, + route := &armnetwork.Route{ + Name: ptr.To(routeName), + Properties: &armnetwork.RoutePropertiesFormat{}, } op := az.routeUpdater.addOperation(getDeleteRouteOperation(route)) @@ -487,9 +479,9 @@ func (az *Cloud) DeleteRoute(_ context.Context, clusterName string, kubeRoute *c if az.ipv6DualStackEnabled { routeNameWithoutIPV6Suffix := strings.Split(routeName, consts.RouteNameSeparator)[0] klog.V(2).Infof("DeleteRoute: deleting route. clusterName=%q instance=%q cidr=%q routeName=%q", clusterName, kubeRoute.TargetNode, kubeRoute.DestinationCIDR, routeNameWithoutIPV6Suffix) - route := network.Route{ - Name: ptr.To(routeNameWithoutIPV6Suffix), - RoutePropertiesFormat: &network.RoutePropertiesFormat{}, + route := &armnetwork.Route{ + Name: ptr.To(routeNameWithoutIPV6Suffix), + Properties: &armnetwork.RoutePropertiesFormat{}, } op := az.routeUpdater.addOperation(getDeleteRouteOperation(route)) @@ -553,7 +545,7 @@ func cidrtoRfc1035(cidr string) string { } // ensureRouteTableTagged ensures the route table is tagged as configured -func (az *Cloud) ensureRouteTableTagged(rt *network.RouteTable) (map[string]*string, bool) { +func (az *Cloud) ensureRouteTableTagged(rt *armnetwork.RouteTable) (map[string]*string, bool) { if !strings.EqualFold(az.RouteTableResourceGroup, az.ResourceGroup) { return nil, false } diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_routetable_repo.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_routetable_repo.go deleted file mode 100644 index 116c9138f9..0000000000 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_routetable_repo.go +++ /dev/null @@ -1,84 +0,0 @@ -/* -Copyright 2023 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package provider - -import ( - "context" - "encoding/json" - "net/http" - "strings" - "time" - - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2022-07-01/network" - - "k8s.io/klog/v2" - "k8s.io/utils/ptr" - - azcache "sigs.k8s.io/cloud-provider-azure/pkg/cache" - "sigs.k8s.io/cloud-provider-azure/pkg/consts" -) - -// CreateOrUpdateRouteTable invokes az.RouteTablesClient.CreateOrUpdate with exponential backoff retry -func (az *Cloud) CreateOrUpdateRouteTable(routeTable network.RouteTable) error { - ctx, cancel := getContextWithCancel() - defer cancel() - - rerr := az.RouteTablesClient.CreateOrUpdate(ctx, az.RouteTableResourceGroup, az.RouteTableName, routeTable, ptr.Deref(routeTable.Etag, "")) - if rerr == nil { - // Invalidate the cache right after updating - _ = az.rtCache.Delete(*routeTable.Name) - return nil - } - - rtJSON, _ := json.Marshal(routeTable) - klog.Warningf("RouteTablesClient.CreateOrUpdate(%s) failed: %v, RouteTable request: %s", ptr.Deref(routeTable.Name, ""), rerr.Error(), string(rtJSON)) - - // Invalidate the cache because etag mismatch. - if rerr.HTTPStatusCode == http.StatusPreconditionFailed { - klog.V(3).Infof("Route table cache for %s is cleanup because of http.StatusPreconditionFailed", *routeTable.Name) - _ = az.rtCache.Delete(*routeTable.Name) - } - // Invalidate the cache because another new operation has canceled the current request. - if strings.Contains(strings.ToLower(rerr.Error().Error()), consts.OperationCanceledErrorMessage) { - klog.V(3).Infof("Route table cache for %s is cleanup because CreateOrUpdateRouteTable is canceled by another operation", *routeTable.Name) - _ = az.rtCache.Delete(*routeTable.Name) - } - klog.Errorf("RouteTablesClient.CreateOrUpdate(%s) failed: %v", az.RouteTableName, rerr.Error()) - return rerr.Error() -} - -func (az *Cloud) newRouteTableCache() (azcache.Resource, error) { - getter := func(ctx context.Context, key string) (interface{}, error) { - rt, err := az.RouteTablesClient.Get(ctx, az.RouteTableResourceGroup, key, "") - exists, rerr := checkResourceExistsFromError(err) - if rerr != nil { - return nil, rerr.Error() - } - - if !exists { - klog.V(2).Infof("Route table %q not found", key) - return nil, nil - } - - return &rt, nil - } - - if az.RouteTableCacheTTLInSeconds == 0 { - az.RouteTableCacheTTLInSeconds = routeTableCacheTTLDefaultInSeconds - } - return azcache.NewTimedCache(time.Duration(az.RouteTableCacheTTLInSeconds)*time.Second, getter, az.Config.DisableAPICallCache) -} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_standard.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_standard.go index fdfbd99333..79b13824c9 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_standard.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_standard.go @@ -48,7 +48,7 @@ import ( var ( errNotInVMSet = errors.New("vm is not in the vmset") providerIDRE = regexp.MustCompile(`.*/subscriptions/(?:.*)/Microsoft.Compute/virtualMachines/(.+)$`) - backendPoolIDRE = regexp.MustCompile(`^/subscriptions/(?:.*)/resourceGroups/(?:.*)/providers/Microsoft.Network/loadBalancers/(.+)/backendAddressPools/(?:.*)`) + backendPoolIDRE = regexp.MustCompile(`^/subscriptions/(?:.*)/resourceGroups/(?:.*)/providers/Microsoft.Network/loadBalancers/(.+)/backendAddressPools/(.+)`) nicResourceGroupRE = regexp.MustCompile(`.*/subscriptions/(?:.*)/resourceGroups/(.+)/providers/Microsoft.Network/networkInterfaces/(?:.*)`) nicIDRE = regexp.MustCompile(`(?i)/subscriptions/(?:.*)/resourceGroups/(.+)/providers/Microsoft.Network/networkInterfaces/(.+)/ipConfigurations/(?:.*)`) vmIDRE = regexp.MustCompile(`(?i)/subscriptions/(?:.*)/resourceGroups/(?:.*)/providers/Microsoft.Compute/virtualMachines/(.+)`) @@ -694,7 +694,7 @@ func (as *availabilitySet) getAgentPoolAvailabilitySets(vms []compute.VirtualMac // annotation would be ignored when using one SLB per cluster. func (as *availabilitySet) GetVMSetNames(ctx context.Context, service *v1.Service, nodes []*v1.Node) (availabilitySetNames *[]string, err error) { hasMode, isAuto, serviceAvailabilitySetName := as.getServiceLoadBalancerMode(service) - if !hasMode || as.useStandardLoadBalancer() { + if !hasMode || as.UseStandardLoadBalancer() { // no mode specified in service annotation or use single SLB mode // default to PrimaryAvailabilitySetName availabilitySetNames = &[]string{as.Config.PrimaryAvailabilitySetName} @@ -825,7 +825,7 @@ func (as *availabilitySet) getPrimaryInterfaceWithVMSet(ctx context.Context, nod // don't check vmSet for it. // - For multiple standard SKU load balancers, the behavior is similar to the basic LB. needCheck := false - if !as.useStandardLoadBalancer() { + if !as.UseStandardLoadBalancer() { // need to check the vmSet name when using the basic LB needCheck = true } @@ -904,7 +904,7 @@ func (as *availabilitySet) EnsureHostInPool(ctx context.Context, service *v1.Ser } } if !foundPool { - if as.useStandardLoadBalancer() && len(newBackendPools) > 0 { + if as.UseStandardLoadBalancer() && len(newBackendPools) > 0 { // Although standard load balancer supports backends from multiple availability // sets, the same network interface couldn't be added to more than one load balancer of // the same type. Omit those nodes (e.g. masters) so Azure ARM won't complain @@ -954,7 +954,7 @@ func (as *availabilitySet) EnsureHostsInPool(ctx context.Context, service *v1.Se hostUpdates := make([]func() error, 0, len(nodes)) for _, node := range nodes { localNodeName := node.Name - if as.useStandardLoadBalancer() && as.excludeMasterNodesFromStandardLB() && isControlPlaneNode(node) { + if as.UseStandardLoadBalancer() && as.ExcludeMasterNodesFromStandardLB() && isControlPlaneNode(node) { klog.V(4).Infof("Excluding master node %q from load balancer backendpool %q", localNodeName, backendPoolID) continue } diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_storageaccount.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_storageaccount.go index fa9341bc00..bd4bcf9ef5 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_storageaccount.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_storageaccount.go @@ -87,6 +87,8 @@ type AccountOptions struct { SoftDeleteContainers int32 // indicate whether to get a random matching account, if false, will get the first matching account PickRandomMatchingAccount bool + // provide the source account name in snapshot restore and volume clone scenarios + SourceAccountName string } type accountWithLocation struct { @@ -341,6 +343,15 @@ func (az *Cloud) EnsureStorageAccount(ctx context.Context, accountOptions *Accou } accountName = accounts[index].Name createNewAccount = false + if accountOptions.SourceAccountName != "" { + for _, acct := range accounts { + if acct.Name == accountOptions.SourceAccountName { + klog.V(2).Infof("found a matching account %s type %s location %s with source account name", acct.Name, acct.StorageType, acct.Location) + accountName = acct.Name + break + } + } + } klog.V(4).Infof("found a matching account %s type %s location %s", accounts[index].Name, accounts[index].StorageType, accounts[index].Location) } } diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_utils.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_utils.go index 65fef0f218..4088ec6ef0 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_utils.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_utils.go @@ -47,44 +47,6 @@ var strToExtendedLocationType = map[string]armnetwork.ExtendedLocationTypes{ "edgezone": armnetwork.ExtendedLocationTypesEdgeZone, } -// LockMap used to lock on entries -type LockMap struct { - sync.Mutex - mutexMap map[string]*sync.Mutex -} - -// NewLockMap returns a new lock map -func newLockMap() *LockMap { - return &LockMap{ - mutexMap: make(map[string]*sync.Mutex), - } -} - -// LockEntry acquires a lock associated with the specific entry -func (lm *LockMap) LockEntry(entry string) { - lm.Lock() - // check if entry does not exists, then add entry - mutex, exists := lm.mutexMap[entry] - if !exists { - mutex = &sync.Mutex{} - lm.mutexMap[entry] = mutex - } - lm.Unlock() - mutex.Lock() -} - -// UnlockEntry release the lock associated with the specific entry -func (lm *LockMap) UnlockEntry(entry string) { - lm.Lock() - defer lm.Unlock() - - mutex, exists := lm.mutexMap[entry] - if !exists { - return - } - mutex.Unlock() -} - func getContextWithCancel() (context.Context, context.CancelFunc) { return context.WithCancel(context.Background()) } @@ -438,9 +400,12 @@ func getResourceByIPFamily(resource string, isDualStack, isIPv6 bool) string { // isFIPIPv6 checks if the frontend IP configuration is of IPv6. // NOTICE: isFIPIPv6 assumes the FIP is owned by the Service and it is the primary Service. -func (az *Cloud) isFIPIPv6(service *v1.Service, _ string, fip *network.FrontendIPConfiguration) (bool, error) { +func (az *Cloud) isFIPIPv6(service *v1.Service, fip *network.FrontendIPConfiguration) (bool, error) { isDualStack := isServiceDualStack(service) if !isDualStack { + if len(service.Spec.IPFamilies) == 0 { + return false, nil + } return service.Spec.IPFamilies[0] == v1.IPv6Protocol, nil } return managedResourceHasIPv6Suffix(ptr.Deref(fip.Name, "")), nil @@ -455,13 +420,13 @@ func getResourceIDPrefix(id string) string { return id[:idx] } -func getLBNameFromBackendPoolID(backendPoolID string) (string, error) { +func getBackendPoolNameFromBackendPoolID(backendPoolID string) (string, error) { matches := backendPoolIDRE.FindStringSubmatch(backendPoolID) - if len(matches) != 2 { + if len(matches) != 3 { return "", fmt.Errorf("backendPoolID %q is in wrong format", backendPoolID) } - return matches[1], nil + return matches[2], nil } func countNICsOnBackendPool(backendPool network.BackendAddressPool) int { diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_vmsets_repo.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_vmsets_repo.go index ec7106c954..00c13e6a66 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_vmsets_repo.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_vmsets_repo.go @@ -19,13 +19,10 @@ package provider import ( "context" "errors" - "fmt" "strings" "time" "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2022-08-01/compute" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2022-07-01/network" - "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/wait" cloudprovider "k8s.io/cloud-provider" @@ -171,20 +168,3 @@ func (az *Cloud) getVirtualMachine(ctx context.Context, nodeName types.NodeName, return *(cachedVM.(*compute.VirtualMachine)), nil } - -func (az *Cloud) getRouteTable(ctx context.Context, crt azcache.AzureCacheReadType) (routeTable network.RouteTable, exists bool, err error) { - if len(az.RouteTableName) == 0 { - return routeTable, false, fmt.Errorf("route table name is not configured") - } - - cachedRt, err := az.rtCache.GetWithDeepCopy(ctx, az.RouteTableName, crt) - if err != nil { - return routeTable, false, err - } - - if cachedRt == nil { - return routeTable, false, nil - } - - return *(cachedRt.(*network.RouteTable)), true, nil -} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_vmss.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_vmss.go index 10be642012..335cccf713 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_vmss.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_vmss.go @@ -40,6 +40,7 @@ import ( "sigs.k8s.io/cloud-provider-azure/pkg/consts" "sigs.k8s.io/cloud-provider-azure/pkg/metrics" "sigs.k8s.io/cloud-provider-azure/pkg/provider/virtualmachine" + "sigs.k8s.io/cloud-provider-azure/pkg/util/lockmap" vmutil "sigs.k8s.io/cloud-provider-azure/pkg/util/vm" ) @@ -102,7 +103,7 @@ type ScaleSet struct { nonVmssUniformNodesCache azcache.Resource // lockMap in cache refresh - lockMap *LockMap + lockMap *lockmap.LockMap } // RefreshCaches invalidates and renew all related caches. @@ -153,14 +154,14 @@ func newScaleSet(az *Cloud) (VMSet, error) { Cloud: az, availabilitySet: as, flexScaleSet: fs, - lockMap: newLockMap(), + lockMap: lockmap.NewLockMap(), } if err := ss.RefreshCaches(); err != nil { return nil, err } - ss.lockMap = newLockMap() + ss.lockMap = lockmap.NewLockMap() return ss, nil } @@ -872,7 +873,7 @@ func (ss *ScaleSet) getAgentPoolScaleSets(ctx context.Context, nodes []*v1.Node) // for loadbalancer exists then return the eligible VMSet. func (ss *ScaleSet) GetVMSetNames(ctx context.Context, service *v1.Service, nodes []*v1.Node) (*[]string, error) { hasMode, isAuto, serviceVMSetName := ss.getServiceLoadBalancerMode(service) - if !hasMode || ss.useStandardLoadBalancer() { + if !hasMode || ss.UseStandardLoadBalancer() { // no mode specified in service annotation or use single SLB mode // default to PrimaryScaleSetName scaleSetNames := &[]string{ss.Config.PrimaryScaleSetName} @@ -1069,7 +1070,7 @@ func (ss *ScaleSet) EnsureHostInPool(ctx context.Context, _ *v1.Service, nodeNam // don't check vmSet for it. // - For multiple standard SKU load balancers, the behavior is similar to the basic load balancer needCheck := false - if !ss.useStandardLoadBalancer() { + if !ss.UseStandardLoadBalancer() { // need to check the vmSet name when using the basic LB needCheck = true } @@ -1115,7 +1116,7 @@ func (ss *ScaleSet) EnsureHostInPool(ctx context.Context, _ *v1.Service, nodeNam return "", "", "", nil, nil } - if ss.useStandardLoadBalancer() && len(newBackendPools) > 0 { + if ss.UseStandardLoadBalancer() && len(newBackendPools) > 0 { // Although standard load balancer supports backends from multiple scale // sets, the same network interface couldn't be added to more than one load balancer of // the same type. Omit those nodes (e.g. masters) so Azure ARM won't complain @@ -1183,9 +1184,9 @@ func (ss *ScaleSet) ensureVMSSInPool(ctx context.Context, _ *v1.Service, nodes [ // the single standard load balancer supports multiple vmss in its backend while // multiple standard load balancers and the basic load balancer doesn't - if ss.useStandardLoadBalancer() { + if ss.UseStandardLoadBalancer() { for _, node := range nodes { - if ss.excludeMasterNodesFromStandardLB() && isControlPlaneNode(node) { + if ss.ExcludeMasterNodesFromStandardLB() && isControlPlaneNode(node) { continue } @@ -1282,7 +1283,7 @@ func (ss *ScaleSet) ensureVMSSInPool(ctx context.Context, _ *v1.Service, nodes [ continue } - if ss.useStandardLoadBalancer() && len(loadBalancerBackendAddressPools) > 0 { + if ss.UseStandardLoadBalancer() && len(loadBalancerBackendAddressPools) > 0 { // Although standard load balancer supports backends from multiple scale // sets, the same network interface couldn't be added to more than one load balancer of // the same type. Omit those nodes (e.g. masters) so Azure ARM won't complain @@ -1377,13 +1378,20 @@ func (ss *ScaleSet) ensureHostsInPool(ctx context.Context, service *v1.Service, mc.ObserveOperationWithResult(isOperationSucceeded) }() + // Ensure the backendPoolID is also added on VMSS itself. + // Refer to issue kubernetes/kubernetes#80365 for detailed information + err := ss.ensureVMSSInPool(ctx, service, nodes, backendPoolID, vmSetNameOfLB) + if err != nil { + return err + } + hostUpdates := make([]func() error, 0, len(nodes)) nodeUpdates := make(map[vmssMetaInfo]map[string]compute.VirtualMachineScaleSetVM) errors := make([]error, 0) for _, node := range nodes { localNodeName := node.Name - if ss.useStandardLoadBalancer() && ss.excludeMasterNodesFromStandardLB() && isControlPlaneNode(node) { + if ss.UseStandardLoadBalancer() && ss.ExcludeMasterNodesFromStandardLB() && isControlPlaneNode(node) { klog.V(4).Infof("Excluding master node %q from load balancer backendpool %q", localNodeName, backendPoolID) continue } @@ -1467,13 +1475,6 @@ func (ss *ScaleSet) ensureHostsInPool(ctx context.Context, service *v1.Service, return utilerrors.Flatten(utilerrors.NewAggregate(errors)) } - // Ensure the backendPoolID is also added on VMSS itself. - // Refer to issue kubernetes/kubernetes#80365 for detailed information - err := ss.ensureVMSSInPool(ctx, service, nodes, backendPoolID, vmSetNameOfLB) - if err != nil { - return err - } - isOperationSucceeded = true return nil } @@ -1491,7 +1492,7 @@ func (ss *ScaleSet) EnsureHostsInPool(ctx context.Context, service *v1.Service, for _, node := range nodes { localNodeName := node.Name - if ss.useStandardLoadBalancer() && ss.excludeMasterNodesFromStandardLB() && isControlPlaneNode(node) { + if ss.UseStandardLoadBalancer() && ss.ExcludeMasterNodesFromStandardLB() && isControlPlaneNode(node) { klog.V(4).Infof("Excluding master node %q from load balancer backendpool %q", localNodeName, backendPoolID) continue } @@ -1516,7 +1517,7 @@ func (ss *ScaleSet) EnsureHostsInPool(ctx context.Context, service *v1.Service, if vmManagementType == ManagedByAvSet { // vm is managed by availability set. // VMAS nodes should also be added to the SLB backends. - if ss.useStandardLoadBalancer() { + if ss.UseStandardLoadBalancer() { vmasNodes = append(vmasNodes, node) continue } @@ -1525,7 +1526,7 @@ func (ss *ScaleSet) EnsureHostsInPool(ctx context.Context, service *v1.Service, } if vmManagementType == ManagedByVmssFlex { // vm is managed by vmss flex. - if ss.useStandardLoadBalancer() { + if ss.UseStandardLoadBalancer() { vmssFlexNodes = append(vmssFlexNodes, node) continue } @@ -1674,7 +1675,7 @@ func getScaleSetAndResourceGroupNameByIPConfigurationID(ipConfigurationID string } func (ss *ScaleSet) ensureBackendPoolDeletedFromVMSS(ctx context.Context, backendPoolIDs []string, vmSetName string) error { - if !ss.useStandardLoadBalancer() { + if !ss.UseStandardLoadBalancer() { found := false cachedUniform, err := ss.vmssCache.Get(ctx, consts.VMSSKey, azcache.CacheReadTypeDefault) @@ -1733,7 +1734,7 @@ func (ss *ScaleSet) ensureBackendPoolDeletedFromVMSS(ctx context.Context, backen func (ss *ScaleSet) ensureBackendPoolDeletedFromVmssUniform(ctx context.Context, backendPoolIDs []string, vmSetName string) error { vmssNamesMap := make(map[string]bool) // the standard load balancer supports multiple vmss in its backend while the basic sku doesn't - if ss.useStandardLoadBalancer() { + if ss.UseStandardLoadBalancer() { cachedUniform, err := ss.vmssCache.Get(ctx, consts.VMSSKey, azcache.CacheReadTypeDefault) if err != nil { klog.Errorf("ensureBackendPoolDeletedFromVMSS: failed to get vmss uniform from cache: %v", err) @@ -1860,7 +1861,7 @@ func (ss *ScaleSet) ensureBackendPoolDeleted(ctx context.Context, service *v1.Se var err error if scaleSetName, err = extractScaleSetNameByProviderID(ipConfigurationID); err == nil { // Only remove nodes belonging to specified vmSet to basic LB backends. - if !ss.useStandardLoadBalancer() && !strings.EqualFold(scaleSetName, vmSetName) { + if !ss.UseStandardLoadBalancer() && !strings.EqualFold(scaleSetName, vmSetName) { continue } } @@ -1967,7 +1968,9 @@ func (ss *ScaleSet) EnsureBackendPoolDeleted(ctx context.Context, service *v1.Se for _, backendPool := range *backendAddressPools { for _, backendPoolID := range backendPoolIDs { - if strings.EqualFold(*backendPool.ID, backendPoolID) && backendPool.BackendIPConfigurations != nil { + if strings.EqualFold(*backendPool.ID, backendPoolID) && + backendPool.BackendAddressPoolPropertiesFormat != nil && + backendPool.BackendIPConfigurations != nil { for _, ipConf := range *backendPool.BackendIPConfigurations { if ipConf.ID == nil { continue @@ -2311,7 +2314,7 @@ func (ss *ScaleSet) VMSSBatchSize(ctx context.Context, vmssName string) (int, er return 0, fmt.Errorf("get vmss batch size: %w", err) } if _, ok := vmss.Tags[consts.VMSSTagForBatchOperation]; ok { - batchSize = ss.getPutVMSSVMBatchSize() + batchSize = ss.GetPutVMSSVMBatchSize() } klog.V(2).InfoS("Fetch VMSS batch size", "vmss", vmssName, "size", batchSize) return batchSize, nil diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_vmssflex.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_vmssflex.go index d2b779768a..666fe2948a 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_vmssflex.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_vmssflex.go @@ -38,6 +38,7 @@ import ( azcache "sigs.k8s.io/cloud-provider-azure/pkg/cache" "sigs.k8s.io/cloud-provider-azure/pkg/consts" "sigs.k8s.io/cloud-provider-azure/pkg/metrics" + "sigs.k8s.io/cloud-provider-azure/pkg/util/lockmap" vmutil "sigs.k8s.io/cloud-provider-azure/pkg/util/vm" ) @@ -54,7 +55,7 @@ type FlexScaleSet struct { vmssFlexVMCache azcache.Resource // lockMap in cache refresh - lockMap *LockMap + lockMap *lockmap.LockMap } // RefreshCaches invalidates and renew all related caches. @@ -79,7 +80,7 @@ func newFlexScaleSet(az *Cloud) (VMSet, error) { Cloud: az, vmssFlexVMNameToVmssID: &sync.Map{}, vmssFlexVMNameToNodeName: &sync.Map{}, - lockMap: newLockMap(), + lockMap: lockmap.NewLockMap(), } if err := fs.RefreshCaches(); err != nil { @@ -135,7 +136,7 @@ func (fs *FlexScaleSet) GetAgentPoolVMSetNames(ctx context.Context, nodes []*v1. // annotation would be ignored when using one SLB per cluster. func (fs *FlexScaleSet) GetVMSetNames(ctx context.Context, service *v1.Service, nodes []*v1.Node) (*[]string, error) { hasMode, isAuto, serviceVMSetName := fs.getServiceLoadBalancerMode(service) - if !hasMode || fs.useStandardLoadBalancer() { + if !hasMode || fs.UseStandardLoadBalancer() { // no mode specified in service annotation or use single SLB mode // default to PrimaryScaleSetName vmssFlexNames := &[]string{fs.Config.PrimaryScaleSetName} @@ -459,7 +460,7 @@ func (fs *FlexScaleSet) EnsureHostInPool(ctx context.Context, service *v1.Servic // don't check vmSet for it. // - For multiple standard SKU load balancers, return nil if the node's scale set is mismatched with vmSetNameOfLB needCheck := false - if !fs.useStandardLoadBalancer() { + if !fs.UseStandardLoadBalancer() { return "", "", "", nil, fmt.Errorf("EnsureHostInPool: VMSS Flex does not support Basic Load Balancer") } if vmSetNameOfLB != "" && needCheck && !strings.EqualFold(vmSetNameOfLB, vmssFlexName) { @@ -508,7 +509,7 @@ func (fs *FlexScaleSet) EnsureHostInPool(ctx context.Context, service *v1.Servic return "", "", "", nil, nil } - if fs.useStandardLoadBalancer() && len(newBackendPools) > 0 { + if fs.UseStandardLoadBalancer() && len(newBackendPools) > 0 { // Although standard load balancer supports backends from multiple availability // sets, the same network interface couldn't be added to more than one load balancer of // the same type. Omit those nodes (e.g. masters) so Azure ARM won't complain @@ -556,15 +557,15 @@ func (fs *FlexScaleSet) ensureVMSSFlexInPool(ctx context.Context, _ *v1.Service, klog.V(2).Infof("ensureVMSSFlexInPool: ensuring VMSS Flex with backendPoolID %s", backendPoolID) vmssFlexIDsMap := make(map[string]bool) - if !fs.useStandardLoadBalancer() { + if !fs.UseStandardLoadBalancer() { return fmt.Errorf("ensureVMSSFlexInPool: VMSS Flex does not support Basic Load Balancer") } // the single standard load balancer supports multiple vmss in its backend while // multiple standard load balancers doesn't - if fs.useStandardLoadBalancer() { + if fs.UseStandardLoadBalancer() { for _, node := range nodes { - if fs.excludeMasterNodesFromStandardLB() && isControlPlaneNode(node) { + if fs.ExcludeMasterNodesFromStandardLB() && isControlPlaneNode(node) { continue } @@ -649,7 +650,7 @@ func (fs *FlexScaleSet) ensureVMSSFlexInPool(ctx context.Context, _ *v1.Service, continue } - if fs.useStandardLoadBalancer() && len(loadBalancerBackendAddressPools) > 0 { + if fs.UseStandardLoadBalancer() && len(loadBalancerBackendAddressPools) > 0 { // Although standard load balancer supports backends from multiple scale // sets, the same network interface couldn't be added to more than one load balancer of // the same type. Omit those nodes (e.g. masters) so Azure ARM won't complain @@ -710,11 +711,16 @@ func (fs *FlexScaleSet) EnsureHostsInPool(ctx context.Context, service *v1.Servi defer func() { mc.ObserveOperationWithResult(isOperationSucceeded) }() - hostUpdates := make([]func() error, 0, len(nodes)) + err := fs.ensureVMSSFlexInPool(ctx, service, nodes, backendPoolID, vmSetNameOfLB) + if err != nil { + return err + } + + hostUpdates := make([]func() error, 0, len(nodes)) for _, node := range nodes { localNodeName := node.Name - if fs.useStandardLoadBalancer() && fs.excludeMasterNodesFromStandardLB() && isControlPlaneNode(node) { + if fs.UseStandardLoadBalancer() && fs.ExcludeMasterNodesFromStandardLB() && isControlPlaneNode(node) { klog.V(4).Infof("Excluding master node %q from load balancer backendpool %q", localNodeName, backendPoolID) continue } @@ -744,18 +750,13 @@ func (fs *FlexScaleSet) EnsureHostsInPool(ctx context.Context, service *v1.Servi return utilerrors.Flatten(errs) } - err := fs.ensureVMSSFlexInPool(ctx, service, nodes, backendPoolID, vmSetNameOfLB) - if err != nil { - return err - } - isOperationSucceeded = true return nil } func (fs *FlexScaleSet) ensureBackendPoolDeletedFromVmssFlex(ctx context.Context, backendPoolIDs []string, vmSetName string) error { vmssNamesMap := make(map[string]bool) - if fs.useStandardLoadBalancer() { + if fs.UseStandardLoadBalancer() { cached, err := fs.vmssFlexCache.Get(ctx, consts.VmssFlexKey, azcache.CacheReadTypeDefault) if err != nil { klog.Errorf("ensureBackendPoolDeletedFromVmssFlex: failed to get vmss flex from cache: %v", err) @@ -904,7 +905,7 @@ func (fs *FlexScaleSet) EnsureBackendPoolDeleted(ctx context.Context, service *v } // only vmsses in the resource group same as it's in azure config are included if strings.EqualFold(resourceGroupName, fs.ResourceGroup) { - if fs.useStandardLoadBalancer() { + if fs.UseStandardLoadBalancer() { vmssFlexVMNameMap[nodeName] = nicName } else { if strings.EqualFold(vmssFlexName, vmSetName) { diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_wrap.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_wrap.go index d599ddbd22..054fd24faf 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_wrap.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_wrap.go @@ -29,7 +29,6 @@ import ( var ( vmCacheTTLDefaultInSeconds = 60 loadBalancerCacheTTLDefaultInSeconds = 120 - routeTableCacheTTLDefaultInSeconds = 120 publicIPCacheTTLDefaultInSeconds = 120 azureNodeProviderIDRE = regexp.MustCompile(`^azure:///subscriptions/(?:.*)/resourceGroups/(?:.*)/providers/Microsoft.Compute/(?:.*)`) @@ -51,22 +50,6 @@ func checkResourceExistsFromError(err *retry.Error) (bool, *retry.Error) { return false, err } -func (az *Cloud) useStandardLoadBalancer() bool { - return strings.EqualFold(az.LoadBalancerSku, consts.LoadBalancerSkuStandard) -} - -func (az *Cloud) excludeMasterNodesFromStandardLB() bool { - return az.ExcludeMasterFromStandardLB != nil && *az.ExcludeMasterFromStandardLB -} - -func (az *Cloud) disableLoadBalancerOutboundSNAT() bool { - if !az.useStandardLoadBalancer() || az.DisableOutboundSNAT == nil { - return false - } - - return *az.DisableOutboundSNAT -} - // IsNodeUnmanaged returns true if the node is not managed by Azure cloud provider. // Those nodes includes on-prem or VMs from other clouds. They will not be added to load balancer // backends. Azure routes and managed disks are also not supported for them. diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_zones.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_zones.go index 8e05dd9443..b5f0306138 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_zones.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_zones.go @@ -73,7 +73,7 @@ func (az *Cloud) updateRegionZonesMap(zones map[string][]string) { } func (az *Cloud) getRegionZonesBackoff(ctx context.Context, region string) ([]string, error) { - if az.isStackCloud() { + if az.IsStackCloud() { // Azure Stack does not support zone at the moment // https://docs.microsoft.com/en-us/azure-stack/user/azure-stack-network-differences?view=azs-2102 klog.V(3).Infof("getRegionZonesMapWrapper: Azure Stack does not support Zones at the moment, skipping") diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/config/azure.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/config/azure.go new file mode 100644 index 0000000000..c643234da7 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/config/azure.go @@ -0,0 +1,216 @@ +/* +Copyright 2024 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package config + +import ( + "strings" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader" + "sigs.k8s.io/cloud-provider-azure/pkg/consts" +) + +// Config holds the configuration parsed from the --cloud-config flag +// All fields are required unless otherwise specified +// NOTE: Cloud config files should follow the same Kubernetes deprecation policy as +// flags or CLIs. Config fields should not change behavior in incompatible ways and +// should be deprecated for at least 2 release prior to removing. +// See https://kubernetes.io/docs/reference/using-api/deprecation-policy/#deprecating-a-flag-or-cli +// for more details. +type Config struct { + AzureClientConfig `json:",inline" yaml:",inline"` + + // The cloud configure type for Azure cloud provider. Supported values are file, secret and merge. + CloudConfigType configloader.CloudConfigType `json:"cloudConfigType,omitempty" yaml:"cloudConfigType,omitempty"` + + // The name of the resource group that the cluster is deployed in + ResourceGroup string `json:"resourceGroup,omitempty" yaml:"resourceGroup,omitempty"` + // The location of the resource group that the cluster is deployed in + Location string `json:"location,omitempty" yaml:"location,omitempty"` + // The name of site where the cluster will be deployed to that is more granular than the region specified by the "location" field. + // Currently only public ip, load balancer and managed disks support this. + ExtendedLocationName string `json:"extendedLocationName,omitempty" yaml:"extendedLocationName,omitempty"` + // The type of site that is being targeted. + // Currently only public ip, load balancer and managed disks support this. + ExtendedLocationType string `json:"extendedLocationType,omitempty" yaml:"extendedLocationType,omitempty"` + // The name of the VNet that the cluster is deployed in + VnetName string `json:"vnetName,omitempty" yaml:"vnetName,omitempty"` + // The name of the resource group that the Vnet is deployed in + VnetResourceGroup string `json:"vnetResourceGroup,omitempty" yaml:"vnetResourceGroup,omitempty"` + // The name of the subnet that the cluster is deployed in + SubnetName string `json:"subnetName,omitempty" yaml:"subnetName,omitempty"` + // The name of the security group attached to the cluster's subnet + SecurityGroupName string `json:"securityGroupName,omitempty" yaml:"securityGroupName,omitempty"` + // The name of the resource group that the security group is deployed in + SecurityGroupResourceGroup string `json:"securityGroupResourceGroup,omitempty" yaml:"securityGroupResourceGroup,omitempty"` + // (Optional in 1.6) The name of the route table attached to the subnet that the cluster is deployed in + RouteTableName string `json:"routeTableName,omitempty" yaml:"routeTableName,omitempty"` + // The name of the resource group that the RouteTable is deployed in + RouteTableResourceGroup string `json:"routeTableResourceGroup,omitempty" yaml:"routeTableResourceGroup,omitempty"` + // (Optional) The name of the availability set that should be used as the load balancer backend + // If this is set, the Azure cloudprovider will only add nodes from that availability set to the load + // balancer backend pool. If this is not set, and multiple agent pools (availability sets) are used, then + // the cloudprovider will try to add all nodes to a single backend pool which is forbidden. + // In other words, if you use multiple agent pools (availability sets), you MUST set this field. + PrimaryAvailabilitySetName string `json:"primaryAvailabilitySetName,omitempty" yaml:"primaryAvailabilitySetName,omitempty"` + // The type of azure nodes. Candidate values are: vmss, standard and vmssflex. + // If not set, it will be default to vmss. + VMType string `json:"vmType,omitempty" yaml:"vmType,omitempty"` + // The name of the scale set that should be used as the load balancer backend. + // If this is set, the Azure cloudprovider will only add nodes from that scale set to the load + // balancer backend pool. If this is not set, and multiple agent pools (scale sets) are used, then + // the cloudprovider will try to add all nodes to a single backend pool which is forbidden in the basic sku. + // In other words, if you use multiple agent pools (scale sets), and loadBalancerSku is set to basic, you MUST set this field. + PrimaryScaleSetName string `json:"primaryScaleSetName,omitempty" yaml:"primaryScaleSetName,omitempty"` + // Tags determines what tags shall be applied to the shared resources managed by controller manager, which + // includes load balancer, security group and route table. The supported format is `a=b,c=d,...`. After updated + // this config, the old tags would be replaced by the new ones. + // Because special characters are not supported in "tags" configuration, "tags" support would be removed in a future release, + // please consider migrating the config to "tagsMap". + Tags string `json:"tags,omitempty" yaml:"tags,omitempty"` + // TagsMap is similar to Tags but holds tags with special characters such as `=` and `,`. + TagsMap map[string]string `json:"tagsMap,omitempty" yaml:"tagsMap,omitempty"` + // SystemTags determines the tag keys managed by cloud provider. If it is not set, no tags would be deleted if + // the `Tags` is changed. However, the old tags would be deleted if they are neither included in `Tags` nor + // in `SystemTags` after the update of `Tags`. + SystemTags string `json:"systemTags,omitempty" yaml:"systemTags,omitempty"` + // Sku of Load Balancer and Public IP. Candidate values are: basic and standard. + // If not set, it will be default to basic. + LoadBalancerSku string `json:"loadBalancerSku,omitempty" yaml:"loadBalancerSku,omitempty"` + // LoadBalancerName determines the specific name of the load balancer user want to use, working with + // LoadBalancerResourceGroup + LoadBalancerName string `json:"loadBalancerName,omitempty" yaml:"loadBalancerName,omitempty"` + // LoadBalancerResourceGroup determines the specific resource group of the load balancer user want to use, working + // with LoadBalancerName + LoadBalancerResourceGroup string `json:"loadBalancerResourceGroup,omitempty" yaml:"loadBalancerResourceGroup,omitempty"` + // PreConfiguredBackendPoolLoadBalancerTypes determines whether the LoadBalancer BackendPool has been preconfigured. + // Candidate values are: + // "": exactly with today (not pre-configured for any LBs) + // "internal": for internal LoadBalancer + // "external": for external LoadBalancer + // "all": for both internal and external LoadBalancer + PreConfiguredBackendPoolLoadBalancerTypes string `json:"preConfiguredBackendPoolLoadBalancerTypes,omitempty" yaml:"preConfiguredBackendPoolLoadBalancerTypes,omitempty"` + + // DisableAvailabilitySetNodes disables VMAS nodes support when "VMType" is set to "vmss". + DisableAvailabilitySetNodes bool `json:"disableAvailabilitySetNodes,omitempty" yaml:"disableAvailabilitySetNodes,omitempty"` + // EnableVmssFlexNodes enables vmss flex nodes support when "VMType" is set to "vmss". + EnableVmssFlexNodes bool `json:"enableVmssFlexNodes,omitempty" yaml:"enableVmssFlexNodes,omitempty"` + // DisableAzureStackCloud disables AzureStackCloud support. It should be used + // when setting AzureAuthConfig.Cloud with "AZURESTACKCLOUD" to customize ARM endpoints + // while the cluster is not running on AzureStack. + DisableAzureStackCloud bool `json:"disableAzureStackCloud,omitempty" yaml:"disableAzureStackCloud,omitempty"` + // Use instance metadata service where possible + UseInstanceMetadata bool `json:"useInstanceMetadata,omitempty" yaml:"useInstanceMetadata,omitempty"` + + // Backoff exponent + CloudProviderBackoffExponent float64 `json:"cloudProviderBackoffExponent,omitempty" yaml:"cloudProviderBackoffExponent,omitempty"` + // Backoff jitter + CloudProviderBackoffJitter float64 `json:"cloudProviderBackoffJitter,omitempty" yaml:"cloudProviderBackoffJitter,omitempty"` + + // ExcludeMasterFromStandardLB excludes master nodes from standard load balancer. + // If not set, it will be default to true. + ExcludeMasterFromStandardLB *bool `json:"excludeMasterFromStandardLB,omitempty" yaml:"excludeMasterFromStandardLB,omitempty"` + // DisableOutboundSNAT disables the outbound SNAT for public load balancer rules. + // It should only be set when loadBalancerSku is standard. If not set, it will be default to false. + DisableOutboundSNAT *bool `json:"disableOutboundSNAT,omitempty" yaml:"disableOutboundSNAT,omitempty"` + + // Maximum allowed LoadBalancer Rule Count is the limit enforced by Azure Load balancer + MaximumLoadBalancerRuleCount int `json:"maximumLoadBalancerRuleCount,omitempty" yaml:"maximumLoadBalancerRuleCount,omitempty"` + + // LoadBalancerBackendPoolConfigurationType defines how vms join the load balancer backend pools. Supported values + // are `nodeIPConfiguration`, `nodeIP` and `podIP`. + // `nodeIPConfiguration`: vm network interfaces will be attached to the inbound backend pool of the load balancer (default); + // `nodeIP`: vm private IPs will be attached to the inbound backend pool of the load balancer; + // `podIP`: pod IPs will be attached to the inbound backend pool of the load balancer (not supported yet). + LoadBalancerBackendPoolConfigurationType string `json:"loadBalancerBackendPoolConfigurationType,omitempty" yaml:"loadBalancerBackendPoolConfigurationType,omitempty"` + // PutVMSSVMBatchSize defines how many requests the client send concurrently when putting the VMSS VMs. + // If it is smaller than or equal to zero, the request will be sent one by one in sequence (default). + PutVMSSVMBatchSize int `json:"putVMSSVMBatchSize" yaml:"putVMSSVMBatchSize"` + // PrivateLinkServiceResourceGroup determines the specific resource group of the private link services user want to use + PrivateLinkServiceResourceGroup string `json:"privateLinkServiceResourceGroup,omitempty" yaml:"privateLinkServiceResourceGroup,omitempty"` + + // EnableMigrateToIPBasedBackendPoolAPI uses the migration API to migrate from NIC-based to IP-based backend pool. + // The migration API can provide a migration from NIC-based to IP-based backend pool without service downtime. + // If the API is not used, the migration will be done by decoupling all nodes on the backend pool and then re-attaching + // node IPs, which will introduce service downtime. The downtime increases with the number of nodes in the backend pool. + EnableMigrateToIPBasedBackendPoolAPI bool `json:"enableMigrateToIPBasedBackendPoolAPI" yaml:"enableMigrateToIPBasedBackendPoolAPI"` + + // MultipleStandardLoadBalancerConfigurations stores the properties regarding multiple standard load balancers. + // It will be ignored if LoadBalancerBackendPoolConfigurationType is nodeIPConfiguration. + // If the length is not 0, it is assumed the multiple standard load balancers mode is on. In this case, + // there must be one configuration named "" or an error will be reported. + MultipleStandardLoadBalancerConfigurations []MultipleStandardLoadBalancerConfiguration `json:"multipleStandardLoadBalancerConfigurations,omitempty" yaml:"multipleStandardLoadBalancerConfigurations,omitempty"` + + // RouteUpdateIntervalInSeconds is the interval for updating routes. Default is 30 seconds. + RouteUpdateIntervalInSeconds int `json:"routeUpdateIntervalInSeconds,omitempty" yaml:"routeUpdateIntervalInSeconds,omitempty"` + // LoadBalancerBackendPoolUpdateIntervalInSeconds is the interval for updating load balancer backend pool of local services. Default is 30 seconds. + LoadBalancerBackendPoolUpdateIntervalInSeconds int `json:"loadBalancerBackendPoolUpdateIntervalInSeconds,omitempty" yaml:"loadBalancerBackendPoolUpdateIntervalInSeconds,omitempty"` + + // ClusterServiceLoadBalancerHealthProbeMode determines the health probe mode for cluster service load balancer. + // Supported values are `shared` and `servicenodeport`. + // `servicenodeport`: the health probe will be created against each port of each service by watching the backend application (default). + // `shared`: all cluster services shares one HTTP probe targeting the kube-proxy on the node (/healthz:10256). + ClusterServiceLoadBalancerHealthProbeMode string `json:"clusterServiceLoadBalancerHealthProbeMode,omitempty" yaml:"clusterServiceLoadBalancerHealthProbeMode,omitempty"` + // ClusterServiceSharedLoadBalancerHealthProbePort defines the target port of the shared health probe. Default to 10256. + ClusterServiceSharedLoadBalancerHealthProbePort int32 `json:"clusterServiceSharedLoadBalancerHealthProbePort,omitempty" yaml:"clusterServiceSharedLoadBalancerHealthProbePort,omitempty"` + // ClusterServiceSharedLoadBalancerHealthProbePath defines the target path of the shared health probe. Default to `/healthz`. + ClusterServiceSharedLoadBalancerHealthProbePath string `json:"clusterServiceSharedLoadBalancerHealthProbePath,omitempty" yaml:"clusterServiceSharedLoadBalancerHealthProbePath,omitempty"` +} + +// HasExtendedLocation returns true if extendedlocation prop are specified. +func (az *Config) HasExtendedLocation() bool { + return az.ExtendedLocationName != "" && az.ExtendedLocationType != "" +} + +func (az *Config) IsLBBackendPoolTypeNodeIPConfig() bool { + return strings.EqualFold(az.LoadBalancerBackendPoolConfigurationType, consts.LoadBalancerBackendPoolConfigurationTypeNodeIPConfiguration) +} + +func (az *Config) IsLBBackendPoolTypeNodeIP() bool { + return strings.EqualFold(az.LoadBalancerBackendPoolConfigurationType, consts.LoadBalancerBackendPoolConfigurationTypeNodeIP) +} + +func (az *Config) GetPutVMSSVMBatchSize() int { + return az.PutVMSSVMBatchSize +} + +func (az *Config) UseStandardLoadBalancer() bool { + return strings.EqualFold(az.LoadBalancerSku, consts.LoadBalancerSkuStandard) +} + +func (az *Config) ExcludeMasterNodesFromStandardLB() bool { + return az.ExcludeMasterFromStandardLB != nil && *az.ExcludeMasterFromStandardLB +} + +func (az *Config) DisableLoadBalancerOutboundSNAT() bool { + if !az.UseStandardLoadBalancer() || az.DisableOutboundSNAT == nil { + return false + } + + return *az.DisableOutboundSNAT +} + +func (az *Config) UseMultipleStandardLoadBalancers() bool { + return az.UseStandardLoadBalancer() && len(az.MultipleStandardLoadBalancerConfigurations) > 0 +} + +func (az *Config) UseSingleStandardLoadBalancer() bool { + return az.UseStandardLoadBalancer() && len(az.MultipleStandardLoadBalancerConfigurations) == 0 +} + +func (az *Config) IsStackCloud() bool { + return strings.EqualFold(az.Cloud, consts.AzureStackCloudName) && !az.DisableAzureStackCloud +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/config/azure_auth.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/config/azure_auth.go index 84858ba975..8ad090e0cb 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/config/azure_auth.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/config/azure_auth.go @@ -47,10 +47,16 @@ const ( maxReadLength = 10 * 1 << 20 // 10MB ) -// AzureAuthConfig holds auth related part of cloud config -type AzureAuthConfig struct { - azclient.ARMClientConfig `json:",inline" yaml:",inline"` - azclient.AzureAuthConfig `json:",inline" yaml:",inline"` +// AzureClientConfig holds azure client related part of cloud config +type AzureClientConfig struct { + azclient.ARMClientConfig `json:",inline" yaml:",inline"` + azclient.AzureAuthConfig `json:",inline" yaml:",inline"` + CloudProviderRateLimitConfig `json:",inline" yaml:",inline"` + CloudProviderCacheConfig `json:",inline" yaml:",inline"` + // Backoff retry limit + CloudProviderBackoffRetries int `json:"cloudProviderBackoffRetries,omitempty" yaml:"cloudProviderBackoffRetries,omitempty"` + // Backoff duration + CloudProviderBackoffDuration int `json:"cloudProviderBackoffDuration,omitempty" yaml:"cloudProviderBackoffDuration,omitempty"` // The ID of the Azure Subscription that the cluster is deployed in SubscriptionID string `json:"subscriptionId,omitempty" yaml:"subscriptionId,omitempty"` @@ -70,7 +76,7 @@ type AzureAuthConfig struct { // If NetworkResourceTenantID and NetworkResourceSubscriptionID are specified to have different values than TenantID and SubscriptionID, network resources are deployed in different AAD Tenant and Subscription than those for the cluster, // than only azure clients except VM/VMSS and network resource ones use this method to fetch Token. // For tokens for VM/VMSS and network resource ones, please check GetMultiTenantServicePrincipalToken and GetNetworkResourceServicePrincipalToken. -func GetServicePrincipalToken(config *AzureAuthConfig, env *azure.Environment, resource string) (*adal.ServicePrincipalToken, error) { +func GetServicePrincipalToken(config *AzureClientConfig, env *azure.Environment, resource string) (*adal.ServicePrincipalToken, error) { logger := klog.Background().WithName("GetServicePrincipalToken") var tenantID string if strings.EqualFold(config.IdentitySystem, consts.ADFSIdentitySystem) { @@ -179,7 +185,7 @@ func GetServicePrincipalToken(config *AzureAuthConfig, env *azure.Environment, r // PrimaryToken of the returned multi-tenant token is for the AAD Tenant specified by TenantID, and AuxiliaryToken of the returned multi-tenant token is for the AAD Tenant specified by NetworkResourceTenantID. // // Azure VM/VMSS clients use this multi-tenant token, in order to operate those VM/VMSS in AAD Tenant specified by TenantID, and meanwhile in their payload they are referencing network resources (e.g. Load Balancer, Network Security Group, etc.) in AAD Tenant specified by NetworkResourceTenantID. -func GetMultiTenantServicePrincipalToken(config *AzureAuthConfig, env *azure.Environment, authProvider *azclient.AuthProvider) (adal.MultitenantOAuthTokenProvider, error) { +func GetMultiTenantServicePrincipalToken(config *AzureClientConfig, env *azure.Environment, authProvider *azclient.AuthProvider) (adal.MultitenantOAuthTokenProvider, error) { logger := klog.Background().WithName("GetMultiTenantServicePrincipalToken") err := config.ValidateForMultiTenant() @@ -241,7 +247,7 @@ func GetMultiTenantServicePrincipalToken(config *AzureAuthConfig, env *azure.Env // and this method creates a new service principal token for network resources tenant based on the configuration. // // Azure network resource (Load Balancer, Public IP, Route Table, Network Security Group and their sub level resources) clients use this multi-tenant token, in order to operate resources in AAD Tenant specified by NetworkResourceTenantID. -func GetNetworkResourceServicePrincipalToken(config *AzureAuthConfig, env *azure.Environment, authProvider *azclient.AuthProvider) (adal.OAuthTokenProvider, error) { +func GetNetworkResourceServicePrincipalToken(config *AzureClientConfig, env *azure.Environment, authProvider *azclient.AuthProvider) (adal.OAuthTokenProvider, error) { logger := klog.Background().WithName("GetNetworkResourceServicePrincipalToken") err := config.ValidateForMultiTenant() @@ -320,8 +326,8 @@ func ParseAzureEnvironment(cloudName, resourceManagerEndpoint, identitySystem st } // ParseAzureAuthConfig returns a parsed configuration for an Azure cloudprovider config file -func ParseAzureAuthConfig(configReader io.Reader) (*AzureAuthConfig, *azure.Environment, error) { - var config AzureAuthConfig +func ParseAzureAuthConfig(configReader io.Reader) (*AzureClientConfig, *azure.Environment, error) { + var config AzureClientConfig if configReader == nil { return nil, nil, errors.New("nil config is provided") @@ -351,14 +357,14 @@ func ParseAzureAuthConfig(configReader io.Reader) (*AzureAuthConfig, *azure.Envi // UsesNetworkResourceInDifferentTenant determines whether the AzureAuthConfig indicates to use network resources in // different AAD Tenant than those for the cluster. Return true when NetworkResourceTenantID is specified and not equal // to one defined in global configs -func (config *AzureAuthConfig) UsesNetworkResourceInDifferentTenant() bool { +func (config *AzureClientConfig) UsesNetworkResourceInDifferentTenant() bool { return len(config.NetworkResourceTenantID) > 0 && !strings.EqualFold(config.NetworkResourceTenantID, config.TenantID) } // UsesNetworkResourceInDifferentSubscription determines whether the AzureAuthConfig indicates to use network resources // in different Subscription than those for the cluster. Return true when NetworkResourceSubscriptionID is specified // and not equal to one defined in global configs -func (config *AzureAuthConfig) UsesNetworkResourceInDifferentSubscription() bool { +func (config *AzureClientConfig) UsesNetworkResourceInDifferentSubscription() bool { return len(config.NetworkResourceSubscriptionID) > 0 && !strings.EqualFold(config.NetworkResourceSubscriptionID, config.SubscriptionID) } @@ -375,7 +381,7 @@ func azureStackOverrides(env *azure.Environment, resourceManagerEndpoint, identi } // ValidateForMultiTenant checks configuration for the scenario of using network resource in different tenant -func (config *AzureAuthConfig) ValidateForMultiTenant() error { +func (config *AzureClientConfig) ValidateForMultiTenant() error { if !config.UsesNetworkResourceInDifferentTenant() { return fmt.Errorf("NetworkResourceTenantID must be configured") } diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/config/azure_cache.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/config/azure_cache.go new file mode 100644 index 0000000000..68d150d093 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/config/azure_cache.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package config + +type CloudProviderCacheConfig struct { + // DisableAPICallCache disables the cache for Azure API calls. It is for ARG support and not all resources will be disabled. + DisableAPICallCache bool `json:"disableAPICallCache,omitempty" yaml:"disableAPICallCache,omitempty"` + // NonVmssUniformNodesCacheTTLInSeconds sets the Cache TTL for NonVmssUniformNodesCacheTTLInSeconds + // if not set, will use default value + NonVmssUniformNodesCacheTTLInSeconds int `json:"nonVmssUniformNodesCacheTTLInSeconds,omitempty" yaml:"nonVmssUniformNodesCacheTTLInSeconds,omitempty"` + // VmssCacheTTLInSeconds sets the cache TTL for VMSS + VmssCacheTTLInSeconds int `json:"vmssCacheTTLInSeconds,omitempty" yaml:"vmssCacheTTLInSeconds,omitempty"` + // VmssVirtualMachinesCacheTTLInSeconds sets the cache TTL for vmssVirtualMachines + VmssVirtualMachinesCacheTTLInSeconds int `json:"vmssVirtualMachinesCacheTTLInSeconds,omitempty" yaml:"vmssVirtualMachinesCacheTTLInSeconds,omitempty"` + + // VmssFlexCacheTTLInSeconds sets the cache TTL for VMSS Flex + VmssFlexCacheTTLInSeconds int `json:"vmssFlexCacheTTLInSeconds,omitempty" yaml:"vmssFlexCacheTTLInSeconds,omitempty"` + // VmssFlexVMCacheTTLInSeconds sets the cache TTL for vmss flex vms + VmssFlexVMCacheTTLInSeconds int `json:"vmssFlexVMCacheTTLInSeconds,omitempty" yaml:"vmssFlexVMCacheTTLInSeconds,omitempty"` + + // VmCacheTTLInSeconds sets the cache TTL for vm + VMCacheTTLInSeconds int `json:"vmCacheTTLInSeconds,omitempty" yaml:"vmCacheTTLInSeconds,omitempty"` + // LoadBalancerCacheTTLInSeconds sets the cache TTL for load balancer + LoadBalancerCacheTTLInSeconds int `json:"loadBalancerCacheTTLInSeconds,omitempty" yaml:"loadBalancerCacheTTLInSeconds,omitempty"` + // NsgCacheTTLInSeconds sets the cache TTL for network security group + NsgCacheTTLInSeconds int `json:"nsgCacheTTLInSeconds,omitempty" yaml:"nsgCacheTTLInSeconds,omitempty"` + // RouteTableCacheTTLInSeconds sets the cache TTL for route table + RouteTableCacheTTLInSeconds int `json:"routeTableCacheTTLInSeconds,omitempty" yaml:"routeTableCacheTTLInSeconds,omitempty"` + // PlsCacheTTLInSeconds sets the cache TTL for private link service resource + PlsCacheTTLInSeconds int `json:"plsCacheTTLInSeconds,omitempty" yaml:"plsCacheTTLInSeconds,omitempty"` + // AvailabilitySetsCacheTTLInSeconds sets the cache TTL for VMAS + AvailabilitySetsCacheTTLInSeconds int `json:"availabilitySetsCacheTTLInSeconds,omitempty" yaml:"availabilitySetsCacheTTLInSeconds,omitempty"` + // PublicIPCacheTTLInSeconds sets the cache TTL for public ip + PublicIPCacheTTLInSeconds int `json:"publicIPCacheTTLInSeconds,omitempty" yaml:"publicIPCacheTTLInSeconds,omitempty"` + // RouteUpdateWaitingInSeconds is the delay time for waiting route updates to take effect. This waiting delay is added + // because the routes are not taken effect when the async route updating operation returns success. Default is 30 seconds. + RouteUpdateWaitingInSeconds int `json:"routeUpdateWaitingInSeconds,omitempty" yaml:"routeUpdateWaitingInSeconds,omitempty"` +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/config/env.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/config/env.go new file mode 100644 index 0000000000..e57f3d6f2d --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/config/env.go @@ -0,0 +1,60 @@ +/* +Copyright 2024 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package config + +import ( + "io" + "os" + "strings" + + "sigs.k8s.io/yaml" +) + +// ParseConfig returns a parsed configuration for an Azure cloudprovider config file +func ParseConfig(configReader io.Reader) (*Config, error) { + var config Config + if configReader == nil { + return nil, nil + } + + configContents, err := io.ReadAll(configReader) + if err != nil { + return nil, err + } + + err = yaml.Unmarshal(configContents, &config) + if err != nil { + return nil, err + } + + // The resource group name may be in different cases from different Azure APIs, hence it is converted to lower here. + // See more context at https://github.com/kubernetes/kubernetes/issues/71994. + config.ResourceGroup = strings.ToLower(config.ResourceGroup) + + // these environment variables are injected by workload identity webhook + if tenantID := os.Getenv("AZURE_TENANT_ID"); tenantID != "" { + config.TenantID = tenantID + } + if clientID := os.Getenv("AZURE_CLIENT_ID"); clientID != "" { + config.AADClientID = clientID + } + if federatedTokenFile := os.Getenv("AZURE_FEDERATED_TOKEN_FILE"); federatedTokenFile != "" { + config.AADFederatedTokenFile = federatedTokenFile + config.UseFederatedWorkloadIdentityExtension = true + } + return &config, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/config/multi_slb.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/config/multi_slb.go new file mode 100644 index 0000000000..079d4afb15 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/config/multi_slb.go @@ -0,0 +1,73 @@ +/* +Copyright 2024 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package config + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + utilsets "sigs.k8s.io/cloud-provider-azure/pkg/util/sets" +) + +// MultipleStandardLoadBalancerConfiguration stores the properties regarding multiple standard load balancers. +type MultipleStandardLoadBalancerConfiguration struct { + // Name of the public load balancer. There will be an internal load balancer + // created if needed, and the name will be `-internal`. The internal lb + // shares the same configurations as the external one. The internal lbs + // are not needed to be included in `MultipleStandardLoadBalancerConfigurations`. + // There must be a name of "" in the load balancer configuration list. + Name string `json:"name" yaml:"name"` + + MultipleStandardLoadBalancerConfigurationSpec + + MultipleStandardLoadBalancerConfigurationStatus +} + +// MultipleStandardLoadBalancerConfigurationSpec stores the properties regarding multiple standard load balancers. +type MultipleStandardLoadBalancerConfigurationSpec struct { + // This load balancer can have services placed on it. Defaults to true, + // can be set to false to drain and eventually remove a load balancer. + // This only affects services that will be using the LB. For services + // that is currently using the LB, they will not be affected. + AllowServicePlacement *bool `json:"allowServicePlacement" yaml:"allowServicePlacement"` + + // A string value that must specify the name of an existing vmSet. + // All nodes in the given vmSet will always be added to this load balancer. + // A vmSet can only be the primary vmSet for a single load balancer. + PrimaryVMSet string `json:"primaryVMSet" yaml:"primaryVMSet"` + + // Services that must match this selector can be placed on this load balancer. If not supplied, + // services with any labels can be created on the load balancer. + ServiceLabelSelector *metav1.LabelSelector `json:"serviceLabelSelector" yaml:"serviceLabelSelector"` + + // Services created in namespaces with the supplied label will be allowed to select that load balancer. + // If not supplied, services created in any namespaces can be created on that load balancer. + ServiceNamespaceSelector *metav1.LabelSelector `json:"serviceNamespaceSelector" yaml:"serviceNamespaceSelector"` + + // Nodes matching this selector will be preferentially added to the load balancers that + // they match selectors for. NodeSelector does not override primaryAgentPool for node allocation. + NodeSelector *metav1.LabelSelector `json:"nodeSelector" yaml:"nodeSelector"` +} + +// MultipleStandardLoadBalancerConfigurationStatus stores the properties regarding multiple standard load balancers. +type MultipleStandardLoadBalancerConfigurationStatus struct { + // ActiveServices stores the services that are supposed to use the load balancer. + ActiveServices *utilsets.IgnoreCaseSet `json:"activeServices" yaml:"activeServices"` + + // ActiveNodes stores the nodes that are supposed to be in the load balancer. + // It will be used in EnsureHostsInPool to make sure the given ones are in the backend pool. + ActiveNodes *utilsets.IgnoreCaseSet `json:"activeNodes" yaml:"activeNodes"` +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/routetable/cache.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/routetable/cache.go new file mode 100644 index 0000000000..96927a51c6 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/routetable/cache.go @@ -0,0 +1,55 @@ +/* +Copyright 2024 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package routetable + +import ( + "context" + "time" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/routetableclient" + "sigs.k8s.io/cloud-provider-azure/pkg/cache" + "sigs.k8s.io/cloud-provider-azure/pkg/util/errutils" +) + +const ( + DefaultCacheTTL = 120 * time.Second +) + +func NewCache( + client routetableclient.Interface, + resourceGroup string, + cacheTTL time.Duration, + disableAPICallCache bool, +) (cache.Resource, error) { + getter := func(ctx context.Context, key string) (interface{}, error) { + rt, err := client.Get(ctx, resourceGroup, key) + found, err := errutils.CheckResourceExistsFromAzcoreError(err) + if err != nil { + return nil, err + } + if !found { + return nil, nil + } + + return rt, nil + } + + if cacheTTL == 0 { + cacheTTL = DefaultCacheTTL + } + return cache.NewTimedCache(cacheTTL, getter, disableAPICallCache) +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/routetable/mock_repo.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/routetable/mock_repo.go new file mode 100644 index 0000000000..76988b62cd --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/routetable/mock_repo.go @@ -0,0 +1,88 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// */ +// + +// Code generated by MockGen. DO NOT EDIT. +// Source: repo.go +// +// Generated by this command: +// +// mockgen -destination=./mock_repo.go -package=routetable -copyright_file ../../../hack/boilerplate/boilerplate.generatego.txt -source=repo.go Repository +// +// Package routetable is a generated GoMock package. +package routetable + +import ( + context "context" + reflect "reflect" + + armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" + gomock "go.uber.org/mock/gomock" + cache "sigs.k8s.io/cloud-provider-azure/pkg/cache" +) + +// MockRepository is a mock of Repository interface. +type MockRepository struct { + ctrl *gomock.Controller + recorder *MockRepositoryMockRecorder +} + +// MockRepositoryMockRecorder is the mock recorder for MockRepository. +type MockRepositoryMockRecorder struct { + mock *MockRepository +} + +// NewMockRepository creates a new mock instance. +func NewMockRepository(ctrl *gomock.Controller) *MockRepository { + mock := &MockRepository{ctrl: ctrl} + mock.recorder = &MockRepositoryMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockRepository) EXPECT() *MockRepositoryMockRecorder { + return m.recorder +} + +// CreateOrUpdate mocks base method. +func (m *MockRepository) CreateOrUpdate(ctx context.Context, routeTable armnetwork.RouteTable) (*armnetwork.RouteTable, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateOrUpdate", ctx, routeTable) + ret0, _ := ret[0].(*armnetwork.RouteTable) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateOrUpdate indicates an expected call of CreateOrUpdate. +func (mr *MockRepositoryMockRecorder) CreateOrUpdate(ctx, routeTable any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdate", reflect.TypeOf((*MockRepository)(nil).CreateOrUpdate), ctx, routeTable) +} + +// Get mocks base method. +func (m *MockRepository) Get(ctx context.Context, routeTableName string, crt cache.AzureCacheReadType) (*armnetwork.RouteTable, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", ctx, routeTableName, crt) + ret0, _ := ret[0].(*armnetwork.RouteTable) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockRepositoryMockRecorder) Get(ctx, routeTableName, crt any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockRepository)(nil).Get), ctx, routeTableName, crt) +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/routetable/repo.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/routetable/repo.go new file mode 100644 index 0000000000..fb5400df1b --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/routetable/repo.go @@ -0,0 +1,87 @@ +/* +Copyright 2024 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package routetable + +import ( + "context" + "fmt" + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/routetableclient" + "sigs.k8s.io/cloud-provider-azure/pkg/cache" +) + +// Generate mocks for the repository interface +//go:generate mockgen -destination=./mock_repo.go -package=routetable -copyright_file ../../../hack/boilerplate/boilerplate.generatego.txt -source=repo.go Repository + +var ( + ErrMissingRouteTableName = fmt.Errorf("missing RouteTable name") +) + +type Repository interface { + Get(ctx context.Context, routeTableName string, crt cache.AzureCacheReadType) (*armnetwork.RouteTable, error) + CreateOrUpdate(ctx context.Context, routeTable armnetwork.RouteTable) (*armnetwork.RouteTable, error) +} + +type repo struct { + resourceGroup string + client routetableclient.Interface + cache cache.Resource +} + +func NewRepo( + client routetableclient.Interface, + resourceGroup string, + cacheTTL time.Duration, + disableAPICallCache bool, +) (Repository, error) { + c, err := NewCache(client, resourceGroup, cacheTTL, disableAPICallCache) + if err != nil { + return nil, fmt.Errorf("new RouteTable cache: %w", err) + } + + return &repo{ + resourceGroup: resourceGroup, + client: client, + cache: c, + }, nil +} + +func (r *repo) Get(ctx context.Context, routeTableName string, crt cache.AzureCacheReadType) (*armnetwork.RouteTable, error) { + rt, err := r.cache.GetWithDeepCopy(ctx, routeTableName, crt) + if err != nil { + return nil, fmt.Errorf("get RouteTable: %w", err) + } + + return rt.(*armnetwork.RouteTable), nil +} + +func (r *repo) CreateOrUpdate(ctx context.Context, routeTable armnetwork.RouteTable) (*armnetwork.RouteTable, error) { + if routeTable.Name == nil { + return nil, ErrMissingRouteTableName + } + + rv, err := r.client.CreateOrUpdate(ctx, r.resourceGroup, *routeTable.Name, routeTable) + if err != nil { + return nil, fmt.Errorf("create or update RouteTable: %w", err) + } + _ = r.cache.Delete(*routeTable.Name) + + return rv, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/util/collectionutil/map.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/util/collectionutil/map.go index 0d55042f58..d214844920 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/util/collectionutil/map.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/util/collectionutil/map.go @@ -16,6 +16,14 @@ limitations under the License. package fnutil +func Keys[K comparable, V any](m map[K]V) []K { + rv := make([]K, 0, len(m)) + for k := range m { + rv = append(rv, k) + } + return rv +} + func Values[K comparable, V any](m map[K]V) []V { rv := make([]V, 0, len(m)) for _, v := range m { diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/util/iputil/bits.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/util/iputil/bits.go new file mode 100644 index 0000000000..dbad47343d --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/util/iputil/bits.go @@ -0,0 +1,37 @@ +/* +Copyright 2024 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package iputil + +// setBitAt sets the bit at the i-th position in the byte slice to the given value. +// Panics if the index is out of bounds. +// For example, +// - setBitAt([0x00, 0x00], 8, 1) returns [0x00, 0b1000_0000]. +// - setBitAt([0xff, 0xff], 0, 0) returns [0b0111_1111, 0xff]. +func setBitAt(bytes []byte, i int, bit uint8) { + if bit == 1 { + bytes[i/8] |= 1 << (7 - i%8) + } else { + bytes[i/8] &^= 1 << (7 - i%8) + } +} + +// bitAt returns the bit at the i-th position in the byte slice. +// The return value is either 0 or 1 as uint8. +// Panics if the index is out of bounds. +func bitAt(bytes []byte, i int) uint8 { + return bytes[i/8] >> (7 - i%8) & 1 +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/util/iputil/prefix.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/util/iputil/prefix.go index 77395c37a8..2c4a8e0298 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/util/iputil/prefix.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/util/iputil/prefix.go @@ -17,8 +17,10 @@ limitations under the License. package iputil import ( + "bytes" "fmt" "net/netip" + "sort" ) // IsPrefixesAllowAll returns true if one of the prefixes allows all addresses. @@ -61,9 +63,108 @@ func GroupPrefixesByFamily(vs []netip.Prefix) ([]netip.Prefix, []netip.Prefix) { return v4, v6 } -// AggregatePrefixes aggregates prefixes. -// Overlapping prefixes are merged. +// ContainsPrefix checks if prefix p fully contains prefix o. +// It returns true if o is a subset of p, meaning all addresses in o are also in p. +// This is true when p overlaps with o and p has fewer or equal number of bits than o. +func ContainsPrefix(p netip.Prefix, o netip.Prefix) bool { + return p.Bits() <= o.Bits() && p.Overlaps(o) +} + +// mergeAdjacentPrefixes attempts to merge two adjacent prefixes into a single prefix. +// It returns the merged prefix and a boolean indicating success. +// Note: This function only merges adjacent prefixes, not overlapping ones. +func mergeAdjacentPrefixes(p1, p2 netip.Prefix) (netip.Prefix, bool) { + // Merge neighboring prefixes if possible + if p1.Bits() != p2.Bits() || p1.Bits() == 0 { + return netip.Prefix{}, false + } + + var ( + bits = p1.Bits() + p1Bytes = p1.Addr().AsSlice() + p2Bytes = p2.Addr().AsSlice() + ) + if bitAt(p1Bytes, bits-1) == 0 { + setBitAt(p1Bytes, bits-1, 1) + } else { + setBitAt(p2Bytes, bits-1, 1) + } + if !bytes.Equal(p1Bytes, p2Bytes) { + return netip.Prefix{}, false + } + + rv, _ := p1.Addr().Prefix(bits - 1) + return rv, true +} + +// aggregatePrefixesForSingleIPFamily merges overlapping or adjacent prefixes into a single prefix. +// The input prefixes must be the same IP family (IPv4 or IPv6). +// For example, +// - [192.168.0.0/32, 192.168.0.1/32] -> [192.168.0.0/31] (adjacent) +// - [192.168.0.0/24, 192.168.0.1/32] -> [192.168.1.0/24] (overlapping) +func aggregatePrefixesForSingleIPFamily(prefixes []netip.Prefix) []netip.Prefix { + if len(prefixes) <= 1 { + return prefixes + } + + sort.Slice(prefixes, func(i, j int) bool { + addrCmp := prefixes[i].Addr().Compare(prefixes[j].Addr()) + if addrCmp == 0 { + return prefixes[i].Bits() < prefixes[j].Bits() + } + return addrCmp < 0 + }) + + var rv = []netip.Prefix{prefixes[0]} + + for i := 1; i < len(prefixes); i++ { + last, p := rv[len(rv)-1], prefixes[i] + if ContainsPrefix(last, p) { + // Skip overlapping prefixes + continue + } + rv = append(rv, p) + + // Merge adjacent prefixes if possible + for len(rv) >= 2 { + // Merge the last two prefixes if they are adjacent + p, ok := mergeAdjacentPrefixes(rv[len(rv)-2], rv[len(rv)-1]) + if !ok { + break + } + + // Replace the last two prefixes with the merged prefix + rv = rv[:len(rv)-2] + rv = append(rv, p) + } + } + return rv +} + +// AggregatePrefixes merges overlapping or adjacent prefixes into a single prefix. +// It combines prefixes that can be represented by a larger, more inclusive prefix. +// +// Examples: +// - Adjacent: [192.168.0.0/32, 192.168.0.1/32] -> [192.168.0.0/31] +// - Overlapping: [192.168.0.0/24, 192.168.0.1/32] -> [192.168.0.0/24] func AggregatePrefixes(prefixes []netip.Prefix) []netip.Prefix { + var ( + v4, v6 = GroupPrefixesByFamily(prefixes) + ) + + return append(aggregatePrefixesForSingleIPFamily(v4), aggregatePrefixesForSingleIPFamily(v6)...) +} + +// AggregatePrefixesWithPrefixTree merges overlapping or adjacent prefixes into a single prefix. +// +// This function uses a prefix tree to aggregate the input prefixes. While it achieves +// the same result as AggregatePrefixes, it is less efficient. For better performance, +// use AggregatePrefixes instead. +// +// Examples: +// - Adjacent: [192.168.0.0/32, 192.168.0.1/32] -> [192.168.0.0/31] +// - Overlapping: [192.168.0.0/24, 192.168.0.1/32] -> [192.168.0.0/24] +func AggregatePrefixesWithPrefixTree(prefixes []netip.Prefix) []netip.Prefix { var ( v4, v6 = GroupPrefixesByFamily(prefixes) v4Tree = newPrefixTreeForIPv4() diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/util/iputil/prefix_tree.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/util/iputil/prefix_tree.go index 2399c09ebd..a7515b42fe 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/util/iputil/prefix_tree.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/util/iputil/prefix_tree.go @@ -29,10 +29,26 @@ type prefixTreeNode struct { r *prefixTreeNode // right child node } -// pruneToRoot prunes the tree to the root. -// If a node's left and right children are both masked, -// it is masked and its children are pruned. -// This is done recursively up to the root. +// pruneToRoot checks if the current node and its sibling are masked, +// and if so, marks their parent as masked and removes both children. +// This process is repeated up the tree until a node with an unmasked sibling is found. +// +// The process can be visualized as follows: +// +// Before: After: +// P P (masked) +// / \ / \ +// A B -> X X +// (M) (M) +// +// Where: +// +// P: Parent node +// A, B: Child nodes +// M: Masked +// X: Removed +// +// This method helps to optimize the tree structure by condensing fully masked subtrees. func (n *prefixTreeNode) pruneToRoot() { var node = n for node.p != nil { @@ -49,6 +65,31 @@ func (n *prefixTreeNode) pruneToRoot() { } } +// prefixTree represents a tree structure for storing and managing IP prefixes. +// It efficiently handles prefix aggregation, merging of overlapping prefixes, +// and collapsing of neighboring prefixes. +// +// The tree is structured as follows: +// - Each node represents a bit in the IP address +// - Left child represents a 0 bit, right child represents a 1 bit +// - Masked nodes indicate the end of a prefix +// - Unused branches are represented by nil pointers +// +// Example tree for 128.0.0.0/4 (binary 1000 0000): +// +// 0 (0.0.0.0/0) +// / \ +// X 1 (128.0.0.0/1) +// / \ +// 0 X +// / \ +// 0 X +// / \ +// 0* X +// +// Where: +// * denotes a masked node (prefix end) +// X denotes an unused branch (nil pointer) type prefixTree struct { maxBits int root *prefixTreeNode diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/util/lockmap/lockmap.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/util/lockmap/lockmap.go new file mode 100644 index 0000000000..57f2205fe7 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/util/lockmap/lockmap.go @@ -0,0 +1,57 @@ +/* +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 lockmap + +import "sync" + +// LockMap used to lock on entries +type LockMap struct { + sync.Mutex + mutexMap map[string]*sync.Mutex +} + +// NewLockMap returns a new lock map +func NewLockMap() *LockMap { + return &LockMap{ + mutexMap: make(map[string]*sync.Mutex), + } +} + +// LockEntry acquires a lock associated with the specific entry +func (lm *LockMap) LockEntry(entry string) { + lm.Lock() + // check if entry does not exists, then add entry + mutex, exists := lm.mutexMap[entry] + if !exists { + mutex = &sync.Mutex{} + lm.mutexMap[entry] = mutex + } + lm.Unlock() + mutex.Lock() +} + +// UnlockEntry release the lock associated with the specific entry +func (lm *LockMap) UnlockEntry(entry string) { + lm.Lock() + defer lm.Unlock() + + mutex, exists := lm.mutexMap[entry] + if !exists { + return + } + mutex.Unlock() +}