diff --git a/go.mod b/go.mod index 45b9b0ca9..5be318c03 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.22.5 require ( github.com/Azure/azure-sdk-for-go v68.0.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.14.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault v1.4.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 @@ -13,39 +13,46 @@ require ( github.com/Azure/go-autorest/autorest v0.11.29 github.com/Azure/go-autorest/autorest/adal v0.9.24 github.com/container-storage-interface/spec v1.9.0 - github.com/gofrs/uuid v4.4.0+incompatible // indirect + github.com/go-ini/ini v1.67.0 github.com/golang/protobuf v1.5.4 + github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.1 github.com/kubernetes-csi/csi-lib-utils v0.16.0 github.com/onsi/ginkgo/v2 v2.20.2 github.com/onsi/gomega v1.34.2 github.com/pborman/uuid v1.2.1 github.com/pkg/errors v0.9.1 - github.com/satori/go.uuid v1.2.0 github.com/stretchr/testify v1.9.0 go.uber.org/mock v0.4.0 golang.org/x/net v0.29.0 + golang.org/x/sync v0.8.0 google.golang.org/grpc v1.65.0 google.golang.org/protobuf v1.34.2 k8s.io/api v0.30.3 k8s.io/apimachinery v0.30.3 + k8s.io/apiserver v0.30.3 k8s.io/client-go v0.30.3 k8s.io/component-base v0.30.3 k8s.io/klog/v2 v2.130.1 - k8s.io/kubernetes v1.29.7 - k8s.io/mount-utils v0.29.7 + k8s.io/kubernetes v1.30.3 + k8s.io/mount-utils v0.30.3 + k8s.io/pod-security-admission v0.30.3 k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 sigs.k8s.io/cloud-provider-azure v1.27.1-0.20240805152051-72936abe6812 + sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.0.49 sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.0.18 sigs.k8s.io/yaml v1.4.0 ) 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/compute/armcompute/v5 v5.7.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/v4 v4.8.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v4 v4.3.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns v1.2.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets v1.1.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.0.0 // indirect github.com/Azure/go-autorest v14.2.0+incompatible // indirect github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect github.com/Azure/go-autorest/autorest/mocks v0.4.2 // indirect @@ -64,16 +71,18 @@ require ( github.com/coreos/go-semver v0.3.1 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect + github.com/distribution/reference v0.5.0 // indirect github.com/emicklei/go-restful/v3 v3.11.0 // indirect github.com/evanphx/json-patch v5.9.0+incompatible // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect - github.com/go-ini/ini v1.67.0 github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-openapi/jsonpointer v0.19.6 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect github.com/go-openapi/swag v0.22.4 // indirect + github.com/go-task/slim-sprig/v3 v3.0.0 // indirect + github.com/gofrs/uuid v4.4.0+incompatible // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt/v4 v4.5.0 // indirect github.com/golang-jwt/jwt/v5 v5.2.1 // indirect @@ -84,6 +93,8 @@ require ( github.com/google/gofuzz v1.2.0 // indirect github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5 // indirect github.com/google/uuid v1.6.0 // indirect + github.com/gorilla/websocket v1.5.0 // indirect + github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0 // indirect github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect github.com/imdario/mergo v0.3.9 // indirect @@ -98,6 +109,7 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/selinux v1.11.0 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect @@ -114,23 +126,22 @@ require ( go.etcd.io/etcd/client/v3 v3.5.10 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.0 // indirect - go.opentelemetry.io/otel v1.28.0 // indirect + go.opentelemetry.io/otel v1.29.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.28.0 // indirect - go.opentelemetry.io/otel/metric v1.28.0 // indirect + go.opentelemetry.io/otel/metric v1.29.0 // indirect go.opentelemetry.io/otel/sdk v1.28.0 // indirect - go.opentelemetry.io/otel/trace v1.28.0 // indirect + go.opentelemetry.io/otel/trace v1.29.0 // indirect go.opentelemetry.io/proto/otlp v1.3.1 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect golang.org/x/crypto v0.27.0 // indirect golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/oauth2 v0.20.0 // indirect - golang.org/x/sync v0.8.0 golang.org/x/sys v0.25.0 // indirect golang.org/x/term v0.24.0 // indirect golang.org/x/text v0.18.0 // indirect - golang.org/x/time v0.5.0 // indirect + golang.org/x/time v0.6.0 // indirect golang.org/x/tools v0.24.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 // indirect @@ -140,33 +151,18 @@ 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.30.3 k8s.io/cloud-provider v0.30.3 // indirect k8s.io/component-helpers v0.30.3 // indirect k8s.io/controller-manager v0.30.3 // indirect k8s.io/kms v0.30.3 // indirect k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect - k8s.io/kubectl v0.0.0 // indirect + k8s.io/kubectl v0.30.3 // indirect k8s.io/kubelet v0.30.3 // indirect - k8s.io/pod-security-admission v0.29.7 sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.29.0 // indirect - sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.0.33 sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect ) -require github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.1 - -require ( - github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets v0.12.0 // indirect - github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.7.1 // indirect - github.com/distribution/reference v0.5.0 // indirect - github.com/go-task/slim-sprig/v3 v3.0.0 // indirect - github.com/gorilla/websocket v1.5.0 // indirect - github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0 // indirect - github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect -) - replace ( k8s.io/api => k8s.io/api v0.29.7 k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.29.7 @@ -190,6 +186,7 @@ replace ( k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.29.7 k8s.io/kubectl => k8s.io/kubectl v0.29.7 k8s.io/kubelet => k8s.io/kubelet v0.29.7 + k8s.io/kubernetes => k8s.io/kubernetes v1.29.7 k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.29.7 k8s.io/metrics => k8s.io/metrics v0.29.7 k8s.io/mount-utils => k8s.io/mount-utils v0.29.7 diff --git a/go.sum b/go.sum index 31749e641..40cd56dae 100644 --- a/go.sum +++ b/go.sum @@ -4,16 +4,14 @@ cloud.google.com/go/compute/metadata v0.3.0 h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2Qx cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= github.com/Azure/azure-sdk-for-go v68.0.0+incompatible h1:fcYLmCpyNYRnvJbPerq7U0hS+6+I79yEDJBqVNcqUzU= github.com/Azure/azure-sdk-for-go v68.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.14.0 h1:nyQWyZvwGTvunIMxi1Y9uXkcyr+I7TeNrr/foo4Kpk8= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.14.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= -github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets v0.12.0 h1:xnO4sFyG8UH2fElBkcqLTOZsAajvKfnSlgBBW8dXYjw= -github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets v0.12.0/go.mod h1:XD3DIOOVgBCO03OleB1fHjgktVRFxlT++KwKgIOewdM= -github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.7.1 h1:FbH3BbSb4bvGluTesZZ+ttN/MDsnMmQP36OSnDuSXqw= -github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.7.1/go.mod h1:9V2j0jn9jDEkCkv8w/bKTNppX/d0FVA1ud77xCIP4KA= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2 v2.2.0 h1:Hp+EScFOu9HeCbeW8WU2yQPJd4gGwhMgKxWe+G6jNzw= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2 v2.2.0/go.mod h1:/pz8dyNQe+Ey3yBp/XuYz7oqX8YDNWVpPB0hH3XWfbc= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 v5.7.0 h1:LkHbJbgF3YyvC53aqYGR+wWQDn2Rdp9AQdGndf9QvY4= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 v5.7.0/go.mod h1:QyiQdW4f4/BIfB8ZutZ2s+28RAgfa/pT+zS++ZHyM1I= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry v1.2.0 h1:DWlwvVV5r/Wy1561nZ3wrpI1/vDIBRY/Wd1HWaRBZWA= @@ -36,6 +34,10 @@ github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1. github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0/go.mod h1:5kakwfW5CjC9KK+Q4wjXAg+ShuIm2mBMua0ZFj2C8PE= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.6.0 h1:PiSrjRPpkQNjrM8H0WwKMnZUdu1RGMtd/LdGKUrOo+c= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.6.0/go.mod h1:oDrbWx4ewMylP7xHivfgixbfGBT6APAwsSoHRKotnIc= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets v1.1.0 h1:h4Zxgmi9oyZL2l8jeg1iRTqPloHktywWcu0nlJmo1tA= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets v1.1.0/go.mod h1:LgLGXawqSreJz135Elog0ywTJDsm0Hz2k+N+6ZK35u8= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.0.0 h1:D3occbWoio4EBLkbkevetNMAVX197GkzbUMtqjGWn80= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.0.0/go.mod h1:bTSOgj05NGRuHHhQwAdPnYr9TOdNmKlZTgGLL6nyAdI= github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.3.2 h1:YUUxeiOWgdAQE3pXt2H7QXzZs0q8UBjgRbl56qo8GYM= github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.3.2/go.mod h1:dmXQgZuiSubAecswZE+Sm8jkvEa7kQgTPVRvwL/nd0E= github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs= @@ -237,8 +239,6 @@ github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPH github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= -github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/soheilhy/cmux v0.1.5 h1:jjzc5WVemNEDTLwv9tlmemhC73tI08BNOIGwBOo10Js= @@ -286,18 +286,18 @@ go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.4 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0/go.mod h1:Ct6zzQEuGK3WpJs2n4dn+wfJYzd/+hNnxMRTWjGn30M= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.0 h1:1eHu3/pUSWaOgltNK3WJFaywKsTIr/PwvHyDmi0lQA0= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.0/go.mod h1:HyABWq60Uy1kjJSa2BVOxUVao8Cdick5AWSKPutqy6U= -go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= -go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= +go.opentelemetry.io/otel v1.29.0 h1:PdomN/Al4q/lN6iBJEN3AwPvUiHPMlt93c8bqTG5Llw= +go.opentelemetry.io/otel v1.29.0/go.mod h1:N/WtXPs1CNCUEx+Agz5uouwCba+i+bJGFicT8SR4NP8= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 h1:3Q/xZUyC1BBkualc9ROb4G8qkH90LXEIICcs5zv1OYY= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0/go.mod h1:s75jGIWA9OfCMzF0xr+ZgfrB5FEbbV7UuYo32ahUiFI= 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/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= -go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= +go.opentelemetry.io/otel/metric v1.29.0 h1:vPf/HFWTNkPu1aYeIsc98l4ktOQaL6LeSoeV2g+8YLc= +go.opentelemetry.io/otel/metric v1.29.0/go.mod h1:auu/QWieFVWx+DmQOUMgj0F8LHWdgalxXqvp7BII/W8= go.opentelemetry.io/otel/sdk v1.28.0 h1:b9d7hIry8yZsgtbmM0DKyPWMMUMlK9NEKuIG4aBqWyE= go.opentelemetry.io/otel/sdk v1.28.0/go.mod h1:oYj7ClPUA7Iw3m+r7GeEjz0qckQRJK2B8zjcZEfu7Pg= -go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= -go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= +go.opentelemetry.io/otel/trace v1.29.0 h1:J/8ZNK4XgR7a21DZUAsbF8pZ5Jcw1VhACmnYt39JTi4= +go.opentelemetry.io/otel/trace v1.29.0/go.mod h1:eHl3w0sp3paPkYstJOmAimxhiFXPg+MMTlEh3nsQgWQ= go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= @@ -374,8 +374,8 @@ golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= -golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= -golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= +golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -455,8 +455,8 @@ sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.29.0 h1:/U5vjBbQn3RCh sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.29.0/go.mod h1:z7+wmGM2dfIiLRfrC6jb5kV2Mq/sK1ZP303cxzkV5Y4= sigs.k8s.io/cloud-provider-azure v1.27.1-0.20240805152051-72936abe6812 h1:/wecScN9etwdtLeibmyMjSrT6WwjZxmaltAUppmcj60= sigs.k8s.io/cloud-provider-azure v1.27.1-0.20240805152051-72936abe6812/go.mod h1:lQvP3CccouEXTBu56sCNxPOPyeNwM8PlfL4+ms2C4sE= -sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.0.33 h1:tCVZx6xMGJWXyqVtR9UE5y8O3BAOBYNrpsojcN17Wrw= -sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.0.33/go.mod h1:Fih1ZXhUc/ZeBjDTukeQMXpaXmaVhtiQstsPYWGrdVE= +sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.0.49 h1:3AsgRzy3mz/AOsofFsuzQFs2paHACDl2J0Ibd6dh+5Q= +sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.0.49/go.mod h1:1M90A+akyTabHVnveSKlvIO/Kk9kEr1LjRx+08twKVU= sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.0.18 h1:PhXbmp06mdagpcavRWc/bAF7aNAEknuuzioI+NJgE3E= sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.0.18/go.mod h1:qJdztdabNCvj3MiRKT1AEOeYwhplYAodY8UPR/LwcT8= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= diff --git a/test/utils/azure/authorization_helper.go b/test/utils/azure/authorization_helper.go deleted file mode 100644 index fa849f453..000000000 --- a/test/utils/azure/authorization_helper.go +++ /dev/null @@ -1,137 +0,0 @@ -/* -Copyright 2019 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package azure - -import ( - "context" - "fmt" - - "k8s.io/utils/ptr" - "sigs.k8s.io/blob-csi-driver/test/utils/credentials" - - "github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/adal" - "github.com/Azure/go-autorest/autorest/azure" - uuid "github.com/satori/go.uuid" -) - -type AuthorizationClient struct { - cred *credentials.Credentials -} - -func NewAuthorizationClient() (*AuthorizationClient, error) { - e2eCred, err := credentials.ParseAzureCredentialFile() - if err != nil { - return nil, err - } - - return &AuthorizationClient{ - cred: &credentials.Credentials{ - SubscriptionID: e2eCred.SubscriptionID, - ResourceGroup: e2eCred.ResourceGroup, - Location: e2eCred.Location, - TenantID: e2eCred.TenantID, - Cloud: e2eCred.Cloud, - AADClientID: e2eCred.AADClientID, - AADClientSecret: e2eCred.AADClientSecret, - }, - }, nil -} - -func (a *AuthorizationClient) AssignRole(ctx context.Context, resourceID, principalID, roleDefID string) (authorization.RoleAssignment, error) { - roleAssignmentsClient, err := a.getRoleAssignmentsClient() - if err != nil { - return authorization.RoleAssignment{}, err - } - - return roleAssignmentsClient.Create( - ctx, - resourceID, - uuid.NewV1().String(), - authorization.RoleAssignmentCreateParameters{ - RoleAssignmentProperties: &authorization.RoleAssignmentProperties{ - PrincipalID: ptr.To(principalID), - RoleDefinitionID: ptr.To(roleDefID), - }, - }) -} - -func (a *AuthorizationClient) GetRoleDefinition(ctx context.Context, resourceID, roleName string) (authorization.RoleDefinition, error) { - roleDefClient, err := a.getRoleDefinitionsClient() - if err != nil { - return authorization.RoleDefinition{}, err - } - - filter := fmt.Sprintf("roleName eq '%s'", roleName) - list, err := roleDefClient.List(ctx, resourceID, filter) - if err != nil { - return authorization.RoleDefinition{}, err - } - - return list.Values()[0], nil -} - -func (a *AuthorizationClient) getRoleAssignmentsClient() (*authorization.RoleAssignmentsClient, error) { - roleClient := authorization.NewRoleAssignmentsClient(a.cred.SubscriptionID) - - env, err := azure.EnvironmentFromName(a.cred.Cloud) - if err != nil { - return nil, err - } - - oauthConfig, err := adal.NewOAuthConfig(env.ActiveDirectoryEndpoint, a.cred.TenantID) - if err != nil { - return nil, err - } - - token, err := adal.NewServicePrincipalToken(*oauthConfig, a.cred.AADClientID, a.cred.AADClientSecret, env.ResourceManagerEndpoint) - if err != nil { - return nil, err - } - - authorizer := autorest.NewBearerAuthorizer(token) - - roleClient.Authorizer = authorizer - - return &roleClient, nil -} - -func (a *AuthorizationClient) getRoleDefinitionsClient() (*authorization.RoleDefinitionsClient, error) { - roleDefClient := authorization.NewRoleDefinitionsClient(a.cred.SubscriptionID) - - env, err := azure.EnvironmentFromName(a.cred.Cloud) - if err != nil { - return nil, err - } - - oauthConfig, err := adal.NewOAuthConfig(env.ActiveDirectoryEndpoint, a.cred.TenantID) - if err != nil { - return nil, err - } - - token, err := adal.NewServicePrincipalToken(*oauthConfig, a.cred.AADClientID, a.cred.AADClientSecret, env.ResourceManagerEndpoint) - if err != nil { - return nil, err - } - - authorizer := autorest.NewBearerAuthorizer(token) - - roleDefClient.Authorizer = authorizer - - return &roleDefClient, nil -} diff --git a/test/utils/azure/azure_helper.go b/test/utils/azure/azure_helper.go index cdf74ff33..ed79cf3f6 100644 --- a/test/utils/azure/azure_helper.go +++ b/test/utils/azure/azure_helper.go @@ -27,12 +27,18 @@ import ( "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/resourcegroupclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/roleassignmentclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/roledefinitionclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/vaultclient" ) type Client struct { - subscriptionID string - groupsClient resourcegroupclient.Interface - accountsClient accountclient.Interface + subscriptionID string + groupsClient resourcegroupclient.Interface + accountsClient accountclient.Interface + roledefinitionclient roledefinitionclient.Interface + roleassignmentclient roleassignmentclient.Interface + vaultclient vaultclient.Interface } func GetClient(cloud, subscriptionID, clientID, tenantID, clientSecret string, aadFederatedTokenFile string) (*Client, error) { @@ -60,11 +66,17 @@ func GetClient(cloud, subscriptionID, clientID, tenantID, clientSecret string, a if err != nil { return nil, err } - + roleclient, err := roledefinitionclient.New(subscriptionID, cred, nil) + if err != nil { + return nil, err + } return &Client{ - subscriptionID: subscriptionID, - groupsClient: factory.GetResourceGroupClient(), - accountsClient: factory.GetAccountClient(), + subscriptionID: subscriptionID, + groupsClient: factory.GetResourceGroupClient(), + accountsClient: factory.GetAccountClient(), + roleassignmentclient: factory.GetRoleAssignmentClient(), + vaultclient: factory.GetVaultClient(), + roledefinitionclient: roleclient, }, nil } diff --git a/test/utils/azure/keyvault_helper.go b/test/utils/azure/keyvault_helper.go index a86bbbfa4..94c6b39f7 100644 --- a/test/utils/azure/keyvault_helper.go +++ b/test/utils/azure/keyvault_helper.go @@ -18,13 +18,10 @@ package azure import ( "context" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault" - "github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac" "github.com/Azure/azure-sdk-for-go/services/msi/mgmt/2018-11-30/msi" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/adal" @@ -32,11 +29,13 @@ import ( "github.com/onsi/ginkgo/v2" "k8s.io/apiserver/pkg/storage/names" "sigs.k8s.io/blob-csi-driver/test/utils/credentials" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/vaultclient" ) type KeyVaultClient struct { - Cred *credentials.Credentials - vaultName string + vaultClient vaultclient.Interface + Cred *credentials.Credentials + vaultName string } func NewKeyVaultClient() (*KeyVaultClient, error) { @@ -44,33 +43,20 @@ func NewKeyVaultClient() (*KeyVaultClient, error) { if err != nil { return nil, err } - + client, err := GetClient(e2eCred.Cloud, e2eCred.SubscriptionID, e2eCred.AADClientID, e2eCred.TenantID, e2eCred.AADClientSecret, e2eCred.AADFederatedTokenFile) + if err != nil { + return nil, err + } return &KeyVaultClient{ - Cred: &credentials.Credentials{ - SubscriptionID: e2eCred.SubscriptionID, - ResourceGroup: e2eCred.ResourceGroup, - Location: e2eCred.Location, - TenantID: e2eCred.TenantID, - Cloud: e2eCred.Cloud, - AADClientID: e2eCred.AADClientID, - AADClientSecret: e2eCred.AADClientSecret, - }, - vaultName: names.SimpleNameGenerator.GenerateName("blob-csi-test-kv-"), + vaultName: names.SimpleNameGenerator.GenerateName("blob-csi-test-kv-"), + vaultClient: client.vaultclient, + Cred: e2eCred, }, nil } func (kvc *KeyVaultClient) CreateVault(ctx context.Context) (*armkeyvault.Vault, error) { - azureCred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - return nil, err - } - - vaultsClient, err := armkeyvault.NewVaultsClient(kvc.Cred.SubscriptionID, azureCred, nil) - if err != nil { - return nil, err - } - pollerResp, err := vaultsClient.BeginCreateOrUpdate( + resp, err := kvc.vaultClient.CreateOrUpdate( ctx, kvc.Cred.ResourceGroup, kvc.vaultName, @@ -85,31 +71,21 @@ func (kvc *KeyVaultClient) CreateVault(ctx context.Context) (*armkeyvault.Vault, AccessPolicies: kvc.getAccessPolicy(ctx), }, }, - nil, ) if err != nil { return nil, err } - resp, err := pollerResp.PollUntilDone(ctx, nil) - if err != nil { - return nil, err - } - return &resp.Vault, nil + return resp, nil } func (kvc *KeyVaultClient) CleanVault(ctx context.Context) error { - azureCred, err := azidentity.NewDefaultAzureCredential(nil) + err := kvc.deleteVault(ctx) if err != nil { return err } - err = kvc.deleteVault(ctx, azureCred) - if err != nil { - return err - } - - err = kvc.purgeDeleted(ctx, azureCred) + err = kvc.purgeDeleted(ctx) if err != nil { return err } @@ -152,22 +128,6 @@ func (kvc *KeyVaultClient) CreateSecret(ctx context.Context, secretName, secretV func (kvc *KeyVaultClient) getAccessPolicy(ctx context.Context) []*armkeyvault.AccessPolicyEntry { accessPolicyEntry := []*armkeyvault.AccessPolicyEntry{} - - // vault secret permission for upstream e2e test, which uses application service principal - clientObjectID, err := kvc.GetServicePrincipalObjectID(ctx, kvc.Cred.AADClientID) - if err == nil { - ginkgo.By("client object ID: " + clientObjectID) - accessPolicyEntry = append(accessPolicyEntry, &armkeyvault.AccessPolicyEntry{ - TenantID: to.Ptr(kvc.Cred.TenantID), - ObjectID: to.Ptr(clientObjectID), - Permissions: &armkeyvault.Permissions{ - Secrets: []*armkeyvault.SecretPermissions{ - to.Ptr(armkeyvault.SecretPermissionsGet), - }, - }, - }) - } - // vault secret permission for upstream e2e-vmss test, which uses msi blobfuse-csi-driver-e2e-test-id msiObjectID, err := kvc.GetMSIObjectID(ctx, "blobfuse-csi-driver-e2e-test-id") if err == nil { @@ -186,80 +146,22 @@ func (kvc *KeyVaultClient) getAccessPolicy(ctx context.Context) []*armkeyvault.A return accessPolicyEntry } -func (kvc *KeyVaultClient) deleteVault(ctx context.Context, cred azcore.TokenCredential) error { - vaultsClient, err := armkeyvault.NewVaultsClient(kvc.Cred.SubscriptionID, cred, nil) - if err != nil { - return err - } - - _, err = vaultsClient.Delete(ctx, kvc.Cred.ResourceGroup, kvc.vaultName, nil) +func (kvc *KeyVaultClient) deleteVault(ctx context.Context) error { + err := kvc.vaultClient.Delete(ctx, kvc.Cred.ResourceGroup, kvc.vaultName) if err != nil { return err } return nil } -func (kvc *KeyVaultClient) purgeDeleted(ctx context.Context, cred azcore.TokenCredential) error { - vaultsClient, err := armkeyvault.NewVaultsClient(kvc.Cred.SubscriptionID, cred, nil) +func (kvc *KeyVaultClient) purgeDeleted(ctx context.Context) error { + err := kvc.vaultClient.PurgeDeleted(ctx, kvc.vaultName, kvc.Cred.Location) if err != nil { return err } - - pollerResp, err := vaultsClient.BeginPurgeDeleted(ctx, kvc.vaultName, kvc.Cred.Location, nil) - if err != nil { - return err - } - - _, err = pollerResp.PollUntilDone(ctx, nil) - if err != nil { - return err - } - return nil } -func (kvc *KeyVaultClient) GetServicePrincipalObjectID(ctx context.Context, clientID string) (string, error) { - spClient, err := kvc.getServicePrincipalsClient() - if err != nil { - return "", err - } - - page, err := spClient.List(ctx, fmt.Sprintf("servicePrincipalNames/any(c:c eq '%s')", clientID)) - if err != nil { - return "", err - } - servicePrincipals := page.Values() - if len(servicePrincipals) == 0 { - return "", fmt.Errorf("didn't find any service principals for client ID %s", clientID) - } - return *servicePrincipals[0].ObjectID, nil -} - -func (kvc *KeyVaultClient) getServicePrincipalsClient() (*graphrbac.ServicePrincipalsClient, error) { - spClient := graphrbac.NewServicePrincipalsClient(kvc.Cred.TenantID) - - env, err := azure.EnvironmentFromName(kvc.Cred.Cloud) - if err != nil { - return nil, err - } - - oauthConfig, err := adal.NewOAuthConfig(env.ActiveDirectoryEndpoint, kvc.Cred.TenantID) - if err != nil { - return nil, err - } - - token, err := adal.NewServicePrincipalToken(*oauthConfig, kvc.Cred.AADClientID, kvc.Cred.AADClientSecret, env.GraphEndpoint) - if err != nil { - return nil, err - } - - authorizer := autorest.NewBearerAuthorizer(token) - - spClient.Authorizer = authorizer - - return &spClient, nil -} - func (kvc *KeyVaultClient) getMSIUserAssignedIDClient() (*msi.UserAssignedIdentitiesClient, error) { msiClient := msi.NewUserAssignedIdentitiesClient(kvc.Cred.SubscriptionID) diff --git a/test/utils/credentials/credentials.go b/test/utils/credentials/credentials.go index e425b5649..1a209c317 100644 --- a/test/utils/credentials/credentials.go +++ b/test/utils/credentials/credentials.go @@ -23,6 +23,7 @@ import ( "os" "github.com/pborman/uuid" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient" ) const ( @@ -31,14 +32,14 @@ const ( TempAzureCredentialFilePath = "/tmp/azure.json" azureCredentialFileTemplate = `{ - "cloud": "{{.Cloud}}", - "tenantId": "{{.TenantID}}", - "subscriptionId": "{{.SubscriptionID}}", - "aadClientId": "{{.AADClientID}}", - "aadClientSecret": "{{.AADClientSecret}}", - "resourceGroup": "{{.ResourceGroup}}", - "location": "{{.Location}}", - "aadFederatedTokenFile": "{{.AADFederatedTokenFile}}" + "cloud": "{{.Cloud}}", + "tenantId": "{{.TenantID}}", + "subscriptionId": "{{.SubscriptionID}}", + "aadClientId": "{{.AADClientID}}", + "aadClientSecret": "{{.AADClientSecret}}", + "resourceGroup": "{{.ResourceGroup}}", + "location": "{{.Location}}", + "aadFederatedTokenFile": "{{.AADFederatedTokenFile}}" }` defaultAzurePublicCloudLocation = "eastus2" @@ -62,24 +63,19 @@ type Config struct { // FromProw is used in Prow to store Azure credentials // https://github.com/kubernetes/test-infra/blob/master/kubetest/azure.go#L107-L114 type FromProw struct { - ClientID string - ClientSecret string - TenantID string - SubscriptionID string + azclient.ARMClientConfig + azclient.AzureAuthConfig StorageAccountName string StorageAccountKey string } // Credentials is used in Azure Blob Storage CSI driver to store Azure credentials type Credentials struct { - Cloud string - TenantID string - SubscriptionID string - AADClientID string - AADClientSecret string - AADFederatedTokenFile string - ResourceGroup string - Location string + azclient.ARMClientConfig + azclient.AzureAuthConfig + SubscriptionID string + ResourceGroup string + Location string } // CreateAzureCredentialFile creates a temporary Azure credential file for @@ -155,14 +151,18 @@ func parseAndExecuteTemplate(cloud, tenantID, subscriptionID, aadClientID, aadCl defer f.Close() c := Credentials{ - cloud, - tenantID, - subscriptionID, - aadClientID, - aadClientSecret, - aadFederatedTokenFile, - resourceGroup, - location, + ARMClientConfig: azclient.ARMClientConfig{ + Cloud: cloud, + TenantID: tenantID, + }, + AzureAuthConfig: azclient.AzureAuthConfig{ + AADClientID: aadClientID, + AADClientSecret: aadClientSecret, + AADFederatedTokenFile: aadFederatedTokenFile, + }, + SubscriptionID: subscriptionID, + ResourceGroup: resourceGroup, + Location: location, } err = t.Execute(f, c) if err != nil { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/CHANGELOG.md index 1a9cedbaf..d13f2e0b3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/CHANGELOG.md +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 1.14.0 (2024-08-07) + +### Features Added + +* Added field `Attributes` to `runtime.StartSpanOptions` to simplify creating spans with attributes. + +### Other Changes + +* Include the HTTP verb and URL in `log.EventRetryPolicy` log entries so it's clear which operation is being retried. + ## 1.13.0 (2024-07-16) ### Features Added diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared/constants.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared/constants.go index e5b28a9b1..7cb8c207e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared/constants.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/internal/shared/constants.go @@ -40,5 +40,5 @@ const ( Module = "azcore" // Version is the semantic version (see http://semver.org) of this module. - Version = "v1.13.0" + Version = "v1.14.0" ) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_http_trace.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_http_trace.go index 3df1c1218..bc6989310 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_http_trace.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_http_trace.go @@ -96,7 +96,8 @@ func (h *httpTracePolicy) Do(req *policy.Request) (resp *http.Response, err erro // StartSpanOptions contains the optional values for StartSpan. type StartSpanOptions struct { - // for future expansion + // Attributes contains key-value pairs of attributes for the span. + Attributes []tracing.Attribute } // StartSpan starts a new tracing span. @@ -126,8 +127,14 @@ func StartSpan(ctx context.Context, name string, tracer tracing.Tracer, options return ctx, func(err error) {} } } + + if options == nil { + options = &StartSpanOptions{} + } + ctx, span := tracer.Start(ctx, name, &tracing.SpanOptions{ - Kind: newSpanKind, + Kind: newSpanKind, + Attributes: options.Attributes, }) ctx = context.WithValue(ctx, ctxActiveSpan{}, newSpanKind) return ctx, func(err error) { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_retry.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_retry.go index 04d7bb4ec..e15eea824 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_retry.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/policy_retry.go @@ -102,7 +102,8 @@ func (p *retryPolicy) Do(req *policy.Request) (resp *http.Response, err error) { try := int32(1) for { resp = nil // reset - log.Writef(log.EventRetryPolicy, "=====> Try=%d", try) + // unfortunately we don't have access to the custom allow-list of query params, so we'll redact everything but the default allowed QPs + log.Writef(log.EventRetryPolicy, "=====> Try=%d for %s %s", try, req.Raw().Method, getSanitizedURL(*req.Raw().URL, getAllowedQueryParams(nil))) // For each try, seek to the beginning of the Body stream. We do this even for the 1st try because // the stream may not be at offset 0 when we first get it and we want the same behavior for the diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/constants.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/constants.go deleted file mode 100644 index d897d67a1..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/constants.go +++ /dev/null @@ -1,63 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package azsecrets - -// DeletionRecoveryLevel - Reflects the deletion recovery level currently in effect for secrets in the current vault. If it -// contains 'Purgeable', the secret can be permanently deleted by a privileged user; otherwise, only the -// system can purge the secret, at the end of the retention interval. -type DeletionRecoveryLevel string - -const ( - // DeletionRecoveryLevelCustomizedRecoverable - Denotes a vault state in which deletion is recoverable without the possibility - // for immediate and permanent deletion (i.e. purge when 7<= SoftDeleteRetentionInDays < 90).This level guarantees the recoverability - // of the deleted entity during the retention interval and while the subscription is still available. - DeletionRecoveryLevelCustomizedRecoverable DeletionRecoveryLevel = "CustomizedRecoverable" - // DeletionRecoveryLevelCustomizedRecoverableProtectedSubscription - Denotes a vault and subscription state in which deletion - // is recoverable, immediate and permanent deletion (i.e. purge) is not permitted, and in which the subscription itself cannot - // be permanently canceled when 7<= SoftDeleteRetentionInDays < 90. This level guarantees the recoverability of the deleted - // entity during the retention interval, and also reflects the fact that the subscription itself cannot be cancelled. - DeletionRecoveryLevelCustomizedRecoverableProtectedSubscription DeletionRecoveryLevel = "CustomizedRecoverable+ProtectedSubscription" - // DeletionRecoveryLevelCustomizedRecoverablePurgeable - Denotes a vault state in which deletion is recoverable, and which - // also permits immediate and permanent deletion (i.e. purge when 7<= SoftDeleteRetentionInDays < 90). This level guarantees - // the recoverability of the deleted entity during the retention interval, unless a Purge operation is requested, or the subscription - // is cancelled. - DeletionRecoveryLevelCustomizedRecoverablePurgeable DeletionRecoveryLevel = "CustomizedRecoverable+Purgeable" - // DeletionRecoveryLevelPurgeable - Denotes a vault state in which deletion is an irreversible operation, without the possibility - // for recovery. This level corresponds to no protection being available against a Delete operation; the data is irretrievably - // lost upon accepting a Delete operation at the entity level or higher (vault, resource group, subscription etc.) - DeletionRecoveryLevelPurgeable DeletionRecoveryLevel = "Purgeable" - // DeletionRecoveryLevelRecoverable - Denotes a vault state in which deletion is recoverable without the possibility for immediate - // and permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted entity during the retention - // interval(90 days) and while the subscription is still available. System wil permanently delete it after 90 days, if not - // recovered - DeletionRecoveryLevelRecoverable DeletionRecoveryLevel = "Recoverable" - // DeletionRecoveryLevelRecoverableProtectedSubscription - Denotes a vault and subscription state in which deletion is recoverable - // within retention interval (90 days), immediate and permanent deletion (i.e. purge) is not permitted, and in which the subscription - // itself cannot be permanently canceled. System wil permanently delete it after 90 days, if not recovered - DeletionRecoveryLevelRecoverableProtectedSubscription DeletionRecoveryLevel = "Recoverable+ProtectedSubscription" - // DeletionRecoveryLevelRecoverablePurgeable - Denotes a vault state in which deletion is recoverable, and which also permits - // immediate and permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted entity during the - // retention interval (90 days), unless a Purge operation is requested, or the subscription is cancelled. System wil permanently - // delete it after 90 days, if not recovered - DeletionRecoveryLevelRecoverablePurgeable DeletionRecoveryLevel = "Recoverable+Purgeable" -) - -// PossibleDeletionRecoveryLevelValues returns the possible values for the DeletionRecoveryLevel const type. -func PossibleDeletionRecoveryLevelValues() []DeletionRecoveryLevel { - return []DeletionRecoveryLevel{ - DeletionRecoveryLevelCustomizedRecoverable, - DeletionRecoveryLevelCustomizedRecoverableProtectedSubscription, - DeletionRecoveryLevelCustomizedRecoverablePurgeable, - DeletionRecoveryLevelPurgeable, - DeletionRecoveryLevelRecoverable, - DeletionRecoveryLevelRecoverableProtectedSubscription, - DeletionRecoveryLevelRecoverablePurgeable, - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/models.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/models.go deleted file mode 100644 index 87be9ab52..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/models.go +++ /dev/null @@ -1,268 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package azsecrets - -import "time" - -// BackupSecretResult - The backup secret result, containing the backup blob. -type BackupSecretResult struct { - // READ-ONLY; The backup blob containing the backed up secret. - Value []byte `json:"value,omitempty" azure:"ro"` -} - -// BackupSecretOptions contains the optional parameters for the Client.BackupSecret method. -type BackupSecretOptions struct { - // placeholder for future optional parameters -} - -// DeleteSecretOptions contains the optional parameters for the Client.DeleteSecret method. -type DeleteSecretOptions struct { - // placeholder for future optional parameters -} - -// GetDeletedSecretOptions contains the optional parameters for the Client.GetDeletedSecret method. -type GetDeletedSecretOptions struct { - // placeholder for future optional parameters -} - -// GetSecretOptions contains the optional parameters for the Client.GetSecret method. -type GetSecretOptions struct { - // placeholder for future optional parameters -} - -// ListDeletedSecretsOptions contains the optional parameters for the Client.NewListDeletedSecretsPager method. -type ListDeletedSecretsOptions struct { - // Maximum number of results to return in a page. If not specified the service will return up to 25 results. - MaxResults *int32 -} - -// ListSecretVersionsOptions contains the optional parameters for the Client.NewListSecretVersionsPager method. -type ListSecretVersionsOptions struct { - // Maximum number of results to return in a page. If not specified, the service will return up to 25 results. - MaxResults *int32 -} - -// ListSecretsOptions contains the optional parameters for the Client.NewListSecretsPager method. -type ListSecretsOptions struct { - // Maximum number of results to return in a page. If not specified, the service will return up to 25 results. - MaxResults *int32 -} - -// PurgeDeletedSecretOptions contains the optional parameters for the Client.PurgeDeletedSecret method. -type PurgeDeletedSecretOptions struct { - // placeholder for future optional parameters -} - -// RecoverDeletedSecretOptions contains the optional parameters for the Client.RecoverDeletedSecret method. -type RecoverDeletedSecretOptions struct { - // placeholder for future optional parameters -} - -// RestoreSecretOptions contains the optional parameters for the Client.RestoreSecret method. -type RestoreSecretOptions struct { - // placeholder for future optional parameters -} - -// SetSecretOptions contains the optional parameters for the Client.SetSecret method. -type SetSecretOptions struct { - // placeholder for future optional parameters -} - -// UpdateSecretOptions contains the optional parameters for the Client.UpdateSecret method. -type UpdateSecretOptions struct { - // placeholder for future optional parameters -} - -// DeletedSecretBundle - A Deleted Secret consisting of its previous id, attributes and its tags, as well as information on -// when it will be purged. -type DeletedSecretBundle struct { - // The secret management attributes. - Attributes *SecretAttributes `json:"attributes,omitempty"` - - // The content type of the secret. - ContentType *string `json:"contentType,omitempty"` - - // The secret id. - ID *ID `json:"id,omitempty"` - - // The url of the recovery object, used to identify and recover the deleted secret. - RecoveryID *string `json:"recoveryId,omitempty"` - - // Application specific metadata in the form of key-value pairs. - Tags map[string]*string `json:"tags,omitempty"` - - // The secret value. - Value *string `json:"value,omitempty"` - - // READ-ONLY; The time when the secret was deleted, in UTC - DeletedDate *time.Time `json:"deletedDate,omitempty" azure:"ro"` - - // READ-ONLY; If this is a secret backing a KV certificate, then this field specifies the corresponding key backing the KV - // certificate. - Kid *string `json:"kid,omitempty" azure:"ro"` - - // READ-ONLY; True if the secret's lifetime is managed by key vault. If this is a secret backing a certificate, then managed - // will be true. - Managed *bool `json:"managed,omitempty" azure:"ro"` - - // READ-ONLY; The time when the secret is scheduled to be purged, in UTC - ScheduledPurgeDate *time.Time `json:"scheduledPurgeDate,omitempty" azure:"ro"` -} - -// DeletedSecretItem - The deleted secret item containing metadata about the deleted secret. -type DeletedSecretItem struct { - // The secret management attributes. - Attributes *SecretAttributes `json:"attributes,omitempty"` - - // Type of the secret value such as a password. - ContentType *string `json:"contentType,omitempty"` - - // Secret identifier. - ID *ID `json:"id,omitempty"` - - // The url of the recovery object, used to identify and recover the deleted secret. - RecoveryID *string `json:"recoveryId,omitempty"` - - // Application specific metadata in the form of key-value pairs. - Tags map[string]*string `json:"tags,omitempty"` - - // READ-ONLY; The time when the secret was deleted, in UTC - DeletedDate *time.Time `json:"deletedDate,omitempty" azure:"ro"` - - // READ-ONLY; True if the secret's lifetime is managed by key vault. If this is a key backing a certificate, then managed - // will be true. - Managed *bool `json:"managed,omitempty" azure:"ro"` - - // READ-ONLY; The time when the secret is scheduled to be purged, in UTC - ScheduledPurgeDate *time.Time `json:"scheduledPurgeDate,omitempty" azure:"ro"` -} - -// DeletedSecretListResult - The deleted secret list result -type DeletedSecretListResult struct { - // READ-ONLY; The URL to get the next set of deleted secrets. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` - - // READ-ONLY; A response message containing a list of the deleted secrets in the vault along with a link to the next page - // of deleted secrets - Value []*DeletedSecretItem `json:"value,omitempty" azure:"ro"` -} - -// RestoreSecretParameters - The secret restore parameters. -type RestoreSecretParameters struct { - // REQUIRED; The backup blob associated with a secret bundle. - SecretBundleBackup []byte `json:"value,omitempty"` -} - -// SecretAttributes - The secret management attributes. -type SecretAttributes struct { - // Determines whether the object is enabled. - Enabled *bool `json:"enabled,omitempty"` - - // Expiry date in UTC. - Expires *time.Time `json:"exp,omitempty"` - - // Not before date in UTC. - NotBefore *time.Time `json:"nbf,omitempty"` - - // READ-ONLY; Creation time in UTC. - Created *time.Time `json:"created,omitempty" azure:"ro"` - - // READ-ONLY; softDelete data retention days. Value should be >=7 and <=90 when softDelete enabled, otherwise 0. - RecoverableDays *int32 `json:"recoverableDays,omitempty" azure:"ro"` - - // READ-ONLY; Reflects the deletion recovery level currently in effect for secrets in the current vault. If it contains 'Purgeable', - // the secret can be permanently deleted by a privileged user; otherwise, only the - // system can purge the secret, at the end of the retention interval. - RecoveryLevel *DeletionRecoveryLevel `json:"recoveryLevel,omitempty" azure:"ro"` - - // READ-ONLY; Last updated time in UTC. - Updated *time.Time `json:"updated,omitempty" azure:"ro"` -} - -// SecretBundle - A secret consisting of a value, id and its attributes. -type SecretBundle struct { - // The secret management attributes. - Attributes *SecretAttributes `json:"attributes,omitempty"` - - // The content type of the secret. - ContentType *string `json:"contentType,omitempty"` - - // The secret id. - ID *ID `json:"id,omitempty"` - - // Application specific metadata in the form of key-value pairs. - Tags map[string]*string `json:"tags,omitempty"` - - // The secret value. - Value *string `json:"value,omitempty"` - - // READ-ONLY; If this is a secret backing a KV certificate, then this field specifies the corresponding key backing the KV - // certificate. - Kid *string `json:"kid,omitempty" azure:"ro"` - - // READ-ONLY; True if the secret's lifetime is managed by key vault. If this is a secret backing a certificate, then managed - // will be true. - Managed *bool `json:"managed,omitempty" azure:"ro"` -} - -// SecretItem - The secret item containing secret metadata. -type SecretItem struct { - // The secret management attributes. - Attributes *SecretAttributes `json:"attributes,omitempty"` - - // Type of the secret value such as a password. - ContentType *string `json:"contentType,omitempty"` - - // Secret identifier. - ID *ID `json:"id,omitempty"` - - // Application specific metadata in the form of key-value pairs. - Tags map[string]*string `json:"tags,omitempty"` - - // READ-ONLY; True if the secret's lifetime is managed by key vault. If this is a key backing a certificate, then managed - // will be true. - Managed *bool `json:"managed,omitempty" azure:"ro"` -} - -// SecretListResult - The secret list result. -type SecretListResult struct { - // READ-ONLY; The URL to get the next set of secrets. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` - - // READ-ONLY; A response message containing a list of secrets in the key vault along with a link to the next page of secrets. - Value []*SecretItem `json:"value,omitempty" azure:"ro"` -} - -// SetSecretParameters - The secret set parameters. -type SetSecretParameters struct { - // REQUIRED; The value of the secret. - Value *string `json:"value,omitempty"` - - // Type of the secret value such as a password. - ContentType *string `json:"contentType,omitempty"` - - // The secret management attributes. - SecretAttributes *SecretAttributes `json:"attributes,omitempty"` - - // Application specific metadata in the form of key-value pairs. - Tags map[string]*string `json:"tags,omitempty"` -} - -// UpdateSecretParameters - The secret update parameters. -type UpdateSecretParameters struct { - // Type of the secret value such as a password. - ContentType *string `json:"contentType,omitempty"` - - // The secret management attributes. - SecretAttributes *SecretAttributes `json:"attributes,omitempty"` - - // Application specific metadata in the form of key-value pairs. - Tags map[string]*string `json:"tags,omitempty"` -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/response_types.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/response_types.go deleted file mode 100644 index 517acaabb..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/response_types.go +++ /dev/null @@ -1,70 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package azsecrets - -// BackupSecretResponse contains the response from method Client.BackupSecret. -type BackupSecretResponse struct { - BackupSecretResult -} - -// DeleteSecretResponse contains the response from method Client.DeleteSecret. -type DeleteSecretResponse struct { - DeletedSecretBundle -} - -// GetDeletedSecretResponse contains the response from method Client.GetDeletedSecret. -type GetDeletedSecretResponse struct { - DeletedSecretBundle -} - -// GetSecretResponse contains the response from method Client.GetSecret. -type GetSecretResponse struct { - SecretBundle -} - -// ListDeletedSecretsResponse contains the response from method Client.NewListDeletedSecretsPager. -type ListDeletedSecretsResponse struct { - DeletedSecretListResult -} - -// ListSecretVersionsResponse contains the response from method Client.NewListSecretVersionsPager. -type ListSecretVersionsResponse struct { - SecretListResult -} - -// ListSecretsResponse contains the response from method Client.NewListSecretsPager. -type ListSecretsResponse struct { - SecretListResult -} - -// PurgeDeletedSecretResponse contains the response from method Client.PurgeDeletedSecret. -type PurgeDeletedSecretResponse struct { - // placeholder for future response values -} - -// RecoverDeletedSecretResponse contains the response from method Client.RecoverDeletedSecret. -type RecoverDeletedSecretResponse struct { - SecretBundle -} - -// RestoreSecretResponse contains the response from method Client.RestoreSecret. -type RestoreSecretResponse struct { - SecretBundle -} - -// SetSecretResponse contains the response from method Client.SetSecret. -type SetSecretResponse struct { - SecretBundle -} - -// UpdateSecretResponse contains the response from method Client.UpdateSecret. -type UpdateSecretResponse struct { - SecretBundle -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal/challenge_policy.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal/challenge_policy.go deleted file mode 100644 index 4cc1e429a..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal/challenge_policy.go +++ /dev/null @@ -1,255 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. - -package internal - -import ( - "bytes" - "errors" - "fmt" - "net/http" - "net/url" - "strings" - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/streaming" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/internal/errorinfo" - "github.com/Azure/azure-sdk-for-go/sdk/internal/temporal" -) - -const ( - headerAuthorization = "Authorization" - challengeMatchError = `challenge resource "%s" doesn't match the requested domain. Set DisableChallengeResourceVerification to true in your client options to disable. See https://aka.ms/azsdk/blog/vault-uri for more information` - bearerHeader = "Bearer " -) - -type KeyVaultChallengePolicyOptions struct { - // DisableChallengeResourceVerification controls whether the policy requires the - // authentication challenge resource to match the Key Vault or Managed HSM domain - DisableChallengeResourceVerification bool -} - -type KeyVaultChallengePolicy struct { - // mainResource is the resource to be retrieved using the tenant specified in the credential - mainResource *temporal.Resource[azcore.AccessToken, acquiringResourceState] - cred azcore.TokenCredential - scope *string - tenantID *string - verifyChallengeResource bool -} - -func NewKeyVaultChallengePolicy(cred azcore.TokenCredential, opts *KeyVaultChallengePolicyOptions) *KeyVaultChallengePolicy { - if opts == nil { - opts = &KeyVaultChallengePolicyOptions{} - } - return &KeyVaultChallengePolicy{ - cred: cred, - mainResource: temporal.NewResource(acquire), - verifyChallengeResource: !opts.DisableChallengeResourceVerification, - } -} - -func (k *KeyVaultChallengePolicy) Do(req *policy.Request) (*http.Response, error) { - as := acquiringResourceState{ - p: k, - req: req, - } - - if k.scope == nil || k.tenantID == nil { - // First request, get both to get the token - challengeReq, err := k.getChallengeRequest(*req) - if err != nil { - return nil, err - } - - resp, err := challengeReq.Next() - if err != nil { - return nil, err - } - - if resp.StatusCode > 399 && resp.StatusCode != http.StatusUnauthorized { - // the request failed for some other reason, don't try any further - return resp, nil - } - err = k.findScopeAndTenant(resp, req.Raw()) - if err != nil { - return nil, err - } - } - - tk, err := k.mainResource.Get(as) - if err != nil { - return nil, err - } - - req.Raw().Header.Set( - headerAuthorization, - fmt.Sprintf("%s%s", bearerHeader, tk.Token), - ) - - // send a copy of the request - cloneReq := req.Clone(req.Raw().Context()) - resp, cloneReqErr := cloneReq.Next() - if cloneReqErr != nil { - return nil, cloneReqErr - } - - // If it fails and has a 401, try it with a new token - if resp.StatusCode == 401 { - // Force a new token - k.mainResource.Expire() - - // Find the scope and tenant again in case they have changed - err := k.findScopeAndTenant(resp, req.Raw()) - if err != nil { - // Error parsing challenge, doomed to fail. Return - return resp, cloneReqErr - } - - tk, err := k.mainResource.Get(as) - if err != nil { - return resp, err - } - - req.Raw().Header.Set( - headerAuthorization, - bearerHeader+tk.Token, - ) - - // send the original request now - return req.Next() - } - - return resp, err -} - -// parses Tenant ID from auth challenge -// https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000 -func parseTenant(url string) *string { - if url == "" { - return to.Ptr("") - } - parts := strings.Split(url, "/") - tenant := parts[3] - tenant = strings.ReplaceAll(tenant, ",", "") - return &tenant -} - -type challengePolicyError struct { - err error -} - -func (c *challengePolicyError) Error() string { - return c.err.Error() -} - -func (*challengePolicyError) NonRetriable() { - // marker method -} - -func (c *challengePolicyError) Unwrap() error { - return c.err -} - -var _ errorinfo.NonRetriable = (*challengePolicyError)(nil) - -// sets the k.scope and k.tenantID from the WWW-Authenticate header -func (k *KeyVaultChallengePolicy) findScopeAndTenant(resp *http.Response, req *http.Request) error { - authHeader := resp.Header.Get("WWW-Authenticate") - if authHeader == "" { - return &challengePolicyError{err: errors.New("response has no WWW-Authenticate header for challenge authentication")} - } - - // Strip down to auth and resource - // Format is "Bearer authorization=\"\" resource=\"\"" OR - // "Bearer authorization=\"\" scope=\"\" resource=\"\"" - authHeader = strings.ReplaceAll(authHeader, "Bearer ", "") - - parts := strings.Split(authHeader, " ") - - vals := map[string]string{} - for _, part := range parts { - subParts := strings.Split(part, "=") - if len(subParts) == 2 { - stripped := strings.ReplaceAll(subParts[1], "\"", "") - stripped = strings.TrimSuffix(stripped, ",") - vals[subParts[0]] = stripped - } - } - - k.tenantID = parseTenant(vals["authorization"]) - scope := "" - if v, ok := vals["scope"]; ok { - scope = v - } else if v, ok := vals["resource"]; ok { - scope = v - } - if scope == "" { - return &challengePolicyError{err: errors.New("could not find a valid resource in the WWW-Authenticate header")} - } - if k.verifyChallengeResource { - // the challenge resource's host must match the requested vault's host - parsed, err := url.Parse(scope) - if err != nil { - return &challengePolicyError{err: fmt.Errorf(`invalid challenge resource "%s": %v`, scope, err)} - } - if !strings.HasSuffix(req.URL.Host, "."+parsed.Host) { - return &challengePolicyError{err: fmt.Errorf(challengeMatchError, scope)} - } - } - if !strings.HasSuffix(scope, "/.default") { - scope += "/.default" - } - k.scope = &scope - return nil -} - -func (k KeyVaultChallengePolicy) getChallengeRequest(orig policy.Request) (*policy.Request, error) { - req, err := runtime.NewRequest(orig.Raw().Context(), orig.Raw().Method, orig.Raw().URL.String()) - if err != nil { - return nil, &challengePolicyError{err: err} - } - - req.Raw().Header = orig.Raw().Header - req.Raw().Header.Set("Content-Length", "0") - req.Raw().ContentLength = 0 - - copied := orig.Clone(orig.Raw().Context()) - copied.Raw().Body = req.Body() - copied.Raw().ContentLength = 0 - copied.Raw().Header.Set("Content-Length", "0") - err = copied.SetBody(streaming.NopCloser(bytes.NewReader([]byte{})), "application/json") - if err != nil { - return nil, &challengePolicyError{err: err} - } - copied.Raw().Header.Del("Content-Type") - - return copied, err -} - -type acquiringResourceState struct { - req *policy.Request - p *KeyVaultChallengePolicy -} - -// acquire acquires or updates the resource; only one -// thread/goroutine at a time ever calls this function -func acquire(state acquiringResourceState) (newResource azcore.AccessToken, newExpiration time.Time, err error) { - tk, err := state.p.cred.GetToken( - state.req.Raw().Context(), - policy.TokenRequestOptions{ - Scopes: []string{*state.p.scope}, - }, - ) - if err != nil { - return azcore.AccessToken{}, time.Time{}, err - } - return tk, tk.ExpiresOn, nil -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/CHANGELOG.md new file mode 100644 index 000000000..bd9c8c90c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/CHANGELOG.md @@ -0,0 +1,320 @@ +# Release History + +## 2.2.0 (2023-11-24) +### Features Added + +- Support for test fakes and OpenTelemetry trace spans. + + +## 3.0.0-beta.1 (2023-07-28) +### Breaking Changes + +- Field `EffectiveRules` of struct `RoleManagementPolicyAssignmentProperties` has been removed + +### Features Added + +- New enum type `AccessRecommendationType` with values `AccessRecommendationTypeApprove`, `AccessRecommendationTypeDeny`, `AccessRecommendationTypeNoInfoAvailable` +- New enum type `AccessReviewActorIdentityType` with values `AccessReviewActorIdentityTypeServicePrincipal`, `AccessReviewActorIdentityTypeUser` +- New enum type `AccessReviewApplyResult` with values `AccessReviewApplyResultAppliedSuccessfully`, `AccessReviewApplyResultAppliedSuccessfullyButObjectNotFound`, `AccessReviewApplyResultAppliedWithUnknownFailure`, `AccessReviewApplyResultApplyNotSupported`, `AccessReviewApplyResultApplying`, `AccessReviewApplyResultNew` +- New enum type `AccessReviewDecisionInsightType` with values `AccessReviewDecisionInsightTypeUserSignInInsight` +- New enum type `AccessReviewDecisionPrincipalResourceMembershipType` with values `AccessReviewDecisionPrincipalResourceMembershipTypeDirect`, `AccessReviewDecisionPrincipalResourceMembershipTypeIndirect` +- New enum type `AccessReviewHistoryDefinitionStatus` with values `AccessReviewHistoryDefinitionStatusDone`, `AccessReviewHistoryDefinitionStatusError`, `AccessReviewHistoryDefinitionStatusInProgress`, `AccessReviewHistoryDefinitionStatusRequested` +- New enum type `AccessReviewInstanceReviewersType` with values `AccessReviewInstanceReviewersTypeAssigned`, `AccessReviewInstanceReviewersTypeManagers`, `AccessReviewInstanceReviewersTypeSelf` +- New enum type `AccessReviewInstanceStatus` with values `AccessReviewInstanceStatusApplied`, `AccessReviewInstanceStatusApplying`, `AccessReviewInstanceStatusAutoReviewed`, `AccessReviewInstanceStatusAutoReviewing`, `AccessReviewInstanceStatusCompleted`, `AccessReviewInstanceStatusCompleting`, `AccessReviewInstanceStatusInProgress`, `AccessReviewInstanceStatusInitializing`, `AccessReviewInstanceStatusNotStarted`, `AccessReviewInstanceStatusScheduled`, `AccessReviewInstanceStatusStarting` +- New enum type `AccessReviewRecurrencePatternType` with values `AccessReviewRecurrencePatternTypeAbsoluteMonthly`, `AccessReviewRecurrencePatternTypeWeekly` +- New enum type `AccessReviewRecurrenceRangeType` with values `AccessReviewRecurrenceRangeTypeEndDate`, `AccessReviewRecurrenceRangeTypeNoEnd`, `AccessReviewRecurrenceRangeTypeNumbered` +- New enum type `AccessReviewResult` with values `AccessReviewResultApprove`, `AccessReviewResultDeny`, `AccessReviewResultDontKnow`, `AccessReviewResultNotNotified`, `AccessReviewResultNotReviewed` +- New enum type `AccessReviewReviewerType` with values `AccessReviewReviewerTypeServicePrincipal`, `AccessReviewReviewerTypeUser` +- New enum type `AccessReviewScheduleDefinitionReviewersType` with values `AccessReviewScheduleDefinitionReviewersTypeAssigned`, `AccessReviewScheduleDefinitionReviewersTypeManagers`, `AccessReviewScheduleDefinitionReviewersTypeSelf` +- New enum type `AccessReviewScheduleDefinitionStatus` with values `AccessReviewScheduleDefinitionStatusApplied`, `AccessReviewScheduleDefinitionStatusApplying`, `AccessReviewScheduleDefinitionStatusAutoReviewed`, `AccessReviewScheduleDefinitionStatusAutoReviewing`, `AccessReviewScheduleDefinitionStatusCompleted`, `AccessReviewScheduleDefinitionStatusCompleting`, `AccessReviewScheduleDefinitionStatusInProgress`, `AccessReviewScheduleDefinitionStatusInitializing`, `AccessReviewScheduleDefinitionStatusNotStarted`, `AccessReviewScheduleDefinitionStatusScheduled`, `AccessReviewScheduleDefinitionStatusStarting` +- New enum type `AccessReviewScopeAssignmentState` with values `AccessReviewScopeAssignmentStateActive`, `AccessReviewScopeAssignmentStateEligible` +- New enum type `AccessReviewScopePrincipalType` with values `AccessReviewScopePrincipalTypeGuestUser`, `AccessReviewScopePrincipalTypeRedeemedGuestUser`, `AccessReviewScopePrincipalTypeServicePrincipal`, `AccessReviewScopePrincipalTypeUser`, `AccessReviewScopePrincipalTypeUserGroup` +- New enum type `DecisionResourceType` with values `DecisionResourceTypeAzureRole` +- New enum type `DecisionTargetType` with values `DecisionTargetTypeServicePrincipal`, `DecisionTargetTypeUser` +- New enum type `DefaultDecisionType` with values `DefaultDecisionTypeApprove`, `DefaultDecisionTypeDeny`, `DefaultDecisionTypeRecommendation` +- New enum type `RecordAllDecisionsResult` with values `RecordAllDecisionsResultApprove`, `RecordAllDecisionsResultDeny` +- New enum type `SeverityLevel` with values `SeverityLevelHigh`, `SeverityLevelLow`, `SeverityLevelMedium` +- New function `*AccessReviewDecisionIdentity.GetAccessReviewDecisionIdentity() *AccessReviewDecisionIdentity` +- New function `*AccessReviewDecisionInsightProperties.GetAccessReviewDecisionInsightProperties() *AccessReviewDecisionInsightProperties` +- New function `*AccessReviewDecisionServicePrincipalIdentity.GetAccessReviewDecisionIdentity() *AccessReviewDecisionIdentity` +- New function `*AccessReviewDecisionUserIdentity.GetAccessReviewDecisionIdentity() *AccessReviewDecisionIdentity` +- New function `*AccessReviewDecisionUserSignInInsightProperties.GetAccessReviewDecisionInsightProperties() *AccessReviewDecisionInsightProperties` +- New function `NewAccessReviewDefaultSettingsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewDefaultSettingsClient, error)` +- New function `*AccessReviewDefaultSettingsClient.Get(context.Context, *AccessReviewDefaultSettingsClientGetOptions) (AccessReviewDefaultSettingsClientGetResponse, error)` +- New function `*AccessReviewDefaultSettingsClient.Put(context.Context, AccessReviewScheduleSettings, *AccessReviewDefaultSettingsClientPutOptions) (AccessReviewDefaultSettingsClientPutResponse, error)` +- New function `NewAccessReviewHistoryDefinitionClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewHistoryDefinitionClient, error)` +- New function `*AccessReviewHistoryDefinitionClient.Create(context.Context, string, AccessReviewHistoryDefinitionProperties, *AccessReviewHistoryDefinitionClientCreateOptions) (AccessReviewHistoryDefinitionClientCreateResponse, error)` +- New function `*AccessReviewHistoryDefinitionClient.DeleteByID(context.Context, string, *AccessReviewHistoryDefinitionClientDeleteByIDOptions) (AccessReviewHistoryDefinitionClientDeleteByIDResponse, error)` +- New function `NewAccessReviewHistoryDefinitionInstanceClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewHistoryDefinitionInstanceClient, error)` +- New function `*AccessReviewHistoryDefinitionInstanceClient.GenerateDownloadURI(context.Context, string, string, *AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIOptions) (AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse, error)` +- New function `NewAccessReviewHistoryDefinitionInstancesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewHistoryDefinitionInstancesClient, error)` +- New function `*AccessReviewHistoryDefinitionInstancesClient.NewListPager(string, *AccessReviewHistoryDefinitionInstancesClientListOptions) *runtime.Pager[AccessReviewHistoryDefinitionInstancesClientListResponse]` +- New function `NewAccessReviewHistoryDefinitionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewHistoryDefinitionsClient, error)` +- New function `*AccessReviewHistoryDefinitionsClient.GetByID(context.Context, string, *AccessReviewHistoryDefinitionsClientGetByIDOptions) (AccessReviewHistoryDefinitionsClientGetByIDResponse, error)` +- New function `*AccessReviewHistoryDefinitionsClient.NewListPager(*AccessReviewHistoryDefinitionsClientListOptions) *runtime.Pager[AccessReviewHistoryDefinitionsClientListResponse]` +- New function `NewAccessReviewInstanceClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewInstanceClient, error)` +- New function `*AccessReviewInstanceClient.AcceptRecommendations(context.Context, string, string, *AccessReviewInstanceClientAcceptRecommendationsOptions) (AccessReviewInstanceClientAcceptRecommendationsResponse, error)` +- New function `*AccessReviewInstanceClient.ApplyDecisions(context.Context, string, string, *AccessReviewInstanceClientApplyDecisionsOptions) (AccessReviewInstanceClientApplyDecisionsResponse, error)` +- New function `*AccessReviewInstanceClient.ResetDecisions(context.Context, string, string, *AccessReviewInstanceClientResetDecisionsOptions) (AccessReviewInstanceClientResetDecisionsResponse, error)` +- New function `*AccessReviewInstanceClient.SendReminders(context.Context, string, string, *AccessReviewInstanceClientSendRemindersOptions) (AccessReviewInstanceClientSendRemindersResponse, error)` +- New function `*AccessReviewInstanceClient.Stop(context.Context, string, string, *AccessReviewInstanceClientStopOptions) (AccessReviewInstanceClientStopResponse, error)` +- New function `NewAccessReviewInstanceContactedReviewersClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewInstanceContactedReviewersClient, error)` +- New function `*AccessReviewInstanceContactedReviewersClient.NewListPager(string, string, *AccessReviewInstanceContactedReviewersClientListOptions) *runtime.Pager[AccessReviewInstanceContactedReviewersClientListResponse]` +- New function `NewAccessReviewInstanceDecisionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewInstanceDecisionsClient, error)` +- New function `*AccessReviewInstanceDecisionsClient.NewListPager(string, string, *AccessReviewInstanceDecisionsClientListOptions) *runtime.Pager[AccessReviewInstanceDecisionsClientListResponse]` +- New function `NewAccessReviewInstanceMyDecisionsClient(azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewInstanceMyDecisionsClient, error)` +- New function `*AccessReviewInstanceMyDecisionsClient.GetByID(context.Context, string, string, string, *AccessReviewInstanceMyDecisionsClientGetByIDOptions) (AccessReviewInstanceMyDecisionsClientGetByIDResponse, error)` +- New function `*AccessReviewInstanceMyDecisionsClient.NewListPager(string, string, *AccessReviewInstanceMyDecisionsClientListOptions) *runtime.Pager[AccessReviewInstanceMyDecisionsClientListResponse]` +- New function `*AccessReviewInstanceMyDecisionsClient.Patch(context.Context, string, string, string, AccessReviewDecisionProperties, *AccessReviewInstanceMyDecisionsClientPatchOptions) (AccessReviewInstanceMyDecisionsClientPatchResponse, error)` +- New function `NewAccessReviewInstancesAssignedForMyApprovalClient(azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewInstancesAssignedForMyApprovalClient, error)` +- New function `*AccessReviewInstancesAssignedForMyApprovalClient.GetByID(context.Context, string, string, *AccessReviewInstancesAssignedForMyApprovalClientGetByIDOptions) (AccessReviewInstancesAssignedForMyApprovalClientGetByIDResponse, error)` +- New function `*AccessReviewInstancesAssignedForMyApprovalClient.NewListPager(string, *AccessReviewInstancesAssignedForMyApprovalClientListOptions) *runtime.Pager[AccessReviewInstancesAssignedForMyApprovalClientListResponse]` +- New function `NewAccessReviewInstancesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewInstancesClient, error)` +- New function `*AccessReviewInstancesClient.Create(context.Context, string, string, AccessReviewInstanceProperties, *AccessReviewInstancesClientCreateOptions) (AccessReviewInstancesClientCreateResponse, error)` +- New function `*AccessReviewInstancesClient.GetByID(context.Context, string, string, *AccessReviewInstancesClientGetByIDOptions) (AccessReviewInstancesClientGetByIDResponse, error)` +- New function `*AccessReviewInstancesClient.NewListPager(string, *AccessReviewInstancesClientListOptions) *runtime.Pager[AccessReviewInstancesClientListResponse]` +- New function `NewAccessReviewScheduleDefinitionsAssignedForMyApprovalClient(azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewScheduleDefinitionsAssignedForMyApprovalClient, error)` +- New function `*AccessReviewScheduleDefinitionsAssignedForMyApprovalClient.NewListPager(*AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListOptions) *runtime.Pager[AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListResponse]` +- New function `NewAccessReviewScheduleDefinitionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewScheduleDefinitionsClient, error)` +- New function `*AccessReviewScheduleDefinitionsClient.CreateOrUpdateByID(context.Context, string, AccessReviewScheduleDefinitionProperties, *AccessReviewScheduleDefinitionsClientCreateOrUpdateByIDOptions) (AccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse, error)` +- New function `*AccessReviewScheduleDefinitionsClient.DeleteByID(context.Context, string, *AccessReviewScheduleDefinitionsClientDeleteByIDOptions) (AccessReviewScheduleDefinitionsClientDeleteByIDResponse, error)` +- New function `*AccessReviewScheduleDefinitionsClient.GetByID(context.Context, string, *AccessReviewScheduleDefinitionsClientGetByIDOptions) (AccessReviewScheduleDefinitionsClientGetByIDResponse, error)` +- New function `*AccessReviewScheduleDefinitionsClient.NewListPager(*AccessReviewScheduleDefinitionsClientListOptions) *runtime.Pager[AccessReviewScheduleDefinitionsClientListResponse]` +- New function `*AccessReviewScheduleDefinitionsClient.Stop(context.Context, string, *AccessReviewScheduleDefinitionsClientStopOptions) (AccessReviewScheduleDefinitionsClientStopResponse, error)` +- New function `*AlertConfigurationProperties.GetAlertConfigurationProperties() *AlertConfigurationProperties` +- New function `NewAlertConfigurationsClient(azcore.TokenCredential, *arm.ClientOptions) (*AlertConfigurationsClient, error)` +- New function `*AlertConfigurationsClient.Get(context.Context, string, string, *AlertConfigurationsClientGetOptions) (AlertConfigurationsClientGetResponse, error)` +- New function `*AlertConfigurationsClient.NewListForScopePager(string, *AlertConfigurationsClientListForScopeOptions) *runtime.Pager[AlertConfigurationsClientListForScopeResponse]` +- New function `*AlertConfigurationsClient.Update(context.Context, string, string, AlertConfiguration, *AlertConfigurationsClientUpdateOptions) (AlertConfigurationsClientUpdateResponse, error)` +- New function `NewAlertDefinitionsClient(azcore.TokenCredential, *arm.ClientOptions) (*AlertDefinitionsClient, error)` +- New function `*AlertDefinitionsClient.Get(context.Context, string, string, *AlertDefinitionsClientGetOptions) (AlertDefinitionsClientGetResponse, error)` +- New function `*AlertDefinitionsClient.NewListForScopePager(string, *AlertDefinitionsClientListForScopeOptions) *runtime.Pager[AlertDefinitionsClientListForScopeResponse]` +- New function `*AlertIncidentProperties.GetAlertIncidentProperties() *AlertIncidentProperties` +- New function `NewAlertIncidentsClient(azcore.TokenCredential, *arm.ClientOptions) (*AlertIncidentsClient, error)` +- New function `*AlertIncidentsClient.Get(context.Context, string, string, string, *AlertIncidentsClientGetOptions) (AlertIncidentsClientGetResponse, error)` +- New function `*AlertIncidentsClient.NewListForScopePager(string, string, *AlertIncidentsClientListForScopeOptions) *runtime.Pager[AlertIncidentsClientListForScopeResponse]` +- New function `*AlertIncidentsClient.Remediate(context.Context, string, string, string, *AlertIncidentsClientRemediateOptions) (AlertIncidentsClientRemediateResponse, error)` +- New function `NewAlertOperationClient(azcore.TokenCredential, *arm.ClientOptions) (*AlertOperationClient, error)` +- New function `*AlertOperationClient.Get(context.Context, string, string, *AlertOperationClientGetOptions) (AlertOperationClientGetResponse, error)` +- New function `NewAlertsClient(azcore.TokenCredential, *arm.ClientOptions) (*AlertsClient, error)` +- New function `*AlertsClient.Get(context.Context, string, string, *AlertsClientGetOptions) (AlertsClientGetResponse, error)` +- New function `*AlertsClient.NewListForScopePager(string, *AlertsClientListForScopeOptions) *runtime.Pager[AlertsClientListForScopeResponse]` +- New function `*AlertsClient.BeginRefresh(context.Context, string, string, *AlertsClientBeginRefreshOptions) (*runtime.Poller[AlertsClientRefreshResponse], error)` +- New function `*AlertsClient.BeginRefreshAll(context.Context, string, *AlertsClientBeginRefreshAllOptions) (*runtime.Poller[AlertsClientRefreshAllResponse], error)` +- New function `*AlertsClient.Update(context.Context, string, string, Alert, *AlertsClientUpdateOptions) (AlertsClientUpdateResponse, error)` +- New function `*AzureRolesAssignedOutsidePimAlertConfigurationProperties.GetAlertConfigurationProperties() *AlertConfigurationProperties` +- New function `*AzureRolesAssignedOutsidePimAlertIncidentProperties.GetAlertIncidentProperties() *AlertIncidentProperties` +- New function `*ClientFactory.NewAccessReviewDefaultSettingsClient() *AccessReviewDefaultSettingsClient` +- New function `*ClientFactory.NewAccessReviewHistoryDefinitionClient() *AccessReviewHistoryDefinitionClient` +- New function `*ClientFactory.NewAccessReviewHistoryDefinitionInstanceClient() *AccessReviewHistoryDefinitionInstanceClient` +- New function `*ClientFactory.NewAccessReviewHistoryDefinitionInstancesClient() *AccessReviewHistoryDefinitionInstancesClient` +- New function `*ClientFactory.NewAccessReviewHistoryDefinitionsClient() *AccessReviewHistoryDefinitionsClient` +- New function `*ClientFactory.NewAccessReviewInstanceClient() *AccessReviewInstanceClient` +- New function `*ClientFactory.NewAccessReviewInstanceContactedReviewersClient() *AccessReviewInstanceContactedReviewersClient` +- New function `*ClientFactory.NewAccessReviewInstanceDecisionsClient() *AccessReviewInstanceDecisionsClient` +- New function `*ClientFactory.NewAccessReviewInstanceMyDecisionsClient() *AccessReviewInstanceMyDecisionsClient` +- New function `*ClientFactory.NewAccessReviewInstancesAssignedForMyApprovalClient() *AccessReviewInstancesAssignedForMyApprovalClient` +- New function `*ClientFactory.NewAccessReviewInstancesClient() *AccessReviewInstancesClient` +- New function `*ClientFactory.NewAccessReviewScheduleDefinitionsAssignedForMyApprovalClient() *AccessReviewScheduleDefinitionsAssignedForMyApprovalClient` +- New function `*ClientFactory.NewAccessReviewScheduleDefinitionsClient() *AccessReviewScheduleDefinitionsClient` +- New function `*ClientFactory.NewAlertConfigurationsClient() *AlertConfigurationsClient` +- New function `*ClientFactory.NewAlertDefinitionsClient() *AlertDefinitionsClient` +- New function `*ClientFactory.NewAlertIncidentsClient() *AlertIncidentsClient` +- New function `*ClientFactory.NewAlertOperationClient() *AlertOperationClient` +- New function `*ClientFactory.NewAlertsClient() *AlertsClient` +- New function `*ClientFactory.NewOperationsClient() *OperationsClient` +- New function `*ClientFactory.NewScopeAccessReviewDefaultSettingsClient() *ScopeAccessReviewDefaultSettingsClient` +- New function `*ClientFactory.NewScopeAccessReviewHistoryDefinitionClient() *ScopeAccessReviewHistoryDefinitionClient` +- New function `*ClientFactory.NewScopeAccessReviewHistoryDefinitionInstanceClient() *ScopeAccessReviewHistoryDefinitionInstanceClient` +- New function `*ClientFactory.NewScopeAccessReviewHistoryDefinitionInstancesClient() *ScopeAccessReviewHistoryDefinitionInstancesClient` +- New function `*ClientFactory.NewScopeAccessReviewHistoryDefinitionsClient() *ScopeAccessReviewHistoryDefinitionsClient` +- New function `*ClientFactory.NewScopeAccessReviewInstanceClient() *ScopeAccessReviewInstanceClient` +- New function `*ClientFactory.NewScopeAccessReviewInstanceContactedReviewersClient() *ScopeAccessReviewInstanceContactedReviewersClient` +- New function `*ClientFactory.NewScopeAccessReviewInstanceDecisionsClient() *ScopeAccessReviewInstanceDecisionsClient` +- New function `*ClientFactory.NewScopeAccessReviewInstancesClient() *ScopeAccessReviewInstancesClient` +- New function `*ClientFactory.NewScopeAccessReviewScheduleDefinitionsClient() *ScopeAccessReviewScheduleDefinitionsClient` +- New function `*ClientFactory.NewTenantLevelAccessReviewInstanceContactedReviewersClient() *TenantLevelAccessReviewInstanceContactedReviewersClient` +- New function `*DuplicateRoleCreatedAlertConfigurationProperties.GetAlertConfigurationProperties() *AlertConfigurationProperties` +- New function `*DuplicateRoleCreatedAlertIncidentProperties.GetAlertIncidentProperties() *AlertIncidentProperties` +- New function `NewOperationsClient(azcore.TokenCredential, *arm.ClientOptions) (*OperationsClient, error)` +- New function `*OperationsClient.NewListPager(*OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse]` +- New function `NewScopeAccessReviewDefaultSettingsClient(azcore.TokenCredential, *arm.ClientOptions) (*ScopeAccessReviewDefaultSettingsClient, error)` +- New function `*ScopeAccessReviewDefaultSettingsClient.Get(context.Context, string, *ScopeAccessReviewDefaultSettingsClientGetOptions) (ScopeAccessReviewDefaultSettingsClientGetResponse, error)` +- New function `*ScopeAccessReviewDefaultSettingsClient.Put(context.Context, string, AccessReviewScheduleSettings, *ScopeAccessReviewDefaultSettingsClientPutOptions) (ScopeAccessReviewDefaultSettingsClientPutResponse, error)` +- New function `NewScopeAccessReviewHistoryDefinitionClient(azcore.TokenCredential, *arm.ClientOptions) (*ScopeAccessReviewHistoryDefinitionClient, error)` +- New function `*ScopeAccessReviewHistoryDefinitionClient.Create(context.Context, string, string, AccessReviewHistoryDefinitionProperties, *ScopeAccessReviewHistoryDefinitionClientCreateOptions) (ScopeAccessReviewHistoryDefinitionClientCreateResponse, error)` +- New function `*ScopeAccessReviewHistoryDefinitionClient.DeleteByID(context.Context, string, string, *ScopeAccessReviewHistoryDefinitionClientDeleteByIDOptions) (ScopeAccessReviewHistoryDefinitionClientDeleteByIDResponse, error)` +- New function `NewScopeAccessReviewHistoryDefinitionInstanceClient(azcore.TokenCredential, *arm.ClientOptions) (*ScopeAccessReviewHistoryDefinitionInstanceClient, error)` +- New function `*ScopeAccessReviewHistoryDefinitionInstanceClient.GenerateDownloadURI(context.Context, string, string, string, *ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIOptions) (ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse, error)` +- New function `NewScopeAccessReviewHistoryDefinitionInstancesClient(azcore.TokenCredential, *arm.ClientOptions) (*ScopeAccessReviewHistoryDefinitionInstancesClient, error)` +- New function `*ScopeAccessReviewHistoryDefinitionInstancesClient.NewListPager(string, string, *ScopeAccessReviewHistoryDefinitionInstancesClientListOptions) *runtime.Pager[ScopeAccessReviewHistoryDefinitionInstancesClientListResponse]` +- New function `NewScopeAccessReviewHistoryDefinitionsClient(azcore.TokenCredential, *arm.ClientOptions) (*ScopeAccessReviewHistoryDefinitionsClient, error)` +- New function `*ScopeAccessReviewHistoryDefinitionsClient.GetByID(context.Context, string, string, *ScopeAccessReviewHistoryDefinitionsClientGetByIDOptions) (ScopeAccessReviewHistoryDefinitionsClientGetByIDResponse, error)` +- New function `*ScopeAccessReviewHistoryDefinitionsClient.NewListPager(string, *ScopeAccessReviewHistoryDefinitionsClientListOptions) *runtime.Pager[ScopeAccessReviewHistoryDefinitionsClientListResponse]` +- New function `NewScopeAccessReviewInstanceClient(azcore.TokenCredential, *arm.ClientOptions) (*ScopeAccessReviewInstanceClient, error)` +- New function `*ScopeAccessReviewInstanceClient.ApplyDecisions(context.Context, string, string, string, *ScopeAccessReviewInstanceClientApplyDecisionsOptions) (ScopeAccessReviewInstanceClientApplyDecisionsResponse, error)` +- New function `*ScopeAccessReviewInstanceClient.RecordAllDecisions(context.Context, string, string, string, RecordAllDecisionsProperties, *ScopeAccessReviewInstanceClientRecordAllDecisionsOptions) (ScopeAccessReviewInstanceClientRecordAllDecisionsResponse, error)` +- New function `*ScopeAccessReviewInstanceClient.ResetDecisions(context.Context, string, string, string, *ScopeAccessReviewInstanceClientResetDecisionsOptions) (ScopeAccessReviewInstanceClientResetDecisionsResponse, error)` +- New function `*ScopeAccessReviewInstanceClient.SendReminders(context.Context, string, string, string, *ScopeAccessReviewInstanceClientSendRemindersOptions) (ScopeAccessReviewInstanceClientSendRemindersResponse, error)` +- New function `*ScopeAccessReviewInstanceClient.Stop(context.Context, string, string, string, *ScopeAccessReviewInstanceClientStopOptions) (ScopeAccessReviewInstanceClientStopResponse, error)` +- New function `NewScopeAccessReviewInstanceContactedReviewersClient(azcore.TokenCredential, *arm.ClientOptions) (*ScopeAccessReviewInstanceContactedReviewersClient, error)` +- New function `*ScopeAccessReviewInstanceContactedReviewersClient.NewListPager(string, string, string, *ScopeAccessReviewInstanceContactedReviewersClientListOptions) *runtime.Pager[ScopeAccessReviewInstanceContactedReviewersClientListResponse]` +- New function `NewScopeAccessReviewInstanceDecisionsClient(azcore.TokenCredential, *arm.ClientOptions) (*ScopeAccessReviewInstanceDecisionsClient, error)` +- New function `*ScopeAccessReviewInstanceDecisionsClient.NewListPager(string, string, string, *ScopeAccessReviewInstanceDecisionsClientListOptions) *runtime.Pager[ScopeAccessReviewInstanceDecisionsClientListResponse]` +- New function `NewScopeAccessReviewInstancesClient(azcore.TokenCredential, *arm.ClientOptions) (*ScopeAccessReviewInstancesClient, error)` +- New function `*ScopeAccessReviewInstancesClient.Create(context.Context, string, string, string, AccessReviewInstanceProperties, *ScopeAccessReviewInstancesClientCreateOptions) (ScopeAccessReviewInstancesClientCreateResponse, error)` +- New function `*ScopeAccessReviewInstancesClient.GetByID(context.Context, string, string, string, *ScopeAccessReviewInstancesClientGetByIDOptions) (ScopeAccessReviewInstancesClientGetByIDResponse, error)` +- New function `*ScopeAccessReviewInstancesClient.NewListPager(string, string, *ScopeAccessReviewInstancesClientListOptions) *runtime.Pager[ScopeAccessReviewInstancesClientListResponse]` +- New function `NewScopeAccessReviewScheduleDefinitionsClient(azcore.TokenCredential, *arm.ClientOptions) (*ScopeAccessReviewScheduleDefinitionsClient, error)` +- New function `*ScopeAccessReviewScheduleDefinitionsClient.CreateOrUpdateByID(context.Context, string, string, AccessReviewScheduleDefinitionProperties, *ScopeAccessReviewScheduleDefinitionsClientCreateOrUpdateByIDOptions) (ScopeAccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse, error)` +- New function `*ScopeAccessReviewScheduleDefinitionsClient.DeleteByID(context.Context, string, string, *ScopeAccessReviewScheduleDefinitionsClientDeleteByIDOptions) (ScopeAccessReviewScheduleDefinitionsClientDeleteByIDResponse, error)` +- New function `*ScopeAccessReviewScheduleDefinitionsClient.GetByID(context.Context, string, string, *ScopeAccessReviewScheduleDefinitionsClientGetByIDOptions) (ScopeAccessReviewScheduleDefinitionsClientGetByIDResponse, error)` +- New function `*ScopeAccessReviewScheduleDefinitionsClient.NewListPager(string, *ScopeAccessReviewScheduleDefinitionsClientListOptions) *runtime.Pager[ScopeAccessReviewScheduleDefinitionsClientListResponse]` +- New function `*ScopeAccessReviewScheduleDefinitionsClient.Stop(context.Context, string, string, *ScopeAccessReviewScheduleDefinitionsClientStopOptions) (ScopeAccessReviewScheduleDefinitionsClientStopResponse, error)` +- New function `NewTenantLevelAccessReviewInstanceContactedReviewersClient(azcore.TokenCredential, *arm.ClientOptions) (*TenantLevelAccessReviewInstanceContactedReviewersClient, error)` +- New function `*TenantLevelAccessReviewInstanceContactedReviewersClient.NewListPager(string, string, *TenantLevelAccessReviewInstanceContactedReviewersClientListOptions) *runtime.Pager[TenantLevelAccessReviewInstanceContactedReviewersClientListResponse]` +- New function `*TooManyOwnersAssignedToResourceAlertConfigurationProperties.GetAlertConfigurationProperties() *AlertConfigurationProperties` +- New function `*TooManyOwnersAssignedToResourceAlertIncidentProperties.GetAlertIncidentProperties() *AlertIncidentProperties` +- New function `*TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties.GetAlertConfigurationProperties() *AlertConfigurationProperties` +- New function `*TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties.GetAlertIncidentProperties() *AlertIncidentProperties` +- New struct `AccessReviewActorIdentity` +- New struct `AccessReviewContactedReviewer` +- New struct `AccessReviewContactedReviewerListResult` +- New struct `AccessReviewContactedReviewerProperties` +- New struct `AccessReviewDecision` +- New struct `AccessReviewDecisionInsight` +- New struct `AccessReviewDecisionListResult` +- New struct `AccessReviewDecisionPrincipalResourceMembership` +- New struct `AccessReviewDecisionProperties` +- New struct `AccessReviewDecisionResource` +- New struct `AccessReviewDecisionServicePrincipalIdentity` +- New struct `AccessReviewDecisionUserIdentity` +- New struct `AccessReviewDecisionUserSignInInsightProperties` +- New struct `AccessReviewDefaultSettings` +- New struct `AccessReviewHistoryDefinition` +- New struct `AccessReviewHistoryDefinitionInstanceListResult` +- New struct `AccessReviewHistoryDefinitionListResult` +- New struct `AccessReviewHistoryDefinitionProperties` +- New struct `AccessReviewHistoryInstance` +- New struct `AccessReviewHistoryInstanceProperties` +- New struct `AccessReviewHistoryScheduleSettings` +- New struct `AccessReviewInstance` +- New struct `AccessReviewInstanceListResult` +- New struct `AccessReviewInstanceProperties` +- New struct `AccessReviewRecurrencePattern` +- New struct `AccessReviewRecurrenceRange` +- New struct `AccessReviewRecurrenceSettings` +- New struct `AccessReviewReviewer` +- New struct `AccessReviewScheduleDefinition` +- New struct `AccessReviewScheduleDefinitionListResult` +- New struct `AccessReviewScheduleDefinitionProperties` +- New struct `AccessReviewScheduleSettings` +- New struct `AccessReviewScope` +- New struct `Alert` +- New struct `AlertConfiguration` +- New struct `AlertConfigurationListResult` +- New struct `AlertDefinition` +- New struct `AlertDefinitionListResult` +- New struct `AlertDefinitionProperties` +- New struct `AlertIncident` +- New struct `AlertIncidentListResult` +- New struct `AlertListResult` +- New struct `AlertOperationResult` +- New struct `AlertProperties` +- New struct `AzureRolesAssignedOutsidePimAlertConfigurationProperties` +- New struct `AzureRolesAssignedOutsidePimAlertIncidentProperties` +- New struct `DuplicateRoleCreatedAlertConfigurationProperties` +- New struct `DuplicateRoleCreatedAlertIncidentProperties` +- New struct `ErrorDefinition` +- New struct `ErrorDefinitionProperties` +- New struct `Operation` +- New struct `OperationDisplay` +- New struct `OperationListResult` +- New struct `RecordAllDecisionsProperties` +- New struct `TooManyOwnersAssignedToResourceAlertConfigurationProperties` +- New struct `TooManyOwnersAssignedToResourceAlertIncidentProperties` +- New struct `TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties` +- New struct `TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties` +- New field `Condition`, `ConditionVersion`, `CreatedBy`, `CreatedOn`, `UpdatedBy`, `UpdatedOn` in struct `DenyAssignmentProperties` +- New field `Condition`, `ConditionVersion` in struct `Permission` +- New field `CreatedBy`, `CreatedOn`, `UpdatedBy`, `UpdatedOn` in struct `RoleDefinitionProperties` + + +## 2.1.1 (2023-04-14) +### Bug Fixes + +- Fix serialization bug of empty value of `any` type. + +## 2.1.0 (2023-03-27) +### Features Added + +- New struct `ClientFactory` which is a client factory used to create any client in this module + + +## 2.0.0 (2022-09-26) +### Breaking Changes + +- Function `*RoleAssignmentsClient.NewListForResourcePager` parameter(s) have been changed from `(string, string, string, string, string, *RoleAssignmentsClientListForResourceOptions)` to `(string, string, string, string, *RoleAssignmentsClientListForResourceOptions)` +- Type of `RoleAssignment.Properties` has been changed from `*RoleAssignmentPropertiesWithScope` to `*RoleAssignmentProperties` +- Function `*RoleAssignmentsClient.NewListPager` has been renamed to `*RoleAssignmentsClient.NewListForSubscriptionPager` + +### Features Added + +- New function `*DenyAssignmentsClient.Get(context.Context, string, string, *DenyAssignmentsClientGetOptions) (DenyAssignmentsClientGetResponse, error)` +- New function `*DenyAssignmentsClient.NewListForScopePager(string, *DenyAssignmentsClientListForScopeOptions) *runtime.Pager[DenyAssignmentsClientListForScopeResponse]` +- New function `*DenyAssignmentsClient.NewListForResourcePager(string, string, string, string, string, *DenyAssignmentsClientListForResourceOptions) *runtime.Pager[DenyAssignmentsClientListForResourceResponse]` +- New function `*DenyAssignmentsClient.NewListForResourceGroupPager(string, *DenyAssignmentsClientListForResourceGroupOptions) *runtime.Pager[DenyAssignmentsClientListForResourceGroupResponse]` +- New function `*DenyAssignmentsClient.GetByID(context.Context, string, *DenyAssignmentsClientGetByIDOptions) (DenyAssignmentsClientGetByIDResponse, error)` +- New function `*DenyAssignmentsClient.NewListPager(*DenyAssignmentsClientListOptions) *runtime.Pager[DenyAssignmentsClientListResponse]` +- New function `NewDenyAssignmentsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*DenyAssignmentsClient, error)` +- New struct `DenyAssignment` +- New struct `DenyAssignmentFilter` +- New struct `DenyAssignmentListResult` +- New struct `DenyAssignmentPermission` +- New struct `DenyAssignmentProperties` +- New struct `DenyAssignmentsClient` +- New struct `DenyAssignmentsClientGetByIDOptions` +- New struct `DenyAssignmentsClientGetByIDResponse` +- New struct `DenyAssignmentsClientGetOptions` +- New struct `DenyAssignmentsClientGetResponse` +- New struct `DenyAssignmentsClientListForResourceGroupOptions` +- New struct `DenyAssignmentsClientListForResourceGroupResponse` +- New struct `DenyAssignmentsClientListForResourceOptions` +- New struct `DenyAssignmentsClientListForResourceResponse` +- New struct `DenyAssignmentsClientListForScopeOptions` +- New struct `DenyAssignmentsClientListForScopeResponse` +- New struct `DenyAssignmentsClientListOptions` +- New struct `DenyAssignmentsClientListResponse` +- New struct `ValidationResponse` +- New struct `ValidationResponseErrorInfo` +- New field `TenantID` in struct `RoleAssignmentsClientGetByIDOptions` +- New field `DataActions` in struct `Permission` +- New field `NotDataActions` in struct `Permission` +- New field `TenantID` in struct `RoleAssignmentsClientListForResourceOptions` +- New field `UpdatedBy` in struct `RoleAssignmentProperties` +- New field `Condition` in struct `RoleAssignmentProperties` +- New field `CreatedOn` in struct `RoleAssignmentProperties` +- New field `UpdatedOn` in struct `RoleAssignmentProperties` +- New field `CreatedBy` in struct `RoleAssignmentProperties` +- New field `ConditionVersion` in struct `RoleAssignmentProperties` +- New field `DelegatedManagedIdentityResourceID` in struct `RoleAssignmentProperties` +- New field `Description` in struct `RoleAssignmentProperties` +- New field `PrincipalType` in struct `RoleAssignmentProperties` +- New field `Scope` in struct `RoleAssignmentProperties` +- New field `TenantID` in struct `RoleAssignmentsClientDeleteByIDOptions` +- New field `IsDataAction` in struct `ProviderOperation` +- New field `TenantID` in struct `RoleAssignmentsClientDeleteOptions` +- New field `Type` in struct `RoleDefinitionFilter` +- New field `TenantID` in struct `RoleAssignmentsClientListForResourceGroupOptions` +- New field `TenantID` in struct `RoleAssignmentsClientGetOptions` +- New field `SkipToken` in struct `RoleAssignmentsClientListForScopeOptions` +- New field `TenantID` in struct `RoleAssignmentsClientListForScopeOptions` + + +## 1.0.0 (2022-06-02) + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 1.0.0, which contains breaking changes. + +To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/azsdk/go/mgmt/migration). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/LICENSE.txt b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/LICENSE.txt new file mode 100644 index 000000000..dc0c2ffb3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/README.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/README.md new file mode 100644 index 000000000..84ccf4ab1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/README.md @@ -0,0 +1,170 @@ +# Azure Authorization Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization) + +The `armauthorization` module provides operations for working with Azure Authorization. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/authorization/armauthorization) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.18 or above (You could download and install the latest version of Go from [here](https://go.dev/doc/install). It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this [doc](https://go.dev/doc/manage-install).) + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Authorization module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Authorization. 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) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Client Factory + +Azure Authorization module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := armauthorization.NewClientFactory(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +clientFactory, err := armauthorization.NewClientFactory(, cred, &options) +``` + +## Client Factory + +Azure XXX module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := armX.NewClientFactory(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +clientFactory, err := armX.NewClientFactory(, cred, &options) +``` + +## 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. + +```go +client := clientFactory.NewXClient() + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization) + +The `armauthorization` module provides operations for working with Azure Authorization. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/authorization/armauthorization) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.18 or above (You could download and install the latest version of Go from [here](https://go.dev/doc/install). It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this [doc](https://go.dev/doc/manage-install).) + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Authorization module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization +``` + +## Fakes + +The fake package contains types used for constructing in-memory fake servers used in unit tests. +This allows writing tests to cover various success/error conditions without the need for connecting to a live service. + +Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes. + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Authorization. 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) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Client Factory + +Azure Authorization module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := armauthorization.NewClientFactory(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +clientFactory, err := armauthorization.NewClientFactory(, cred, &options) +``` + +## 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. + +```go +client := clientFactory.NewPermissionsClient() +``` + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Authorization` label. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/autorest.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/autorest.md new file mode 100644 index 000000000..ef18c345b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/autorest.md @@ -0,0 +1,13 @@ +### AutoRest Configuration + +> see https://aka.ms/autorest + +``` yaml +azure-arm: true +require: +- https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 2.2.0 +tag: package-2022-04-01 +``` \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/build.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/build.go new file mode 100644 index 000000000..6d9616df8 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/build.go @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This file enables 'go generate' to regenerate this specific SDK +//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/authorization/armauthorization + +package armauthorization diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/ci.yml b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/ci.yml new file mode 100644 index 000000000..af58b0f74 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/ci.yml @@ -0,0 +1,28 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/authorization/armauthorization/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/authorization/armauthorization/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/authorization/armauthorization' diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/classicadministrators_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/classicadministrators_client.go new file mode 100644 index 000000000..b10e91fa1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/classicadministrators_client.go @@ -0,0 +1,99 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armauthorization + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ClassicAdministratorsClient contains the methods for the ClassicAdministrators group. +// Don't use this type directly, use NewClassicAdministratorsClient() instead. +type ClassicAdministratorsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewClassicAdministratorsClient creates a new instance of ClassicAdministratorsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewClassicAdministratorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClassicAdministratorsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ClassicAdministratorsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - Gets service administrator, account administrator, and co-administrators for the subscription. +// +// Generated from API version 2015-07-01 +// - options - ClassicAdministratorsClientListOptions contains the optional parameters for the ClassicAdministratorsClient.NewListPager +// method. +func (client *ClassicAdministratorsClient) NewListPager(options *ClassicAdministratorsClientListOptions) *runtime.Pager[ClassicAdministratorsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ClassicAdministratorsClientListResponse]{ + More: func(page ClassicAdministratorsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ClassicAdministratorsClientListResponse) (ClassicAdministratorsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ClassicAdministratorsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return ClassicAdministratorsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *ClassicAdministratorsClient) listCreateRequest(ctx context.Context, options *ClassicAdministratorsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/classicAdministrators" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2015-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ClassicAdministratorsClient) listHandleResponse(resp *http.Response) (ClassicAdministratorsClientListResponse, error) { + result := ClassicAdministratorsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ClassicAdministratorListResult); err != nil { + return ClassicAdministratorsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/client_factory.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/client_factory.go new file mode 100644 index 000000000..0bd46c858 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/client_factory.go @@ -0,0 +1,134 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armauthorization + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + credential azcore.TokenCredential + options *arm.ClientOptions +} + +// NewClientFactory creates a new instance of ClientFactory with the specified values. +// The parameter values will be propagated to any client created from this factory. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + _, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, credential: credential, + options: options.Clone(), + }, nil +} + +// NewClassicAdministratorsClient creates a new instance of ClassicAdministratorsClient. +func (c *ClientFactory) NewClassicAdministratorsClient() *ClassicAdministratorsClient { + subClient, _ := NewClassicAdministratorsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewDenyAssignmentsClient creates a new instance of DenyAssignmentsClient. +func (c *ClientFactory) NewDenyAssignmentsClient() *DenyAssignmentsClient { + subClient, _ := NewDenyAssignmentsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewEligibleChildResourcesClient creates a new instance of EligibleChildResourcesClient. +func (c *ClientFactory) NewEligibleChildResourcesClient() *EligibleChildResourcesClient { + subClient, _ := NewEligibleChildResourcesClient(c.credential, c.options) + return subClient +} + +// NewGlobalAdministratorClient creates a new instance of GlobalAdministratorClient. +func (c *ClientFactory) NewGlobalAdministratorClient() *GlobalAdministratorClient { + subClient, _ := NewGlobalAdministratorClient(c.credential, c.options) + return subClient +} + +// NewPermissionsClient creates a new instance of PermissionsClient. +func (c *ClientFactory) NewPermissionsClient() *PermissionsClient { + subClient, _ := NewPermissionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewProviderOperationsMetadataClient creates a new instance of ProviderOperationsMetadataClient. +func (c *ClientFactory) NewProviderOperationsMetadataClient() *ProviderOperationsMetadataClient { + subClient, _ := NewProviderOperationsMetadataClient(c.credential, c.options) + return subClient +} + +// NewRoleAssignmentScheduleInstancesClient creates a new instance of RoleAssignmentScheduleInstancesClient. +func (c *ClientFactory) NewRoleAssignmentScheduleInstancesClient() *RoleAssignmentScheduleInstancesClient { + subClient, _ := NewRoleAssignmentScheduleInstancesClient(c.credential, c.options) + return subClient +} + +// NewRoleAssignmentScheduleRequestsClient creates a new instance of RoleAssignmentScheduleRequestsClient. +func (c *ClientFactory) NewRoleAssignmentScheduleRequestsClient() *RoleAssignmentScheduleRequestsClient { + subClient, _ := NewRoleAssignmentScheduleRequestsClient(c.credential, c.options) + return subClient +} + +// NewRoleAssignmentSchedulesClient creates a new instance of RoleAssignmentSchedulesClient. +func (c *ClientFactory) NewRoleAssignmentSchedulesClient() *RoleAssignmentSchedulesClient { + subClient, _ := NewRoleAssignmentSchedulesClient(c.credential, c.options) + return subClient +} + +// NewRoleAssignmentsClient creates a new instance of RoleAssignmentsClient. +func (c *ClientFactory) NewRoleAssignmentsClient() *RoleAssignmentsClient { + subClient, _ := NewRoleAssignmentsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewRoleDefinitionsClient creates a new instance of RoleDefinitionsClient. +func (c *ClientFactory) NewRoleDefinitionsClient() *RoleDefinitionsClient { + subClient, _ := NewRoleDefinitionsClient(c.credential, c.options) + return subClient +} + +// NewRoleEligibilityScheduleInstancesClient creates a new instance of RoleEligibilityScheduleInstancesClient. +func (c *ClientFactory) NewRoleEligibilityScheduleInstancesClient() *RoleEligibilityScheduleInstancesClient { + subClient, _ := NewRoleEligibilityScheduleInstancesClient(c.credential, c.options) + return subClient +} + +// NewRoleEligibilityScheduleRequestsClient creates a new instance of RoleEligibilityScheduleRequestsClient. +func (c *ClientFactory) NewRoleEligibilityScheduleRequestsClient() *RoleEligibilityScheduleRequestsClient { + subClient, _ := NewRoleEligibilityScheduleRequestsClient(c.credential, c.options) + return subClient +} + +// NewRoleEligibilitySchedulesClient creates a new instance of RoleEligibilitySchedulesClient. +func (c *ClientFactory) NewRoleEligibilitySchedulesClient() *RoleEligibilitySchedulesClient { + subClient, _ := NewRoleEligibilitySchedulesClient(c.credential, c.options) + return subClient +} + +// NewRoleManagementPoliciesClient creates a new instance of RoleManagementPoliciesClient. +func (c *ClientFactory) NewRoleManagementPoliciesClient() *RoleManagementPoliciesClient { + subClient, _ := NewRoleManagementPoliciesClient(c.credential, c.options) + return subClient +} + +// NewRoleManagementPolicyAssignmentsClient creates a new instance of RoleManagementPolicyAssignmentsClient. +func (c *ClientFactory) NewRoleManagementPolicyAssignmentsClient() *RoleManagementPolicyAssignmentsClient { + subClient, _ := NewRoleManagementPolicyAssignmentsClient(c.credential, c.options) + return subClient +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/constants.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/constants.go new file mode 100644 index 000000000..bdc378893 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/constants.go @@ -0,0 +1,300 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armauthorization + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization" + moduleVersion = "v2.2.0" +) + +// ApprovalMode - The type of rule +type ApprovalMode string + +const ( + ApprovalModeNoApproval ApprovalMode = "NoApproval" + ApprovalModeParallel ApprovalMode = "Parallel" + ApprovalModeSerial ApprovalMode = "Serial" + ApprovalModeSingleStage ApprovalMode = "SingleStage" +) + +// PossibleApprovalModeValues returns the possible values for the ApprovalMode const type. +func PossibleApprovalModeValues() []ApprovalMode { + return []ApprovalMode{ + ApprovalModeNoApproval, + ApprovalModeParallel, + ApprovalModeSerial, + ApprovalModeSingleStage, + } +} + +// AssignmentType - Assignment type of the role assignment schedule +type AssignmentType string + +const ( + AssignmentTypeActivated AssignmentType = "Activated" + AssignmentTypeAssigned AssignmentType = "Assigned" +) + +// PossibleAssignmentTypeValues returns the possible values for the AssignmentType const type. +func PossibleAssignmentTypeValues() []AssignmentType { + return []AssignmentType{ + AssignmentTypeActivated, + AssignmentTypeAssigned, + } +} + +// EnablementRules - The type of enablement rule +type EnablementRules string + +const ( + EnablementRulesJustification EnablementRules = "Justification" + EnablementRulesMultiFactorAuthentication EnablementRules = "MultiFactorAuthentication" + EnablementRulesTicketing EnablementRules = "Ticketing" +) + +// PossibleEnablementRulesValues returns the possible values for the EnablementRules const type. +func PossibleEnablementRulesValues() []EnablementRules { + return []EnablementRules{ + EnablementRulesJustification, + EnablementRulesMultiFactorAuthentication, + EnablementRulesTicketing, + } +} + +// MemberType - Membership type of the role assignment schedule +type MemberType string + +const ( + MemberTypeDirect MemberType = "Direct" + MemberTypeGroup MemberType = "Group" + MemberTypeInherited MemberType = "Inherited" +) + +// PossibleMemberTypeValues returns the possible values for the MemberType const type. +func PossibleMemberTypeValues() []MemberType { + return []MemberType{ + MemberTypeDirect, + MemberTypeGroup, + MemberTypeInherited, + } +} + +// NotificationDeliveryMechanism - The type of notification. +type NotificationDeliveryMechanism string + +const ( + NotificationDeliveryMechanismEmail NotificationDeliveryMechanism = "Email" +) + +// PossibleNotificationDeliveryMechanismValues returns the possible values for the NotificationDeliveryMechanism const type. +func PossibleNotificationDeliveryMechanismValues() []NotificationDeliveryMechanism { + return []NotificationDeliveryMechanism{ + NotificationDeliveryMechanismEmail, + } +} + +// NotificationLevel - The notification level. +type NotificationLevel string + +const ( + NotificationLevelAll NotificationLevel = "All" + NotificationLevelCritical NotificationLevel = "Critical" + NotificationLevelNone NotificationLevel = "None" +) + +// PossibleNotificationLevelValues returns the possible values for the NotificationLevel const type. +func PossibleNotificationLevelValues() []NotificationLevel { + return []NotificationLevel{ + NotificationLevelAll, + NotificationLevelCritical, + NotificationLevelNone, + } +} + +// PrincipalType - The principal type of the assigned principal ID. +type PrincipalType string + +const ( + PrincipalTypeDevice PrincipalType = "Device" + PrincipalTypeForeignGroup PrincipalType = "ForeignGroup" + PrincipalTypeGroup PrincipalType = "Group" + PrincipalTypeServicePrincipal PrincipalType = "ServicePrincipal" + PrincipalTypeUser PrincipalType = "User" +) + +// PossiblePrincipalTypeValues returns the possible values for the PrincipalType const type. +func PossiblePrincipalTypeValues() []PrincipalType { + return []PrincipalType{ + PrincipalTypeDevice, + PrincipalTypeForeignGroup, + PrincipalTypeGroup, + PrincipalTypeServicePrincipal, + PrincipalTypeUser, + } +} + +// RecipientType - The recipient type. +type RecipientType string + +const ( + RecipientTypeAdmin RecipientType = "Admin" + RecipientTypeApprover RecipientType = "Approver" + RecipientTypeRequestor RecipientType = "Requestor" +) + +// PossibleRecipientTypeValues returns the possible values for the RecipientType const type. +func PossibleRecipientTypeValues() []RecipientType { + return []RecipientType{ + RecipientTypeAdmin, + RecipientTypeApprover, + RecipientTypeRequestor, + } +} + +// RequestType - The type of the role assignment schedule request. Eg: SelfActivate, AdminAssign etc +type RequestType string + +const ( + RequestTypeAdminAssign RequestType = "AdminAssign" + RequestTypeAdminExtend RequestType = "AdminExtend" + RequestTypeAdminRemove RequestType = "AdminRemove" + RequestTypeAdminRenew RequestType = "AdminRenew" + RequestTypeAdminUpdate RequestType = "AdminUpdate" + RequestTypeSelfActivate RequestType = "SelfActivate" + RequestTypeSelfDeactivate RequestType = "SelfDeactivate" + RequestTypeSelfExtend RequestType = "SelfExtend" + RequestTypeSelfRenew RequestType = "SelfRenew" +) + +// PossibleRequestTypeValues returns the possible values for the RequestType const type. +func PossibleRequestTypeValues() []RequestType { + return []RequestType{ + RequestTypeAdminAssign, + RequestTypeAdminExtend, + RequestTypeAdminRemove, + RequestTypeAdminRenew, + RequestTypeAdminUpdate, + RequestTypeSelfActivate, + RequestTypeSelfDeactivate, + RequestTypeSelfExtend, + RequestTypeSelfRenew, + } +} + +// RoleManagementPolicyRuleType - The type of rule +type RoleManagementPolicyRuleType string + +const ( + RoleManagementPolicyRuleTypeRoleManagementPolicyApprovalRule RoleManagementPolicyRuleType = "RoleManagementPolicyApprovalRule" + RoleManagementPolicyRuleTypeRoleManagementPolicyAuthenticationContextRule RoleManagementPolicyRuleType = "RoleManagementPolicyAuthenticationContextRule" + RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule RoleManagementPolicyRuleType = "RoleManagementPolicyEnablementRule" + RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule RoleManagementPolicyRuleType = "RoleManagementPolicyExpirationRule" + RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule RoleManagementPolicyRuleType = "RoleManagementPolicyNotificationRule" +) + +// PossibleRoleManagementPolicyRuleTypeValues returns the possible values for the RoleManagementPolicyRuleType const type. +func PossibleRoleManagementPolicyRuleTypeValues() []RoleManagementPolicyRuleType { + return []RoleManagementPolicyRuleType{ + RoleManagementPolicyRuleTypeRoleManagementPolicyApprovalRule, + RoleManagementPolicyRuleTypeRoleManagementPolicyAuthenticationContextRule, + RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule, + RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule, + RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule, + } +} + +// Status - The status of the role assignment schedule. +type Status string + +const ( + StatusAccepted Status = "Accepted" + StatusAdminApproved Status = "AdminApproved" + StatusAdminDenied Status = "AdminDenied" + StatusCanceled Status = "Canceled" + StatusDenied Status = "Denied" + StatusFailed Status = "Failed" + StatusFailedAsResourceIsLocked Status = "FailedAsResourceIsLocked" + StatusGranted Status = "Granted" + StatusInvalid Status = "Invalid" + StatusPendingAdminDecision Status = "PendingAdminDecision" + StatusPendingApproval Status = "PendingApproval" + StatusPendingApprovalProvisioning Status = "PendingApprovalProvisioning" + StatusPendingEvaluation Status = "PendingEvaluation" + StatusPendingExternalProvisioning Status = "PendingExternalProvisioning" + StatusPendingProvisioning Status = "PendingProvisioning" + StatusPendingRevocation Status = "PendingRevocation" + StatusPendingScheduleCreation Status = "PendingScheduleCreation" + StatusProvisioned Status = "Provisioned" + StatusProvisioningStarted Status = "ProvisioningStarted" + StatusRevoked Status = "Revoked" + StatusScheduleCreated Status = "ScheduleCreated" + StatusTimedOut Status = "TimedOut" +) + +// PossibleStatusValues returns the possible values for the Status const type. +func PossibleStatusValues() []Status { + return []Status{ + StatusAccepted, + StatusAdminApproved, + StatusAdminDenied, + StatusCanceled, + StatusDenied, + StatusFailed, + StatusFailedAsResourceIsLocked, + StatusGranted, + StatusInvalid, + StatusPendingAdminDecision, + StatusPendingApproval, + StatusPendingApprovalProvisioning, + StatusPendingEvaluation, + StatusPendingExternalProvisioning, + StatusPendingProvisioning, + StatusPendingRevocation, + StatusPendingScheduleCreation, + StatusProvisioned, + StatusProvisioningStarted, + StatusRevoked, + StatusScheduleCreated, + StatusTimedOut, + } +} + +// Type - Type of the role assignment schedule expiration +type Type string + +const ( + TypeAfterDateTime Type = "AfterDateTime" + TypeAfterDuration Type = "AfterDuration" + TypeNoExpiration Type = "NoExpiration" +) + +// PossibleTypeValues returns the possible values for the Type const type. +func PossibleTypeValues() []Type { + return []Type{ + TypeAfterDateTime, + TypeAfterDuration, + TypeNoExpiration, + } +} + +// UserType - The type of user. +type UserType string + +const ( + UserTypeGroup UserType = "Group" + UserTypeUser UserType = "User" +) + +// PossibleUserTypeValues returns the possible values for the UserType const type. +func PossibleUserTypeValues() []UserType { + return []UserType{ + UserTypeGroup, + UserTypeUser, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/denyassignments_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/denyassignments_client.go new file mode 100644 index 000000000..16e58650f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/denyassignments_client.go @@ -0,0 +1,406 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armauthorization + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// DenyAssignmentsClient contains the methods for the DenyAssignments group. +// Don't use this type directly, use NewDenyAssignmentsClient() instead. +type DenyAssignmentsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewDenyAssignmentsClient creates a new instance of DenyAssignmentsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewDenyAssignmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DenyAssignmentsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DenyAssignmentsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get the specified deny assignment. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-04-01 +// - scope - The scope of the deny assignment. +// - denyAssignmentID - The ID of the deny assignment to get. +// - options - DenyAssignmentsClientGetOptions contains the optional parameters for the DenyAssignmentsClient.Get method. +func (client *DenyAssignmentsClient) Get(ctx context.Context, scope string, denyAssignmentID string, options *DenyAssignmentsClientGetOptions) (DenyAssignmentsClientGetResponse, error) { + var err error + const operationName = "DenyAssignmentsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, scope, denyAssignmentID, options) + if err != nil { + return DenyAssignmentsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DenyAssignmentsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DenyAssignmentsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *DenyAssignmentsClient) getCreateRequest(ctx context.Context, scope string, denyAssignmentID string, options *DenyAssignmentsClientGetOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if denyAssignmentID == "" { + return nil, errors.New("parameter denyAssignmentID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{denyAssignmentId}", url.PathEscape(denyAssignmentID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DenyAssignmentsClient) getHandleResponse(resp *http.Response) (DenyAssignmentsClientGetResponse, error) { + result := DenyAssignmentsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DenyAssignment); err != nil { + return DenyAssignmentsClientGetResponse{}, err + } + return result, nil +} + +// GetByID - Gets a deny assignment by ID. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-04-01 +// - denyAssignmentID - The fully qualified deny assignment ID. For example, use the format, /subscriptions/{guid}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} +// for subscription level deny assignments, +// or /providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for tenant level deny assignments. +// - options - DenyAssignmentsClientGetByIDOptions contains the optional parameters for the DenyAssignmentsClient.GetByID method. +func (client *DenyAssignmentsClient) GetByID(ctx context.Context, denyAssignmentID string, options *DenyAssignmentsClientGetByIDOptions) (DenyAssignmentsClientGetByIDResponse, error) { + var err error + const operationName = "DenyAssignmentsClient.GetByID" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getByIDCreateRequest(ctx, denyAssignmentID, options) + if err != nil { + return DenyAssignmentsClientGetByIDResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DenyAssignmentsClientGetByIDResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DenyAssignmentsClientGetByIDResponse{}, err + } + resp, err := client.getByIDHandleResponse(httpResp) + return resp, err +} + +// getByIDCreateRequest creates the GetByID request. +func (client *DenyAssignmentsClient) getByIDCreateRequest(ctx context.Context, denyAssignmentID string, options *DenyAssignmentsClientGetByIDOptions) (*policy.Request, error) { + urlPath := "/{denyAssignmentId}" + urlPath = strings.ReplaceAll(urlPath, "{denyAssignmentId}", denyAssignmentID) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getByIDHandleResponse handles the GetByID response. +func (client *DenyAssignmentsClient) getByIDHandleResponse(resp *http.Response) (DenyAssignmentsClientGetByIDResponse, error) { + result := DenyAssignmentsClientGetByIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DenyAssignment); err != nil { + return DenyAssignmentsClientGetByIDResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all deny assignments for the subscription. +// +// Generated from API version 2022-04-01 +// - options - DenyAssignmentsClientListOptions contains the optional parameters for the DenyAssignmentsClient.NewListPager +// method. +func (client *DenyAssignmentsClient) NewListPager(options *DenyAssignmentsClientListOptions) *runtime.Pager[DenyAssignmentsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[DenyAssignmentsClientListResponse]{ + More: func(page DenyAssignmentsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DenyAssignmentsClientListResponse) (DenyAssignmentsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DenyAssignmentsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return DenyAssignmentsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *DenyAssignmentsClient) listCreateRequest(ctx context.Context, options *DenyAssignmentsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/denyAssignments" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *DenyAssignmentsClient) listHandleResponse(resp *http.Response) (DenyAssignmentsClientListResponse, error) { + result := DenyAssignmentsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DenyAssignmentListResult); err != nil { + return DenyAssignmentsClientListResponse{}, err + } + return result, nil +} + +// NewListForResourcePager - Gets deny assignments for a resource. +// +// Generated from API version 2022-04-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceProviderNamespace - The namespace of the resource provider. +// - parentResourcePath - The parent resource identity. +// - resourceType - The resource type of the resource. +// - resourceName - The name of the resource to get deny assignments for. +// - options - DenyAssignmentsClientListForResourceOptions contains the optional parameters for the DenyAssignmentsClient.NewListForResourcePager +// method. +func (client *DenyAssignmentsClient) NewListForResourcePager(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, options *DenyAssignmentsClientListForResourceOptions) *runtime.Pager[DenyAssignmentsClientListForResourceResponse] { + return runtime.NewPager(runtime.PagingHandler[DenyAssignmentsClientListForResourceResponse]{ + More: func(page DenyAssignmentsClientListForResourceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DenyAssignmentsClientListForResourceResponse) (DenyAssignmentsClientListForResourceResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DenyAssignmentsClient.NewListForResourcePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listForResourceCreateRequest(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, options) + }, nil) + if err != nil { + return DenyAssignmentsClientListForResourceResponse{}, err + } + return client.listForResourceHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listForResourceCreateRequest creates the ListForResource request. +func (client *DenyAssignmentsClient) listForResourceCreateRequest(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, options *DenyAssignmentsClientListForResourceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/denyAssignments" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", resourceProviderNamespace) + urlPath = strings.ReplaceAll(urlPath, "{parentResourcePath}", parentResourcePath) + urlPath = strings.ReplaceAll(urlPath, "{resourceType}", resourceType) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listForResourceHandleResponse handles the ListForResource response. +func (client *DenyAssignmentsClient) listForResourceHandleResponse(resp *http.Response) (DenyAssignmentsClientListForResourceResponse, error) { + result := DenyAssignmentsClientListForResourceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DenyAssignmentListResult); err != nil { + return DenyAssignmentsClientListForResourceResponse{}, err + } + return result, nil +} + +// NewListForResourceGroupPager - Gets deny assignments for a resource group. +// +// Generated from API version 2022-04-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - DenyAssignmentsClientListForResourceGroupOptions contains the optional parameters for the DenyAssignmentsClient.NewListForResourceGroupPager +// method. +func (client *DenyAssignmentsClient) NewListForResourceGroupPager(resourceGroupName string, options *DenyAssignmentsClientListForResourceGroupOptions) *runtime.Pager[DenyAssignmentsClientListForResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[DenyAssignmentsClientListForResourceGroupResponse]{ + More: func(page DenyAssignmentsClientListForResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DenyAssignmentsClientListForResourceGroupResponse) (DenyAssignmentsClientListForResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DenyAssignmentsClient.NewListForResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listForResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return DenyAssignmentsClientListForResourceGroupResponse{}, err + } + return client.listForResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listForResourceGroupCreateRequest creates the ListForResourceGroup request. +func (client *DenyAssignmentsClient) listForResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *DenyAssignmentsClientListForResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/denyAssignments" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listForResourceGroupHandleResponse handles the ListForResourceGroup response. +func (client *DenyAssignmentsClient) listForResourceGroupHandleResponse(resp *http.Response) (DenyAssignmentsClientListForResourceGroupResponse, error) { + result := DenyAssignmentsClientListForResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DenyAssignmentListResult); err != nil { + return DenyAssignmentsClientListForResourceGroupResponse{}, err + } + return result, nil +} + +// NewListForScopePager - Gets deny assignments for a scope. +// +// Generated from API version 2022-04-01 +// - scope - The scope of the deny assignments. +// - options - DenyAssignmentsClientListForScopeOptions contains the optional parameters for the DenyAssignmentsClient.NewListForScopePager +// method. +func (client *DenyAssignmentsClient) NewListForScopePager(scope string, options *DenyAssignmentsClientListForScopeOptions) *runtime.Pager[DenyAssignmentsClientListForScopeResponse] { + return runtime.NewPager(runtime.PagingHandler[DenyAssignmentsClientListForScopeResponse]{ + More: func(page DenyAssignmentsClientListForScopeResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DenyAssignmentsClientListForScopeResponse) (DenyAssignmentsClientListForScopeResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DenyAssignmentsClient.NewListForScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listForScopeCreateRequest(ctx, scope, options) + }, nil) + if err != nil { + return DenyAssignmentsClientListForScopeResponse{}, err + } + return client.listForScopeHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listForScopeCreateRequest creates the ListForScope request. +func (client *DenyAssignmentsClient) listForScopeCreateRequest(ctx context.Context, scope string, options *DenyAssignmentsClientListForScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/denyAssignments" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listForScopeHandleResponse handles the ListForScope response. +func (client *DenyAssignmentsClient) listForScopeHandleResponse(resp *http.Response) (DenyAssignmentsClientListForScopeResponse, error) { + result := DenyAssignmentsClientListForScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DenyAssignmentListResult); err != nil { + return DenyAssignmentsClientListForScopeResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/eligiblechildresources_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/eligiblechildresources_client.go new file mode 100644 index 000000000..64efb1036 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/eligiblechildresources_client.go @@ -0,0 +1,95 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armauthorization + +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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" +) + +// EligibleChildResourcesClient contains the methods for the EligibleChildResources group. +// Don't use this type directly, use NewEligibleChildResourcesClient() instead. +type EligibleChildResourcesClient struct { + internal *arm.Client +} + +// NewEligibleChildResourcesClient creates a new instance of EligibleChildResourcesClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewEligibleChildResourcesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*EligibleChildResourcesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &EligibleChildResourcesClient{ + internal: cl, + } + return client, nil +} + +// NewGetPager - Get the child resources of a resource on which user has eligible access +// +// Generated from API version 2020-10-01 +// - scope - The scope of the role management policy. +// - options - EligibleChildResourcesClientGetOptions contains the optional parameters for the EligibleChildResourcesClient.NewGetPager +// method. +func (client *EligibleChildResourcesClient) NewGetPager(scope string, options *EligibleChildResourcesClientGetOptions) *runtime.Pager[EligibleChildResourcesClientGetResponse] { + return runtime.NewPager(runtime.PagingHandler[EligibleChildResourcesClientGetResponse]{ + More: func(page EligibleChildResourcesClientGetResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *EligibleChildResourcesClientGetResponse) (EligibleChildResourcesClientGetResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EligibleChildResourcesClient.NewGetPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.getCreateRequest(ctx, scope, options) + }, nil) + if err != nil { + return EligibleChildResourcesClientGetResponse{}, err + } + return client.getHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// getCreateRequest creates the Get request. +func (client *EligibleChildResourcesClient) getCreateRequest(ctx context.Context, scope string, options *EligibleChildResourcesClientGetOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/eligibleChildResources" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + reqQP.Set("api-version", "2020-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *EligibleChildResourcesClient) getHandleResponse(resp *http.Response) (EligibleChildResourcesClientGetResponse, error) { + result := EligibleChildResourcesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EligibleChildResourcesListResult); err != nil { + return EligibleChildResourcesClientGetResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/globaladministrator_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/globaladministrator_client.go new file mode 100644 index 000000000..7cc75f42f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/globaladministrator_client.go @@ -0,0 +1,79 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armauthorization + +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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" +) + +// GlobalAdministratorClient contains the methods for the GlobalAdministrator group. +// Don't use this type directly, use NewGlobalAdministratorClient() instead. +type GlobalAdministratorClient struct { + internal *arm.Client +} + +// NewGlobalAdministratorClient creates a new instance of GlobalAdministratorClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewGlobalAdministratorClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*GlobalAdministratorClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &GlobalAdministratorClient{ + internal: cl, + } + return client, nil +} + +// ElevateAccess - Elevates access for a Global Administrator. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2015-07-01 +// - options - GlobalAdministratorClientElevateAccessOptions contains the optional parameters for the GlobalAdministratorClient.ElevateAccess +// method. +func (client *GlobalAdministratorClient) ElevateAccess(ctx context.Context, options *GlobalAdministratorClientElevateAccessOptions) (GlobalAdministratorClientElevateAccessResponse, error) { + var err error + const operationName = "GlobalAdministratorClient.ElevateAccess" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.elevateAccessCreateRequest(ctx, options) + if err != nil { + return GlobalAdministratorClientElevateAccessResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GlobalAdministratorClientElevateAccessResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return GlobalAdministratorClientElevateAccessResponse{}, err + } + return GlobalAdministratorClientElevateAccessResponse{}, nil +} + +// elevateAccessCreateRequest creates the ElevateAccess request. +func (client *GlobalAdministratorClient) elevateAccessCreateRequest(ctx context.Context, options *GlobalAdministratorClientElevateAccessOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Authorization/elevateAccess" + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2015-07-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/authorization/armauthorization/v2/interfaces.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/interfaces.go new file mode 100644 index 000000000..7d6c52181 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/interfaces.go @@ -0,0 +1,19 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armauthorization + +// RoleManagementPolicyRuleClassification provides polymorphic access to related types. +// Call the interface's GetRoleManagementPolicyRule() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *RoleManagementPolicyApprovalRule, *RoleManagementPolicyAuthenticationContextRule, *RoleManagementPolicyEnablementRule, +// - *RoleManagementPolicyExpirationRule, *RoleManagementPolicyNotificationRule, *RoleManagementPolicyRule +type RoleManagementPolicyRuleClassification interface { + // GetRoleManagementPolicyRule returns the RoleManagementPolicyRule content of the underlying type. + GetRoleManagementPolicyRule() *RoleManagementPolicyRule +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/models.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/models.go new file mode 100644 index 000000000..2ee2c7c3c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/models.go @@ -0,0 +1,1475 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armauthorization + +import "time" + +// ApprovalSettings - The approval settings. +type ApprovalSettings struct { + // The type of rule + ApprovalMode *ApprovalMode + + // The approval stages of the request. + ApprovalStages []*ApprovalStage + + // Determines whether approval is required or not. + IsApprovalRequired *bool + + // Determines whether approval is required for assignment extension. + IsApprovalRequiredForExtension *bool + + // Determine whether requestor justification is required. + IsRequestorJustificationRequired *bool +} + +// ApprovalStage - The approval stage. +type ApprovalStage struct { + // The time in days when approval request would be timed out + ApprovalStageTimeOutInDays *int32 + + // The escalation approver of the request. + EscalationApprovers []*UserSet + + // The time in minutes when the approval request would be escalated if the primary approver does not approve + EscalationTimeInMinutes *int32 + + // Determines whether approver need to provide justification for his decision. + IsApproverJustificationRequired *bool + + // The value determine whether escalation feature is enabled. + IsEscalationEnabled *bool + + // The primary approver of the request. + PrimaryApprovers []*UserSet +} + +// ClassicAdministrator - Classic Administrators +type ClassicAdministrator struct { + // The ID of the administrator. + ID *string + + // The name of the administrator. + Name *string + + // Properties for the classic administrator. + Properties *ClassicAdministratorProperties + + // The type of the administrator. + Type *string +} + +// ClassicAdministratorListResult - ClassicAdministrator list result information. +type ClassicAdministratorListResult struct { + // The URL to use for getting the next set of results. + NextLink *string + + // An array of administrators. + Value []*ClassicAdministrator +} + +// ClassicAdministratorProperties - Classic Administrator properties. +type ClassicAdministratorProperties struct { + // The email address of the administrator. + EmailAddress *string + + // The role of the administrator. + Role *string +} + +// DenyAssignment - Deny Assignment +type DenyAssignment struct { + // Deny assignment properties. + Properties *DenyAssignmentProperties + + // READ-ONLY; The deny assignment ID. + ID *string + + // READ-ONLY; The deny assignment name. + Name *string + + // READ-ONLY; The deny assignment type. + Type *string +} + +// DenyAssignmentFilter - Deny Assignments filter +type DenyAssignmentFilter struct { + // Return deny assignment with specified name. + DenyAssignmentName *string + + // Return all deny assignments where the specified principal is listed either in the principals list or exclude principals + // list of deny assignments. + GdprExportPrincipalID *string + + // Return all deny assignments where the specified principal is listed in the principals list of deny assignments. + PrincipalID *string +} + +// DenyAssignmentListResult - Deny assignment list operation result. +type DenyAssignmentListResult struct { + // The URL to use for getting the next set of results. + NextLink *string + + // Deny assignment list. + Value []*DenyAssignment +} + +// DenyAssignmentPermission - Deny assignment permissions. +type DenyAssignmentPermission struct { + // Actions to which the deny assignment does not grant access. + Actions []*string + + // The conditions on the Deny assignment permission. This limits the resources it applies to. + Condition *string + + // Version of the condition. + ConditionVersion *string + + // Data actions to which the deny assignment does not grant access. + DataActions []*string + + // Actions to exclude from that the deny assignment does not grant access. + NotActions []*string + + // Data actions to exclude from that the deny assignment does not grant access. + NotDataActions []*string +} + +// DenyAssignmentProperties - Deny assignment properties. +type DenyAssignmentProperties struct { + // The display name of the deny assignment. + DenyAssignmentName *string + + // The description of the deny assignment. + Description *string + + // Determines if the deny assignment applies to child scopes. Default value is false. + DoNotApplyToChildScopes *bool + + // Array of principals to which the deny assignment does not apply. + ExcludePrincipals []*Principal + + // Specifies whether this deny assignment was created by Azure and cannot be edited or deleted. + IsSystemProtected *bool + + // An array of permissions that are denied by the deny assignment. + Permissions []*DenyAssignmentPermission + + // Array of principals to which the deny assignment applies. + Principals []*Principal + + // The deny assignment scope. + Scope *string +} + +// EligibleChildResource - Eligible child resource +type EligibleChildResource struct { + // READ-ONLY; The resource scope Id. + ID *string + + // READ-ONLY; The resource name. + Name *string + + // READ-ONLY; The resource type. + Type *string +} + +// EligibleChildResourcesListResult - Eligible child resources list operation result. +type EligibleChildResourcesListResult struct { + // The URL to use for getting the next set of results. + NextLink *string + + // Eligible child resource list. + Value []*EligibleChildResource +} + +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info any + + // READ-ONLY; The additional info type. + Type *string +} + +// ErrorDetail - The error detail. +type ErrorDetail struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo + + // READ-ONLY; The error code. + Code *string + + // READ-ONLY; The error details. + Details []*ErrorDetail + + // READ-ONLY; The error message. + Message *string + + // READ-ONLY; The error target. + Target *string +} + +// ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. +// (This also follows the OData error response format.). +type ErrorResponse struct { + // The error object. + Error *ErrorDetail +} + +type ExpandedProperties struct { + // Details of the principal + Principal *ExpandedPropertiesPrincipal + + // Details of role definition + RoleDefinition *ExpandedPropertiesRoleDefinition + + // Details of the resource scope + Scope *ExpandedPropertiesScope +} + +// ExpandedPropertiesPrincipal - Details of the principal +type ExpandedPropertiesPrincipal struct { + // Display name of the principal + DisplayName *string + + // Email id of the principal + Email *string + + // Id of the principal + ID *string + + // Type of the principal + Type *string +} + +// ExpandedPropertiesRoleDefinition - Details of role definition +type ExpandedPropertiesRoleDefinition struct { + // Display name of the role definition + DisplayName *string + + // Id of the role definition + ID *string + + // Type of the role definition + Type *string +} + +// ExpandedPropertiesScope - Details of the resource scope +type ExpandedPropertiesScope struct { + // Display name of the resource + DisplayName *string + + // Scope id of the resource + ID *string + + // Type of the resource + Type *string +} + +// Permission - Role definition permissions. +type Permission struct { + // Allowed actions. + Actions []*string + + // Allowed Data actions. + DataActions []*string + + // Denied actions. + NotActions []*string + + // Denied Data actions. + NotDataActions []*string +} + +// PermissionGetResult - Permissions information. +type PermissionGetResult struct { + // The URL to use for getting the next set of results. + NextLink *string + + // An array of permissions. + Value []*Permission +} + +// PolicyAssignmentProperties - Expanded info of resource scope, role definition and policy +type PolicyAssignmentProperties struct { + // Details of the policy + Policy *PolicyAssignmentPropertiesPolicy + + // Details of role definition + RoleDefinition *PolicyAssignmentPropertiesRoleDefinition + + // Details of the resource scope + Scope *PolicyAssignmentPropertiesScope +} + +// PolicyAssignmentPropertiesPolicy - Details of the policy +type PolicyAssignmentPropertiesPolicy struct { + // Id of the policy + ID *string + + // The last modified date time. + LastModifiedDateTime *time.Time + + // READ-ONLY; The name of the entity last modified it + LastModifiedBy *Principal +} + +// PolicyAssignmentPropertiesRoleDefinition - Details of role definition +type PolicyAssignmentPropertiesRoleDefinition struct { + // Display name of the role definition + DisplayName *string + + // Id of the role definition + ID *string + + // Type of the role definition + Type *string +} + +// PolicyAssignmentPropertiesScope - Details of the resource scope +type PolicyAssignmentPropertiesScope struct { + // Display name of the resource + DisplayName *string + + // Scope id of the resource + ID *string + + // Type of the resource + Type *string +} + +// PolicyProperties - Expanded info of resource scope +type PolicyProperties struct { + // READ-ONLY; Details of the resource scope + Scope *PolicyPropertiesScope +} + +// PolicyPropertiesScope - Details of the resource scope +type PolicyPropertiesScope struct { + // Display name of the resource + DisplayName *string + + // Scope id of the resource + ID *string + + // Type of the resource + Type *string +} + +// Principal - The name of the entity last modified it +type Principal struct { + // The name of the principal made changes + DisplayName *string + + // Email of principal + Email *string + + // The id of the principal made changes + ID *string + + // Type of principal such as user , group etc + Type *string +} + +// ProviderOperation - Operation +type ProviderOperation struct { + // The operation description. + Description *string + + // The operation display name. + DisplayName *string + + // The dataAction flag to specify the operation type. + IsDataAction *bool + + // The operation name. + Name *string + + // The operation origin. + Origin *string + + // The operation properties. + Properties any +} + +// ProviderOperationsMetadata - Provider Operations metadata +type ProviderOperationsMetadata struct { + // The provider display name. + DisplayName *string + + // The provider id. + ID *string + + // The provider name. + Name *string + + // The provider operations. + Operations []*ProviderOperation + + // The provider resource types + ResourceTypes []*ResourceType + + // The provider type. + Type *string +} + +// ProviderOperationsMetadataListResult - Provider operations metadata list +type ProviderOperationsMetadataListResult struct { + // The URL to use for getting the next set of results. + NextLink *string + + // The list of providers. + Value []*ProviderOperationsMetadata +} + +// ResourceType - Resource Type +type ResourceType struct { + // The resource type display name. + DisplayName *string + + // The resource type name. + Name *string + + // The resource type operations. + Operations []*ProviderOperation +} + +// RoleAssignment - Role Assignments +type RoleAssignment struct { + // Role assignment properties. + Properties *RoleAssignmentProperties + + // READ-ONLY; The role assignment ID. + ID *string + + // READ-ONLY; The role assignment name. + Name *string + + // READ-ONLY; The role assignment type. + Type *string +} + +// RoleAssignmentCreateParameters - Role assignment create parameters. +type RoleAssignmentCreateParameters struct { + // REQUIRED; Role assignment properties. + Properties *RoleAssignmentProperties +} + +// RoleAssignmentFilter - Role Assignments filter +type RoleAssignmentFilter struct { + // Returns role assignment of the specific principal. + PrincipalID *string +} + +// RoleAssignmentListResult - Role assignment list operation result. +type RoleAssignmentListResult struct { + // Role assignment list. + Value []*RoleAssignment + + // READ-ONLY; The skipToken to use for getting the next set of results. + NextLink *string +} + +// RoleAssignmentProperties - Role assignment properties. +type RoleAssignmentProperties struct { + // REQUIRED; The principal ID. + PrincipalID *string + + // REQUIRED; The role definition ID. + RoleDefinitionID *string + + // The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] + // StringEqualsIgnoreCase + // 'foostoragecontainer' + Condition *string + + // Version of the condition. Currently the only accepted value is '2.0' + ConditionVersion *string + + // Id of the delegated managed identity resource + DelegatedManagedIdentityResourceID *string + + // Description of role assignment + Description *string + + // The principal type of the assigned principal ID. + PrincipalType *PrincipalType + + // READ-ONLY; Id of the user who created the assignment + CreatedBy *string + + // READ-ONLY; Time it was created + CreatedOn *time.Time + + // READ-ONLY; The role assignment scope. + Scope *string + + // READ-ONLY; Id of the user who updated the assignment + UpdatedBy *string + + // READ-ONLY; Time it was updated + UpdatedOn *time.Time +} + +// RoleAssignmentSchedule - Role Assignment schedule +type RoleAssignmentSchedule struct { + // Role assignment schedule properties. + Properties *RoleAssignmentScheduleProperties + + // READ-ONLY; The role assignment schedule Id. + ID *string + + // READ-ONLY; The role assignment schedule name. + Name *string + + // READ-ONLY; The role assignment schedule type. + Type *string +} + +// RoleAssignmentScheduleFilter - Role assignment schedule filter +type RoleAssignmentScheduleFilter struct { + // Returns role assignment schedule of the specific principal. + PrincipalID *string + + // Returns role assignment schedule of the specific role definition. + RoleDefinitionID *string + + // Returns role assignment schedule instances of the specific status. + Status *string +} + +// RoleAssignmentScheduleInstance - Information about current or upcoming role assignment schedule instance +type RoleAssignmentScheduleInstance struct { + // Role assignment schedule instance properties. + Properties *RoleAssignmentScheduleInstanceProperties + + // READ-ONLY; The role assignment schedule instance ID. + ID *string + + // READ-ONLY; The role assignment schedule instance name. + Name *string + + // READ-ONLY; The role assignment schedule instance type. + Type *string +} + +// RoleAssignmentScheduleInstanceFilter - Role assignment schedule instance filter +type RoleAssignmentScheduleInstanceFilter struct { + // Returns role assignment schedule instances of the specific principal. + PrincipalID *string + + // Returns role assignment schedule instances belonging to a specific role assignment schedule. + RoleAssignmentScheduleID *string + + // Returns role assignment schedule instances of the specific role definition. + RoleDefinitionID *string + + // Returns role assignment schedule instances of the specific status. + Status *string +} + +// RoleAssignmentScheduleInstanceListResult - Role assignment schedule instance list operation result. +type RoleAssignmentScheduleInstanceListResult struct { + // The URL to use for getting the next set of results. + NextLink *string + + // Role assignment schedule instance list. + Value []*RoleAssignmentScheduleInstance +} + +// RoleAssignmentScheduleInstanceProperties - Role assignment schedule properties with scope. +type RoleAssignmentScheduleInstanceProperties struct { + // Assignment type of the role assignment schedule + AssignmentType *AssignmentType + + // The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] + // StringEqualsIgnoreCase + // 'foostoragecontainer' + Condition *string + + // Version of the condition. Currently accepted value is '2.0' + ConditionVersion *string + + // DateTime when role assignment schedule was created + CreatedOn *time.Time + + // The endDateTime of the role assignment schedule instance + EndDateTime *time.Time + + // Additional properties of principal, scope and role definition + ExpandedProperties *ExpandedProperties + + // roleEligibilityScheduleId used to activate + LinkedRoleEligibilityScheduleID *string + + // roleEligibilityScheduleInstanceId linked to this roleAssignmentScheduleInstance + LinkedRoleEligibilityScheduleInstanceID *string + + // Membership type of the role assignment schedule + MemberType *MemberType + + // Role Assignment Id in external system + OriginRoleAssignmentID *string + + // The principal ID. + PrincipalID *string + + // The principal type of the assigned principal ID. + PrincipalType *PrincipalType + + // Id of the master role assignment schedule + RoleAssignmentScheduleID *string + + // The role definition ID. + RoleDefinitionID *string + + // The role assignment schedule scope. + Scope *string + + // The startDateTime of the role assignment schedule instance + StartDateTime *time.Time + + // The status of the role assignment schedule instance. + Status *Status +} + +// RoleAssignmentScheduleListResult - Role assignment schedule list operation result. +type RoleAssignmentScheduleListResult struct { + // The URL to use for getting the next set of results. + NextLink *string + + // Role assignment schedule list. + Value []*RoleAssignmentSchedule +} + +// RoleAssignmentScheduleProperties - Role assignment schedule properties with scope. +type RoleAssignmentScheduleProperties struct { + // Assignment type of the role assignment schedule + AssignmentType *AssignmentType + + // The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] + // StringEqualsIgnoreCase + // 'foostoragecontainer' + Condition *string + + // Version of the condition. Currently accepted value is '2.0' + ConditionVersion *string + + // DateTime when role assignment schedule was created + CreatedOn *time.Time + + // End DateTime when role assignment schedule + EndDateTime *time.Time + + // Additional properties of principal, scope and role definition + ExpandedProperties *ExpandedProperties + + // The id of roleEligibilitySchedule used to activated this roleAssignmentSchedule + LinkedRoleEligibilityScheduleID *string + + // Membership type of the role assignment schedule + MemberType *MemberType + + // The principal ID. + PrincipalID *string + + // The principal type of the assigned principal ID. + PrincipalType *PrincipalType + + // The id of roleAssignmentScheduleRequest used to create this roleAssignmentSchedule + RoleAssignmentScheduleRequestID *string + + // The role definition ID. + RoleDefinitionID *string + + // The role assignment schedule scope. + Scope *string + + // Start DateTime when role assignment schedule + StartDateTime *time.Time + + // The status of the role assignment schedule. + Status *Status + + // DateTime when role assignment schedule was modified + UpdatedOn *time.Time +} + +// RoleAssignmentScheduleRequest - Role Assignment schedule request +type RoleAssignmentScheduleRequest struct { + // Role assignment schedule request properties. + Properties *RoleAssignmentScheduleRequestProperties + + // READ-ONLY; The role assignment schedule request ID. + ID *string + + // READ-ONLY; The role assignment schedule request name. + Name *string + + // READ-ONLY; The role assignment schedule request type. + Type *string +} + +// RoleAssignmentScheduleRequestFilter - Role assignment schedule request filter +type RoleAssignmentScheduleRequestFilter struct { + // Returns role assignment requests of the specific principal. + PrincipalID *string + + // Returns role assignment requests created by specific principal. + RequestorID *string + + // Returns role assignment requests of the specific role definition. + RoleDefinitionID *string + + // Returns role assignment requests of specific status. + Status *string +} + +// RoleAssignmentScheduleRequestListResult - Role assignment schedule request list operation result. +type RoleAssignmentScheduleRequestListResult struct { + // The URL to use for getting the next set of results. + NextLink *string + + // Role assignment schedule request list. + Value []*RoleAssignmentScheduleRequest +} + +// RoleAssignmentScheduleRequestProperties - Role assignment schedule request properties with scope. +type RoleAssignmentScheduleRequestProperties struct { + // REQUIRED; The principal ID. + PrincipalID *string + + // REQUIRED; The type of the role assignment schedule request. Eg: SelfActivate, AdminAssign etc + RequestType *RequestType + + // REQUIRED; The role definition ID. + RoleDefinitionID *string + + // The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] + // StringEqualsIgnoreCase + // 'foostoragecontainer' + Condition *string + + // Version of the condition. Currently accepted value is '2.0' + ConditionVersion *string + + // Justification for the role assignment + Justification *string + + // The linked role eligibility schedule id - to activate an eligibility. + LinkedRoleEligibilityScheduleID *string + + // Schedule info of the role assignment schedule + ScheduleInfo *RoleAssignmentScheduleRequestPropertiesScheduleInfo + + // The resultant role assignment schedule id or the role assignment schedule id being updated + TargetRoleAssignmentScheduleID *string + + // The role assignment schedule instance id being updated + TargetRoleAssignmentScheduleInstanceID *string + + // Ticket Info of the role assignment + TicketInfo *RoleAssignmentScheduleRequestPropertiesTicketInfo + + // READ-ONLY; The approvalId of the role assignment schedule request. + ApprovalID *string + + // READ-ONLY; DateTime when role assignment schedule request was created + CreatedOn *time.Time + + // READ-ONLY; Additional properties of principal, scope and role definition + ExpandedProperties *ExpandedProperties + + // READ-ONLY; The principal type of the assigned principal ID. + PrincipalType *PrincipalType + + // READ-ONLY; Id of the user who created this request + RequestorID *string + + // READ-ONLY; The role assignment schedule request scope. + Scope *string + + // READ-ONLY; The status of the role assignment schedule request. + Status *Status +} + +// RoleAssignmentScheduleRequestPropertiesScheduleInfo - Schedule info of the role assignment schedule +type RoleAssignmentScheduleRequestPropertiesScheduleInfo struct { + // Expiration of the role assignment schedule + Expiration *RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration + + // Start DateTime of the role assignment schedule. + StartDateTime *time.Time +} + +// RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration - Expiration of the role assignment schedule +type RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration struct { + // Duration of the role assignment schedule in TimeSpan. + Duration *string + + // End DateTime of the role assignment schedule. + EndDateTime *time.Time + + // Type of the role assignment schedule expiration + Type *Type +} + +// RoleAssignmentScheduleRequestPropertiesTicketInfo - Ticket Info of the role assignment +type RoleAssignmentScheduleRequestPropertiesTicketInfo struct { + // Ticket number for the role assignment + TicketNumber *string + + // Ticket system name for the role assignment + TicketSystem *string +} + +// RoleDefinition - Role definition. +type RoleDefinition struct { + // Role definition properties. + Properties *RoleDefinitionProperties + + // READ-ONLY; The role definition ID. + ID *string + + // READ-ONLY; The role definition name. + Name *string + + // READ-ONLY; The role definition type. + Type *string +} + +// RoleDefinitionFilter - Role Definitions filter +type RoleDefinitionFilter struct { + // Returns role definition with the specific name. + RoleName *string + + // Returns role definition with the specific type. + Type *string +} + +// RoleDefinitionListResult - Role definition list operation result. +type RoleDefinitionListResult struct { + // The URL to use for getting the next set of results. + NextLink *string + + // Role definition list. + Value []*RoleDefinition +} + +// RoleDefinitionProperties - Role definition properties. +type RoleDefinitionProperties struct { + // Role definition assignable scopes. + AssignableScopes []*string + + // The role definition description. + Description *string + + // Role definition permissions. + Permissions []*Permission + + // The role name. + RoleName *string + + // The role type. + RoleType *string +} + +// RoleEligibilitySchedule - Role eligibility schedule +type RoleEligibilitySchedule struct { + // role eligibility schedule properties. + Properties *RoleEligibilityScheduleProperties + + // READ-ONLY; The role eligibility schedule Id. + ID *string + + // READ-ONLY; The role eligibility schedule name. + Name *string + + // READ-ONLY; The role eligibility schedule type. + Type *string +} + +// RoleEligibilityScheduleFilter - Role eligibility schedule filter +type RoleEligibilityScheduleFilter struct { + // Returns role eligibility schedule of the specific principal. + PrincipalID *string + + // Returns role eligibility schedule of the specific role definition. + RoleDefinitionID *string + + // Returns role eligibility schedule of the specific status. + Status *string +} + +// RoleEligibilityScheduleInstance - Information about current or upcoming role eligibility schedule instance +type RoleEligibilityScheduleInstance struct { + // Role eligibility schedule instance properties. + Properties *RoleEligibilityScheduleInstanceProperties + + // READ-ONLY; The role eligibility schedule instance ID. + ID *string + + // READ-ONLY; The role eligibility schedule instance name. + Name *string + + // READ-ONLY; The role eligibility schedule instance type. + Type *string +} + +// RoleEligibilityScheduleInstanceFilter - Role eligibility schedule instance filter +type RoleEligibilityScheduleInstanceFilter struct { + // Returns role eligibility schedule instances of the specific principal. + PrincipalID *string + + // Returns role eligibility schedule instances of the specific role definition. + RoleDefinitionID *string + + // Returns role eligibility schedule instances belonging to a specific role eligibility schedule. + RoleEligibilityScheduleID *string + + // Returns role eligibility schedule instances of the specific status. + Status *string +} + +// RoleEligibilityScheduleInstanceListResult - Role eligibility schedule instance list operation result. +type RoleEligibilityScheduleInstanceListResult struct { + // The URL to use for getting the next set of results. + NextLink *string + + // Role eligibility schedule instance list. + Value []*RoleEligibilityScheduleInstance +} + +// RoleEligibilityScheduleInstanceProperties - Role eligibility schedule properties with scope. +type RoleEligibilityScheduleInstanceProperties struct { + // The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] + // StringEqualsIgnoreCase + // 'foostoragecontainer' + Condition *string + + // Version of the condition. Currently accepted value is '2.0' + ConditionVersion *string + + // DateTime when role eligibility schedule was created + CreatedOn *time.Time + + // The endDateTime of the role eligibility schedule instance + EndDateTime *time.Time + + // Additional properties of principal, scope and role definition + ExpandedProperties *ExpandedProperties + + // Membership type of the role eligibility schedule + MemberType *MemberType + + // The principal ID. + PrincipalID *string + + // The principal type of the assigned principal ID. + PrincipalType *PrincipalType + + // The role definition ID. + RoleDefinitionID *string + + // Id of the master role eligibility schedule + RoleEligibilityScheduleID *string + + // The role eligibility schedule scope. + Scope *string + + // The startDateTime of the role eligibility schedule instance + StartDateTime *time.Time + + // The status of the role eligibility schedule instance + Status *Status +} + +// RoleEligibilityScheduleListResult - role eligibility schedule list operation result. +type RoleEligibilityScheduleListResult struct { + // The URL to use for getting the next set of results. + NextLink *string + + // role eligibility schedule list. + Value []*RoleEligibilitySchedule +} + +// RoleEligibilityScheduleProperties - Role eligibility schedule properties with scope. +type RoleEligibilityScheduleProperties struct { + // The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] + // StringEqualsIgnoreCase + // 'foostoragecontainer' + Condition *string + + // Version of the condition. Currently accepted value is '2.0' + ConditionVersion *string + + // DateTime when role eligibility schedule was created + CreatedOn *time.Time + + // End DateTime when role eligibility schedule + EndDateTime *time.Time + + // Additional properties of principal, scope and role definition + ExpandedProperties *ExpandedProperties + + // Membership type of the role eligibility schedule + MemberType *MemberType + + // The principal ID. + PrincipalID *string + + // The principal type of the assigned principal ID. + PrincipalType *PrincipalType + + // The role definition ID. + RoleDefinitionID *string + + // The id of roleEligibilityScheduleRequest used to create this roleAssignmentSchedule + RoleEligibilityScheduleRequestID *string + + // The role eligibility schedule scope. + Scope *string + + // Start DateTime when role eligibility schedule + StartDateTime *time.Time + + // The status of the role eligibility schedule. + Status *Status + + // DateTime when role eligibility schedule was modified + UpdatedOn *time.Time +} + +// RoleEligibilityScheduleRequest - Role Eligibility schedule request +type RoleEligibilityScheduleRequest struct { + // Role eligibility schedule request properties. + Properties *RoleEligibilityScheduleRequestProperties + + // READ-ONLY; The role eligibility schedule request ID. + ID *string + + // READ-ONLY; The role eligibility schedule request name. + Name *string + + // READ-ONLY; The role eligibility schedule request type. + Type *string +} + +// RoleEligibilityScheduleRequestFilter - Role eligibility schedule request filter +type RoleEligibilityScheduleRequestFilter struct { + // Returns role eligibility requests of the specific principal. + PrincipalID *string + + // Returns role eligibility requests created by specific principal. + RequestorID *string + + // Returns role eligibility requests of the specific role definition. + RoleDefinitionID *string + + // Returns role eligibility requests of specific status. + Status *string +} + +// RoleEligibilityScheduleRequestListResult - Role eligibility schedule request list operation result. +type RoleEligibilityScheduleRequestListResult struct { + // The URL to use for getting the next set of results. + NextLink *string + + // Role eligibility schedule request list. + Value []*RoleEligibilityScheduleRequest +} + +// RoleEligibilityScheduleRequestProperties - Role eligibility schedule request properties with scope. +type RoleEligibilityScheduleRequestProperties struct { + // REQUIRED; The principal ID. + PrincipalID *string + + // REQUIRED; The type of the role assignment schedule request. Eg: SelfActivate, AdminAssign etc + RequestType *RequestType + + // REQUIRED; The role definition ID. + RoleDefinitionID *string + + // The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] + // StringEqualsIgnoreCase + // 'foostoragecontainer' + Condition *string + + // Version of the condition. Currently accepted value is '2.0' + ConditionVersion *string + + // Justification for the role eligibility + Justification *string + + // Schedule info of the role eligibility schedule + ScheduleInfo *RoleEligibilityScheduleRequestPropertiesScheduleInfo + + // The resultant role eligibility schedule id or the role eligibility schedule id being updated + TargetRoleEligibilityScheduleID *string + + // The role eligibility schedule instance id being updated + TargetRoleEligibilityScheduleInstanceID *string + + // Ticket Info of the role eligibility + TicketInfo *RoleEligibilityScheduleRequestPropertiesTicketInfo + + // READ-ONLY; The approvalId of the role eligibility schedule request. + ApprovalID *string + + // READ-ONLY; DateTime when role eligibility schedule request was created + CreatedOn *time.Time + + // READ-ONLY; Additional properties of principal, scope and role definition + ExpandedProperties *ExpandedProperties + + // READ-ONLY; The principal type of the assigned principal ID. + PrincipalType *PrincipalType + + // READ-ONLY; Id of the user who created this request + RequestorID *string + + // READ-ONLY; The role eligibility schedule request scope. + Scope *string + + // READ-ONLY; The status of the role eligibility schedule request. + Status *Status +} + +// RoleEligibilityScheduleRequestPropertiesScheduleInfo - Schedule info of the role eligibility schedule +type RoleEligibilityScheduleRequestPropertiesScheduleInfo struct { + // Expiration of the role eligibility schedule + Expiration *RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration + + // Start DateTime of the role eligibility schedule. + StartDateTime *time.Time +} + +// RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration - Expiration of the role eligibility schedule +type RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration struct { + // Duration of the role eligibility schedule in TimeSpan. + Duration *string + + // End DateTime of the role eligibility schedule. + EndDateTime *time.Time + + // Type of the role eligibility schedule expiration + Type *Type +} + +// RoleEligibilityScheduleRequestPropertiesTicketInfo - Ticket Info of the role eligibility +type RoleEligibilityScheduleRequestPropertiesTicketInfo struct { + // Ticket number for the role eligibility + TicketNumber *string + + // Ticket system name for the role eligibility + TicketSystem *string +} + +// RoleManagementPolicy - Role management policy +type RoleManagementPolicy struct { + // Role management policy properties. + Properties *RoleManagementPolicyProperties + + // READ-ONLY; The role management policy Id. + ID *string + + // READ-ONLY; The role management policy name. + Name *string + + // READ-ONLY; The role management policy type. + Type *string +} + +// RoleManagementPolicyApprovalRule - The role management policy approval rule. +type RoleManagementPolicyApprovalRule struct { + // REQUIRED; The type of rule + RuleType *RoleManagementPolicyRuleType + + // The id of the rule. + ID *string + + // The approval setting + Setting *ApprovalSettings + + // The target of the current rule. + Target *RoleManagementPolicyRuleTarget +} + +// GetRoleManagementPolicyRule implements the RoleManagementPolicyRuleClassification interface for type RoleManagementPolicyApprovalRule. +func (r *RoleManagementPolicyApprovalRule) GetRoleManagementPolicyRule() *RoleManagementPolicyRule { + return &RoleManagementPolicyRule{ + ID: r.ID, + RuleType: r.RuleType, + Target: r.Target, + } +} + +// RoleManagementPolicyAssignment - Role management policy +type RoleManagementPolicyAssignment struct { + // Role management policy properties. + Properties *RoleManagementPolicyAssignmentProperties + + // READ-ONLY; The role management policy Id. + ID *string + + // READ-ONLY; The role management policy name. + Name *string + + // READ-ONLY; The role management policy type. + Type *string +} + +// RoleManagementPolicyAssignmentListResult - Role management policy assignment list operation result. +type RoleManagementPolicyAssignmentListResult struct { + // The URL to use for getting the next set of results. + NextLink *string + + // Role management policy assignment list. + Value []*RoleManagementPolicyAssignment +} + +// RoleManagementPolicyAssignmentProperties - Role management policy assignment properties with scope. +type RoleManagementPolicyAssignmentProperties struct { + // The policy id role management policy assignment. + PolicyID *string + + // The role definition of management policy assignment. + RoleDefinitionID *string + + // The role management policy scope. + Scope *string + + // READ-ONLY; The readonly computed rule applied to the policy. + EffectiveRules []RoleManagementPolicyRuleClassification + + // READ-ONLY; Additional properties of scope, role definition and policy + PolicyAssignmentProperties *PolicyAssignmentProperties +} + +// RoleManagementPolicyAuthenticationContextRule - The role management policy authentication context rule. +type RoleManagementPolicyAuthenticationContextRule struct { + // REQUIRED; The type of rule + RuleType *RoleManagementPolicyRuleType + + // The claim value. + ClaimValue *string + + // The id of the rule. + ID *string + + // The value indicating if rule is enabled. + IsEnabled *bool + + // The target of the current rule. + Target *RoleManagementPolicyRuleTarget +} + +// GetRoleManagementPolicyRule implements the RoleManagementPolicyRuleClassification interface for type RoleManagementPolicyAuthenticationContextRule. +func (r *RoleManagementPolicyAuthenticationContextRule) GetRoleManagementPolicyRule() *RoleManagementPolicyRule { + return &RoleManagementPolicyRule{ + ID: r.ID, + RuleType: r.RuleType, + Target: r.Target, + } +} + +// RoleManagementPolicyEnablementRule - The role management policy enablement rule. +type RoleManagementPolicyEnablementRule struct { + // REQUIRED; The type of rule + RuleType *RoleManagementPolicyRuleType + + // The list of enabled rules. + EnabledRules []*EnablementRules + + // The id of the rule. + ID *string + + // The target of the current rule. + Target *RoleManagementPolicyRuleTarget +} + +// GetRoleManagementPolicyRule implements the RoleManagementPolicyRuleClassification interface for type RoleManagementPolicyEnablementRule. +func (r *RoleManagementPolicyEnablementRule) GetRoleManagementPolicyRule() *RoleManagementPolicyRule { + return &RoleManagementPolicyRule{ + ID: r.ID, + RuleType: r.RuleType, + Target: r.Target, + } +} + +// RoleManagementPolicyExpirationRule - The role management policy expiration rule. +type RoleManagementPolicyExpirationRule struct { + // REQUIRED; The type of rule + RuleType *RoleManagementPolicyRuleType + + // The id of the rule. + ID *string + + // The value indicating whether expiration is required. + IsExpirationRequired *bool + + // The maximum duration of expiration in timespan. + MaximumDuration *string + + // The target of the current rule. + Target *RoleManagementPolicyRuleTarget +} + +// GetRoleManagementPolicyRule implements the RoleManagementPolicyRuleClassification interface for type RoleManagementPolicyExpirationRule. +func (r *RoleManagementPolicyExpirationRule) GetRoleManagementPolicyRule() *RoleManagementPolicyRule { + return &RoleManagementPolicyRule{ + ID: r.ID, + RuleType: r.RuleType, + Target: r.Target, + } +} + +// RoleManagementPolicyListResult - Role management policy list operation result. +type RoleManagementPolicyListResult struct { + // The URL to use for getting the next set of results. + NextLink *string + + // Role management policy list. + Value []*RoleManagementPolicy +} + +// RoleManagementPolicyNotificationRule - The role management policy notification rule. +type RoleManagementPolicyNotificationRule struct { + // REQUIRED; The type of rule + RuleType *RoleManagementPolicyRuleType + + // The id of the rule. + ID *string + + // Determines if the notification will be sent to the recipient type specified in the policy rule. + IsDefaultRecipientsEnabled *bool + + // The notification level. + NotificationLevel *NotificationLevel + + // The list of notification recipients. + NotificationRecipients []*string + + // The type of notification. + NotificationType *NotificationDeliveryMechanism + + // The recipient type. + RecipientType *RecipientType + + // The target of the current rule. + Target *RoleManagementPolicyRuleTarget +} + +// GetRoleManagementPolicyRule implements the RoleManagementPolicyRuleClassification interface for type RoleManagementPolicyNotificationRule. +func (r *RoleManagementPolicyNotificationRule) GetRoleManagementPolicyRule() *RoleManagementPolicyRule { + return &RoleManagementPolicyRule{ + ID: r.ID, + RuleType: r.RuleType, + Target: r.Target, + } +} + +// RoleManagementPolicyProperties - Role management policy properties with scope. +type RoleManagementPolicyProperties struct { + // The role management policy description. + Description *string + + // The role management policy display name. + DisplayName *string + + // The role management policy is default policy. + IsOrganizationDefault *bool + + // The rule applied to the policy. + Rules []RoleManagementPolicyRuleClassification + + // The role management policy scope. + Scope *string + + // READ-ONLY; The readonly computed rule applied to the policy. + EffectiveRules []RoleManagementPolicyRuleClassification + + // READ-ONLY; The name of the entity last modified it + LastModifiedBy *Principal + + // READ-ONLY; The last modified date time. + LastModifiedDateTime *time.Time + + // READ-ONLY; Additional properties of scope + PolicyProperties *PolicyProperties +} + +// RoleManagementPolicyRule - The role management policy rule. +type RoleManagementPolicyRule struct { + // REQUIRED; The type of rule + RuleType *RoleManagementPolicyRuleType + + // The id of the rule. + ID *string + + // The target of the current rule. + Target *RoleManagementPolicyRuleTarget +} + +// GetRoleManagementPolicyRule implements the RoleManagementPolicyRuleClassification interface for type RoleManagementPolicyRule. +func (r *RoleManagementPolicyRule) GetRoleManagementPolicyRule() *RoleManagementPolicyRule { return r } + +// RoleManagementPolicyRuleTarget - The role management policy rule target. +type RoleManagementPolicyRuleTarget struct { + // The caller of the setting. + Caller *string + + // The list of enforced settings. + EnforcedSettings []*string + + // The list of inheritable settings. + InheritableSettings []*string + + // The assignment level to which rule is applied. + Level *string + + // The type of operation. + Operations []*string + + // The list of target objects. + TargetObjects []*string +} + +// UserSet - The detail of a user. +type UserSet struct { + // The description of the user. + Description *string + + // The object id of the user. + ID *string + + // The value indicating whether the user is a backup fallback approver + IsBackup *bool + + // The type of user. + UserType *UserType +} + +// ValidationResponse - Validation response +type ValidationResponse struct { + // Failed validation result details + ErrorInfo *ValidationResponseErrorInfo + + // READ-ONLY; Whether or not validation succeeded + IsValid *bool +} + +// ValidationResponseErrorInfo - Failed validation result details +type ValidationResponseErrorInfo struct { + // READ-ONLY; Error code indicating why validation failed + Code *string + + // READ-ONLY; Message indicating why validation failed + Message *string +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/models_serde.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/models_serde.go new file mode 100644 index 000000000..c34ca4bc5 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/models_serde.go @@ -0,0 +1,3567 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armauthorization + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type ApprovalSettings. +func (a ApprovalSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "approvalMode", a.ApprovalMode) + populate(objectMap, "approvalStages", a.ApprovalStages) + populate(objectMap, "isApprovalRequired", a.IsApprovalRequired) + populate(objectMap, "isApprovalRequiredForExtension", a.IsApprovalRequiredForExtension) + populate(objectMap, "isRequestorJustificationRequired", a.IsRequestorJustificationRequired) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApprovalSettings. +func (a *ApprovalSettings) 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 "approvalMode": + err = unpopulate(val, "ApprovalMode", &a.ApprovalMode) + delete(rawMsg, key) + case "approvalStages": + err = unpopulate(val, "ApprovalStages", &a.ApprovalStages) + delete(rawMsg, key) + case "isApprovalRequired": + err = unpopulate(val, "IsApprovalRequired", &a.IsApprovalRequired) + delete(rawMsg, key) + case "isApprovalRequiredForExtension": + err = unpopulate(val, "IsApprovalRequiredForExtension", &a.IsApprovalRequiredForExtension) + delete(rawMsg, key) + case "isRequestorJustificationRequired": + err = unpopulate(val, "IsRequestorJustificationRequired", &a.IsRequestorJustificationRequired) + 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 ApprovalStage. +func (a ApprovalStage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "approvalStageTimeOutInDays", a.ApprovalStageTimeOutInDays) + populate(objectMap, "escalationApprovers", a.EscalationApprovers) + populate(objectMap, "escalationTimeInMinutes", a.EscalationTimeInMinutes) + populate(objectMap, "isApproverJustificationRequired", a.IsApproverJustificationRequired) + populate(objectMap, "isEscalationEnabled", a.IsEscalationEnabled) + populate(objectMap, "primaryApprovers", a.PrimaryApprovers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApprovalStage. +func (a *ApprovalStage) 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 "approvalStageTimeOutInDays": + err = unpopulate(val, "ApprovalStageTimeOutInDays", &a.ApprovalStageTimeOutInDays) + delete(rawMsg, key) + case "escalationApprovers": + err = unpopulate(val, "EscalationApprovers", &a.EscalationApprovers) + delete(rawMsg, key) + case "escalationTimeInMinutes": + err = unpopulate(val, "EscalationTimeInMinutes", &a.EscalationTimeInMinutes) + delete(rawMsg, key) + case "isApproverJustificationRequired": + err = unpopulate(val, "IsApproverJustificationRequired", &a.IsApproverJustificationRequired) + delete(rawMsg, key) + case "isEscalationEnabled": + err = unpopulate(val, "IsEscalationEnabled", &a.IsEscalationEnabled) + delete(rawMsg, key) + case "primaryApprovers": + err = unpopulate(val, "PrimaryApprovers", &a.PrimaryApprovers) + 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 ClassicAdministrator. +func (c ClassicAdministrator) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClassicAdministrator. +func (c *ClassicAdministrator) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClassicAdministratorListResult. +func (c ClassicAdministratorListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClassicAdministratorListResult. +func (c *ClassicAdministratorListResult) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClassicAdministratorProperties. +func (c ClassicAdministratorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "emailAddress", c.EmailAddress) + populate(objectMap, "role", c.Role) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClassicAdministratorProperties. +func (c *ClassicAdministratorProperties) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "emailAddress": + err = unpopulate(val, "EmailAddress", &c.EmailAddress) + delete(rawMsg, key) + case "role": + err = unpopulate(val, "Role", &c.Role) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DenyAssignment. +func (d DenyAssignment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DenyAssignment. +func (d *DenyAssignment) 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DenyAssignmentFilter. +func (d DenyAssignmentFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "denyAssignmentName", d.DenyAssignmentName) + populate(objectMap, "gdprExportPrincipalId", d.GdprExportPrincipalID) + populate(objectMap, "principalId", d.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DenyAssignmentFilter. +func (d *DenyAssignmentFilter) 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "denyAssignmentName": + err = unpopulate(val, "DenyAssignmentName", &d.DenyAssignmentName) + delete(rawMsg, key) + case "gdprExportPrincipalId": + err = unpopulate(val, "GdprExportPrincipalID", &d.GdprExportPrincipalID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &d.PrincipalID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DenyAssignmentListResult. +func (d DenyAssignmentListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DenyAssignmentListResult. +func (d *DenyAssignmentListResult) 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DenyAssignmentPermission. +func (d DenyAssignmentPermission) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actions", d.Actions) + populate(objectMap, "condition", d.Condition) + populate(objectMap, "conditionVersion", d.ConditionVersion) + populate(objectMap, "dataActions", d.DataActions) + populate(objectMap, "notActions", d.NotActions) + populate(objectMap, "notDataActions", d.NotDataActions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DenyAssignmentPermission. +func (d *DenyAssignmentPermission) 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actions": + err = unpopulate(val, "Actions", &d.Actions) + delete(rawMsg, key) + case "condition": + err = unpopulate(val, "Condition", &d.Condition) + delete(rawMsg, key) + case "conditionVersion": + err = unpopulate(val, "ConditionVersion", &d.ConditionVersion) + delete(rawMsg, key) + case "dataActions": + err = unpopulate(val, "DataActions", &d.DataActions) + delete(rawMsg, key) + case "notActions": + err = unpopulate(val, "NotActions", &d.NotActions) + delete(rawMsg, key) + case "notDataActions": + err = unpopulate(val, "NotDataActions", &d.NotDataActions) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DenyAssignmentProperties. +func (d DenyAssignmentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "denyAssignmentName", d.DenyAssignmentName) + populate(objectMap, "description", d.Description) + populate(objectMap, "doNotApplyToChildScopes", d.DoNotApplyToChildScopes) + populate(objectMap, "excludePrincipals", d.ExcludePrincipals) + populate(objectMap, "isSystemProtected", d.IsSystemProtected) + populate(objectMap, "permissions", d.Permissions) + populate(objectMap, "principals", d.Principals) + populate(objectMap, "scope", d.Scope) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DenyAssignmentProperties. +func (d *DenyAssignmentProperties) 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "denyAssignmentName": + err = unpopulate(val, "DenyAssignmentName", &d.DenyAssignmentName) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &d.Description) + delete(rawMsg, key) + case "doNotApplyToChildScopes": + err = unpopulate(val, "DoNotApplyToChildScopes", &d.DoNotApplyToChildScopes) + delete(rawMsg, key) + case "excludePrincipals": + err = unpopulate(val, "ExcludePrincipals", &d.ExcludePrincipals) + delete(rawMsg, key) + case "isSystemProtected": + err = unpopulate(val, "IsSystemProtected", &d.IsSystemProtected) + delete(rawMsg, key) + case "permissions": + err = unpopulate(val, "Permissions", &d.Permissions) + delete(rawMsg, key) + case "principals": + err = unpopulate(val, "Principals", &d.Principals) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &d.Scope) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EligibleChildResource. +func (e EligibleChildResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EligibleChildResource. +func (e *EligibleChildResource) 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EligibleChildResourcesListResult. +func (e EligibleChildResourcesListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EligibleChildResourcesListResult. +func (e *EligibleChildResourcesListResult) 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateAny(objectMap, "info", e.Info) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "info": + err = unpopulate(val, "Info", &e.Info) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. +func (e *ErrorDetail) 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &e.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpandedProperties. +func (e ExpandedProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principal", e.Principal) + populate(objectMap, "roleDefinition", e.RoleDefinition) + populate(objectMap, "scope", e.Scope) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpandedProperties. +func (e *ExpandedProperties) 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principal": + err = unpopulate(val, "Principal", &e.Principal) + delete(rawMsg, key) + case "roleDefinition": + err = unpopulate(val, "RoleDefinition", &e.RoleDefinition) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &e.Scope) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpandedPropertiesPrincipal. +func (e ExpandedPropertiesPrincipal) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", e.DisplayName) + populate(objectMap, "email", e.Email) + populate(objectMap, "id", e.ID) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpandedPropertiesPrincipal. +func (e *ExpandedPropertiesPrincipal) 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &e.DisplayName) + delete(rawMsg, key) + case "email": + err = unpopulate(val, "Email", &e.Email) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpandedPropertiesRoleDefinition. +func (e ExpandedPropertiesRoleDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", e.DisplayName) + populate(objectMap, "id", e.ID) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpandedPropertiesRoleDefinition. +func (e *ExpandedPropertiesRoleDefinition) 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &e.DisplayName) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpandedPropertiesScope. +func (e ExpandedPropertiesScope) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", e.DisplayName) + populate(objectMap, "id", e.ID) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpandedPropertiesScope. +func (e *ExpandedPropertiesScope) 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &e.DisplayName) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Permission. +func (p Permission) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actions", p.Actions) + populate(objectMap, "dataActions", p.DataActions) + populate(objectMap, "notActions", p.NotActions) + populate(objectMap, "notDataActions", p.NotDataActions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Permission. +func (p *Permission) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actions": + err = unpopulate(val, "Actions", &p.Actions) + delete(rawMsg, key) + case "dataActions": + err = unpopulate(val, "DataActions", &p.DataActions) + delete(rawMsg, key) + case "notActions": + err = unpopulate(val, "NotActions", &p.NotActions) + delete(rawMsg, key) + case "notDataActions": + err = unpopulate(val, "NotDataActions", &p.NotDataActions) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PermissionGetResult. +func (p PermissionGetResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PermissionGetResult. +func (p *PermissionGetResult) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PolicyAssignmentProperties. +func (p PolicyAssignmentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "policy", p.Policy) + populate(objectMap, "roleDefinition", p.RoleDefinition) + populate(objectMap, "scope", p.Scope) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyAssignmentProperties. +func (p *PolicyAssignmentProperties) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "policy": + err = unpopulate(val, "Policy", &p.Policy) + delete(rawMsg, key) + case "roleDefinition": + err = unpopulate(val, "RoleDefinition", &p.RoleDefinition) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &p.Scope) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PolicyAssignmentPropertiesPolicy. +func (p PolicyAssignmentPropertiesPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "lastModifiedBy", p.LastModifiedBy) + populateDateTimeRFC3339(objectMap, "lastModifiedDateTime", p.LastModifiedDateTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyAssignmentPropertiesPolicy. +func (p *PolicyAssignmentPropertiesPolicy) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &p.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedDateTime": + err = unpopulateDateTimeRFC3339(val, "LastModifiedDateTime", &p.LastModifiedDateTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PolicyAssignmentPropertiesRoleDefinition. +func (p PolicyAssignmentPropertiesRoleDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", p.DisplayName) + populate(objectMap, "id", p.ID) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyAssignmentPropertiesRoleDefinition. +func (p *PolicyAssignmentPropertiesRoleDefinition) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PolicyAssignmentPropertiesScope. +func (p PolicyAssignmentPropertiesScope) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", p.DisplayName) + populate(objectMap, "id", p.ID) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyAssignmentPropertiesScope. +func (p *PolicyAssignmentPropertiesScope) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PolicyProperties. +func (p PolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "scope", p.Scope) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyProperties. +func (p *PolicyProperties) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "scope": + err = unpopulate(val, "Scope", &p.Scope) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PolicyPropertiesScope. +func (p PolicyPropertiesScope) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", p.DisplayName) + populate(objectMap, "id", p.ID) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyPropertiesScope. +func (p *PolicyPropertiesScope) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Principal. +func (p Principal) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", p.DisplayName) + populate(objectMap, "email", p.Email) + populate(objectMap, "id", p.ID) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Principal. +func (p *Principal) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) + delete(rawMsg, key) + case "email": + err = unpopulate(val, "Email", &p.Email) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProviderOperation. +func (p ProviderOperation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", p.Description) + populate(objectMap, "displayName", p.DisplayName) + populate(objectMap, "isDataAction", p.IsDataAction) + populate(objectMap, "name", p.Name) + populate(objectMap, "origin", p.Origin) + populateAny(objectMap, "properties", p.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProviderOperation. +func (p *ProviderOperation) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &p.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &p.Origin) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProviderOperationsMetadata. +func (p ProviderOperationsMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", p.DisplayName) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "operations", p.Operations) + populate(objectMap, "resourceTypes", p.ResourceTypes) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProviderOperationsMetadata. +func (p *ProviderOperationsMetadata) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "operations": + err = unpopulate(val, "Operations", &p.Operations) + delete(rawMsg, key) + case "resourceTypes": + err = unpopulate(val, "ResourceTypes", &p.ResourceTypes) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProviderOperationsMetadataListResult. +func (p ProviderOperationsMetadataListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProviderOperationsMetadataListResult. +func (p *ProviderOperationsMetadataListResult) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceType. +func (r ResourceType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", r.DisplayName) + populate(objectMap, "name", r.Name) + populate(objectMap, "operations", r.Operations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceType. +func (r *ResourceType) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &r.DisplayName) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "operations": + err = unpopulate(val, "Operations", &r.Operations) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleAssignment. +func (r RoleAssignment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignment. +func (r *RoleAssignment) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentCreateParameters. +func (r RoleAssignmentCreateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", r.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentCreateParameters. +func (r *RoleAssignmentCreateParameters) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentFilter. +func (r RoleAssignmentFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", r.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentFilter. +func (r *RoleAssignmentFilter) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &r.PrincipalID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentListResult. +func (r RoleAssignmentListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentListResult. +func (r *RoleAssignmentListResult) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentProperties. +func (r RoleAssignmentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "condition", r.Condition) + populate(objectMap, "conditionVersion", r.ConditionVersion) + populate(objectMap, "createdBy", r.CreatedBy) + populateDateTimeRFC3339(objectMap, "createdOn", r.CreatedOn) + populate(objectMap, "delegatedManagedIdentityResourceId", r.DelegatedManagedIdentityResourceID) + populate(objectMap, "description", r.Description) + populate(objectMap, "principalId", r.PrincipalID) + populate(objectMap, "principalType", r.PrincipalType) + populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) + populate(objectMap, "scope", r.Scope) + populate(objectMap, "updatedBy", r.UpdatedBy) + populateDateTimeRFC3339(objectMap, "updatedOn", r.UpdatedOn) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentProperties. +func (r *RoleAssignmentProperties) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "condition": + err = unpopulate(val, "Condition", &r.Condition) + delete(rawMsg, key) + case "conditionVersion": + err = unpopulate(val, "ConditionVersion", &r.ConditionVersion) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &r.CreatedBy) + delete(rawMsg, key) + case "createdOn": + err = unpopulateDateTimeRFC3339(val, "CreatedOn", &r.CreatedOn) + delete(rawMsg, key) + case "delegatedManagedIdentityResourceId": + err = unpopulate(val, "DelegatedManagedIdentityResourceID", &r.DelegatedManagedIdentityResourceID) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &r.Description) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &r.PrincipalID) + delete(rawMsg, key) + case "principalType": + err = unpopulate(val, "PrincipalType", &r.PrincipalType) + delete(rawMsg, key) + case "roleDefinitionId": + err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &r.Scope) + delete(rawMsg, key) + case "updatedBy": + err = unpopulate(val, "UpdatedBy", &r.UpdatedBy) + delete(rawMsg, key) + case "updatedOn": + err = unpopulateDateTimeRFC3339(val, "UpdatedOn", &r.UpdatedOn) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentSchedule. +func (r RoleAssignmentSchedule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentSchedule. +func (r *RoleAssignmentSchedule) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleFilter. +func (r RoleAssignmentScheduleFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", r.PrincipalID) + populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) + populate(objectMap, "status", r.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleFilter. +func (r *RoleAssignmentScheduleFilter) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &r.PrincipalID) + delete(rawMsg, key) + case "roleDefinitionId": + err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &r.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleInstance. +func (r RoleAssignmentScheduleInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleInstance. +func (r *RoleAssignmentScheduleInstance) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleInstanceFilter. +func (r RoleAssignmentScheduleInstanceFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", r.PrincipalID) + populate(objectMap, "roleAssignmentScheduleId", r.RoleAssignmentScheduleID) + populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) + populate(objectMap, "status", r.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleInstanceFilter. +func (r *RoleAssignmentScheduleInstanceFilter) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &r.PrincipalID) + delete(rawMsg, key) + case "roleAssignmentScheduleId": + err = unpopulate(val, "RoleAssignmentScheduleID", &r.RoleAssignmentScheduleID) + delete(rawMsg, key) + case "roleDefinitionId": + err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &r.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleInstanceListResult. +func (r RoleAssignmentScheduleInstanceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleInstanceListResult. +func (r *RoleAssignmentScheduleInstanceListResult) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleInstanceProperties. +func (r RoleAssignmentScheduleInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "assignmentType", r.AssignmentType) + populate(objectMap, "condition", r.Condition) + populate(objectMap, "conditionVersion", r.ConditionVersion) + populateDateTimeRFC3339(objectMap, "createdOn", r.CreatedOn) + populateDateTimeRFC3339(objectMap, "endDateTime", r.EndDateTime) + populate(objectMap, "expandedProperties", r.ExpandedProperties) + populate(objectMap, "linkedRoleEligibilityScheduleId", r.LinkedRoleEligibilityScheduleID) + populate(objectMap, "linkedRoleEligibilityScheduleInstanceId", r.LinkedRoleEligibilityScheduleInstanceID) + populate(objectMap, "memberType", r.MemberType) + populate(objectMap, "originRoleAssignmentId", r.OriginRoleAssignmentID) + populate(objectMap, "principalId", r.PrincipalID) + populate(objectMap, "principalType", r.PrincipalType) + populate(objectMap, "roleAssignmentScheduleId", r.RoleAssignmentScheduleID) + populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) + populate(objectMap, "scope", r.Scope) + populateDateTimeRFC3339(objectMap, "startDateTime", r.StartDateTime) + populate(objectMap, "status", r.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleInstanceProperties. +func (r *RoleAssignmentScheduleInstanceProperties) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "assignmentType": + err = unpopulate(val, "AssignmentType", &r.AssignmentType) + delete(rawMsg, key) + case "condition": + err = unpopulate(val, "Condition", &r.Condition) + delete(rawMsg, key) + case "conditionVersion": + err = unpopulate(val, "ConditionVersion", &r.ConditionVersion) + delete(rawMsg, key) + case "createdOn": + err = unpopulateDateTimeRFC3339(val, "CreatedOn", &r.CreatedOn) + delete(rawMsg, key) + case "endDateTime": + err = unpopulateDateTimeRFC3339(val, "EndDateTime", &r.EndDateTime) + delete(rawMsg, key) + case "expandedProperties": + err = unpopulate(val, "ExpandedProperties", &r.ExpandedProperties) + delete(rawMsg, key) + case "linkedRoleEligibilityScheduleId": + err = unpopulate(val, "LinkedRoleEligibilityScheduleID", &r.LinkedRoleEligibilityScheduleID) + delete(rawMsg, key) + case "linkedRoleEligibilityScheduleInstanceId": + err = unpopulate(val, "LinkedRoleEligibilityScheduleInstanceID", &r.LinkedRoleEligibilityScheduleInstanceID) + delete(rawMsg, key) + case "memberType": + err = unpopulate(val, "MemberType", &r.MemberType) + delete(rawMsg, key) + case "originRoleAssignmentId": + err = unpopulate(val, "OriginRoleAssignmentID", &r.OriginRoleAssignmentID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &r.PrincipalID) + delete(rawMsg, key) + case "principalType": + err = unpopulate(val, "PrincipalType", &r.PrincipalType) + delete(rawMsg, key) + case "roleAssignmentScheduleId": + err = unpopulate(val, "RoleAssignmentScheduleID", &r.RoleAssignmentScheduleID) + delete(rawMsg, key) + case "roleDefinitionId": + err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &r.Scope) + delete(rawMsg, key) + case "startDateTime": + err = unpopulateDateTimeRFC3339(val, "StartDateTime", &r.StartDateTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &r.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleListResult. +func (r RoleAssignmentScheduleListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleListResult. +func (r *RoleAssignmentScheduleListResult) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleProperties. +func (r RoleAssignmentScheduleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "assignmentType", r.AssignmentType) + populate(objectMap, "condition", r.Condition) + populate(objectMap, "conditionVersion", r.ConditionVersion) + populateDateTimeRFC3339(objectMap, "createdOn", r.CreatedOn) + populateDateTimeRFC3339(objectMap, "endDateTime", r.EndDateTime) + populate(objectMap, "expandedProperties", r.ExpandedProperties) + populate(objectMap, "linkedRoleEligibilityScheduleId", r.LinkedRoleEligibilityScheduleID) + populate(objectMap, "memberType", r.MemberType) + populate(objectMap, "principalId", r.PrincipalID) + populate(objectMap, "principalType", r.PrincipalType) + populate(objectMap, "roleAssignmentScheduleRequestId", r.RoleAssignmentScheduleRequestID) + populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) + populate(objectMap, "scope", r.Scope) + populateDateTimeRFC3339(objectMap, "startDateTime", r.StartDateTime) + populate(objectMap, "status", r.Status) + populateDateTimeRFC3339(objectMap, "updatedOn", r.UpdatedOn) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleProperties. +func (r *RoleAssignmentScheduleProperties) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "assignmentType": + err = unpopulate(val, "AssignmentType", &r.AssignmentType) + delete(rawMsg, key) + case "condition": + err = unpopulate(val, "Condition", &r.Condition) + delete(rawMsg, key) + case "conditionVersion": + err = unpopulate(val, "ConditionVersion", &r.ConditionVersion) + delete(rawMsg, key) + case "createdOn": + err = unpopulateDateTimeRFC3339(val, "CreatedOn", &r.CreatedOn) + delete(rawMsg, key) + case "endDateTime": + err = unpopulateDateTimeRFC3339(val, "EndDateTime", &r.EndDateTime) + delete(rawMsg, key) + case "expandedProperties": + err = unpopulate(val, "ExpandedProperties", &r.ExpandedProperties) + delete(rawMsg, key) + case "linkedRoleEligibilityScheduleId": + err = unpopulate(val, "LinkedRoleEligibilityScheduleID", &r.LinkedRoleEligibilityScheduleID) + delete(rawMsg, key) + case "memberType": + err = unpopulate(val, "MemberType", &r.MemberType) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &r.PrincipalID) + delete(rawMsg, key) + case "principalType": + err = unpopulate(val, "PrincipalType", &r.PrincipalType) + delete(rawMsg, key) + case "roleAssignmentScheduleRequestId": + err = unpopulate(val, "RoleAssignmentScheduleRequestID", &r.RoleAssignmentScheduleRequestID) + delete(rawMsg, key) + case "roleDefinitionId": + err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &r.Scope) + delete(rawMsg, key) + case "startDateTime": + err = unpopulateDateTimeRFC3339(val, "StartDateTime", &r.StartDateTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &r.Status) + delete(rawMsg, key) + case "updatedOn": + err = unpopulateDateTimeRFC3339(val, "UpdatedOn", &r.UpdatedOn) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleRequest. +func (r RoleAssignmentScheduleRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleRequest. +func (r *RoleAssignmentScheduleRequest) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleRequestFilter. +func (r RoleAssignmentScheduleRequestFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", r.PrincipalID) + populate(objectMap, "requestorId", r.RequestorID) + populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) + populate(objectMap, "status", r.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleRequestFilter. +func (r *RoleAssignmentScheduleRequestFilter) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &r.PrincipalID) + delete(rawMsg, key) + case "requestorId": + err = unpopulate(val, "RequestorID", &r.RequestorID) + delete(rawMsg, key) + case "roleDefinitionId": + err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &r.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleRequestListResult. +func (r RoleAssignmentScheduleRequestListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleRequestListResult. +func (r *RoleAssignmentScheduleRequestListResult) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleRequestProperties. +func (r RoleAssignmentScheduleRequestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "approvalId", r.ApprovalID) + populate(objectMap, "condition", r.Condition) + populate(objectMap, "conditionVersion", r.ConditionVersion) + populateDateTimeRFC3339(objectMap, "createdOn", r.CreatedOn) + populate(objectMap, "expandedProperties", r.ExpandedProperties) + populate(objectMap, "justification", r.Justification) + populate(objectMap, "linkedRoleEligibilityScheduleId", r.LinkedRoleEligibilityScheduleID) + populate(objectMap, "principalId", r.PrincipalID) + populate(objectMap, "principalType", r.PrincipalType) + populate(objectMap, "requestType", r.RequestType) + populate(objectMap, "requestorId", r.RequestorID) + populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) + populate(objectMap, "scheduleInfo", r.ScheduleInfo) + populate(objectMap, "scope", r.Scope) + populate(objectMap, "status", r.Status) + populate(objectMap, "targetRoleAssignmentScheduleId", r.TargetRoleAssignmentScheduleID) + populate(objectMap, "targetRoleAssignmentScheduleInstanceId", r.TargetRoleAssignmentScheduleInstanceID) + populate(objectMap, "ticketInfo", r.TicketInfo) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleRequestProperties. +func (r *RoleAssignmentScheduleRequestProperties) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "approvalId": + err = unpopulate(val, "ApprovalID", &r.ApprovalID) + delete(rawMsg, key) + case "condition": + err = unpopulate(val, "Condition", &r.Condition) + delete(rawMsg, key) + case "conditionVersion": + err = unpopulate(val, "ConditionVersion", &r.ConditionVersion) + delete(rawMsg, key) + case "createdOn": + err = unpopulateDateTimeRFC3339(val, "CreatedOn", &r.CreatedOn) + delete(rawMsg, key) + case "expandedProperties": + err = unpopulate(val, "ExpandedProperties", &r.ExpandedProperties) + delete(rawMsg, key) + case "justification": + err = unpopulate(val, "Justification", &r.Justification) + delete(rawMsg, key) + case "linkedRoleEligibilityScheduleId": + err = unpopulate(val, "LinkedRoleEligibilityScheduleID", &r.LinkedRoleEligibilityScheduleID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &r.PrincipalID) + delete(rawMsg, key) + case "principalType": + err = unpopulate(val, "PrincipalType", &r.PrincipalType) + delete(rawMsg, key) + case "requestType": + err = unpopulate(val, "RequestType", &r.RequestType) + delete(rawMsg, key) + case "requestorId": + err = unpopulate(val, "RequestorID", &r.RequestorID) + delete(rawMsg, key) + case "roleDefinitionId": + err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) + delete(rawMsg, key) + case "scheduleInfo": + err = unpopulate(val, "ScheduleInfo", &r.ScheduleInfo) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &r.Scope) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &r.Status) + delete(rawMsg, key) + case "targetRoleAssignmentScheduleId": + err = unpopulate(val, "TargetRoleAssignmentScheduleID", &r.TargetRoleAssignmentScheduleID) + delete(rawMsg, key) + case "targetRoleAssignmentScheduleInstanceId": + err = unpopulate(val, "TargetRoleAssignmentScheduleInstanceID", &r.TargetRoleAssignmentScheduleInstanceID) + delete(rawMsg, key) + case "ticketInfo": + err = unpopulate(val, "TicketInfo", &r.TicketInfo) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleRequestPropertiesScheduleInfo. +func (r RoleAssignmentScheduleRequestPropertiesScheduleInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "expiration", r.Expiration) + populateDateTimeRFC3339(objectMap, "startDateTime", r.StartDateTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleRequestPropertiesScheduleInfo. +func (r *RoleAssignmentScheduleRequestPropertiesScheduleInfo) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "expiration": + err = unpopulate(val, "Expiration", &r.Expiration) + delete(rawMsg, key) + case "startDateTime": + err = unpopulateDateTimeRFC3339(val, "StartDateTime", &r.StartDateTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration. +func (r RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "duration", r.Duration) + populateDateTimeRFC3339(objectMap, "endDateTime", r.EndDateTime) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration. +func (r *RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "duration": + err = unpopulate(val, "Duration", &r.Duration) + delete(rawMsg, key) + case "endDateTime": + err = unpopulateDateTimeRFC3339(val, "EndDateTime", &r.EndDateTime) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleRequestPropertiesTicketInfo. +func (r RoleAssignmentScheduleRequestPropertiesTicketInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ticketNumber", r.TicketNumber) + populate(objectMap, "ticketSystem", r.TicketSystem) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleRequestPropertiesTicketInfo. +func (r *RoleAssignmentScheduleRequestPropertiesTicketInfo) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ticketNumber": + err = unpopulate(val, "TicketNumber", &r.TicketNumber) + delete(rawMsg, key) + case "ticketSystem": + err = unpopulate(val, "TicketSystem", &r.TicketSystem) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleDefinition. +func (r RoleDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleDefinition. +func (r *RoleDefinition) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleDefinitionFilter. +func (r RoleDefinitionFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "roleName", r.RoleName) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleDefinitionFilter. +func (r *RoleDefinitionFilter) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "roleName": + err = unpopulate(val, "RoleName", &r.RoleName) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleDefinitionListResult. +func (r RoleDefinitionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleDefinitionListResult. +func (r *RoleDefinitionListResult) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleDefinitionProperties. +func (r RoleDefinitionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "assignableScopes", r.AssignableScopes) + populate(objectMap, "description", r.Description) + populate(objectMap, "permissions", r.Permissions) + populate(objectMap, "roleName", r.RoleName) + populate(objectMap, "type", r.RoleType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleDefinitionProperties. +func (r *RoleDefinitionProperties) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "assignableScopes": + err = unpopulate(val, "AssignableScopes", &r.AssignableScopes) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &r.Description) + delete(rawMsg, key) + case "permissions": + err = unpopulate(val, "Permissions", &r.Permissions) + delete(rawMsg, key) + case "roleName": + err = unpopulate(val, "RoleName", &r.RoleName) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "RoleType", &r.RoleType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleEligibilitySchedule. +func (r RoleEligibilitySchedule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilitySchedule. +func (r *RoleEligibilitySchedule) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleFilter. +func (r RoleEligibilityScheduleFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", r.PrincipalID) + populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) + populate(objectMap, "status", r.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleFilter. +func (r *RoleEligibilityScheduleFilter) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &r.PrincipalID) + delete(rawMsg, key) + case "roleDefinitionId": + err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &r.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleInstance. +func (r RoleEligibilityScheduleInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleInstance. +func (r *RoleEligibilityScheduleInstance) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleInstanceFilter. +func (r RoleEligibilityScheduleInstanceFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", r.PrincipalID) + populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) + populate(objectMap, "roleEligibilityScheduleId", r.RoleEligibilityScheduleID) + populate(objectMap, "status", r.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleInstanceFilter. +func (r *RoleEligibilityScheduleInstanceFilter) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &r.PrincipalID) + delete(rawMsg, key) + case "roleDefinitionId": + err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) + delete(rawMsg, key) + case "roleEligibilityScheduleId": + err = unpopulate(val, "RoleEligibilityScheduleID", &r.RoleEligibilityScheduleID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &r.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleInstanceListResult. +func (r RoleEligibilityScheduleInstanceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleInstanceListResult. +func (r *RoleEligibilityScheduleInstanceListResult) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleInstanceProperties. +func (r RoleEligibilityScheduleInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "condition", r.Condition) + populate(objectMap, "conditionVersion", r.ConditionVersion) + populateDateTimeRFC3339(objectMap, "createdOn", r.CreatedOn) + populateDateTimeRFC3339(objectMap, "endDateTime", r.EndDateTime) + populate(objectMap, "expandedProperties", r.ExpandedProperties) + populate(objectMap, "memberType", r.MemberType) + populate(objectMap, "principalId", r.PrincipalID) + populate(objectMap, "principalType", r.PrincipalType) + populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) + populate(objectMap, "roleEligibilityScheduleId", r.RoleEligibilityScheduleID) + populate(objectMap, "scope", r.Scope) + populateDateTimeRFC3339(objectMap, "startDateTime", r.StartDateTime) + populate(objectMap, "status", r.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleInstanceProperties. +func (r *RoleEligibilityScheduleInstanceProperties) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "condition": + err = unpopulate(val, "Condition", &r.Condition) + delete(rawMsg, key) + case "conditionVersion": + err = unpopulate(val, "ConditionVersion", &r.ConditionVersion) + delete(rawMsg, key) + case "createdOn": + err = unpopulateDateTimeRFC3339(val, "CreatedOn", &r.CreatedOn) + delete(rawMsg, key) + case "endDateTime": + err = unpopulateDateTimeRFC3339(val, "EndDateTime", &r.EndDateTime) + delete(rawMsg, key) + case "expandedProperties": + err = unpopulate(val, "ExpandedProperties", &r.ExpandedProperties) + delete(rawMsg, key) + case "memberType": + err = unpopulate(val, "MemberType", &r.MemberType) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &r.PrincipalID) + delete(rawMsg, key) + case "principalType": + err = unpopulate(val, "PrincipalType", &r.PrincipalType) + delete(rawMsg, key) + case "roleDefinitionId": + err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) + delete(rawMsg, key) + case "roleEligibilityScheduleId": + err = unpopulate(val, "RoleEligibilityScheduleID", &r.RoleEligibilityScheduleID) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &r.Scope) + delete(rawMsg, key) + case "startDateTime": + err = unpopulateDateTimeRFC3339(val, "StartDateTime", &r.StartDateTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &r.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleListResult. +func (r RoleEligibilityScheduleListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleListResult. +func (r *RoleEligibilityScheduleListResult) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleProperties. +func (r RoleEligibilityScheduleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "condition", r.Condition) + populate(objectMap, "conditionVersion", r.ConditionVersion) + populateDateTimeRFC3339(objectMap, "createdOn", r.CreatedOn) + populateDateTimeRFC3339(objectMap, "endDateTime", r.EndDateTime) + populate(objectMap, "expandedProperties", r.ExpandedProperties) + populate(objectMap, "memberType", r.MemberType) + populate(objectMap, "principalId", r.PrincipalID) + populate(objectMap, "principalType", r.PrincipalType) + populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) + populate(objectMap, "roleEligibilityScheduleRequestId", r.RoleEligibilityScheduleRequestID) + populate(objectMap, "scope", r.Scope) + populateDateTimeRFC3339(objectMap, "startDateTime", r.StartDateTime) + populate(objectMap, "status", r.Status) + populateDateTimeRFC3339(objectMap, "updatedOn", r.UpdatedOn) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleProperties. +func (r *RoleEligibilityScheduleProperties) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "condition": + err = unpopulate(val, "Condition", &r.Condition) + delete(rawMsg, key) + case "conditionVersion": + err = unpopulate(val, "ConditionVersion", &r.ConditionVersion) + delete(rawMsg, key) + case "createdOn": + err = unpopulateDateTimeRFC3339(val, "CreatedOn", &r.CreatedOn) + delete(rawMsg, key) + case "endDateTime": + err = unpopulateDateTimeRFC3339(val, "EndDateTime", &r.EndDateTime) + delete(rawMsg, key) + case "expandedProperties": + err = unpopulate(val, "ExpandedProperties", &r.ExpandedProperties) + delete(rawMsg, key) + case "memberType": + err = unpopulate(val, "MemberType", &r.MemberType) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &r.PrincipalID) + delete(rawMsg, key) + case "principalType": + err = unpopulate(val, "PrincipalType", &r.PrincipalType) + delete(rawMsg, key) + case "roleDefinitionId": + err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) + delete(rawMsg, key) + case "roleEligibilityScheduleRequestId": + err = unpopulate(val, "RoleEligibilityScheduleRequestID", &r.RoleEligibilityScheduleRequestID) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &r.Scope) + delete(rawMsg, key) + case "startDateTime": + err = unpopulateDateTimeRFC3339(val, "StartDateTime", &r.StartDateTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &r.Status) + delete(rawMsg, key) + case "updatedOn": + err = unpopulateDateTimeRFC3339(val, "UpdatedOn", &r.UpdatedOn) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleRequest. +func (r RoleEligibilityScheduleRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleRequest. +func (r *RoleEligibilityScheduleRequest) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleRequestFilter. +func (r RoleEligibilityScheduleRequestFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", r.PrincipalID) + populate(objectMap, "requestorId", r.RequestorID) + populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) + populate(objectMap, "status", r.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleRequestFilter. +func (r *RoleEligibilityScheduleRequestFilter) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &r.PrincipalID) + delete(rawMsg, key) + case "requestorId": + err = unpopulate(val, "RequestorID", &r.RequestorID) + delete(rawMsg, key) + case "roleDefinitionId": + err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &r.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleRequestListResult. +func (r RoleEligibilityScheduleRequestListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleRequestListResult. +func (r *RoleEligibilityScheduleRequestListResult) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleRequestProperties. +func (r RoleEligibilityScheduleRequestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "approvalId", r.ApprovalID) + populate(objectMap, "condition", r.Condition) + populate(objectMap, "conditionVersion", r.ConditionVersion) + populateDateTimeRFC3339(objectMap, "createdOn", r.CreatedOn) + populate(objectMap, "expandedProperties", r.ExpandedProperties) + populate(objectMap, "justification", r.Justification) + populate(objectMap, "principalId", r.PrincipalID) + populate(objectMap, "principalType", r.PrincipalType) + populate(objectMap, "requestType", r.RequestType) + populate(objectMap, "requestorId", r.RequestorID) + populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) + populate(objectMap, "scheduleInfo", r.ScheduleInfo) + populate(objectMap, "scope", r.Scope) + populate(objectMap, "status", r.Status) + populate(objectMap, "targetRoleEligibilityScheduleId", r.TargetRoleEligibilityScheduleID) + populate(objectMap, "targetRoleEligibilityScheduleInstanceId", r.TargetRoleEligibilityScheduleInstanceID) + populate(objectMap, "ticketInfo", r.TicketInfo) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleRequestProperties. +func (r *RoleEligibilityScheduleRequestProperties) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "approvalId": + err = unpopulate(val, "ApprovalID", &r.ApprovalID) + delete(rawMsg, key) + case "condition": + err = unpopulate(val, "Condition", &r.Condition) + delete(rawMsg, key) + case "conditionVersion": + err = unpopulate(val, "ConditionVersion", &r.ConditionVersion) + delete(rawMsg, key) + case "createdOn": + err = unpopulateDateTimeRFC3339(val, "CreatedOn", &r.CreatedOn) + delete(rawMsg, key) + case "expandedProperties": + err = unpopulate(val, "ExpandedProperties", &r.ExpandedProperties) + delete(rawMsg, key) + case "justification": + err = unpopulate(val, "Justification", &r.Justification) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &r.PrincipalID) + delete(rawMsg, key) + case "principalType": + err = unpopulate(val, "PrincipalType", &r.PrincipalType) + delete(rawMsg, key) + case "requestType": + err = unpopulate(val, "RequestType", &r.RequestType) + delete(rawMsg, key) + case "requestorId": + err = unpopulate(val, "RequestorID", &r.RequestorID) + delete(rawMsg, key) + case "roleDefinitionId": + err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) + delete(rawMsg, key) + case "scheduleInfo": + err = unpopulate(val, "ScheduleInfo", &r.ScheduleInfo) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &r.Scope) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &r.Status) + delete(rawMsg, key) + case "targetRoleEligibilityScheduleId": + err = unpopulate(val, "TargetRoleEligibilityScheduleID", &r.TargetRoleEligibilityScheduleID) + delete(rawMsg, key) + case "targetRoleEligibilityScheduleInstanceId": + err = unpopulate(val, "TargetRoleEligibilityScheduleInstanceID", &r.TargetRoleEligibilityScheduleInstanceID) + delete(rawMsg, key) + case "ticketInfo": + err = unpopulate(val, "TicketInfo", &r.TicketInfo) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleRequestPropertiesScheduleInfo. +func (r RoleEligibilityScheduleRequestPropertiesScheduleInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "expiration", r.Expiration) + populateDateTimeRFC3339(objectMap, "startDateTime", r.StartDateTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleRequestPropertiesScheduleInfo. +func (r *RoleEligibilityScheduleRequestPropertiesScheduleInfo) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "expiration": + err = unpopulate(val, "Expiration", &r.Expiration) + delete(rawMsg, key) + case "startDateTime": + err = unpopulateDateTimeRFC3339(val, "StartDateTime", &r.StartDateTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration. +func (r RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "duration", r.Duration) + populateDateTimeRFC3339(objectMap, "endDateTime", r.EndDateTime) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration. +func (r *RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "duration": + err = unpopulate(val, "Duration", &r.Duration) + delete(rawMsg, key) + case "endDateTime": + err = unpopulateDateTimeRFC3339(val, "EndDateTime", &r.EndDateTime) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleRequestPropertiesTicketInfo. +func (r RoleEligibilityScheduleRequestPropertiesTicketInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ticketNumber", r.TicketNumber) + populate(objectMap, "ticketSystem", r.TicketSystem) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleRequestPropertiesTicketInfo. +func (r *RoleEligibilityScheduleRequestPropertiesTicketInfo) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ticketNumber": + err = unpopulate(val, "TicketNumber", &r.TicketNumber) + delete(rawMsg, key) + case "ticketSystem": + err = unpopulate(val, "TicketSystem", &r.TicketSystem) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicy. +func (r RoleManagementPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicy. +func (r *RoleManagementPolicy) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyApprovalRule. +func (r RoleManagementPolicyApprovalRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + objectMap["ruleType"] = RoleManagementPolicyRuleTypeRoleManagementPolicyApprovalRule + populate(objectMap, "setting", r.Setting) + populate(objectMap, "target", r.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyApprovalRule. +func (r *RoleManagementPolicyApprovalRule) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &r.RuleType) + delete(rawMsg, key) + case "setting": + err = unpopulate(val, "Setting", &r.Setting) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &r.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyAssignment. +func (r RoleManagementPolicyAssignment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyAssignment. +func (r *RoleManagementPolicyAssignment) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyAssignmentListResult. +func (r RoleManagementPolicyAssignmentListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyAssignmentListResult. +func (r *RoleManagementPolicyAssignmentListResult) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyAssignmentProperties. +func (r RoleManagementPolicyAssignmentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "effectiveRules", r.EffectiveRules) + populate(objectMap, "policyAssignmentProperties", r.PolicyAssignmentProperties) + populate(objectMap, "policyId", r.PolicyID) + populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) + populate(objectMap, "scope", r.Scope) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyAssignmentProperties. +func (r *RoleManagementPolicyAssignmentProperties) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "effectiveRules": + r.EffectiveRules, err = unmarshalRoleManagementPolicyRuleClassificationArray(val) + delete(rawMsg, key) + case "policyAssignmentProperties": + err = unpopulate(val, "PolicyAssignmentProperties", &r.PolicyAssignmentProperties) + delete(rawMsg, key) + case "policyId": + err = unpopulate(val, "PolicyID", &r.PolicyID) + delete(rawMsg, key) + case "roleDefinitionId": + err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &r.Scope) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyAuthenticationContextRule. +func (r RoleManagementPolicyAuthenticationContextRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "claimValue", r.ClaimValue) + populate(objectMap, "id", r.ID) + populate(objectMap, "isEnabled", r.IsEnabled) + objectMap["ruleType"] = RoleManagementPolicyRuleTypeRoleManagementPolicyAuthenticationContextRule + populate(objectMap, "target", r.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyAuthenticationContextRule. +func (r *RoleManagementPolicyAuthenticationContextRule) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "claimValue": + err = unpopulate(val, "ClaimValue", &r.ClaimValue) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &r.IsEnabled) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &r.RuleType) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &r.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyEnablementRule. +func (r RoleManagementPolicyEnablementRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabledRules", r.EnabledRules) + populate(objectMap, "id", r.ID) + objectMap["ruleType"] = RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule + populate(objectMap, "target", r.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyEnablementRule. +func (r *RoleManagementPolicyEnablementRule) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabledRules": + err = unpopulate(val, "EnabledRules", &r.EnabledRules) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &r.RuleType) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &r.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyExpirationRule. +func (r RoleManagementPolicyExpirationRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "isExpirationRequired", r.IsExpirationRequired) + populate(objectMap, "maximumDuration", r.MaximumDuration) + objectMap["ruleType"] = RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule + populate(objectMap, "target", r.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyExpirationRule. +func (r *RoleManagementPolicyExpirationRule) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "isExpirationRequired": + err = unpopulate(val, "IsExpirationRequired", &r.IsExpirationRequired) + delete(rawMsg, key) + case "maximumDuration": + err = unpopulate(val, "MaximumDuration", &r.MaximumDuration) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &r.RuleType) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &r.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyListResult. +func (r RoleManagementPolicyListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyListResult. +func (r *RoleManagementPolicyListResult) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyNotificationRule. +func (r RoleManagementPolicyNotificationRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "isDefaultRecipientsEnabled", r.IsDefaultRecipientsEnabled) + populate(objectMap, "notificationLevel", r.NotificationLevel) + populate(objectMap, "notificationRecipients", r.NotificationRecipients) + populate(objectMap, "notificationType", r.NotificationType) + populate(objectMap, "recipientType", r.RecipientType) + objectMap["ruleType"] = RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule + populate(objectMap, "target", r.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyNotificationRule. +func (r *RoleManagementPolicyNotificationRule) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "isDefaultRecipientsEnabled": + err = unpopulate(val, "IsDefaultRecipientsEnabled", &r.IsDefaultRecipientsEnabled) + delete(rawMsg, key) + case "notificationLevel": + err = unpopulate(val, "NotificationLevel", &r.NotificationLevel) + delete(rawMsg, key) + case "notificationRecipients": + err = unpopulate(val, "NotificationRecipients", &r.NotificationRecipients) + delete(rawMsg, key) + case "notificationType": + err = unpopulate(val, "NotificationType", &r.NotificationType) + delete(rawMsg, key) + case "recipientType": + err = unpopulate(val, "RecipientType", &r.RecipientType) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &r.RuleType) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &r.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyProperties. +func (r RoleManagementPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", r.Description) + populate(objectMap, "displayName", r.DisplayName) + populate(objectMap, "effectiveRules", r.EffectiveRules) + populate(objectMap, "isOrganizationDefault", r.IsOrganizationDefault) + populate(objectMap, "lastModifiedBy", r.LastModifiedBy) + populateDateTimeRFC3339(objectMap, "lastModifiedDateTime", r.LastModifiedDateTime) + populate(objectMap, "policyProperties", r.PolicyProperties) + populate(objectMap, "rules", r.Rules) + populate(objectMap, "scope", r.Scope) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyProperties. +func (r *RoleManagementPolicyProperties) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &r.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &r.DisplayName) + delete(rawMsg, key) + case "effectiveRules": + r.EffectiveRules, err = unmarshalRoleManagementPolicyRuleClassificationArray(val) + delete(rawMsg, key) + case "isOrganizationDefault": + err = unpopulate(val, "IsOrganizationDefault", &r.IsOrganizationDefault) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &r.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedDateTime": + err = unpopulateDateTimeRFC3339(val, "LastModifiedDateTime", &r.LastModifiedDateTime) + delete(rawMsg, key) + case "policyProperties": + err = unpopulate(val, "PolicyProperties", &r.PolicyProperties) + delete(rawMsg, key) + case "rules": + r.Rules, err = unmarshalRoleManagementPolicyRuleClassificationArray(val) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &r.Scope) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyRule. +func (r RoleManagementPolicyRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + objectMap["ruleType"] = r.RuleType + populate(objectMap, "target", r.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyRule. +func (r *RoleManagementPolicyRule) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &r.RuleType) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &r.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyRuleTarget. +func (r RoleManagementPolicyRuleTarget) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "caller", r.Caller) + populate(objectMap, "enforcedSettings", r.EnforcedSettings) + populate(objectMap, "inheritableSettings", r.InheritableSettings) + populate(objectMap, "level", r.Level) + populate(objectMap, "operations", r.Operations) + populate(objectMap, "targetObjects", r.TargetObjects) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyRuleTarget. +func (r *RoleManagementPolicyRuleTarget) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "caller": + err = unpopulate(val, "Caller", &r.Caller) + delete(rawMsg, key) + case "enforcedSettings": + err = unpopulate(val, "EnforcedSettings", &r.EnforcedSettings) + delete(rawMsg, key) + case "inheritableSettings": + err = unpopulate(val, "InheritableSettings", &r.InheritableSettings) + delete(rawMsg, key) + case "level": + err = unpopulate(val, "Level", &r.Level) + delete(rawMsg, key) + case "operations": + err = unpopulate(val, "Operations", &r.Operations) + delete(rawMsg, key) + case "targetObjects": + err = unpopulate(val, "TargetObjects", &r.TargetObjects) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UserSet. +func (u UserSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", u.Description) + populate(objectMap, "id", u.ID) + populate(objectMap, "isBackup", u.IsBackup) + populate(objectMap, "userType", u.UserType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserSet. +func (u *UserSet) 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", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &u.Description) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &u.ID) + delete(rawMsg, key) + case "isBackup": + err = unpopulate(val, "IsBackup", &u.IsBackup) + delete(rawMsg, key) + case "userType": + err = unpopulate(val, "UserType", &u.UserType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ValidationResponse. +func (v ValidationResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "errorInfo", v.ErrorInfo) + populate(objectMap, "isValid", v.IsValid) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ValidationResponse. +func (v *ValidationResponse) 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", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "errorInfo": + err = unpopulate(val, "ErrorInfo", &v.ErrorInfo) + delete(rawMsg, key) + case "isValid": + err = unpopulate(val, "IsValid", &v.IsValid) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ValidationResponseErrorInfo. +func (v ValidationResponseErrorInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", v.Code) + populate(objectMap, "message", v.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ValidationResponseErrorInfo. +func (v *ValidationResponseErrorInfo) 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", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &v.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &v.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func populateAny(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/options.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/options.go new file mode 100644 index 000000000..05e23b54d --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/options.go @@ -0,0 +1,426 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armauthorization + +// ClassicAdministratorsClientListOptions contains the optional parameters for the ClassicAdministratorsClient.NewListPager +// method. +type ClassicAdministratorsClientListOptions struct { + // placeholder for future optional parameters +} + +// DenyAssignmentsClientGetByIDOptions contains the optional parameters for the DenyAssignmentsClient.GetByID method. +type DenyAssignmentsClientGetByIDOptions struct { + // placeholder for future optional parameters +} + +// DenyAssignmentsClientGetOptions contains the optional parameters for the DenyAssignmentsClient.Get method. +type DenyAssignmentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// DenyAssignmentsClientListForResourceGroupOptions contains the optional parameters for the DenyAssignmentsClient.NewListForResourceGroupPager +// method. +type DenyAssignmentsClientListForResourceGroupOptions struct { + // The filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or above the scope. Use $filter=denyAssignmentName + // eq '{name}' to search deny assignments by name at + // specified scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for the + // specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all + // deny assignments at, above and below the scope for the specified principal. This filter is different from the principalId + // filter as it returns not only those deny assignments that contain the + // specified principal is the Principals list but also those deny assignments that contain the specified principal is the + // ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, + // only the deny assignment name and description properties are returned. + Filter *string +} + +// DenyAssignmentsClientListForResourceOptions contains the optional parameters for the DenyAssignmentsClient.NewListForResourcePager +// method. +type DenyAssignmentsClientListForResourceOptions struct { + // The filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or above the scope. Use $filter=denyAssignmentName + // eq '{name}' to search deny assignments by name at + // specified scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for the + // specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all + // deny assignments at, above and below the scope for the specified principal. This filter is different from the principalId + // filter as it returns not only those deny assignments that contain the + // specified principal is the Principals list but also those deny assignments that contain the specified principal is the + // ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, + // only the deny assignment name and description properties are returned. + Filter *string +} + +// DenyAssignmentsClientListForScopeOptions contains the optional parameters for the DenyAssignmentsClient.NewListForScopePager +// method. +type DenyAssignmentsClientListForScopeOptions struct { + // The filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or above the scope. Use $filter=denyAssignmentName + // eq '{name}' to search deny assignments by name at + // specified scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for the + // specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all + // deny assignments at, above and below the scope for the specified principal. This filter is different from the principalId + // filter as it returns not only those deny assignments that contain the + // specified principal is the Principals list but also those deny assignments that contain the specified principal is the + // ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, + // only the deny assignment name and description properties are returned. + Filter *string +} + +// DenyAssignmentsClientListOptions contains the optional parameters for the DenyAssignmentsClient.NewListPager method. +type DenyAssignmentsClientListOptions struct { + // The filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or above the scope. Use $filter=denyAssignmentName + // eq '{name}' to search deny assignments by name at + // specified scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for the + // specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all + // deny assignments at, above and below the scope for the specified principal. This filter is different from the principalId + // filter as it returns not only those deny assignments that contain the + // specified principal is the Principals list but also those deny assignments that contain the specified principal is the + // ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, + // only the deny assignment name and description properties are returned. + Filter *string +} + +// EligibleChildResourcesClientGetOptions contains the optional parameters for the EligibleChildResourcesClient.NewGetPager +// method. +type EligibleChildResourcesClientGetOptions struct { + // The filter to apply on the operation. Use $filter=resourceType+eq+'Subscription' to filter on only resource of type = 'Subscription'. + // Use + // $filter=resourceType+eq+'subscription'+or+resourceType+eq+'resourcegroup' to filter on resource of type = 'Subscription' + // or 'ResourceGroup' + Filter *string +} + +// GlobalAdministratorClientElevateAccessOptions contains the optional parameters for the GlobalAdministratorClient.ElevateAccess +// method. +type GlobalAdministratorClientElevateAccessOptions struct { + // placeholder for future optional parameters +} + +// PermissionsClientListForResourceGroupOptions contains the optional parameters for the PermissionsClient.NewListForResourceGroupPager +// method. +type PermissionsClientListForResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// PermissionsClientListForResourceOptions contains the optional parameters for the PermissionsClient.NewListForResourcePager +// method. +type PermissionsClientListForResourceOptions struct { + // placeholder for future optional parameters +} + +// ProviderOperationsMetadataClientGetOptions contains the optional parameters for the ProviderOperationsMetadataClient.Get +// method. +type ProviderOperationsMetadataClientGetOptions struct { + // Specifies whether to expand the values. + Expand *string +} + +// ProviderOperationsMetadataClientListOptions contains the optional parameters for the ProviderOperationsMetadataClient.NewListPager +// method. +type ProviderOperationsMetadataClientListOptions struct { + // Specifies whether to expand the values. + Expand *string +} + +// RoleAssignmentScheduleInstancesClientGetOptions contains the optional parameters for the RoleAssignmentScheduleInstancesClient.Get +// method. +type RoleAssignmentScheduleInstancesClientGetOptions struct { + // placeholder for future optional parameters +} + +// RoleAssignmentScheduleInstancesClientListForScopeOptions contains the optional parameters for the RoleAssignmentScheduleInstancesClient.NewListForScopePager +// method. +type RoleAssignmentScheduleInstancesClientListForScopeOptions struct { + // The filter to apply on the operation. Use $filter=atScope() to return all role assignment schedules at or above the scope. + // Use $filter=principalId eq {id} to return all role assignment schedules at, + // above or below the scope for the specified principal. Use $filter=assignedTo('{userId}') to return all role assignment + // schedule instances for the user. Use $filter=asTarget() to return all role + // assignment schedule instances created for the current user. + Filter *string +} + +// RoleAssignmentScheduleRequestsClientCancelOptions contains the optional parameters for the RoleAssignmentScheduleRequestsClient.Cancel +// method. +type RoleAssignmentScheduleRequestsClientCancelOptions struct { + // placeholder for future optional parameters +} + +// RoleAssignmentScheduleRequestsClientCreateOptions contains the optional parameters for the RoleAssignmentScheduleRequestsClient.Create +// method. +type RoleAssignmentScheduleRequestsClientCreateOptions struct { + // placeholder for future optional parameters +} + +// RoleAssignmentScheduleRequestsClientGetOptions contains the optional parameters for the RoleAssignmentScheduleRequestsClient.Get +// method. +type RoleAssignmentScheduleRequestsClientGetOptions struct { + // placeholder for future optional parameters +} + +// RoleAssignmentScheduleRequestsClientListForScopeOptions contains the optional parameters for the RoleAssignmentScheduleRequestsClient.NewListForScopePager +// method. +type RoleAssignmentScheduleRequestsClientListForScopeOptions struct { + // The filter to apply on the operation. Use $filter=atScope() to return all role assignment schedule requests at or above + // the scope. Use $filter=principalId eq {id} to return all role assignment + // schedule requests at, above or below the scope for the specified principal. Use $filter=asRequestor() to return all role + // assignment schedule requests requested by the current user. Use + // $filter=asTarget() to return all role assignment schedule requests created for the current user. Use $filter=asApprover() + // to return all role assignment schedule requests where the current user is an + // approver. + Filter *string +} + +// RoleAssignmentScheduleRequestsClientValidateOptions contains the optional parameters for the RoleAssignmentScheduleRequestsClient.Validate +// method. +type RoleAssignmentScheduleRequestsClientValidateOptions struct { + // placeholder for future optional parameters +} + +// RoleAssignmentSchedulesClientGetOptions contains the optional parameters for the RoleAssignmentSchedulesClient.Get method. +type RoleAssignmentSchedulesClientGetOptions struct { + // placeholder for future optional parameters +} + +// RoleAssignmentSchedulesClientListForScopeOptions contains the optional parameters for the RoleAssignmentSchedulesClient.NewListForScopePager +// method. +type RoleAssignmentSchedulesClientListForScopeOptions struct { + // The filter to apply on the operation. Use $filter=atScope() to return all role assignment schedules at or above the scope. + // Use $filter=principalId eq {id} to return all role assignment schedules at, + // above or below the scope for the specified principal. Use $filter=assignedTo('{userId}') to return all role assignment + // schedules for the current user. Use $filter=asTarget() to return all role + // assignment schedules created for the current user. + Filter *string +} + +// RoleAssignmentsClientCreateByIDOptions contains the optional parameters for the RoleAssignmentsClient.CreateByID method. +type RoleAssignmentsClientCreateByIDOptions struct { + // placeholder for future optional parameters +} + +// RoleAssignmentsClientCreateOptions contains the optional parameters for the RoleAssignmentsClient.Create method. +type RoleAssignmentsClientCreateOptions struct { + // placeholder for future optional parameters +} + +// RoleAssignmentsClientDeleteByIDOptions contains the optional parameters for the RoleAssignmentsClient.DeleteByID method. +type RoleAssignmentsClientDeleteByIDOptions struct { + // Tenant ID for cross-tenant request + TenantID *string +} + +// RoleAssignmentsClientDeleteOptions contains the optional parameters for the RoleAssignmentsClient.Delete method. +type RoleAssignmentsClientDeleteOptions struct { + // Tenant ID for cross-tenant request + TenantID *string +} + +// RoleAssignmentsClientGetByIDOptions contains the optional parameters for the RoleAssignmentsClient.GetByID method. +type RoleAssignmentsClientGetByIDOptions struct { + // Tenant ID for cross-tenant request + TenantID *string +} + +// RoleAssignmentsClientGetOptions contains the optional parameters for the RoleAssignmentsClient.Get method. +type RoleAssignmentsClientGetOptions struct { + // Tenant ID for cross-tenant request + TenantID *string +} + +// RoleAssignmentsClientListForResourceGroupOptions contains the optional parameters for the RoleAssignmentsClient.NewListForResourceGroupPager +// method. +type RoleAssignmentsClientListForResourceGroupOptions struct { + // The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId + // eq {id} to return all role assignments at, above or below the + // scope for the specified principal. + Filter *string + + // Tenant ID for cross-tenant request + TenantID *string +} + +// RoleAssignmentsClientListForResourceOptions contains the optional parameters for the RoleAssignmentsClient.NewListForResourcePager +// method. +type RoleAssignmentsClientListForResourceOptions struct { + // The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId + // eq {id} to return all role assignments at, above or below the + // scope for the specified principal. + Filter *string + + // Tenant ID for cross-tenant request + TenantID *string +} + +// RoleAssignmentsClientListForScopeOptions contains the optional parameters for the RoleAssignmentsClient.NewListForScopePager +// method. +type RoleAssignmentsClientListForScopeOptions struct { + // The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId + // eq {id} to return all role assignments at, above or below the + // scope for the specified principal. + Filter *string + + // The skipToken to apply on the operation. Use $skipToken={skiptoken} to return paged role assignments following the skipToken + // passed. Only supported on provider level calls. + SkipToken *string + + // Tenant ID for cross-tenant request + TenantID *string +} + +// RoleAssignmentsClientListForSubscriptionOptions contains the optional parameters for the RoleAssignmentsClient.NewListForSubscriptionPager +// method. +type RoleAssignmentsClientListForSubscriptionOptions struct { + // The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId + // eq {id} to return all role assignments at, above or below the + // scope for the specified principal. + Filter *string + + // Tenant ID for cross-tenant request + TenantID *string +} + +// RoleDefinitionsClientCreateOrUpdateOptions contains the optional parameters for the RoleDefinitionsClient.CreateOrUpdate +// method. +type RoleDefinitionsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// RoleDefinitionsClientDeleteOptions contains the optional parameters for the RoleDefinitionsClient.Delete method. +type RoleDefinitionsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// RoleDefinitionsClientGetByIDOptions contains the optional parameters for the RoleDefinitionsClient.GetByID method. +type RoleDefinitionsClientGetByIDOptions struct { + // placeholder for future optional parameters +} + +// RoleDefinitionsClientGetOptions contains the optional parameters for the RoleDefinitionsClient.Get method. +type RoleDefinitionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// RoleDefinitionsClientListOptions contains the optional parameters for the RoleDefinitionsClient.NewListPager method. +type RoleDefinitionsClientListOptions struct { + // The filter to apply on the operation. Use atScopeAndBelow filter to search below the given scope as well. + Filter *string +} + +// RoleEligibilityScheduleInstancesClientGetOptions contains the optional parameters for the RoleEligibilityScheduleInstancesClient.Get +// method. +type RoleEligibilityScheduleInstancesClientGetOptions struct { + // placeholder for future optional parameters +} + +// RoleEligibilityScheduleInstancesClientListForScopeOptions contains the optional parameters for the RoleEligibilityScheduleInstancesClient.NewListForScopePager +// method. +type RoleEligibilityScheduleInstancesClientListForScopeOptions struct { + // The filter to apply on the operation. Use $filter=atScope() to return all role assignment schedules at or above the scope. + // Use $filter=principalId eq {id} to return all role assignment schedules at, + // above or below the scope for the specified principal. Use $filter=assignedTo('{userId}') to return all role eligibility + // schedules for the user. Use $filter=asTarget() to return all role eligibility + // schedules created for the current user. + Filter *string +} + +// RoleEligibilityScheduleRequestsClientCancelOptions contains the optional parameters for the RoleEligibilityScheduleRequestsClient.Cancel +// method. +type RoleEligibilityScheduleRequestsClientCancelOptions struct { + // placeholder for future optional parameters +} + +// RoleEligibilityScheduleRequestsClientCreateOptions contains the optional parameters for the RoleEligibilityScheduleRequestsClient.Create +// method. +type RoleEligibilityScheduleRequestsClientCreateOptions struct { + // placeholder for future optional parameters +} + +// RoleEligibilityScheduleRequestsClientGetOptions contains the optional parameters for the RoleEligibilityScheduleRequestsClient.Get +// method. +type RoleEligibilityScheduleRequestsClientGetOptions struct { + // placeholder for future optional parameters +} + +// RoleEligibilityScheduleRequestsClientListForScopeOptions contains the optional parameters for the RoleEligibilityScheduleRequestsClient.NewListForScopePager +// method. +type RoleEligibilityScheduleRequestsClientListForScopeOptions struct { + // The filter to apply on the operation. Use $filter=atScope() to return all role eligibility schedule requests at or above + // the scope. Use $filter=principalId eq {id} to return all role eligibility + // schedule requests at, above or below the scope for the specified principal. Use $filter=asRequestor() to return all role + // eligibility schedule requests requested by the current user. Use + // $filter=asTarget() to return all role eligibility schedule requests created for the current user. Use $filter=asApprover() + // to return all role eligibility schedule requests where the current user is an + // approver. + Filter *string +} + +// RoleEligibilityScheduleRequestsClientValidateOptions contains the optional parameters for the RoleEligibilityScheduleRequestsClient.Validate +// method. +type RoleEligibilityScheduleRequestsClientValidateOptions struct { + // placeholder for future optional parameters +} + +// RoleEligibilitySchedulesClientGetOptions contains the optional parameters for the RoleEligibilitySchedulesClient.Get method. +type RoleEligibilitySchedulesClientGetOptions struct { + // placeholder for future optional parameters +} + +// RoleEligibilitySchedulesClientListForScopeOptions contains the optional parameters for the RoleEligibilitySchedulesClient.NewListForScopePager +// method. +type RoleEligibilitySchedulesClientListForScopeOptions struct { + // The filter to apply on the operation. Use $filter=atScope() to return all role eligibility schedules at or above the scope. + // Use $filter=principalId eq {id} to return all role eligibility schedules at, + // above or below the scope for the specified principal. Use $filter=assignedTo('{userId}') to return all role eligibility + // schedules for the user. Use $filter=asTarget() to return all role eligibility + // schedules created for the current user. + Filter *string +} + +// RoleManagementPoliciesClientDeleteOptions contains the optional parameters for the RoleManagementPoliciesClient.Delete +// method. +type RoleManagementPoliciesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// RoleManagementPoliciesClientGetOptions contains the optional parameters for the RoleManagementPoliciesClient.Get method. +type RoleManagementPoliciesClientGetOptions struct { + // placeholder for future optional parameters +} + +// RoleManagementPoliciesClientListForScopeOptions contains the optional parameters for the RoleManagementPoliciesClient.NewListForScopePager +// method. +type RoleManagementPoliciesClientListForScopeOptions struct { + // placeholder for future optional parameters +} + +// RoleManagementPoliciesClientUpdateOptions contains the optional parameters for the RoleManagementPoliciesClient.Update +// method. +type RoleManagementPoliciesClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// RoleManagementPolicyAssignmentsClientCreateOptions contains the optional parameters for the RoleManagementPolicyAssignmentsClient.Create +// method. +type RoleManagementPolicyAssignmentsClientCreateOptions struct { + // placeholder for future optional parameters +} + +// RoleManagementPolicyAssignmentsClientDeleteOptions contains the optional parameters for the RoleManagementPolicyAssignmentsClient.Delete +// method. +type RoleManagementPolicyAssignmentsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// RoleManagementPolicyAssignmentsClientGetOptions contains the optional parameters for the RoleManagementPolicyAssignmentsClient.Get +// method. +type RoleManagementPolicyAssignmentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// RoleManagementPolicyAssignmentsClientListForScopeOptions contains the optional parameters for the RoleManagementPolicyAssignmentsClient.NewListForScopePager +// method. +type RoleManagementPolicyAssignmentsClientListForScopeOptions struct { + // placeholder for future optional parameters +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/permissions_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/permissions_client.go new file mode 100644 index 000000000..aeed18e26 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/permissions_client.go @@ -0,0 +1,175 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armauthorization + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// PermissionsClient contains the methods for the Permissions group. +// Don't use this type directly, use NewPermissionsClient() instead. +type PermissionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPermissionsClient creates a new instance of PermissionsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewPermissionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PermissionsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PermissionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListForResourcePager - Gets all permissions the caller has for a resource. +// +// Generated from API version 2022-04-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceProviderNamespace - The namespace of the resource provider. +// - parentResourcePath - The parent resource identity. +// - resourceType - The resource type of the resource. +// - resourceName - The name of the resource to get the permissions for. +// - options - PermissionsClientListForResourceOptions contains the optional parameters for the PermissionsClient.NewListForResourcePager +// method. +func (client *PermissionsClient) NewListForResourcePager(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, options *PermissionsClientListForResourceOptions) *runtime.Pager[PermissionsClientListForResourceResponse] { + return runtime.NewPager(runtime.PagingHandler[PermissionsClientListForResourceResponse]{ + More: func(page PermissionsClientListForResourceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PermissionsClientListForResourceResponse) (PermissionsClientListForResourceResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PermissionsClient.NewListForResourcePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listForResourceCreateRequest(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, options) + }, nil) + if err != nil { + return PermissionsClientListForResourceResponse{}, err + } + return client.listForResourceHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listForResourceCreateRequest creates the ListForResource request. +func (client *PermissionsClient) listForResourceCreateRequest(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, options *PermissionsClientListForResourceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", resourceProviderNamespace) + urlPath = strings.ReplaceAll(urlPath, "{parentResourcePath}", parentResourcePath) + urlPath = strings.ReplaceAll(urlPath, "{resourceType}", resourceType) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listForResourceHandleResponse handles the ListForResource response. +func (client *PermissionsClient) listForResourceHandleResponse(resp *http.Response) (PermissionsClientListForResourceResponse, error) { + result := PermissionsClientListForResourceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PermissionGetResult); err != nil { + return PermissionsClientListForResourceResponse{}, err + } + return result, nil +} + +// NewListForResourceGroupPager - Gets all permissions the caller has for a resource group. +// +// Generated from API version 2022-04-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - PermissionsClientListForResourceGroupOptions contains the optional parameters for the PermissionsClient.NewListForResourceGroupPager +// method. +func (client *PermissionsClient) NewListForResourceGroupPager(resourceGroupName string, options *PermissionsClientListForResourceGroupOptions) *runtime.Pager[PermissionsClientListForResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[PermissionsClientListForResourceGroupResponse]{ + More: func(page PermissionsClientListForResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PermissionsClientListForResourceGroupResponse) (PermissionsClientListForResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PermissionsClient.NewListForResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listForResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return PermissionsClientListForResourceGroupResponse{}, err + } + return client.listForResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listForResourceGroupCreateRequest creates the ListForResourceGroup request. +func (client *PermissionsClient) listForResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *PermissionsClientListForResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listForResourceGroupHandleResponse handles the ListForResourceGroup response. +func (client *PermissionsClient) listForResourceGroupHandleResponse(resp *http.Response) (PermissionsClientListForResourceGroupResponse, error) { + result := PermissionsClientListForResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PermissionGetResult); err != nil { + return PermissionsClientListForResourceGroupResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/polymorphic_helpers.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/polymorphic_helpers.go new file mode 100644 index 000000000..6f1166cc0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/polymorphic_helpers.go @@ -0,0 +1,59 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armauthorization + +import "encoding/json" + +func unmarshalRoleManagementPolicyRuleClassification(rawMsg json.RawMessage) (RoleManagementPolicyRuleClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b RoleManagementPolicyRuleClassification + switch m["ruleType"] { + case string(RoleManagementPolicyRuleTypeRoleManagementPolicyApprovalRule): + b = &RoleManagementPolicyApprovalRule{} + case string(RoleManagementPolicyRuleTypeRoleManagementPolicyAuthenticationContextRule): + b = &RoleManagementPolicyAuthenticationContextRule{} + case string(RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule): + b = &RoleManagementPolicyEnablementRule{} + case string(RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule): + b = &RoleManagementPolicyExpirationRule{} + case string(RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule): + b = &RoleManagementPolicyNotificationRule{} + default: + b = &RoleManagementPolicyRule{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} + +func unmarshalRoleManagementPolicyRuleClassificationArray(rawMsg json.RawMessage) ([]RoleManagementPolicyRuleClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]RoleManagementPolicyRuleClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalRoleManagementPolicyRuleClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/provideroperationsmetadata_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/provideroperationsmetadata_client.go new file mode 100644 index 000000000..dccd8687a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/provideroperationsmetadata_client.go @@ -0,0 +1,149 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armauthorization + +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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" +) + +// ProviderOperationsMetadataClient contains the methods for the ProviderOperationsMetadata group. +// Don't use this type directly, use NewProviderOperationsMetadataClient() instead. +type ProviderOperationsMetadataClient struct { + internal *arm.Client +} + +// NewProviderOperationsMetadataClient creates a new instance of ProviderOperationsMetadataClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewProviderOperationsMetadataClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ProviderOperationsMetadataClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ProviderOperationsMetadataClient{ + internal: cl, + } + return client, nil +} + +// Get - Gets provider operations metadata for the specified resource provider. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-04-01 +// - resourceProviderNamespace - The namespace of the resource provider. +// - options - ProviderOperationsMetadataClientGetOptions contains the optional parameters for the ProviderOperationsMetadataClient.Get +// method. +func (client *ProviderOperationsMetadataClient) Get(ctx context.Context, resourceProviderNamespace string, options *ProviderOperationsMetadataClientGetOptions) (ProviderOperationsMetadataClientGetResponse, error) { + var err error + const operationName = "ProviderOperationsMetadataClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceProviderNamespace, options) + if err != nil { + return ProviderOperationsMetadataClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProviderOperationsMetadataClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProviderOperationsMetadataClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ProviderOperationsMetadataClient) getCreateRequest(ctx context.Context, resourceProviderNamespace string, options *ProviderOperationsMetadataClientGetOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}" + urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", resourceProviderNamespace) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ProviderOperationsMetadataClient) getHandleResponse(resp *http.Response) (ProviderOperationsMetadataClientGetResponse, error) { + result := ProviderOperationsMetadataClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProviderOperationsMetadata); err != nil { + return ProviderOperationsMetadataClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets provider operations metadata for all resource providers. +// +// Generated from API version 2022-04-01 +// - options - ProviderOperationsMetadataClientListOptions contains the optional parameters for the ProviderOperationsMetadataClient.NewListPager +// method. +func (client *ProviderOperationsMetadataClient) NewListPager(options *ProviderOperationsMetadataClientListOptions) *runtime.Pager[ProviderOperationsMetadataClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ProviderOperationsMetadataClientListResponse]{ + More: func(page ProviderOperationsMetadataClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ProviderOperationsMetadataClientListResponse) (ProviderOperationsMetadataClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ProviderOperationsMetadataClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return ProviderOperationsMetadataClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *ProviderOperationsMetadataClient) listCreateRequest(ctx context.Context, options *ProviderOperationsMetadataClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Authorization/providerOperations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ProviderOperationsMetadataClient) listHandleResponse(resp *http.Response) (ProviderOperationsMetadataClientListResponse, error) { + result := ProviderOperationsMetadataClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProviderOperationsMetadataListResult); err != nil { + return ProviderOperationsMetadataClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/response_types.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/response_types.go new file mode 100644 index 000000000..a1df622bc --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/response_types.go @@ -0,0 +1,328 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armauthorization + +// ClassicAdministratorsClientListResponse contains the response from method ClassicAdministratorsClient.NewListPager. +type ClassicAdministratorsClientListResponse struct { + // ClassicAdministrator list result information. + ClassicAdministratorListResult +} + +// DenyAssignmentsClientGetByIDResponse contains the response from method DenyAssignmentsClient.GetByID. +type DenyAssignmentsClientGetByIDResponse struct { + // Deny Assignment + DenyAssignment +} + +// DenyAssignmentsClientGetResponse contains the response from method DenyAssignmentsClient.Get. +type DenyAssignmentsClientGetResponse struct { + // Deny Assignment + DenyAssignment +} + +// DenyAssignmentsClientListForResourceGroupResponse contains the response from method DenyAssignmentsClient.NewListForResourceGroupPager. +type DenyAssignmentsClientListForResourceGroupResponse struct { + // Deny assignment list operation result. + DenyAssignmentListResult +} + +// DenyAssignmentsClientListForResourceResponse contains the response from method DenyAssignmentsClient.NewListForResourcePager. +type DenyAssignmentsClientListForResourceResponse struct { + // Deny assignment list operation result. + DenyAssignmentListResult +} + +// DenyAssignmentsClientListForScopeResponse contains the response from method DenyAssignmentsClient.NewListForScopePager. +type DenyAssignmentsClientListForScopeResponse struct { + // Deny assignment list operation result. + DenyAssignmentListResult +} + +// DenyAssignmentsClientListResponse contains the response from method DenyAssignmentsClient.NewListPager. +type DenyAssignmentsClientListResponse struct { + // Deny assignment list operation result. + DenyAssignmentListResult +} + +// EligibleChildResourcesClientGetResponse contains the response from method EligibleChildResourcesClient.NewGetPager. +type EligibleChildResourcesClientGetResponse struct { + // Eligible child resources list operation result. + EligibleChildResourcesListResult +} + +// GlobalAdministratorClientElevateAccessResponse contains the response from method GlobalAdministratorClient.ElevateAccess. +type GlobalAdministratorClientElevateAccessResponse struct { + // placeholder for future response values +} + +// PermissionsClientListForResourceGroupResponse contains the response from method PermissionsClient.NewListForResourceGroupPager. +type PermissionsClientListForResourceGroupResponse struct { + // Permissions information. + PermissionGetResult +} + +// PermissionsClientListForResourceResponse contains the response from method PermissionsClient.NewListForResourcePager. +type PermissionsClientListForResourceResponse struct { + // Permissions information. + PermissionGetResult +} + +// ProviderOperationsMetadataClientGetResponse contains the response from method ProviderOperationsMetadataClient.Get. +type ProviderOperationsMetadataClientGetResponse struct { + // Provider Operations metadata + ProviderOperationsMetadata +} + +// ProviderOperationsMetadataClientListResponse contains the response from method ProviderOperationsMetadataClient.NewListPager. +type ProviderOperationsMetadataClientListResponse struct { + // Provider operations metadata list + ProviderOperationsMetadataListResult +} + +// RoleAssignmentScheduleInstancesClientGetResponse contains the response from method RoleAssignmentScheduleInstancesClient.Get. +type RoleAssignmentScheduleInstancesClientGetResponse struct { + // Information about current or upcoming role assignment schedule instance + RoleAssignmentScheduleInstance +} + +// RoleAssignmentScheduleInstancesClientListForScopeResponse contains the response from method RoleAssignmentScheduleInstancesClient.NewListForScopePager. +type RoleAssignmentScheduleInstancesClientListForScopeResponse struct { + // Role assignment schedule instance list operation result. + RoleAssignmentScheduleInstanceListResult +} + +// RoleAssignmentScheduleRequestsClientCancelResponse contains the response from method RoleAssignmentScheduleRequestsClient.Cancel. +type RoleAssignmentScheduleRequestsClientCancelResponse struct { + // placeholder for future response values +} + +// RoleAssignmentScheduleRequestsClientCreateResponse contains the response from method RoleAssignmentScheduleRequestsClient.Create. +type RoleAssignmentScheduleRequestsClientCreateResponse struct { + // Role Assignment schedule request + RoleAssignmentScheduleRequest +} + +// RoleAssignmentScheduleRequestsClientGetResponse contains the response from method RoleAssignmentScheduleRequestsClient.Get. +type RoleAssignmentScheduleRequestsClientGetResponse struct { + // Role Assignment schedule request + RoleAssignmentScheduleRequest +} + +// RoleAssignmentScheduleRequestsClientListForScopeResponse contains the response from method RoleAssignmentScheduleRequestsClient.NewListForScopePager. +type RoleAssignmentScheduleRequestsClientListForScopeResponse struct { + // Role assignment schedule request list operation result. + RoleAssignmentScheduleRequestListResult +} + +// RoleAssignmentScheduleRequestsClientValidateResponse contains the response from method RoleAssignmentScheduleRequestsClient.Validate. +type RoleAssignmentScheduleRequestsClientValidateResponse struct { + // Role Assignment schedule request + RoleAssignmentScheduleRequest +} + +// RoleAssignmentSchedulesClientGetResponse contains the response from method RoleAssignmentSchedulesClient.Get. +type RoleAssignmentSchedulesClientGetResponse struct { + // Role Assignment schedule + RoleAssignmentSchedule +} + +// RoleAssignmentSchedulesClientListForScopeResponse contains the response from method RoleAssignmentSchedulesClient.NewListForScopePager. +type RoleAssignmentSchedulesClientListForScopeResponse struct { + // Role assignment schedule list operation result. + RoleAssignmentScheduleListResult +} + +// RoleAssignmentsClientCreateByIDResponse contains the response from method RoleAssignmentsClient.CreateByID. +type RoleAssignmentsClientCreateByIDResponse struct { + // Role Assignments + RoleAssignment +} + +// RoleAssignmentsClientCreateResponse contains the response from method RoleAssignmentsClient.Create. +type RoleAssignmentsClientCreateResponse struct { + // Role Assignments + RoleAssignment +} + +// RoleAssignmentsClientDeleteByIDResponse contains the response from method RoleAssignmentsClient.DeleteByID. +type RoleAssignmentsClientDeleteByIDResponse struct { + // Role Assignments + RoleAssignment +} + +// RoleAssignmentsClientDeleteResponse contains the response from method RoleAssignmentsClient.Delete. +type RoleAssignmentsClientDeleteResponse struct { + // Role Assignments + RoleAssignment +} + +// RoleAssignmentsClientGetByIDResponse contains the response from method RoleAssignmentsClient.GetByID. +type RoleAssignmentsClientGetByIDResponse struct { + // Role Assignments + RoleAssignment +} + +// RoleAssignmentsClientGetResponse contains the response from method RoleAssignmentsClient.Get. +type RoleAssignmentsClientGetResponse struct { + // Role Assignments + RoleAssignment +} + +// RoleAssignmentsClientListForResourceGroupResponse contains the response from method RoleAssignmentsClient.NewListForResourceGroupPager. +type RoleAssignmentsClientListForResourceGroupResponse struct { + // Role assignment list operation result. + RoleAssignmentListResult +} + +// RoleAssignmentsClientListForResourceResponse contains the response from method RoleAssignmentsClient.NewListForResourcePager. +type RoleAssignmentsClientListForResourceResponse struct { + // Role assignment list operation result. + RoleAssignmentListResult +} + +// RoleAssignmentsClientListForScopeResponse contains the response from method RoleAssignmentsClient.NewListForScopePager. +type RoleAssignmentsClientListForScopeResponse struct { + // Role assignment list operation result. + RoleAssignmentListResult +} + +// RoleAssignmentsClientListForSubscriptionResponse contains the response from method RoleAssignmentsClient.NewListForSubscriptionPager. +type RoleAssignmentsClientListForSubscriptionResponse struct { + // Role assignment list operation result. + RoleAssignmentListResult +} + +// RoleDefinitionsClientCreateOrUpdateResponse contains the response from method RoleDefinitionsClient.CreateOrUpdate. +type RoleDefinitionsClientCreateOrUpdateResponse struct { + // Role definition. + RoleDefinition +} + +// RoleDefinitionsClientDeleteResponse contains the response from method RoleDefinitionsClient.Delete. +type RoleDefinitionsClientDeleteResponse struct { + // Role definition. + RoleDefinition +} + +// RoleDefinitionsClientGetByIDResponse contains the response from method RoleDefinitionsClient.GetByID. +type RoleDefinitionsClientGetByIDResponse struct { + // Role definition. + RoleDefinition +} + +// RoleDefinitionsClientGetResponse contains the response from method RoleDefinitionsClient.Get. +type RoleDefinitionsClientGetResponse struct { + // Role definition. + RoleDefinition +} + +// RoleDefinitionsClientListResponse contains the response from method RoleDefinitionsClient.NewListPager. +type RoleDefinitionsClientListResponse struct { + // Role definition list operation result. + RoleDefinitionListResult +} + +// RoleEligibilityScheduleInstancesClientGetResponse contains the response from method RoleEligibilityScheduleInstancesClient.Get. +type RoleEligibilityScheduleInstancesClientGetResponse struct { + // Information about current or upcoming role eligibility schedule instance + RoleEligibilityScheduleInstance +} + +// RoleEligibilityScheduleInstancesClientListForScopeResponse contains the response from method RoleEligibilityScheduleInstancesClient.NewListForScopePager. +type RoleEligibilityScheduleInstancesClientListForScopeResponse struct { + // Role eligibility schedule instance list operation result. + RoleEligibilityScheduleInstanceListResult +} + +// RoleEligibilityScheduleRequestsClientCancelResponse contains the response from method RoleEligibilityScheduleRequestsClient.Cancel. +type RoleEligibilityScheduleRequestsClientCancelResponse struct { + // placeholder for future response values +} + +// RoleEligibilityScheduleRequestsClientCreateResponse contains the response from method RoleEligibilityScheduleRequestsClient.Create. +type RoleEligibilityScheduleRequestsClientCreateResponse struct { + // Role Eligibility schedule request + RoleEligibilityScheduleRequest +} + +// RoleEligibilityScheduleRequestsClientGetResponse contains the response from method RoleEligibilityScheduleRequestsClient.Get. +type RoleEligibilityScheduleRequestsClientGetResponse struct { + // Role Eligibility schedule request + RoleEligibilityScheduleRequest +} + +// RoleEligibilityScheduleRequestsClientListForScopeResponse contains the response from method RoleEligibilityScheduleRequestsClient.NewListForScopePager. +type RoleEligibilityScheduleRequestsClientListForScopeResponse struct { + // Role eligibility schedule request list operation result. + RoleEligibilityScheduleRequestListResult +} + +// RoleEligibilityScheduleRequestsClientValidateResponse contains the response from method RoleEligibilityScheduleRequestsClient.Validate. +type RoleEligibilityScheduleRequestsClientValidateResponse struct { + // Role Eligibility schedule request + RoleEligibilityScheduleRequest +} + +// RoleEligibilitySchedulesClientGetResponse contains the response from method RoleEligibilitySchedulesClient.Get. +type RoleEligibilitySchedulesClientGetResponse struct { + // Role eligibility schedule + RoleEligibilitySchedule +} + +// RoleEligibilitySchedulesClientListForScopeResponse contains the response from method RoleEligibilitySchedulesClient.NewListForScopePager. +type RoleEligibilitySchedulesClientListForScopeResponse struct { + // role eligibility schedule list operation result. + RoleEligibilityScheduleListResult +} + +// RoleManagementPoliciesClientDeleteResponse contains the response from method RoleManagementPoliciesClient.Delete. +type RoleManagementPoliciesClientDeleteResponse struct { + // placeholder for future response values +} + +// RoleManagementPoliciesClientGetResponse contains the response from method RoleManagementPoliciesClient.Get. +type RoleManagementPoliciesClientGetResponse struct { + // Role management policy + RoleManagementPolicy +} + +// RoleManagementPoliciesClientListForScopeResponse contains the response from method RoleManagementPoliciesClient.NewListForScopePager. +type RoleManagementPoliciesClientListForScopeResponse struct { + // Role management policy list operation result. + RoleManagementPolicyListResult +} + +// RoleManagementPoliciesClientUpdateResponse contains the response from method RoleManagementPoliciesClient.Update. +type RoleManagementPoliciesClientUpdateResponse struct { + // Role management policy + RoleManagementPolicy +} + +// RoleManagementPolicyAssignmentsClientCreateResponse contains the response from method RoleManagementPolicyAssignmentsClient.Create. +type RoleManagementPolicyAssignmentsClientCreateResponse struct { + // Role management policy + RoleManagementPolicyAssignment +} + +// RoleManagementPolicyAssignmentsClientDeleteResponse contains the response from method RoleManagementPolicyAssignmentsClient.Delete. +type RoleManagementPolicyAssignmentsClientDeleteResponse struct { + // placeholder for future response values +} + +// RoleManagementPolicyAssignmentsClientGetResponse contains the response from method RoleManagementPolicyAssignmentsClient.Get. +type RoleManagementPolicyAssignmentsClientGetResponse struct { + // Role management policy + RoleManagementPolicyAssignment +} + +// RoleManagementPolicyAssignmentsClientListForScopeResponse contains the response from method RoleManagementPolicyAssignmentsClient.NewListForScopePager. +type RoleManagementPolicyAssignmentsClientListForScopeResponse struct { + // Role management policy assignment list operation result. + RoleManagementPolicyAssignmentListResult +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/roleassignments_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/roleassignments_client.go new file mode 100644 index 000000000..808b83f0a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/roleassignments_client.go @@ -0,0 +1,671 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armauthorization + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// RoleAssignmentsClient contains the methods for the RoleAssignments group. +// Don't use this type directly, use NewRoleAssignmentsClient() instead. +type RoleAssignmentsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewRoleAssignmentsClient creates a new instance of RoleAssignmentsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewRoleAssignmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RoleAssignmentsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &RoleAssignmentsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Create - Create or update a role assignment by scope and name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-04-01 +// - scope - The scope of the operation or resource. Valid scopes are: subscription (format: '/subscriptions/{subscriptionId}'), +// resource group (format: +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' +// - roleAssignmentName - The name of the role assignment. It can be any valid GUID. +// - parameters - Parameters for the role assignment. +// - options - RoleAssignmentsClientCreateOptions contains the optional parameters for the RoleAssignmentsClient.Create method. +func (client *RoleAssignmentsClient) Create(ctx context.Context, scope string, roleAssignmentName string, parameters RoleAssignmentCreateParameters, options *RoleAssignmentsClientCreateOptions) (RoleAssignmentsClientCreateResponse, error) { + var err error + const operationName = "RoleAssignmentsClient.Create" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, scope, roleAssignmentName, parameters, options) + if err != nil { + return RoleAssignmentsClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RoleAssignmentsClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return RoleAssignmentsClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *RoleAssignmentsClient) createCreateRequest(ctx context.Context, scope string, roleAssignmentName string, parameters RoleAssignmentCreateParameters, options *RoleAssignmentsClientCreateOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentName}", roleAssignmentName) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *RoleAssignmentsClient) createHandleResponse(resp *http.Response) (RoleAssignmentsClientCreateResponse, error) { + result := RoleAssignmentsClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignment); err != nil { + return RoleAssignmentsClientCreateResponse{}, err + } + return result, nil +} + +// CreateByID - Create or update a role assignment by ID. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-04-01 +// - roleAssignmentID - The fully qualified ID of the role assignment including scope, resource name, and resource type. Format: +// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: +// /subscriptions//resourcegroups//providers/Microsoft.Authorization/roleAssignments/ +// - parameters - Parameters for the role assignment. +// - options - RoleAssignmentsClientCreateByIDOptions contains the optional parameters for the RoleAssignmentsClient.CreateByID +// method. +func (client *RoleAssignmentsClient) CreateByID(ctx context.Context, roleAssignmentID string, parameters RoleAssignmentCreateParameters, options *RoleAssignmentsClientCreateByIDOptions) (RoleAssignmentsClientCreateByIDResponse, error) { + var err error + const operationName = "RoleAssignmentsClient.CreateByID" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createByIDCreateRequest(ctx, roleAssignmentID, parameters, options) + if err != nil { + return RoleAssignmentsClientCreateByIDResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RoleAssignmentsClientCreateByIDResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return RoleAssignmentsClientCreateByIDResponse{}, err + } + resp, err := client.createByIDHandleResponse(httpResp) + return resp, err +} + +// createByIDCreateRequest creates the CreateByID request. +func (client *RoleAssignmentsClient) createByIDCreateRequest(ctx context.Context, roleAssignmentID string, parameters RoleAssignmentCreateParameters, options *RoleAssignmentsClientCreateByIDOptions) (*policy.Request, error) { + urlPath := "/{roleAssignmentId}" + urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentId}", roleAssignmentID) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// createByIDHandleResponse handles the CreateByID response. +func (client *RoleAssignmentsClient) createByIDHandleResponse(resp *http.Response) (RoleAssignmentsClientCreateByIDResponse, error) { + result := RoleAssignmentsClientCreateByIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignment); err != nil { + return RoleAssignmentsClientCreateByIDResponse{}, err + } + return result, nil +} + +// Delete - Delete a role assignment by scope and name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-04-01 +// - scope - The scope of the operation or resource. Valid scopes are: subscription (format: '/subscriptions/{subscriptionId}'), +// resource group (format: +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' +// - roleAssignmentName - The name of the role assignment. It can be any valid GUID. +// - options - RoleAssignmentsClientDeleteOptions contains the optional parameters for the RoleAssignmentsClient.Delete method. +func (client *RoleAssignmentsClient) Delete(ctx context.Context, scope string, roleAssignmentName string, options *RoleAssignmentsClientDeleteOptions) (RoleAssignmentsClientDeleteResponse, error) { + var err error + const operationName = "RoleAssignmentsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, scope, roleAssignmentName, options) + if err != nil { + return RoleAssignmentsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RoleAssignmentsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return RoleAssignmentsClientDeleteResponse{}, err + } + resp, err := client.deleteHandleResponse(httpResp) + return resp, err +} + +// deleteCreateRequest creates the Delete request. +func (client *RoleAssignmentsClient) deleteCreateRequest(ctx context.Context, scope string, roleAssignmentName string, options *RoleAssignmentsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentName}", roleAssignmentName) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-01") + if options != nil && options.TenantID != nil { + reqQP.Set("tenantId", *options.TenantID) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// deleteHandleResponse handles the Delete response. +func (client *RoleAssignmentsClient) deleteHandleResponse(resp *http.Response) (RoleAssignmentsClientDeleteResponse, error) { + result := RoleAssignmentsClientDeleteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignment); err != nil { + return RoleAssignmentsClientDeleteResponse{}, err + } + return result, nil +} + +// DeleteByID - Delete a role assignment by ID. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-04-01 +// - roleAssignmentID - The fully qualified ID of the role assignment including scope, resource name, and resource type. Format: +// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: +// /subscriptions//resourcegroups//providers/Microsoft.Authorization/roleAssignments/ +// - options - RoleAssignmentsClientDeleteByIDOptions contains the optional parameters for the RoleAssignmentsClient.DeleteByID +// method. +func (client *RoleAssignmentsClient) DeleteByID(ctx context.Context, roleAssignmentID string, options *RoleAssignmentsClientDeleteByIDOptions) (RoleAssignmentsClientDeleteByIDResponse, error) { + var err error + const operationName = "RoleAssignmentsClient.DeleteByID" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteByIDCreateRequest(ctx, roleAssignmentID, options) + if err != nil { + return RoleAssignmentsClientDeleteByIDResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RoleAssignmentsClientDeleteByIDResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return RoleAssignmentsClientDeleteByIDResponse{}, err + } + resp, err := client.deleteByIDHandleResponse(httpResp) + return resp, err +} + +// deleteByIDCreateRequest creates the DeleteByID request. +func (client *RoleAssignmentsClient) deleteByIDCreateRequest(ctx context.Context, roleAssignmentID string, options *RoleAssignmentsClientDeleteByIDOptions) (*policy.Request, error) { + urlPath := "/{roleAssignmentId}" + urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentId}", roleAssignmentID) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-01") + if options != nil && options.TenantID != nil { + reqQP.Set("tenantId", *options.TenantID) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// deleteByIDHandleResponse handles the DeleteByID response. +func (client *RoleAssignmentsClient) deleteByIDHandleResponse(resp *http.Response) (RoleAssignmentsClientDeleteByIDResponse, error) { + result := RoleAssignmentsClientDeleteByIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignment); err != nil { + return RoleAssignmentsClientDeleteByIDResponse{}, err + } + return result, nil +} + +// Get - Get a role assignment by scope and name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-04-01 +// - scope - The scope of the operation or resource. Valid scopes are: subscription (format: '/subscriptions/{subscriptionId}'), +// resource group (format: +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' +// - roleAssignmentName - The name of the role assignment. It can be any valid GUID. +// - options - RoleAssignmentsClientGetOptions contains the optional parameters for the RoleAssignmentsClient.Get method. +func (client *RoleAssignmentsClient) Get(ctx context.Context, scope string, roleAssignmentName string, options *RoleAssignmentsClientGetOptions) (RoleAssignmentsClientGetResponse, error) { + var err error + const operationName = "RoleAssignmentsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, scope, roleAssignmentName, options) + if err != nil { + return RoleAssignmentsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RoleAssignmentsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RoleAssignmentsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *RoleAssignmentsClient) getCreateRequest(ctx context.Context, scope string, roleAssignmentName string, options *RoleAssignmentsClientGetOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentName}", roleAssignmentName) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-01") + if options != nil && options.TenantID != nil { + reqQP.Set("tenantId", *options.TenantID) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *RoleAssignmentsClient) getHandleResponse(resp *http.Response) (RoleAssignmentsClientGetResponse, error) { + result := RoleAssignmentsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignment); err != nil { + return RoleAssignmentsClientGetResponse{}, err + } + return result, nil +} + +// GetByID - Get a role assignment by ID. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-04-01 +// - roleAssignmentID - The fully qualified ID of the role assignment including scope, resource name, and resource type. Format: +// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: +// /subscriptions//resourcegroups//providers/Microsoft.Authorization/roleAssignments/ +// - options - RoleAssignmentsClientGetByIDOptions contains the optional parameters for the RoleAssignmentsClient.GetByID method. +func (client *RoleAssignmentsClient) GetByID(ctx context.Context, roleAssignmentID string, options *RoleAssignmentsClientGetByIDOptions) (RoleAssignmentsClientGetByIDResponse, error) { + var err error + const operationName = "RoleAssignmentsClient.GetByID" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getByIDCreateRequest(ctx, roleAssignmentID, options) + if err != nil { + return RoleAssignmentsClientGetByIDResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RoleAssignmentsClientGetByIDResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RoleAssignmentsClientGetByIDResponse{}, err + } + resp, err := client.getByIDHandleResponse(httpResp) + return resp, err +} + +// getByIDCreateRequest creates the GetByID request. +func (client *RoleAssignmentsClient) getByIDCreateRequest(ctx context.Context, roleAssignmentID string, options *RoleAssignmentsClientGetByIDOptions) (*policy.Request, error) { + urlPath := "/{roleAssignmentId}" + urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentId}", roleAssignmentID) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-01") + if options != nil && options.TenantID != nil { + reqQP.Set("tenantId", *options.TenantID) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getByIDHandleResponse handles the GetByID response. +func (client *RoleAssignmentsClient) getByIDHandleResponse(resp *http.Response) (RoleAssignmentsClientGetByIDResponse, error) { + result := RoleAssignmentsClientGetByIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignment); err != nil { + return RoleAssignmentsClientGetByIDResponse{}, err + } + return result, nil +} + +// NewListForResourcePager - List all role assignments that apply to a resource. +// +// Generated from API version 2022-04-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceProviderNamespace - The namespace of the resource provider. +// - resourceType - The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). +// - resourceName - The resource name. +// - options - RoleAssignmentsClientListForResourceOptions contains the optional parameters for the RoleAssignmentsClient.NewListForResourcePager +// method. +func (client *RoleAssignmentsClient) NewListForResourcePager(resourceGroupName string, resourceProviderNamespace string, resourceType string, resourceName string, options *RoleAssignmentsClientListForResourceOptions) *runtime.Pager[RoleAssignmentsClientListForResourceResponse] { + return runtime.NewPager(runtime.PagingHandler[RoleAssignmentsClientListForResourceResponse]{ + More: func(page RoleAssignmentsClientListForResourceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *RoleAssignmentsClientListForResourceResponse) (RoleAssignmentsClientListForResourceResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RoleAssignmentsClient.NewListForResourcePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listForResourceCreateRequest(ctx, resourceGroupName, resourceProviderNamespace, resourceType, resourceName, options) + }, nil) + if err != nil { + return RoleAssignmentsClientListForResourceResponse{}, err + } + return client.listForResourceHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listForResourceCreateRequest creates the ListForResource request. +func (client *RoleAssignmentsClient) listForResourceCreateRequest(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, resourceType string, resourceName string, options *RoleAssignmentsClientListForResourceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", resourceProviderNamespace) + urlPath = strings.ReplaceAll(urlPath, "{resourceType}", resourceType) + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", resourceName) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-01") + if options != nil && options.TenantID != nil { + reqQP.Set("tenantId", *options.TenantID) + } + req.Raw().URL.RawQuery = reqQP.Encode() + unencodedParams := []string{req.Raw().URL.RawQuery} + if options != nil && options.Filter != nil { + unencodedParams = append(unencodedParams, "$filter="+*options.Filter) + } + req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listForResourceHandleResponse handles the ListForResource response. +func (client *RoleAssignmentsClient) listForResourceHandleResponse(resp *http.Response) (RoleAssignmentsClientListForResourceResponse, error) { + result := RoleAssignmentsClientListForResourceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentListResult); err != nil { + return RoleAssignmentsClientListForResourceResponse{}, err + } + return result, nil +} + +// NewListForResourceGroupPager - List all role assignments that apply to a resource group. +// +// Generated from API version 2022-04-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - RoleAssignmentsClientListForResourceGroupOptions contains the optional parameters for the RoleAssignmentsClient.NewListForResourceGroupPager +// method. +func (client *RoleAssignmentsClient) NewListForResourceGroupPager(resourceGroupName string, options *RoleAssignmentsClientListForResourceGroupOptions) *runtime.Pager[RoleAssignmentsClientListForResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[RoleAssignmentsClientListForResourceGroupResponse]{ + More: func(page RoleAssignmentsClientListForResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *RoleAssignmentsClientListForResourceGroupResponse) (RoleAssignmentsClientListForResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RoleAssignmentsClient.NewListForResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listForResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return RoleAssignmentsClientListForResourceGroupResponse{}, err + } + return client.listForResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listForResourceGroupCreateRequest creates the ListForResourceGroup request. +func (client *RoleAssignmentsClient) listForResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *RoleAssignmentsClientListForResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-01") + if options != nil && options.TenantID != nil { + reqQP.Set("tenantId", *options.TenantID) + } + req.Raw().URL.RawQuery = reqQP.Encode() + unencodedParams := []string{req.Raw().URL.RawQuery} + if options != nil && options.Filter != nil { + unencodedParams = append(unencodedParams, "$filter="+*options.Filter) + } + req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listForResourceGroupHandleResponse handles the ListForResourceGroup response. +func (client *RoleAssignmentsClient) listForResourceGroupHandleResponse(resp *http.Response) (RoleAssignmentsClientListForResourceGroupResponse, error) { + result := RoleAssignmentsClientListForResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentListResult); err != nil { + return RoleAssignmentsClientListForResourceGroupResponse{}, err + } + return result, nil +} + +// NewListForScopePager - List all role assignments that apply to a scope. +// +// Generated from API version 2022-04-01 +// - scope - The scope of the operation or resource. Valid scopes are: subscription (format: '/subscriptions/{subscriptionId}'), +// resource group (format: +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' +// - options - RoleAssignmentsClientListForScopeOptions contains the optional parameters for the RoleAssignmentsClient.NewListForScopePager +// method. +func (client *RoleAssignmentsClient) NewListForScopePager(scope string, options *RoleAssignmentsClientListForScopeOptions) *runtime.Pager[RoleAssignmentsClientListForScopeResponse] { + return runtime.NewPager(runtime.PagingHandler[RoleAssignmentsClientListForScopeResponse]{ + More: func(page RoleAssignmentsClientListForScopeResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *RoleAssignmentsClientListForScopeResponse) (RoleAssignmentsClientListForScopeResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RoleAssignmentsClient.NewListForScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listForScopeCreateRequest(ctx, scope, options) + }, nil) + if err != nil { + return RoleAssignmentsClientListForScopeResponse{}, err + } + return client.listForScopeHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listForScopeCreateRequest creates the ListForScope request. +func (client *RoleAssignmentsClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleAssignmentsClientListForScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignments" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-01") + if options != nil && options.TenantID != nil { + reqQP.Set("tenantId", *options.TenantID) + } + req.Raw().URL.RawQuery = reqQP.Encode() + unencodedParams := []string{req.Raw().URL.RawQuery} + if options != nil && options.Filter != nil { + unencodedParams = append(unencodedParams, "$filter="+*options.Filter) + } + if options != nil && options.SkipToken != nil { + unencodedParams = append(unencodedParams, "$skipToken="+*options.SkipToken) + } + req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listForScopeHandleResponse handles the ListForScope response. +func (client *RoleAssignmentsClient) listForScopeHandleResponse(resp *http.Response) (RoleAssignmentsClientListForScopeResponse, error) { + result := RoleAssignmentsClientListForScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentListResult); err != nil { + return RoleAssignmentsClientListForScopeResponse{}, err + } + return result, nil +} + +// NewListForSubscriptionPager - List all role assignments that apply to a subscription. +// +// Generated from API version 2022-04-01 +// - options - RoleAssignmentsClientListForSubscriptionOptions contains the optional parameters for the RoleAssignmentsClient.NewListForSubscriptionPager +// method. +func (client *RoleAssignmentsClient) NewListForSubscriptionPager(options *RoleAssignmentsClientListForSubscriptionOptions) *runtime.Pager[RoleAssignmentsClientListForSubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[RoleAssignmentsClientListForSubscriptionResponse]{ + More: func(page RoleAssignmentsClientListForSubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *RoleAssignmentsClientListForSubscriptionResponse) (RoleAssignmentsClientListForSubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RoleAssignmentsClient.NewListForSubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listForSubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return RoleAssignmentsClientListForSubscriptionResponse{}, err + } + return client.listForSubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listForSubscriptionCreateRequest creates the ListForSubscription request. +func (client *RoleAssignmentsClient) listForSubscriptionCreateRequest(ctx context.Context, options *RoleAssignmentsClientListForSubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-01") + if options != nil && options.TenantID != nil { + reqQP.Set("tenantId", *options.TenantID) + } + req.Raw().URL.RawQuery = reqQP.Encode() + unencodedParams := []string{req.Raw().URL.RawQuery} + if options != nil && options.Filter != nil { + unencodedParams = append(unencodedParams, "$filter="+*options.Filter) + } + req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listForSubscriptionHandleResponse handles the ListForSubscription response. +func (client *RoleAssignmentsClient) listForSubscriptionHandleResponse(resp *http.Response) (RoleAssignmentsClientListForSubscriptionResponse, error) { + result := RoleAssignmentsClientListForSubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentListResult); err != nil { + return RoleAssignmentsClientListForSubscriptionResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/roleassignmentscheduleinstances_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/roleassignmentscheduleinstances_client.go new file mode 100644 index 000000000..3134e6723 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/roleassignmentscheduleinstances_client.go @@ -0,0 +1,155 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armauthorization + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// RoleAssignmentScheduleInstancesClient contains the methods for the RoleAssignmentScheduleInstances group. +// Don't use this type directly, use NewRoleAssignmentScheduleInstancesClient() instead. +type RoleAssignmentScheduleInstancesClient struct { + internal *arm.Client +} + +// NewRoleAssignmentScheduleInstancesClient creates a new instance of RoleAssignmentScheduleInstancesClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewRoleAssignmentScheduleInstancesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*RoleAssignmentScheduleInstancesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &RoleAssignmentScheduleInstancesClient{ + internal: cl, + } + return client, nil +} + +// Get - Gets the specified role assignment schedule instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-10-01 +// - scope - The scope of the role assignments schedules. +// - roleAssignmentScheduleInstanceName - The name (hash of schedule name + time) of the role assignment schedule to get. +// - options - RoleAssignmentScheduleInstancesClientGetOptions contains the optional parameters for the RoleAssignmentScheduleInstancesClient.Get +// method. +func (client *RoleAssignmentScheduleInstancesClient) Get(ctx context.Context, scope string, roleAssignmentScheduleInstanceName string, options *RoleAssignmentScheduleInstancesClientGetOptions) (RoleAssignmentScheduleInstancesClientGetResponse, error) { + var err error + const operationName = "RoleAssignmentScheduleInstancesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, scope, roleAssignmentScheduleInstanceName, options) + if err != nil { + return RoleAssignmentScheduleInstancesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RoleAssignmentScheduleInstancesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RoleAssignmentScheduleInstancesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *RoleAssignmentScheduleInstancesClient) getCreateRequest(ctx context.Context, scope string, roleAssignmentScheduleInstanceName string, options *RoleAssignmentScheduleInstancesClientGetOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances/{roleAssignmentScheduleInstanceName}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if roleAssignmentScheduleInstanceName == "" { + return nil, errors.New("parameter roleAssignmentScheduleInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentScheduleInstanceName}", url.PathEscape(roleAssignmentScheduleInstanceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *RoleAssignmentScheduleInstancesClient) getHandleResponse(resp *http.Response) (RoleAssignmentScheduleInstancesClientGetResponse, error) { + result := RoleAssignmentScheduleInstancesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentScheduleInstance); err != nil { + return RoleAssignmentScheduleInstancesClientGetResponse{}, err + } + return result, nil +} + +// NewListForScopePager - Gets role assignment schedule instances of a role assignment schedule. +// +// Generated from API version 2020-10-01 +// - scope - The scope of the role assignment schedule. +// - options - RoleAssignmentScheduleInstancesClientListForScopeOptions contains the optional parameters for the RoleAssignmentScheduleInstancesClient.NewListForScopePager +// method. +func (client *RoleAssignmentScheduleInstancesClient) NewListForScopePager(scope string, options *RoleAssignmentScheduleInstancesClientListForScopeOptions) *runtime.Pager[RoleAssignmentScheduleInstancesClientListForScopeResponse] { + return runtime.NewPager(runtime.PagingHandler[RoleAssignmentScheduleInstancesClientListForScopeResponse]{ + More: func(page RoleAssignmentScheduleInstancesClientListForScopeResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *RoleAssignmentScheduleInstancesClientListForScopeResponse) (RoleAssignmentScheduleInstancesClientListForScopeResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RoleAssignmentScheduleInstancesClient.NewListForScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listForScopeCreateRequest(ctx, scope, options) + }, nil) + if err != nil { + return RoleAssignmentScheduleInstancesClientListForScopeResponse{}, err + } + return client.listForScopeHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listForScopeCreateRequest creates the ListForScope request. +func (client *RoleAssignmentScheduleInstancesClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleAssignmentScheduleInstancesClientListForScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + reqQP.Set("api-version", "2020-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listForScopeHandleResponse handles the ListForScope response. +func (client *RoleAssignmentScheduleInstancesClient) listForScopeHandleResponse(resp *http.Response) (RoleAssignmentScheduleInstancesClientListForScopeResponse, error) { + result := RoleAssignmentScheduleInstancesClientListForScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentScheduleInstanceListResult); err != nil { + return RoleAssignmentScheduleInstancesClientListForScopeResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/roleassignmentschedulerequests_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/roleassignmentschedulerequests_client.go new file mode 100644 index 000000000..660672016 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/roleassignmentschedulerequests_client.go @@ -0,0 +1,332 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armauthorization + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// RoleAssignmentScheduleRequestsClient contains the methods for the RoleAssignmentScheduleRequests group. +// Don't use this type directly, use NewRoleAssignmentScheduleRequestsClient() instead. +type RoleAssignmentScheduleRequestsClient struct { + internal *arm.Client +} + +// NewRoleAssignmentScheduleRequestsClient creates a new instance of RoleAssignmentScheduleRequestsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewRoleAssignmentScheduleRequestsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*RoleAssignmentScheduleRequestsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &RoleAssignmentScheduleRequestsClient{ + internal: cl, + } + return client, nil +} + +// Cancel - Cancels a pending role assignment schedule request. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-10-01 +// - scope - The scope of the role assignment request to cancel. +// - roleAssignmentScheduleRequestName - The name of the role assignment request to cancel. +// - options - RoleAssignmentScheduleRequestsClientCancelOptions contains the optional parameters for the RoleAssignmentScheduleRequestsClient.Cancel +// method. +func (client *RoleAssignmentScheduleRequestsClient) Cancel(ctx context.Context, scope string, roleAssignmentScheduleRequestName string, options *RoleAssignmentScheduleRequestsClientCancelOptions) (RoleAssignmentScheduleRequestsClientCancelResponse, error) { + var err error + const operationName = "RoleAssignmentScheduleRequestsClient.Cancel" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.cancelCreateRequest(ctx, scope, roleAssignmentScheduleRequestName, options) + if err != nil { + return RoleAssignmentScheduleRequestsClientCancelResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RoleAssignmentScheduleRequestsClientCancelResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RoleAssignmentScheduleRequestsClientCancelResponse{}, err + } + return RoleAssignmentScheduleRequestsClientCancelResponse{}, nil +} + +// cancelCreateRequest creates the Cancel request. +func (client *RoleAssignmentScheduleRequestsClient) cancelCreateRequest(ctx context.Context, scope string, roleAssignmentScheduleRequestName string, options *RoleAssignmentScheduleRequestsClientCancelOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/cancel" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if roleAssignmentScheduleRequestName == "" { + return nil, errors.New("parameter roleAssignmentScheduleRequestName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentScheduleRequestName}", url.PathEscape(roleAssignmentScheduleRequestName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Create - Creates a role assignment schedule request. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-10-01 +// - scope - The scope of the role assignment schedule request to create. The scope can be any REST resource instance. For example, +// use '/subscriptions/{subscription-id}/' for a subscription, +// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and +// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' +// for a resource. +// - roleAssignmentScheduleRequestName - A GUID for the role assignment to create. The name must be unique and different for +// each role assignment. +// - parameters - Parameters for the role assignment schedule request. +// - options - RoleAssignmentScheduleRequestsClientCreateOptions contains the optional parameters for the RoleAssignmentScheduleRequestsClient.Create +// method. +func (client *RoleAssignmentScheduleRequestsClient) Create(ctx context.Context, scope string, roleAssignmentScheduleRequestName string, parameters RoleAssignmentScheduleRequest, options *RoleAssignmentScheduleRequestsClientCreateOptions) (RoleAssignmentScheduleRequestsClientCreateResponse, error) { + var err error + const operationName = "RoleAssignmentScheduleRequestsClient.Create" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, scope, roleAssignmentScheduleRequestName, parameters, options) + if err != nil { + return RoleAssignmentScheduleRequestsClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RoleAssignmentScheduleRequestsClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return RoleAssignmentScheduleRequestsClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *RoleAssignmentScheduleRequestsClient) createCreateRequest(ctx context.Context, scope string, roleAssignmentScheduleRequestName string, parameters RoleAssignmentScheduleRequest, options *RoleAssignmentScheduleRequestsClientCreateOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if roleAssignmentScheduleRequestName == "" { + return nil, errors.New("parameter roleAssignmentScheduleRequestName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentScheduleRequestName}", url.PathEscape(roleAssignmentScheduleRequestName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *RoleAssignmentScheduleRequestsClient) createHandleResponse(resp *http.Response) (RoleAssignmentScheduleRequestsClientCreateResponse, error) { + result := RoleAssignmentScheduleRequestsClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentScheduleRequest); err != nil { + return RoleAssignmentScheduleRequestsClientCreateResponse{}, err + } + return result, nil +} + +// Get - Get the specified role assignment schedule request. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-10-01 +// - scope - The scope of the role assignment schedule request. +// - roleAssignmentScheduleRequestName - The name (guid) of the role assignment schedule request to get. +// - options - RoleAssignmentScheduleRequestsClientGetOptions contains the optional parameters for the RoleAssignmentScheduleRequestsClient.Get +// method. +func (client *RoleAssignmentScheduleRequestsClient) Get(ctx context.Context, scope string, roleAssignmentScheduleRequestName string, options *RoleAssignmentScheduleRequestsClientGetOptions) (RoleAssignmentScheduleRequestsClientGetResponse, error) { + var err error + const operationName = "RoleAssignmentScheduleRequestsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, scope, roleAssignmentScheduleRequestName, options) + if err != nil { + return RoleAssignmentScheduleRequestsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RoleAssignmentScheduleRequestsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RoleAssignmentScheduleRequestsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *RoleAssignmentScheduleRequestsClient) getCreateRequest(ctx context.Context, scope string, roleAssignmentScheduleRequestName string, options *RoleAssignmentScheduleRequestsClientGetOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if roleAssignmentScheduleRequestName == "" { + return nil, errors.New("parameter roleAssignmentScheduleRequestName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentScheduleRequestName}", url.PathEscape(roleAssignmentScheduleRequestName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *RoleAssignmentScheduleRequestsClient) getHandleResponse(resp *http.Response) (RoleAssignmentScheduleRequestsClientGetResponse, error) { + result := RoleAssignmentScheduleRequestsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentScheduleRequest); err != nil { + return RoleAssignmentScheduleRequestsClientGetResponse{}, err + } + return result, nil +} + +// NewListForScopePager - Gets role assignment schedule requests for a scope. +// +// Generated from API version 2020-10-01 +// - scope - The scope of the role assignments schedule requests. +// - options - RoleAssignmentScheduleRequestsClientListForScopeOptions contains the optional parameters for the RoleAssignmentScheduleRequestsClient.NewListForScopePager +// method. +func (client *RoleAssignmentScheduleRequestsClient) NewListForScopePager(scope string, options *RoleAssignmentScheduleRequestsClientListForScopeOptions) *runtime.Pager[RoleAssignmentScheduleRequestsClientListForScopeResponse] { + return runtime.NewPager(runtime.PagingHandler[RoleAssignmentScheduleRequestsClientListForScopeResponse]{ + More: func(page RoleAssignmentScheduleRequestsClientListForScopeResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *RoleAssignmentScheduleRequestsClientListForScopeResponse) (RoleAssignmentScheduleRequestsClientListForScopeResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RoleAssignmentScheduleRequestsClient.NewListForScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listForScopeCreateRequest(ctx, scope, options) + }, nil) + if err != nil { + return RoleAssignmentScheduleRequestsClientListForScopeResponse{}, err + } + return client.listForScopeHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listForScopeCreateRequest creates the ListForScope request. +func (client *RoleAssignmentScheduleRequestsClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleAssignmentScheduleRequestsClientListForScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + reqQP.Set("api-version", "2020-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listForScopeHandleResponse handles the ListForScope response. +func (client *RoleAssignmentScheduleRequestsClient) listForScopeHandleResponse(resp *http.Response) (RoleAssignmentScheduleRequestsClientListForScopeResponse, error) { + result := RoleAssignmentScheduleRequestsClientListForScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentScheduleRequestListResult); err != nil { + return RoleAssignmentScheduleRequestsClientListForScopeResponse{}, err + } + return result, nil +} + +// Validate - Validates a new role assignment schedule request. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-10-01 +// - scope - The scope of the role assignment request to validate. +// - roleAssignmentScheduleRequestName - The name of the role assignment request to validate. +// - parameters - Parameters for the role assignment schedule request. +// - options - RoleAssignmentScheduleRequestsClientValidateOptions contains the optional parameters for the RoleAssignmentScheduleRequestsClient.Validate +// method. +func (client *RoleAssignmentScheduleRequestsClient) Validate(ctx context.Context, scope string, roleAssignmentScheduleRequestName string, parameters RoleAssignmentScheduleRequest, options *RoleAssignmentScheduleRequestsClientValidateOptions) (RoleAssignmentScheduleRequestsClientValidateResponse, error) { + var err error + const operationName = "RoleAssignmentScheduleRequestsClient.Validate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.validateCreateRequest(ctx, scope, roleAssignmentScheduleRequestName, parameters, options) + if err != nil { + return RoleAssignmentScheduleRequestsClientValidateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RoleAssignmentScheduleRequestsClientValidateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RoleAssignmentScheduleRequestsClientValidateResponse{}, err + } + resp, err := client.validateHandleResponse(httpResp) + return resp, err +} + +// validateCreateRequest creates the Validate request. +func (client *RoleAssignmentScheduleRequestsClient) validateCreateRequest(ctx context.Context, scope string, roleAssignmentScheduleRequestName string, parameters RoleAssignmentScheduleRequest, options *RoleAssignmentScheduleRequestsClientValidateOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/validate" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if roleAssignmentScheduleRequestName == "" { + return nil, errors.New("parameter roleAssignmentScheduleRequestName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentScheduleRequestName}", url.PathEscape(roleAssignmentScheduleRequestName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// validateHandleResponse handles the Validate response. +func (client *RoleAssignmentScheduleRequestsClient) validateHandleResponse(resp *http.Response) (RoleAssignmentScheduleRequestsClientValidateResponse, error) { + result := RoleAssignmentScheduleRequestsClientValidateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentScheduleRequest); err != nil { + return RoleAssignmentScheduleRequestsClientValidateResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/roleassignmentschedules_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/roleassignmentschedules_client.go new file mode 100644 index 000000000..3788a52a6 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/roleassignmentschedules_client.go @@ -0,0 +1,155 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armauthorization + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// RoleAssignmentSchedulesClient contains the methods for the RoleAssignmentSchedules group. +// Don't use this type directly, use NewRoleAssignmentSchedulesClient() instead. +type RoleAssignmentSchedulesClient struct { + internal *arm.Client +} + +// NewRoleAssignmentSchedulesClient creates a new instance of RoleAssignmentSchedulesClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewRoleAssignmentSchedulesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*RoleAssignmentSchedulesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &RoleAssignmentSchedulesClient{ + internal: cl, + } + return client, nil +} + +// Get - Get the specified role assignment schedule for a resource scope +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-10-01 +// - scope - The scope of the role assignment schedule. +// - roleAssignmentScheduleName - The name (guid) of the role assignment schedule to get. +// - options - RoleAssignmentSchedulesClientGetOptions contains the optional parameters for the RoleAssignmentSchedulesClient.Get +// method. +func (client *RoleAssignmentSchedulesClient) Get(ctx context.Context, scope string, roleAssignmentScheduleName string, options *RoleAssignmentSchedulesClientGetOptions) (RoleAssignmentSchedulesClientGetResponse, error) { + var err error + const operationName = "RoleAssignmentSchedulesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, scope, roleAssignmentScheduleName, options) + if err != nil { + return RoleAssignmentSchedulesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RoleAssignmentSchedulesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RoleAssignmentSchedulesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *RoleAssignmentSchedulesClient) getCreateRequest(ctx context.Context, scope string, roleAssignmentScheduleName string, options *RoleAssignmentSchedulesClientGetOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules/{roleAssignmentScheduleName}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if roleAssignmentScheduleName == "" { + return nil, errors.New("parameter roleAssignmentScheduleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentScheduleName}", url.PathEscape(roleAssignmentScheduleName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *RoleAssignmentSchedulesClient) getHandleResponse(resp *http.Response) (RoleAssignmentSchedulesClientGetResponse, error) { + result := RoleAssignmentSchedulesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentSchedule); err != nil { + return RoleAssignmentSchedulesClientGetResponse{}, err + } + return result, nil +} + +// NewListForScopePager - Gets role assignment schedules for a resource scope. +// +// Generated from API version 2020-10-01 +// - scope - The scope of the role assignments schedules. +// - options - RoleAssignmentSchedulesClientListForScopeOptions contains the optional parameters for the RoleAssignmentSchedulesClient.NewListForScopePager +// method. +func (client *RoleAssignmentSchedulesClient) NewListForScopePager(scope string, options *RoleAssignmentSchedulesClientListForScopeOptions) *runtime.Pager[RoleAssignmentSchedulesClientListForScopeResponse] { + return runtime.NewPager(runtime.PagingHandler[RoleAssignmentSchedulesClientListForScopeResponse]{ + More: func(page RoleAssignmentSchedulesClientListForScopeResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *RoleAssignmentSchedulesClientListForScopeResponse) (RoleAssignmentSchedulesClientListForScopeResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RoleAssignmentSchedulesClient.NewListForScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listForScopeCreateRequest(ctx, scope, options) + }, nil) + if err != nil { + return RoleAssignmentSchedulesClientListForScopeResponse{}, err + } + return client.listForScopeHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listForScopeCreateRequest creates the ListForScope request. +func (client *RoleAssignmentSchedulesClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleAssignmentSchedulesClientListForScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + reqQP.Set("api-version", "2020-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listForScopeHandleResponse handles the ListForScope response. +func (client *RoleAssignmentSchedulesClient) listForScopeHandleResponse(resp *http.Response) (RoleAssignmentSchedulesClientListForScopeResponse, error) { + result := RoleAssignmentSchedulesClientListForScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentScheduleListResult); err != nil { + return RoleAssignmentSchedulesClientListForScopeResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/roledefinitions_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/roledefinitions_client.go new file mode 100644 index 000000000..97b9c0655 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/roledefinitions_client.go @@ -0,0 +1,327 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armauthorization + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// RoleDefinitionsClient contains the methods for the RoleDefinitions group. +// Don't use this type directly, use NewRoleDefinitionsClient() instead. +type RoleDefinitionsClient struct { + internal *arm.Client +} + +// NewRoleDefinitionsClient creates a new instance of RoleDefinitionsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewRoleDefinitionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*RoleDefinitionsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &RoleDefinitionsClient{ + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates a role definition. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-04-01 +// - scope - The scope of the role definition. +// - roleDefinitionID - The ID of the role definition. +// - roleDefinition - The values for the role definition. +// - options - RoleDefinitionsClientCreateOrUpdateOptions contains the optional parameters for the RoleDefinitionsClient.CreateOrUpdate +// method. +func (client *RoleDefinitionsClient) CreateOrUpdate(ctx context.Context, scope string, roleDefinitionID string, roleDefinition RoleDefinition, options *RoleDefinitionsClientCreateOrUpdateOptions) (RoleDefinitionsClientCreateOrUpdateResponse, error) { + var err error + const operationName = "RoleDefinitionsClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, scope, roleDefinitionID, roleDefinition, options) + if err != nil { + return RoleDefinitionsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RoleDefinitionsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return RoleDefinitionsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *RoleDefinitionsClient) createOrUpdateCreateRequest(ctx context.Context, scope string, roleDefinitionID string, roleDefinition RoleDefinition, options *RoleDefinitionsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if roleDefinitionID == "" { + return nil, errors.New("parameter roleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleDefinitionId}", url.PathEscape(roleDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, roleDefinition); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *RoleDefinitionsClient) createOrUpdateHandleResponse(resp *http.Response) (RoleDefinitionsClientCreateOrUpdateResponse, error) { + result := RoleDefinitionsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleDefinition); err != nil { + return RoleDefinitionsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes a role definition. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-04-01 +// - scope - The scope of the role definition. +// - roleDefinitionID - The ID of the role definition to delete. +// - options - RoleDefinitionsClientDeleteOptions contains the optional parameters for the RoleDefinitionsClient.Delete method. +func (client *RoleDefinitionsClient) Delete(ctx context.Context, scope string, roleDefinitionID string, options *RoleDefinitionsClientDeleteOptions) (RoleDefinitionsClientDeleteResponse, error) { + var err error + const operationName = "RoleDefinitionsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, scope, roleDefinitionID, options) + if err != nil { + return RoleDefinitionsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RoleDefinitionsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return RoleDefinitionsClientDeleteResponse{}, err + } + resp, err := client.deleteHandleResponse(httpResp) + return resp, err +} + +// deleteCreateRequest creates the Delete request. +func (client *RoleDefinitionsClient) deleteCreateRequest(ctx context.Context, scope string, roleDefinitionID string, options *RoleDefinitionsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if roleDefinitionID == "" { + return nil, errors.New("parameter roleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleDefinitionId}", url.PathEscape(roleDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// deleteHandleResponse handles the Delete response. +func (client *RoleDefinitionsClient) deleteHandleResponse(resp *http.Response) (RoleDefinitionsClientDeleteResponse, error) { + result := RoleDefinitionsClientDeleteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleDefinition); err != nil { + return RoleDefinitionsClientDeleteResponse{}, err + } + return result, nil +} + +// Get - Get role definition by name (GUID). +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-04-01 +// - scope - The scope of the role definition. +// - roleDefinitionID - The ID of the role definition. +// - options - RoleDefinitionsClientGetOptions contains the optional parameters for the RoleDefinitionsClient.Get method. +func (client *RoleDefinitionsClient) Get(ctx context.Context, scope string, roleDefinitionID string, options *RoleDefinitionsClientGetOptions) (RoleDefinitionsClientGetResponse, error) { + var err error + const operationName = "RoleDefinitionsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, scope, roleDefinitionID, options) + if err != nil { + return RoleDefinitionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RoleDefinitionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RoleDefinitionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *RoleDefinitionsClient) getCreateRequest(ctx context.Context, scope string, roleDefinitionID string, options *RoleDefinitionsClientGetOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if roleDefinitionID == "" { + return nil, errors.New("parameter roleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleDefinitionId}", url.PathEscape(roleDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *RoleDefinitionsClient) getHandleResponse(resp *http.Response) (RoleDefinitionsClientGetResponse, error) { + result := RoleDefinitionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleDefinition); err != nil { + return RoleDefinitionsClientGetResponse{}, err + } + return result, nil +} + +// GetByID - Gets a role definition by ID. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-04-01 +// - roleID - The fully qualified role definition ID. Use the format, /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} +// for subscription level role definitions, or +// /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for tenant level role definitions. +// - options - RoleDefinitionsClientGetByIDOptions contains the optional parameters for the RoleDefinitionsClient.GetByID method. +func (client *RoleDefinitionsClient) GetByID(ctx context.Context, roleID string, options *RoleDefinitionsClientGetByIDOptions) (RoleDefinitionsClientGetByIDResponse, error) { + var err error + const operationName = "RoleDefinitionsClient.GetByID" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getByIDCreateRequest(ctx, roleID, options) + if err != nil { + return RoleDefinitionsClientGetByIDResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RoleDefinitionsClientGetByIDResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RoleDefinitionsClientGetByIDResponse{}, err + } + resp, err := client.getByIDHandleResponse(httpResp) + return resp, err +} + +// getByIDCreateRequest creates the GetByID request. +func (client *RoleDefinitionsClient) getByIDCreateRequest(ctx context.Context, roleID string, options *RoleDefinitionsClientGetByIDOptions) (*policy.Request, error) { + urlPath := "/{roleId}" + urlPath = strings.ReplaceAll(urlPath, "{roleId}", roleID) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getByIDHandleResponse handles the GetByID response. +func (client *RoleDefinitionsClient) getByIDHandleResponse(resp *http.Response) (RoleDefinitionsClientGetByIDResponse, error) { + result := RoleDefinitionsClientGetByIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleDefinition); err != nil { + return RoleDefinitionsClientGetByIDResponse{}, err + } + return result, nil +} + +// NewListPager - Get all role definitions that are applicable at scope and above. +// +// Generated from API version 2022-04-01 +// - scope - The scope of the role definition. +// - options - RoleDefinitionsClientListOptions contains the optional parameters for the RoleDefinitionsClient.NewListPager +// method. +func (client *RoleDefinitionsClient) NewListPager(scope string, options *RoleDefinitionsClientListOptions) *runtime.Pager[RoleDefinitionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[RoleDefinitionsClientListResponse]{ + More: func(page RoleDefinitionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *RoleDefinitionsClientListResponse) (RoleDefinitionsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RoleDefinitionsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, scope, options) + }, nil) + if err != nil { + return RoleDefinitionsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *RoleDefinitionsClient) listCreateRequest(ctx context.Context, scope string, options *RoleDefinitionsClientListOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleDefinitions" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + reqQP.Set("api-version", "2022-04-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *RoleDefinitionsClient) listHandleResponse(resp *http.Response) (RoleDefinitionsClientListResponse, error) { + result := RoleDefinitionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleDefinitionListResult); err != nil { + return RoleDefinitionsClientListResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/roleeligibilityscheduleinstances_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/roleeligibilityscheduleinstances_client.go new file mode 100644 index 000000000..e9fb778e1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/roleeligibilityscheduleinstances_client.go @@ -0,0 +1,155 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armauthorization + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// RoleEligibilityScheduleInstancesClient contains the methods for the RoleEligibilityScheduleInstances group. +// Don't use this type directly, use NewRoleEligibilityScheduleInstancesClient() instead. +type RoleEligibilityScheduleInstancesClient struct { + internal *arm.Client +} + +// NewRoleEligibilityScheduleInstancesClient creates a new instance of RoleEligibilityScheduleInstancesClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewRoleEligibilityScheduleInstancesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*RoleEligibilityScheduleInstancesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &RoleEligibilityScheduleInstancesClient{ + internal: cl, + } + return client, nil +} + +// Get - Gets the specified role eligibility schedule instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-10-01 +// - scope - The scope of the role eligibility schedules. +// - roleEligibilityScheduleInstanceName - The name (hash of schedule name + time) of the role eligibility schedule to get. +// - options - RoleEligibilityScheduleInstancesClientGetOptions contains the optional parameters for the RoleEligibilityScheduleInstancesClient.Get +// method. +func (client *RoleEligibilityScheduleInstancesClient) Get(ctx context.Context, scope string, roleEligibilityScheduleInstanceName string, options *RoleEligibilityScheduleInstancesClientGetOptions) (RoleEligibilityScheduleInstancesClientGetResponse, error) { + var err error + const operationName = "RoleEligibilityScheduleInstancesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, scope, roleEligibilityScheduleInstanceName, options) + if err != nil { + return RoleEligibilityScheduleInstancesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RoleEligibilityScheduleInstancesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RoleEligibilityScheduleInstancesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *RoleEligibilityScheduleInstancesClient) getCreateRequest(ctx context.Context, scope string, roleEligibilityScheduleInstanceName string, options *RoleEligibilityScheduleInstancesClientGetOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances/{roleEligibilityScheduleInstanceName}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if roleEligibilityScheduleInstanceName == "" { + return nil, errors.New("parameter roleEligibilityScheduleInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleEligibilityScheduleInstanceName}", url.PathEscape(roleEligibilityScheduleInstanceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *RoleEligibilityScheduleInstancesClient) getHandleResponse(resp *http.Response) (RoleEligibilityScheduleInstancesClientGetResponse, error) { + result := RoleEligibilityScheduleInstancesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleEligibilityScheduleInstance); err != nil { + return RoleEligibilityScheduleInstancesClientGetResponse{}, err + } + return result, nil +} + +// NewListForScopePager - Gets role eligibility schedule instances of a role eligibility schedule. +// +// Generated from API version 2020-10-01 +// - scope - The scope of the role eligibility schedule. +// - options - RoleEligibilityScheduleInstancesClientListForScopeOptions contains the optional parameters for the RoleEligibilityScheduleInstancesClient.NewListForScopePager +// method. +func (client *RoleEligibilityScheduleInstancesClient) NewListForScopePager(scope string, options *RoleEligibilityScheduleInstancesClientListForScopeOptions) *runtime.Pager[RoleEligibilityScheduleInstancesClientListForScopeResponse] { + return runtime.NewPager(runtime.PagingHandler[RoleEligibilityScheduleInstancesClientListForScopeResponse]{ + More: func(page RoleEligibilityScheduleInstancesClientListForScopeResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *RoleEligibilityScheduleInstancesClientListForScopeResponse) (RoleEligibilityScheduleInstancesClientListForScopeResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RoleEligibilityScheduleInstancesClient.NewListForScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listForScopeCreateRequest(ctx, scope, options) + }, nil) + if err != nil { + return RoleEligibilityScheduleInstancesClientListForScopeResponse{}, err + } + return client.listForScopeHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listForScopeCreateRequest creates the ListForScope request. +func (client *RoleEligibilityScheduleInstancesClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleEligibilityScheduleInstancesClientListForScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + reqQP.Set("api-version", "2020-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listForScopeHandleResponse handles the ListForScope response. +func (client *RoleEligibilityScheduleInstancesClient) listForScopeHandleResponse(resp *http.Response) (RoleEligibilityScheduleInstancesClientListForScopeResponse, error) { + result := RoleEligibilityScheduleInstancesClientListForScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleEligibilityScheduleInstanceListResult); err != nil { + return RoleEligibilityScheduleInstancesClientListForScopeResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/roleeligibilityschedulerequests_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/roleeligibilityschedulerequests_client.go new file mode 100644 index 000000000..fca5ee49c --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/roleeligibilityschedulerequests_client.go @@ -0,0 +1,331 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armauthorization + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// RoleEligibilityScheduleRequestsClient contains the methods for the RoleEligibilityScheduleRequests group. +// Don't use this type directly, use NewRoleEligibilityScheduleRequestsClient() instead. +type RoleEligibilityScheduleRequestsClient struct { + internal *arm.Client +} + +// NewRoleEligibilityScheduleRequestsClient creates a new instance of RoleEligibilityScheduleRequestsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewRoleEligibilityScheduleRequestsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*RoleEligibilityScheduleRequestsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &RoleEligibilityScheduleRequestsClient{ + internal: cl, + } + return client, nil +} + +// Cancel - Cancels a pending role eligibility schedule request. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-10-01 +// - scope - The scope of the role eligibility request to cancel. +// - roleEligibilityScheduleRequestName - The name of the role eligibility request to cancel. +// - options - RoleEligibilityScheduleRequestsClientCancelOptions contains the optional parameters for the RoleEligibilityScheduleRequestsClient.Cancel +// method. +func (client *RoleEligibilityScheduleRequestsClient) Cancel(ctx context.Context, scope string, roleEligibilityScheduleRequestName string, options *RoleEligibilityScheduleRequestsClientCancelOptions) (RoleEligibilityScheduleRequestsClientCancelResponse, error) { + var err error + const operationName = "RoleEligibilityScheduleRequestsClient.Cancel" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.cancelCreateRequest(ctx, scope, roleEligibilityScheduleRequestName, options) + if err != nil { + return RoleEligibilityScheduleRequestsClientCancelResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RoleEligibilityScheduleRequestsClientCancelResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RoleEligibilityScheduleRequestsClientCancelResponse{}, err + } + return RoleEligibilityScheduleRequestsClientCancelResponse{}, nil +} + +// cancelCreateRequest creates the Cancel request. +func (client *RoleEligibilityScheduleRequestsClient) cancelCreateRequest(ctx context.Context, scope string, roleEligibilityScheduleRequestName string, options *RoleEligibilityScheduleRequestsClientCancelOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/cancel" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if roleEligibilityScheduleRequestName == "" { + return nil, errors.New("parameter roleEligibilityScheduleRequestName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleEligibilityScheduleRequestName}", url.PathEscape(roleEligibilityScheduleRequestName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Create - Creates a role eligibility schedule request. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-10-01 +// - scope - The scope of the role eligibility schedule request to create. The scope can be any REST resource instance. For +// example, use '/subscriptions/{subscription-id}/' for a subscription, +// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and +// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' +// for a resource. +// - roleEligibilityScheduleRequestName - The name of the role eligibility to create. It can be any valid GUID. +// - parameters - Parameters for the role eligibility schedule request. +// - options - RoleEligibilityScheduleRequestsClientCreateOptions contains the optional parameters for the RoleEligibilityScheduleRequestsClient.Create +// method. +func (client *RoleEligibilityScheduleRequestsClient) Create(ctx context.Context, scope string, roleEligibilityScheduleRequestName string, parameters RoleEligibilityScheduleRequest, options *RoleEligibilityScheduleRequestsClientCreateOptions) (RoleEligibilityScheduleRequestsClientCreateResponse, error) { + var err error + const operationName = "RoleEligibilityScheduleRequestsClient.Create" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, scope, roleEligibilityScheduleRequestName, parameters, options) + if err != nil { + return RoleEligibilityScheduleRequestsClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RoleEligibilityScheduleRequestsClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return RoleEligibilityScheduleRequestsClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *RoleEligibilityScheduleRequestsClient) createCreateRequest(ctx context.Context, scope string, roleEligibilityScheduleRequestName string, parameters RoleEligibilityScheduleRequest, options *RoleEligibilityScheduleRequestsClientCreateOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if roleEligibilityScheduleRequestName == "" { + return nil, errors.New("parameter roleEligibilityScheduleRequestName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleEligibilityScheduleRequestName}", url.PathEscape(roleEligibilityScheduleRequestName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *RoleEligibilityScheduleRequestsClient) createHandleResponse(resp *http.Response) (RoleEligibilityScheduleRequestsClientCreateResponse, error) { + result := RoleEligibilityScheduleRequestsClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleEligibilityScheduleRequest); err != nil { + return RoleEligibilityScheduleRequestsClientCreateResponse{}, err + } + return result, nil +} + +// Get - Get the specified role eligibility schedule request. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-10-01 +// - scope - The scope of the role eligibility schedule request. +// - roleEligibilityScheduleRequestName - The name (guid) of the role eligibility schedule request to get. +// - options - RoleEligibilityScheduleRequestsClientGetOptions contains the optional parameters for the RoleEligibilityScheduleRequestsClient.Get +// method. +func (client *RoleEligibilityScheduleRequestsClient) Get(ctx context.Context, scope string, roleEligibilityScheduleRequestName string, options *RoleEligibilityScheduleRequestsClientGetOptions) (RoleEligibilityScheduleRequestsClientGetResponse, error) { + var err error + const operationName = "RoleEligibilityScheduleRequestsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, scope, roleEligibilityScheduleRequestName, options) + if err != nil { + return RoleEligibilityScheduleRequestsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RoleEligibilityScheduleRequestsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RoleEligibilityScheduleRequestsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *RoleEligibilityScheduleRequestsClient) getCreateRequest(ctx context.Context, scope string, roleEligibilityScheduleRequestName string, options *RoleEligibilityScheduleRequestsClientGetOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if roleEligibilityScheduleRequestName == "" { + return nil, errors.New("parameter roleEligibilityScheduleRequestName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleEligibilityScheduleRequestName}", url.PathEscape(roleEligibilityScheduleRequestName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *RoleEligibilityScheduleRequestsClient) getHandleResponse(resp *http.Response) (RoleEligibilityScheduleRequestsClientGetResponse, error) { + result := RoleEligibilityScheduleRequestsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleEligibilityScheduleRequest); err != nil { + return RoleEligibilityScheduleRequestsClientGetResponse{}, err + } + return result, nil +} + +// NewListForScopePager - Gets role eligibility schedule requests for a scope. +// +// Generated from API version 2020-10-01 +// - scope - The scope of the role eligibility schedule requests. +// - options - RoleEligibilityScheduleRequestsClientListForScopeOptions contains the optional parameters for the RoleEligibilityScheduleRequestsClient.NewListForScopePager +// method. +func (client *RoleEligibilityScheduleRequestsClient) NewListForScopePager(scope string, options *RoleEligibilityScheduleRequestsClientListForScopeOptions) *runtime.Pager[RoleEligibilityScheduleRequestsClientListForScopeResponse] { + return runtime.NewPager(runtime.PagingHandler[RoleEligibilityScheduleRequestsClientListForScopeResponse]{ + More: func(page RoleEligibilityScheduleRequestsClientListForScopeResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *RoleEligibilityScheduleRequestsClientListForScopeResponse) (RoleEligibilityScheduleRequestsClientListForScopeResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RoleEligibilityScheduleRequestsClient.NewListForScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listForScopeCreateRequest(ctx, scope, options) + }, nil) + if err != nil { + return RoleEligibilityScheduleRequestsClientListForScopeResponse{}, err + } + return client.listForScopeHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listForScopeCreateRequest creates the ListForScope request. +func (client *RoleEligibilityScheduleRequestsClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleEligibilityScheduleRequestsClientListForScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + reqQP.Set("api-version", "2020-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listForScopeHandleResponse handles the ListForScope response. +func (client *RoleEligibilityScheduleRequestsClient) listForScopeHandleResponse(resp *http.Response) (RoleEligibilityScheduleRequestsClientListForScopeResponse, error) { + result := RoleEligibilityScheduleRequestsClientListForScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleEligibilityScheduleRequestListResult); err != nil { + return RoleEligibilityScheduleRequestsClientListForScopeResponse{}, err + } + return result, nil +} + +// Validate - Validates a new role eligibility schedule request. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-10-01 +// - scope - The scope of the role eligibility request to validate. +// - roleEligibilityScheduleRequestName - The name of the role eligibility request to validate. +// - parameters - Parameters for the role eligibility schedule request. +// - options - RoleEligibilityScheduleRequestsClientValidateOptions contains the optional parameters for the RoleEligibilityScheduleRequestsClient.Validate +// method. +func (client *RoleEligibilityScheduleRequestsClient) Validate(ctx context.Context, scope string, roleEligibilityScheduleRequestName string, parameters RoleEligibilityScheduleRequest, options *RoleEligibilityScheduleRequestsClientValidateOptions) (RoleEligibilityScheduleRequestsClientValidateResponse, error) { + var err error + const operationName = "RoleEligibilityScheduleRequestsClient.Validate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.validateCreateRequest(ctx, scope, roleEligibilityScheduleRequestName, parameters, options) + if err != nil { + return RoleEligibilityScheduleRequestsClientValidateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RoleEligibilityScheduleRequestsClientValidateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RoleEligibilityScheduleRequestsClientValidateResponse{}, err + } + resp, err := client.validateHandleResponse(httpResp) + return resp, err +} + +// validateCreateRequest creates the Validate request. +func (client *RoleEligibilityScheduleRequestsClient) validateCreateRequest(ctx context.Context, scope string, roleEligibilityScheduleRequestName string, parameters RoleEligibilityScheduleRequest, options *RoleEligibilityScheduleRequestsClientValidateOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/validate" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if roleEligibilityScheduleRequestName == "" { + return nil, errors.New("parameter roleEligibilityScheduleRequestName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleEligibilityScheduleRequestName}", url.PathEscape(roleEligibilityScheduleRequestName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// validateHandleResponse handles the Validate response. +func (client *RoleEligibilityScheduleRequestsClient) validateHandleResponse(resp *http.Response) (RoleEligibilityScheduleRequestsClientValidateResponse, error) { + result := RoleEligibilityScheduleRequestsClientValidateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleEligibilityScheduleRequest); err != nil { + return RoleEligibilityScheduleRequestsClientValidateResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/roleeligibilityschedules_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/roleeligibilityschedules_client.go new file mode 100644 index 000000000..8c6102618 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/roleeligibilityschedules_client.go @@ -0,0 +1,155 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armauthorization + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// RoleEligibilitySchedulesClient contains the methods for the RoleEligibilitySchedules group. +// Don't use this type directly, use NewRoleEligibilitySchedulesClient() instead. +type RoleEligibilitySchedulesClient struct { + internal *arm.Client +} + +// NewRoleEligibilitySchedulesClient creates a new instance of RoleEligibilitySchedulesClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewRoleEligibilitySchedulesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*RoleEligibilitySchedulesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &RoleEligibilitySchedulesClient{ + internal: cl, + } + return client, nil +} + +// Get - Get the specified role eligibility schedule for a resource scope +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-10-01 +// - scope - The scope of the role eligibility schedule. +// - roleEligibilityScheduleName - The name (guid) of the role eligibility schedule to get. +// - options - RoleEligibilitySchedulesClientGetOptions contains the optional parameters for the RoleEligibilitySchedulesClient.Get +// method. +func (client *RoleEligibilitySchedulesClient) Get(ctx context.Context, scope string, roleEligibilityScheduleName string, options *RoleEligibilitySchedulesClientGetOptions) (RoleEligibilitySchedulesClientGetResponse, error) { + var err error + const operationName = "RoleEligibilitySchedulesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, scope, roleEligibilityScheduleName, options) + if err != nil { + return RoleEligibilitySchedulesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RoleEligibilitySchedulesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RoleEligibilitySchedulesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *RoleEligibilitySchedulesClient) getCreateRequest(ctx context.Context, scope string, roleEligibilityScheduleName string, options *RoleEligibilitySchedulesClientGetOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules/{roleEligibilityScheduleName}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if roleEligibilityScheduleName == "" { + return nil, errors.New("parameter roleEligibilityScheduleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleEligibilityScheduleName}", url.PathEscape(roleEligibilityScheduleName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *RoleEligibilitySchedulesClient) getHandleResponse(resp *http.Response) (RoleEligibilitySchedulesClientGetResponse, error) { + result := RoleEligibilitySchedulesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleEligibilitySchedule); err != nil { + return RoleEligibilitySchedulesClientGetResponse{}, err + } + return result, nil +} + +// NewListForScopePager - Gets role eligibility schedules for a resource scope. +// +// Generated from API version 2020-10-01 +// - scope - The scope of the role eligibility schedules. +// - options - RoleEligibilitySchedulesClientListForScopeOptions contains the optional parameters for the RoleEligibilitySchedulesClient.NewListForScopePager +// method. +func (client *RoleEligibilitySchedulesClient) NewListForScopePager(scope string, options *RoleEligibilitySchedulesClientListForScopeOptions) *runtime.Pager[RoleEligibilitySchedulesClientListForScopeResponse] { + return runtime.NewPager(runtime.PagingHandler[RoleEligibilitySchedulesClientListForScopeResponse]{ + More: func(page RoleEligibilitySchedulesClientListForScopeResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *RoleEligibilitySchedulesClientListForScopeResponse) (RoleEligibilitySchedulesClientListForScopeResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RoleEligibilitySchedulesClient.NewListForScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listForScopeCreateRequest(ctx, scope, options) + }, nil) + if err != nil { + return RoleEligibilitySchedulesClientListForScopeResponse{}, err + } + return client.listForScopeHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listForScopeCreateRequest creates the ListForScope request. +func (client *RoleEligibilitySchedulesClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleEligibilitySchedulesClientListForScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + reqQP.Set("api-version", "2020-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listForScopeHandleResponse handles the ListForScope response. +func (client *RoleEligibilitySchedulesClient) listForScopeHandleResponse(resp *http.Response) (RoleEligibilitySchedulesClientListForScopeResponse, error) { + result := RoleEligibilitySchedulesClientListForScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleEligibilityScheduleListResult); err != nil { + return RoleEligibilitySchedulesClientListForScopeResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/rolemanagementpolicies_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/rolemanagementpolicies_client.go new file mode 100644 index 000000000..34aa8cabb --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/rolemanagementpolicies_client.go @@ -0,0 +1,262 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armauthorization + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// RoleManagementPoliciesClient contains the methods for the RoleManagementPolicies group. +// Don't use this type directly, use NewRoleManagementPoliciesClient() instead. +type RoleManagementPoliciesClient struct { + internal *arm.Client +} + +// NewRoleManagementPoliciesClient creates a new instance of RoleManagementPoliciesClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewRoleManagementPoliciesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*RoleManagementPoliciesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &RoleManagementPoliciesClient{ + internal: cl, + } + return client, nil +} + +// Delete - Delete a role management policy +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-10-01 +// - scope - The scope of the role management policy to upsert. +// - roleManagementPolicyName - The name (guid) of the role management policy to upsert. +// - options - RoleManagementPoliciesClientDeleteOptions contains the optional parameters for the RoleManagementPoliciesClient.Delete +// method. +func (client *RoleManagementPoliciesClient) Delete(ctx context.Context, scope string, roleManagementPolicyName string, options *RoleManagementPoliciesClientDeleteOptions) (RoleManagementPoliciesClientDeleteResponse, error) { + var err error + const operationName = "RoleManagementPoliciesClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, scope, roleManagementPolicyName, options) + if err != nil { + return RoleManagementPoliciesClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RoleManagementPoliciesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return RoleManagementPoliciesClientDeleteResponse{}, err + } + return RoleManagementPoliciesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *RoleManagementPoliciesClient) deleteCreateRequest(ctx context.Context, scope string, roleManagementPolicyName string, options *RoleManagementPoliciesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if roleManagementPolicyName == "" { + return nil, errors.New("parameter roleManagementPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleManagementPolicyName}", url.PathEscape(roleManagementPolicyName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the specified role management policy for a resource scope +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-10-01 +// - scope - The scope of the role management policy. +// - roleManagementPolicyName - The name (guid) of the role management policy to get. +// - options - RoleManagementPoliciesClientGetOptions contains the optional parameters for the RoleManagementPoliciesClient.Get +// method. +func (client *RoleManagementPoliciesClient) Get(ctx context.Context, scope string, roleManagementPolicyName string, options *RoleManagementPoliciesClientGetOptions) (RoleManagementPoliciesClientGetResponse, error) { + var err error + const operationName = "RoleManagementPoliciesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, scope, roleManagementPolicyName, options) + if err != nil { + return RoleManagementPoliciesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RoleManagementPoliciesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RoleManagementPoliciesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *RoleManagementPoliciesClient) getCreateRequest(ctx context.Context, scope string, roleManagementPolicyName string, options *RoleManagementPoliciesClientGetOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if roleManagementPolicyName == "" { + return nil, errors.New("parameter roleManagementPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleManagementPolicyName}", url.PathEscape(roleManagementPolicyName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *RoleManagementPoliciesClient) getHandleResponse(resp *http.Response) (RoleManagementPoliciesClientGetResponse, error) { + result := RoleManagementPoliciesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleManagementPolicy); err != nil { + return RoleManagementPoliciesClientGetResponse{}, err + } + return result, nil +} + +// NewListForScopePager - Gets role management policies for a resource scope. +// +// Generated from API version 2020-10-01 +// - scope - The scope of the role management policy. +// - options - RoleManagementPoliciesClientListForScopeOptions contains the optional parameters for the RoleManagementPoliciesClient.NewListForScopePager +// method. +func (client *RoleManagementPoliciesClient) NewListForScopePager(scope string, options *RoleManagementPoliciesClientListForScopeOptions) *runtime.Pager[RoleManagementPoliciesClientListForScopeResponse] { + return runtime.NewPager(runtime.PagingHandler[RoleManagementPoliciesClientListForScopeResponse]{ + More: func(page RoleManagementPoliciesClientListForScopeResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *RoleManagementPoliciesClientListForScopeResponse) (RoleManagementPoliciesClientListForScopeResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RoleManagementPoliciesClient.NewListForScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listForScopeCreateRequest(ctx, scope, options) + }, nil) + if err != nil { + return RoleManagementPoliciesClientListForScopeResponse{}, err + } + return client.listForScopeHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listForScopeCreateRequest creates the ListForScope request. +func (client *RoleManagementPoliciesClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleManagementPoliciesClientListForScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listForScopeHandleResponse handles the ListForScope response. +func (client *RoleManagementPoliciesClient) listForScopeHandleResponse(resp *http.Response) (RoleManagementPoliciesClientListForScopeResponse, error) { + result := RoleManagementPoliciesClientListForScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleManagementPolicyListResult); err != nil { + return RoleManagementPoliciesClientListForScopeResponse{}, err + } + return result, nil +} + +// Update - Update a role management policy +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-10-01 +// - scope - The scope of the role management policy to upsert. +// - roleManagementPolicyName - The name (guid) of the role management policy to upsert. +// - parameters - Parameters for the role management policy. +// - options - RoleManagementPoliciesClientUpdateOptions contains the optional parameters for the RoleManagementPoliciesClient.Update +// method. +func (client *RoleManagementPoliciesClient) Update(ctx context.Context, scope string, roleManagementPolicyName string, parameters RoleManagementPolicy, options *RoleManagementPoliciesClientUpdateOptions) (RoleManagementPoliciesClientUpdateResponse, error) { + var err error + const operationName = "RoleManagementPoliciesClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, scope, roleManagementPolicyName, parameters, options) + if err != nil { + return RoleManagementPoliciesClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RoleManagementPoliciesClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RoleManagementPoliciesClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *RoleManagementPoliciesClient) updateCreateRequest(ctx context.Context, scope string, roleManagementPolicyName string, parameters RoleManagementPolicy, options *RoleManagementPoliciesClientUpdateOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if roleManagementPolicyName == "" { + return nil, errors.New("parameter roleManagementPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleManagementPolicyName}", url.PathEscape(roleManagementPolicyName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *RoleManagementPoliciesClient) updateHandleResponse(resp *http.Response) (RoleManagementPoliciesClientUpdateResponse, error) { + result := RoleManagementPoliciesClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleManagementPolicy); err != nil { + return RoleManagementPoliciesClientUpdateResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/rolemanagementpolicyassignments_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/rolemanagementpolicyassignments_client.go new file mode 100644 index 000000000..0f20dd1c9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/rolemanagementpolicyassignments_client.go @@ -0,0 +1,262 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armauthorization + +import ( + "context" + "errors" + "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/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// RoleManagementPolicyAssignmentsClient contains the methods for the RoleManagementPolicyAssignments group. +// Don't use this type directly, use NewRoleManagementPolicyAssignmentsClient() instead. +type RoleManagementPolicyAssignmentsClient struct { + internal *arm.Client +} + +// NewRoleManagementPolicyAssignmentsClient creates a new instance of RoleManagementPolicyAssignmentsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewRoleManagementPolicyAssignmentsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*RoleManagementPolicyAssignmentsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &RoleManagementPolicyAssignmentsClient{ + internal: cl, + } + return client, nil +} + +// Create - Create a role management policy assignment +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-10-01 +// - scope - The scope of the role management policy assignment to upsert. +// - roleManagementPolicyAssignmentName - The name of format {guid_guid} the role management policy assignment to upsert. +// - parameters - Parameters for the role management policy assignment. +// - options - RoleManagementPolicyAssignmentsClientCreateOptions contains the optional parameters for the RoleManagementPolicyAssignmentsClient.Create +// method. +func (client *RoleManagementPolicyAssignmentsClient) Create(ctx context.Context, scope string, roleManagementPolicyAssignmentName string, parameters RoleManagementPolicyAssignment, options *RoleManagementPolicyAssignmentsClientCreateOptions) (RoleManagementPolicyAssignmentsClientCreateResponse, error) { + var err error + const operationName = "RoleManagementPolicyAssignmentsClient.Create" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, scope, roleManagementPolicyAssignmentName, parameters, options) + if err != nil { + return RoleManagementPolicyAssignmentsClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RoleManagementPolicyAssignmentsClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return RoleManagementPolicyAssignmentsClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *RoleManagementPolicyAssignmentsClient) createCreateRequest(ctx context.Context, scope string, roleManagementPolicyAssignmentName string, parameters RoleManagementPolicyAssignment, options *RoleManagementPolicyAssignmentsClientCreateOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if roleManagementPolicyAssignmentName == "" { + return nil, errors.New("parameter roleManagementPolicyAssignmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleManagementPolicyAssignmentName}", url.PathEscape(roleManagementPolicyAssignmentName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *RoleManagementPolicyAssignmentsClient) createHandleResponse(resp *http.Response) (RoleManagementPolicyAssignmentsClientCreateResponse, error) { + result := RoleManagementPolicyAssignmentsClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleManagementPolicyAssignment); err != nil { + return RoleManagementPolicyAssignmentsClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Delete a role management policy assignment +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-10-01 +// - scope - The scope of the role management policy assignment to delete. +// - roleManagementPolicyAssignmentName - The name of format {guid_guid} the role management policy assignment to delete. +// - options - RoleManagementPolicyAssignmentsClientDeleteOptions contains the optional parameters for the RoleManagementPolicyAssignmentsClient.Delete +// method. +func (client *RoleManagementPolicyAssignmentsClient) Delete(ctx context.Context, scope string, roleManagementPolicyAssignmentName string, options *RoleManagementPolicyAssignmentsClientDeleteOptions) (RoleManagementPolicyAssignmentsClientDeleteResponse, error) { + var err error + const operationName = "RoleManagementPolicyAssignmentsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, scope, roleManagementPolicyAssignmentName, options) + if err != nil { + return RoleManagementPolicyAssignmentsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RoleManagementPolicyAssignmentsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return RoleManagementPolicyAssignmentsClientDeleteResponse{}, err + } + return RoleManagementPolicyAssignmentsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *RoleManagementPolicyAssignmentsClient) deleteCreateRequest(ctx context.Context, scope string, roleManagementPolicyAssignmentName string, options *RoleManagementPolicyAssignmentsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if roleManagementPolicyAssignmentName == "" { + return nil, errors.New("parameter roleManagementPolicyAssignmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleManagementPolicyAssignmentName}", url.PathEscape(roleManagementPolicyAssignmentName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the specified role management policy assignment for a resource scope +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2020-10-01 +// - scope - The scope of the role management policy. +// - roleManagementPolicyAssignmentName - The name of format {guid_guid} the role management policy assignment to get. +// - options - RoleManagementPolicyAssignmentsClientGetOptions contains the optional parameters for the RoleManagementPolicyAssignmentsClient.Get +// method. +func (client *RoleManagementPolicyAssignmentsClient) Get(ctx context.Context, scope string, roleManagementPolicyAssignmentName string, options *RoleManagementPolicyAssignmentsClientGetOptions) (RoleManagementPolicyAssignmentsClientGetResponse, error) { + var err error + const operationName = "RoleManagementPolicyAssignmentsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, scope, roleManagementPolicyAssignmentName, options) + if err != nil { + return RoleManagementPolicyAssignmentsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RoleManagementPolicyAssignmentsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RoleManagementPolicyAssignmentsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *RoleManagementPolicyAssignmentsClient) getCreateRequest(ctx context.Context, scope string, roleManagementPolicyAssignmentName string, options *RoleManagementPolicyAssignmentsClientGetOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if roleManagementPolicyAssignmentName == "" { + return nil, errors.New("parameter roleManagementPolicyAssignmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{roleManagementPolicyAssignmentName}", url.PathEscape(roleManagementPolicyAssignmentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *RoleManagementPolicyAssignmentsClient) getHandleResponse(resp *http.Response) (RoleManagementPolicyAssignmentsClientGetResponse, error) { + result := RoleManagementPolicyAssignmentsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleManagementPolicyAssignment); err != nil { + return RoleManagementPolicyAssignmentsClientGetResponse{}, err + } + return result, nil +} + +// NewListForScopePager - Gets role management assignment policies for a resource scope. +// +// Generated from API version 2020-10-01 +// - scope - The scope of the role management policy. +// - options - RoleManagementPolicyAssignmentsClientListForScopeOptions contains the optional parameters for the RoleManagementPolicyAssignmentsClient.NewListForScopePager +// method. +func (client *RoleManagementPolicyAssignmentsClient) NewListForScopePager(scope string, options *RoleManagementPolicyAssignmentsClientListForScopeOptions) *runtime.Pager[RoleManagementPolicyAssignmentsClientListForScopeResponse] { + return runtime.NewPager(runtime.PagingHandler[RoleManagementPolicyAssignmentsClientListForScopeResponse]{ + More: func(page RoleManagementPolicyAssignmentsClientListForScopeResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *RoleManagementPolicyAssignmentsClientListForScopeResponse) (RoleManagementPolicyAssignmentsClientListForScopeResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RoleManagementPolicyAssignmentsClient.NewListForScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listForScopeCreateRequest(ctx, scope, options) + }, nil) + if err != nil { + return RoleManagementPolicyAssignmentsClientListForScopeResponse{}, err + } + return client.listForScopeHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listForScopeCreateRequest creates the ListForScope request. +func (client *RoleManagementPolicyAssignmentsClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleManagementPolicyAssignmentsClientListForScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listForScopeHandleResponse handles the ListForScope response. +func (client *RoleManagementPolicyAssignmentsClient) listForScopeHandleResponse(resp *http.Response) (RoleManagementPolicyAssignmentsClientListForScopeResponse, error) { + result := RoleManagementPolicyAssignmentsClientListForScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleManagementPolicyAssignmentListResult); err != nil { + return RoleManagementPolicyAssignmentsClientListForScopeResponse{}, err + } + return result, nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/time_rfc3339.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/time_rfc3339.go new file mode 100644 index 000000000..57651544a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2/time_rfc3339.go @@ -0,0 +1,86 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armauthorization + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) + +const ( + utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` + utcDateTime = "2006-01-02T15:04:05.999999999" + dateTimeJSON = `"` + time.RFC3339Nano + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + layout := utcDateTimeJSON + if tzOffsetRegex.Match(data) { + layout = dateTimeJSON + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + layout := utcDateTime + if tzOffsetRegex.Match(data) { + layout = time.RFC3339Nano + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/CHANGELOG.md similarity index 77% rename from vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/CHANGELOG.md rename to vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/CHANGELOG.md index 8a5c4cc9f..2eb9f6435 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/CHANGELOG.md +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/CHANGELOG.md @@ -1,12 +1,56 @@ # Release History -## 0.12.0 (2023-04-13) +## 1.1.0 (2024-02-13) + +### Other Changes +* Upgraded to API service version `7.5` +* Upgraded dependencies + +## 1.1.0-beta.1 (2023-11-08) + +### Other Changes +* Upgraded service version to `7.5-preview.1` +* Updated to latest version of `azcore`. +* Enabled spans for distributed tracing. + +## 1.0.1 (2023-08-22) + +### Other Changes +* Upgraded dependencies + +## 1.0.0 (2023-07-17) ### Features Added -* upgraded to api version 7.4 +* first stable release of `azsecrets` module + +### Breaking Changes +* changed type of `KID` from string to type `ID` + +## 0.14.0 (2023-06-08) + +### Breaking Changes +* Renamed `Client.ListSecrets` to `Client.ListSecretProperties` +* Renamed `Client.ListSecretVersions` to `Client.ListSecretPropertiesVersions` +* Renamed `SecretBundle` to `Secret` +* Renamed `DeletedSecretBundle` to `DeletedSecret` +* Renamed `SecretItem` to `SecretProperties` +* Renamed `DeletedSecretItem` to `DeletedSecretProperties` +* Renamed `Kid` to `KID` +* Removed `DeletionRecoveryLevel` type +* Remove `MaxResults` option + +### Other Changes +* Updated dependencies + +## 0.13.0 (2023-04-13) ### Breaking Changes -* This module is now DEPRECATED. The latest supported version of this module is at github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets +* Moved from `sdk/keyvault/azsecrets` to `sdk/security/keyvault/azsecrets` + +## 0.12.0 (2023-04-13) + +### Features Added +* upgraded to api version 7.4 ## 0.11.0 (2022-11-08) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/LICENSE.txt b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/LICENSE.txt similarity index 100% rename from vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/LICENSE.txt rename to vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/LICENSE.txt diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/README.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/README.md similarity index 90% rename from vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/README.md rename to vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/README.md index 06a23c841..e34c527bf 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/README.md +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/README.md @@ -1,10 +1,10 @@ # Azure Key Vault Secrets client module for Go -> Deprecated: use github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets instead Azure Key Vault helps solve the following problems: * Secrets management (this module) - securely store and control access to tokens, passwords, certificates, API keys, and other secrets -* Cryptographic key management ([azkeys](https://azsdk/go/keyvault-keys/docs)) - create, store, and control access to the keys used to encrypt your data +* Managed HSM administration ([azadmin](https://aka.ms/azsdk/go/keyvault-admin/docs)) - role-based access control (RBAC), settings, and vault-level backup and restore options * Certificate management ([azcertificates](https://aka.ms/azsdk/go/keyvault-certificates/docs)) - create, manage, and deploy public and private SSL/TLS certificates +* Cryptographic key management ([azkeys](https://azsdk/go/keyvault-keys/docs)) - create, store, and control access to the keys used to encrypt your data [Source code][module_source] | [Package (pkg.go.dev)][reference_docs] | [Product documentation][keyvault_docs] | [Samples][secrets_samples] @@ -14,7 +14,7 @@ Azure Key Vault helps solve the following problems: Install `azsecrets` and `azidentity` with `go get`: ``` -go get github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets +go get github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets go get github.com/Azure/azure-sdk-for-go/sdk/azidentity ``` [azidentity][azure_identity] is used for Azure Active Directory authentication as demonstrated below. @@ -39,7 +39,7 @@ Constructing the client also requires your vault's URL, which you can get from t ```golang import ( "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets" + "github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets" ) func main() { @@ -62,7 +62,7 @@ A secret consists of a secret value and its associated metadata and management i ## Examples -Get started with our [examples](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets#pkg-examples). +Get started with our [examples][secrets_samples]. ## Troubleshooting @@ -96,7 +96,7 @@ azlog.SetListener(func(cls azlog.Event, msg string) { fmt.Println(msg) }) -// Includes only requests and responses in credential logs +// Includes only requests and responses in logs azlog.SetEvents(azlog.EventRequest, azlog.EventResponse) ``` @@ -138,7 +138,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con [managed_identity]: https://docs.microsoft.com/azure/active-directory/managed-identities-azure-resources/overview [reference_docs]: https://aka.ms/azsdk/go/keyvault-secrets/docs [client_docs]: https://aka.ms/azsdk/go/keyvault-secrets/docs#Client -[module_source]: https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/keyvault/azsecrets -[secrets_samples]: https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/keyvault/azsecrets/example_test.go +[module_source]: https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/security/keyvault/azsecrets +[secrets_samples]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets#pkg-examples -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-go%2Fsdk%2Fkeyvault%2Fazsecrets%2FREADME.png) +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-go%2Fsdk%2Fsecurity%2Fkeyvault%2Fazsecrets%2FREADME.png) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/TROUBLESHOOTING.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/TROUBLESHOOTING.md similarity index 69% rename from vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/TROUBLESHOOTING.md rename to vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/TROUBLESHOOTING.md index 72269c7a0..64d2a4f39 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/TROUBLESHOOTING.md +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/TROUBLESHOOTING.md @@ -1,4 +1,4 @@ # Troubleshoot Azure Key Vault Secrets Client Module Issues -See our [Azure Key Vault SDK Troubleshooting Guide](https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/keyvault/TROUBLESHOOTING.md) +See our [Azure Key Vault SDK Troubleshooting Guide](https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/security/keyvault/TROUBLESHOOTING.md) to troubleshoot issues common to Azure Key Vault client modules. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/assets.json b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/assets.json new file mode 100644 index 000000000..a6769e311 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "go", + "TagPrefix": "go/security/keyvault/azsecrets", + "Tag": "go/security/keyvault/azsecrets_46bc7ae56f" +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/autorest.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/autorest.md similarity index 60% rename from vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/autorest.md rename to vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/autorest.md index e6cfb9f8c..73ebe3a4e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/autorest.md +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/autorest.md @@ -1,22 +1,20 @@ ## Go -These settings apply only when `--go` is specified on the command line. - ```yaml clear-output-folder: false export-clients: true go: true -input-file: https://github.com/Azure/azure-rest-api-specs/blob/551275acb80e1f8b39036b79dfc35a8f63b601a7/specification/keyvault/data-plane/Microsoft.KeyVault/stable/7.4/secrets.json +input-file: https://github.com/Azure/azure-rest-api-specs/blob/7452e1cc7db72fbc6cd9539b390d8b8e5c2a1864/specification/keyvault/data-plane/Microsoft.KeyVault/stable/7.5/secrets.json license-header: MICROSOFT_MIT_NO_VERSION -module: github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets +module: github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets openapi-type: "data-plane" output-folder: ../azsecrets override-client-name: Client security: "AADToken" security-scopes: "https://vault.azure.net/.default" -use: "@autorest/go@4.0.0-preview.46" +use: "@autorest/go@4.0.0-preview.59" +inject-spans: true version: "^3.0.0" - directive: # delete unused model - remove-model: SecretProperties @@ -36,17 +34,60 @@ directive: - rename-model: from: SecretUpdateParameters to: UpdateSecretParameters + - rename-model: + from: SecretBundle + to: Secret + - rename-model: + from: DeletedSecretBundle + to: DeletedSecret + - rename-model: + from: SecretItem + to: SecretProperties + - rename-model: + from: DeletedSecretItem + to: DeletedSecretProperties + - rename-model: + from: UpdateSecretParameters + to: UpdateSecretPropertiesParameters + - rename-model: + from: DeletedSecretListResult + to: DeletedSecretPropertiesListResult + - rename-model: + from: SecretListResult + to: SecretPropertiesListResult - # rename paged operations from Get* to List* + # rename operations - rename-operation: from: GetDeletedSecrets - to: ListDeletedSecrets + to: ListDeletedSecretProperties - rename-operation: from: GetSecrets - to: ListSecrets + to: ListSecretProperties - rename-operation: from: GetSecretVersions - to: ListSecretVersions + to: ListSecretPropertiesVersions + - rename-operation: + from: UpdateSecret + to: UpdateSecretProperties + + # rename fields + - from: swagger-document + where: $.definitions.RestoreSecretParameters.properties.value + transform: $["x-ms-client-name"] = "SecretBackup" + - from: swagger-document + where: $.definitions.Secret.properties.kid + transform: $["x-ms-client-name"] = "KID" + + # remove type DeletionRecoveryLevel, use string instead + - from: models.go + where: $ + transform: return $.replace(/DeletionRecoveryLevel/g, "string"); + + # Remove MaxResults parameter + - where: "$.paths..*" + remove-parameter: + in: query + name: maxresults # delete unused error models - from: models.go @@ -73,6 +114,7 @@ directive: - from: - client.go - models.go + - options.go - response_types.go where: $ transform: return $.replace(/Client(\w+)((?:Options|Response))/g, "$1$2"); @@ -81,6 +123,9 @@ directive: - from: models.go where: $ transform: return $.replace(/(\sID \*)string(\s+.*)/g, "$1ID$2") + - from: models.go + where: $ + transform: return $.replace(/(\sKID \*)string(\s+.*)/g, "$1ID$2") # Maxresults -> MaxResults - from: diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/build.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/build.go similarity index 89% rename from vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/build.go rename to vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/build.go index d6e487f2c..95af01282 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/build.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/build.go @@ -2,6 +2,7 @@ // +build go1.18 //go:generate autorest ./autorest.md +//go:generate rm ./constants.go //go:generate gofmt -w . // Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/ci.yml b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/ci.yml similarity index 73% rename from vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/ci.yml rename to vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/ci.yml index 3e196e0c8..f9ad1f166 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/ci.yml +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/ci.yml @@ -9,7 +9,7 @@ trigger: - release/* paths: include: - - sdk/keyvault/azsecrets + - sdk/security/keyvault/azsecrets pr: branches: @@ -20,10 +20,11 @@ pr: - release/* paths: include: - - sdk/keyvault/azsecrets + - sdk/security/keyvault/azsecrets stages: - template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml parameters: - ServiceDirectory: 'keyvault/azsecrets' + ServiceDirectory: 'security/keyvault/azsecrets' RunLiveTests: true + UsePipelineProxy: false diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/client.go similarity index 58% rename from vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/client.go rename to vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/client.go index fdfbabf96..685643ceb 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package azsecrets @@ -17,7 +16,6 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" - "strconv" "strings" ) @@ -32,22 +30,27 @@ type Client struct { // be downloaded. This operation requires the secrets/backup permission. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 7.4 +// Generated from API version 7.5 // - name - The name of the secret. // - options - BackupSecretOptions contains the optional parameters for the Client.BackupSecret method. func (client *Client) BackupSecret(ctx context.Context, name string, options *BackupSecretOptions) (BackupSecretResponse, error) { + var err error + ctx, endSpan := runtime.StartSpan(ctx, "Client.BackupSecret", client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.backupSecretCreateRequest(ctx, name, options) if err != nil { return BackupSecretResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return BackupSecretResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return BackupSecretResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BackupSecretResponse{}, err } - return client.backupSecretHandleResponse(resp) + resp, err := client.backupSecretHandleResponse(httpResp) + return resp, err } // backupSecretCreateRequest creates the BackupSecret request. @@ -62,7 +65,7 @@ func (client *Client) backupSecretCreateRequest(ctx context.Context, name string return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "7.4") + reqQP.Set("api-version", "7.5") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -81,22 +84,27 @@ func (client *Client) backupSecretHandleResponse(resp *http.Response) (BackupSec // version of a secret. This operation requires the secrets/delete permission. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 7.4 +// Generated from API version 7.5 // - name - The name of the secret. // - options - DeleteSecretOptions contains the optional parameters for the Client.DeleteSecret method. func (client *Client) DeleteSecret(ctx context.Context, name string, options *DeleteSecretOptions) (DeleteSecretResponse, error) { + var err error + ctx, endSpan := runtime.StartSpan(ctx, "Client.DeleteSecret", client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteSecretCreateRequest(ctx, name, options) if err != nil { return DeleteSecretResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeleteSecretResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeleteSecretResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeleteSecretResponse{}, err } - return client.deleteSecretHandleResponse(resp) + resp, err := client.deleteSecretHandleResponse(httpResp) + return resp, err } // deleteSecretCreateRequest creates the DeleteSecret request. @@ -111,7 +119,7 @@ func (client *Client) deleteSecretCreateRequest(ctx context.Context, name string return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "7.4") + reqQP.Set("api-version", "7.5") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -120,7 +128,7 @@ func (client *Client) deleteSecretCreateRequest(ctx context.Context, name string // deleteSecretHandleResponse handles the DeleteSecret response. func (client *Client) deleteSecretHandleResponse(resp *http.Response) (DeleteSecretResponse, error) { result := DeleteSecretResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DeletedSecretBundle); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.DeletedSecret); err != nil { return DeleteSecretResponse{}, err } return result, nil @@ -130,22 +138,27 @@ func (client *Client) deleteSecretHandleResponse(resp *http.Response) (DeleteSec // operation requires the secrets/get permission. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 7.4 +// Generated from API version 7.5 // - name - The name of the secret. // - options - GetDeletedSecretOptions contains the optional parameters for the Client.GetDeletedSecret method. func (client *Client) GetDeletedSecret(ctx context.Context, name string, options *GetDeletedSecretOptions) (GetDeletedSecretResponse, error) { + var err error + ctx, endSpan := runtime.StartSpan(ctx, "Client.GetDeletedSecret", client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getDeletedSecretCreateRequest(ctx, name, options) if err != nil { return GetDeletedSecretResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return GetDeletedSecretResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return GetDeletedSecretResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return GetDeletedSecretResponse{}, err } - return client.getDeletedSecretHandleResponse(resp) + resp, err := client.getDeletedSecretHandleResponse(httpResp) + return resp, err } // getDeletedSecretCreateRequest creates the GetDeletedSecret request. @@ -160,7 +173,7 @@ func (client *Client) getDeletedSecretCreateRequest(ctx context.Context, name st return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "7.4") + reqQP.Set("api-version", "7.5") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -169,7 +182,7 @@ func (client *Client) getDeletedSecretCreateRequest(ctx context.Context, name st // getDeletedSecretHandleResponse handles the GetDeletedSecret response. func (client *Client) getDeletedSecretHandleResponse(resp *http.Response) (GetDeletedSecretResponse, error) { result := GetDeletedSecretResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DeletedSecretBundle); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.DeletedSecret); err != nil { return GetDeletedSecretResponse{}, err } return result, nil @@ -179,24 +192,29 @@ func (client *Client) getDeletedSecretHandleResponse(resp *http.Response) (GetDe // permission. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 7.4 +// Generated from API version 7.5 // - name - The name of the secret. // - version - The version of the secret. This URI fragment is optional. If not specified, the latest version of the secret // is returned. // - options - GetSecretOptions contains the optional parameters for the Client.GetSecret method. func (client *Client) GetSecret(ctx context.Context, name string, version string, options *GetSecretOptions) (GetSecretResponse, error) { + var err error + ctx, endSpan := runtime.StartSpan(ctx, "Client.GetSecret", client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getSecretCreateRequest(ctx, name, version, options) if err != nil { return GetSecretResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return GetSecretResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return GetSecretResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return GetSecretResponse{}, err } - return client.getSecretHandleResponse(resp) + resp, err := client.getSecretHandleResponse(httpResp) + return resp, err } // getSecretCreateRequest creates the GetSecret request. @@ -212,7 +230,7 @@ func (client *Client) getSecretCreateRequest(ctx context.Context, name string, v return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "7.4") + reqQP.Set("api-version", "7.5") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -221,191 +239,167 @@ func (client *Client) getSecretCreateRequest(ctx context.Context, name string, v // getSecretHandleResponse handles the GetSecret response. func (client *Client) getSecretHandleResponse(resp *http.Response) (GetSecretResponse, error) { result := GetSecretResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SecretBundle); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.Secret); err != nil { return GetSecretResponse{}, err } return result, nil } -// NewListDeletedSecretsPager - The Get Deleted Secrets operation returns the secrets that have been deleted for a vault enabled -// for soft-delete. This operation requires the secrets/list permission. +// NewListDeletedSecretPropertiesPager - The Get Deleted Secrets operation returns the secrets that have been deleted for +// a vault enabled for soft-delete. This operation requires the secrets/list permission. // -// Generated from API version 7.4 -// - options - ListDeletedSecretsOptions contains the optional parameters for the Client.NewListDeletedSecretsPager method. -func (client *Client) NewListDeletedSecretsPager(options *ListDeletedSecretsOptions) *runtime.Pager[ListDeletedSecretsResponse] { - return runtime.NewPager(runtime.PagingHandler[ListDeletedSecretsResponse]{ - More: func(page ListDeletedSecretsResponse) bool { +// Generated from API version 7.5 +// - options - ListDeletedSecretPropertiesOptions contains the optional parameters for the Client.NewListDeletedSecretPropertiesPager +// method. +func (client *Client) NewListDeletedSecretPropertiesPager(options *ListDeletedSecretPropertiesOptions) *runtime.Pager[ListDeletedSecretPropertiesResponse] { + return runtime.NewPager(runtime.PagingHandler[ListDeletedSecretPropertiesResponse]{ + More: func(page ListDeletedSecretPropertiesResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *ListDeletedSecretsResponse) (ListDeletedSecretsResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listDeletedSecretsCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ListDeletedSecretsResponse{}, err + Fetcher: func(ctx context.Context, page *ListDeletedSecretPropertiesResponse) (ListDeletedSecretPropertiesResponse, error) { + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listDeletedSecretPropertiesCreateRequest(ctx, options) + }, nil) if err != nil { - return ListDeletedSecretsResponse{}, err + return ListDeletedSecretPropertiesResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ListDeletedSecretsResponse{}, runtime.NewResponseError(resp) - } - return client.listDeletedSecretsHandleResponse(resp) + return client.listDeletedSecretPropertiesHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } -// listDeletedSecretsCreateRequest creates the ListDeletedSecrets request. -func (client *Client) listDeletedSecretsCreateRequest(ctx context.Context, options *ListDeletedSecretsOptions) (*policy.Request, error) { +// listDeletedSecretPropertiesCreateRequest creates the ListDeletedSecretProperties request. +func (client *Client) listDeletedSecretPropertiesCreateRequest(ctx context.Context, options *ListDeletedSecretPropertiesOptions) (*policy.Request, error) { urlPath := "/deletedsecrets" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.endpoint, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - if options != nil && options.MaxResults != nil { - reqQP.Set("maxresults", strconv.FormatInt(int64(*options.MaxResults), 10)) - } - reqQP.Set("api-version", "7.4") + reqQP.Set("api-version", "7.5") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// listDeletedSecretsHandleResponse handles the ListDeletedSecrets response. -func (client *Client) listDeletedSecretsHandleResponse(resp *http.Response) (ListDeletedSecretsResponse, error) { - result := ListDeletedSecretsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DeletedSecretListResult); err != nil { - return ListDeletedSecretsResponse{}, err +// listDeletedSecretPropertiesHandleResponse handles the ListDeletedSecretProperties response. +func (client *Client) listDeletedSecretPropertiesHandleResponse(resp *http.Response) (ListDeletedSecretPropertiesResponse, error) { + result := ListDeletedSecretPropertiesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeletedSecretPropertiesListResult); err != nil { + return ListDeletedSecretPropertiesResponse{}, err } return result, nil } -// NewListSecretVersionsPager - The full secret identifier and attributes are provided in the response. No values are returned -// for the secrets. This operations requires the secrets/list permission. +// NewListSecretPropertiesPager - The Get Secrets operation is applicable to the entire vault. However, only the base secret +// identifier and its attributes are provided in the response. Individual secret versions are not listed in the +// response. This operation requires the secrets/list permission. // -// Generated from API version 7.4 -// - name - The name of the secret. -// - options - ListSecretVersionsOptions contains the optional parameters for the Client.NewListSecretVersionsPager method. -func (client *Client) NewListSecretVersionsPager(name string, options *ListSecretVersionsOptions) *runtime.Pager[ListSecretVersionsResponse] { - return runtime.NewPager(runtime.PagingHandler[ListSecretVersionsResponse]{ - More: func(page ListSecretVersionsResponse) bool { +// Generated from API version 7.5 +// - options - ListSecretPropertiesOptions contains the optional parameters for the Client.NewListSecretPropertiesPager +// method. +func (client *Client) NewListSecretPropertiesPager(options *ListSecretPropertiesOptions) *runtime.Pager[ListSecretPropertiesResponse] { + return runtime.NewPager(runtime.PagingHandler[ListSecretPropertiesResponse]{ + More: func(page ListSecretPropertiesResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *ListSecretVersionsResponse) (ListSecretVersionsResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listSecretVersionsCreateRequest(ctx, name, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ListSecretVersionsResponse{}, err + Fetcher: func(ctx context.Context, page *ListSecretPropertiesResponse) (ListSecretPropertiesResponse, error) { + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listSecretPropertiesCreateRequest(ctx, options) + }, nil) if err != nil { - return ListSecretVersionsResponse{}, err + return ListSecretPropertiesResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ListSecretVersionsResponse{}, runtime.NewResponseError(resp) - } - return client.listSecretVersionsHandleResponse(resp) + return client.listSecretPropertiesHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } -// listSecretVersionsCreateRequest creates the ListSecretVersions request. -func (client *Client) listSecretVersionsCreateRequest(ctx context.Context, name string, options *ListSecretVersionsOptions) (*policy.Request, error) { - urlPath := "/secrets/{secret-name}/versions" - if name == "" { - return nil, errors.New("parameter name cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{secret-name}", url.PathEscape(name)) +// listSecretPropertiesCreateRequest creates the ListSecretProperties request. +func (client *Client) listSecretPropertiesCreateRequest(ctx context.Context, options *ListSecretPropertiesOptions) (*policy.Request, error) { + urlPath := "/secrets" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.endpoint, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - if options != nil && options.MaxResults != nil { - reqQP.Set("maxresults", strconv.FormatInt(int64(*options.MaxResults), 10)) - } - reqQP.Set("api-version", "7.4") + reqQP.Set("api-version", "7.5") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// listSecretVersionsHandleResponse handles the ListSecretVersions response. -func (client *Client) listSecretVersionsHandleResponse(resp *http.Response) (ListSecretVersionsResponse, error) { - result := ListSecretVersionsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SecretListResult); err != nil { - return ListSecretVersionsResponse{}, err +// listSecretPropertiesHandleResponse handles the ListSecretProperties response. +func (client *Client) listSecretPropertiesHandleResponse(resp *http.Response) (ListSecretPropertiesResponse, error) { + result := ListSecretPropertiesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SecretPropertiesListResult); err != nil { + return ListSecretPropertiesResponse{}, err } return result, nil } -// NewListSecretsPager - The Get Secrets operation is applicable to the entire vault. However, only the base secret identifier -// and its attributes are provided in the response. Individual secret versions are not listed in the -// response. This operation requires the secrets/list permission. +// NewListSecretPropertiesVersionsPager - The full secret identifier and attributes are provided in the response. No values +// are returned for the secrets. This operations requires the secrets/list permission. // -// Generated from API version 7.4 -// - options - ListSecretsOptions contains the optional parameters for the Client.NewListSecretsPager method. -func (client *Client) NewListSecretsPager(options *ListSecretsOptions) *runtime.Pager[ListSecretsResponse] { - return runtime.NewPager(runtime.PagingHandler[ListSecretsResponse]{ - More: func(page ListSecretsResponse) bool { +// Generated from API version 7.5 +// - name - The name of the secret. +// - options - ListSecretPropertiesVersionsOptions contains the optional parameters for the Client.NewListSecretPropertiesVersionsPager +// method. +func (client *Client) NewListSecretPropertiesVersionsPager(name string, options *ListSecretPropertiesVersionsOptions) *runtime.Pager[ListSecretPropertiesVersionsResponse] { + return runtime.NewPager(runtime.PagingHandler[ListSecretPropertiesVersionsResponse]{ + More: func(page ListSecretPropertiesVersionsResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *ListSecretsResponse) (ListSecretsResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listSecretsCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + Fetcher: func(ctx context.Context, page *ListSecretPropertiesVersionsResponse) (ListSecretPropertiesVersionsResponse, error) { + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listSecretPropertiesVersionsCreateRequest(ctx, name, options) + }, nil) if err != nil { - return ListSecretsResponse{}, err + return ListSecretPropertiesVersionsResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ListSecretsResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ListSecretsResponse{}, runtime.NewResponseError(resp) - } - return client.listSecretsHandleResponse(resp) + return client.listSecretPropertiesVersionsHandleResponse(resp) }, + Tracer: client.internal.Tracer(), }) } -// listSecretsCreateRequest creates the ListSecrets request. -func (client *Client) listSecretsCreateRequest(ctx context.Context, options *ListSecretsOptions) (*policy.Request, error) { - urlPath := "/secrets" +// listSecretPropertiesVersionsCreateRequest creates the ListSecretPropertiesVersions request. +func (client *Client) listSecretPropertiesVersionsCreateRequest(ctx context.Context, name string, options *ListSecretPropertiesVersionsOptions) (*policy.Request, error) { + urlPath := "/secrets/{secret-name}/versions" + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{secret-name}", url.PathEscape(name)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.endpoint, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - if options != nil && options.MaxResults != nil { - reqQP.Set("maxresults", strconv.FormatInt(int64(*options.MaxResults), 10)) - } - reqQP.Set("api-version", "7.4") + reqQP.Set("api-version", "7.5") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// listSecretsHandleResponse handles the ListSecrets response. -func (client *Client) listSecretsHandleResponse(resp *http.Response) (ListSecretsResponse, error) { - result := ListSecretsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SecretListResult); err != nil { - return ListSecretsResponse{}, err +// listSecretPropertiesVersionsHandleResponse handles the ListSecretPropertiesVersions response. +func (client *Client) listSecretPropertiesVersionsHandleResponse(resp *http.Response) (ListSecretPropertiesVersionsResponse, error) { + result := ListSecretPropertiesVersionsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SecretPropertiesListResult); err != nil { + return ListSecretPropertiesVersionsResponse{}, err } return result, nil } @@ -415,20 +409,24 @@ func (client *Client) listSecretsHandleResponse(resp *http.Response) (ListSecret // secrets/purge permission. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 7.4 +// Generated from API version 7.5 // - name - The name of the secret. // - options - PurgeDeletedSecretOptions contains the optional parameters for the Client.PurgeDeletedSecret method. func (client *Client) PurgeDeletedSecret(ctx context.Context, name string, options *PurgeDeletedSecretOptions) (PurgeDeletedSecretResponse, error) { + var err error + ctx, endSpan := runtime.StartSpan(ctx, "Client.PurgeDeletedSecret", client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.purgeDeletedSecretCreateRequest(ctx, name, options) if err != nil { return PurgeDeletedSecretResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PurgeDeletedSecretResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusNoContent) { - return PurgeDeletedSecretResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return PurgeDeletedSecretResponse{}, err } return PurgeDeletedSecretResponse{}, nil } @@ -445,7 +443,7 @@ func (client *Client) purgeDeletedSecretCreateRequest(ctx context.Context, name return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "7.4") + reqQP.Set("api-version", "7.5") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -455,22 +453,27 @@ func (client *Client) purgeDeletedSecretCreateRequest(ctx context.Context, name // enabled vault. This operation requires the secrets/recover permission. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 7.4 +// Generated from API version 7.5 // - name - The name of the deleted secret. // - options - RecoverDeletedSecretOptions contains the optional parameters for the Client.RecoverDeletedSecret method. func (client *Client) RecoverDeletedSecret(ctx context.Context, name string, options *RecoverDeletedSecretOptions) (RecoverDeletedSecretResponse, error) { + var err error + ctx, endSpan := runtime.StartSpan(ctx, "Client.RecoverDeletedSecret", client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.recoverDeletedSecretCreateRequest(ctx, name, options) if err != nil { return RecoverDeletedSecretResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return RecoverDeletedSecretResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RecoverDeletedSecretResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RecoverDeletedSecretResponse{}, err } - return client.recoverDeletedSecretHandleResponse(resp) + resp, err := client.recoverDeletedSecretHandleResponse(httpResp) + return resp, err } // recoverDeletedSecretCreateRequest creates the RecoverDeletedSecret request. @@ -485,7 +488,7 @@ func (client *Client) recoverDeletedSecretCreateRequest(ctx context.Context, nam return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "7.4") + reqQP.Set("api-version", "7.5") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -494,7 +497,7 @@ func (client *Client) recoverDeletedSecretCreateRequest(ctx context.Context, nam // recoverDeletedSecretHandleResponse handles the RecoverDeletedSecret response. func (client *Client) recoverDeletedSecretHandleResponse(resp *http.Response) (RecoverDeletedSecretResponse, error) { result := RecoverDeletedSecretResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SecretBundle); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.Secret); err != nil { return RecoverDeletedSecretResponse{}, err } return result, nil @@ -504,22 +507,27 @@ func (client *Client) recoverDeletedSecretHandleResponse(resp *http.Response) (R // permission. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 7.4 +// Generated from API version 7.5 // - parameters - The parameters to restore the secret. // - options - RestoreSecretOptions contains the optional parameters for the Client.RestoreSecret method. func (client *Client) RestoreSecret(ctx context.Context, parameters RestoreSecretParameters, options *RestoreSecretOptions) (RestoreSecretResponse, error) { + var err error + ctx, endSpan := runtime.StartSpan(ctx, "Client.RestoreSecret", client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.restoreSecretCreateRequest(ctx, parameters, options) if err != nil { return RestoreSecretResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return RestoreSecretResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RestoreSecretResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RestoreSecretResponse{}, err } - return client.restoreSecretHandleResponse(resp) + resp, err := client.restoreSecretHandleResponse(httpResp) + return resp, err } // restoreSecretCreateRequest creates the RestoreSecret request. @@ -530,16 +538,19 @@ func (client *Client) restoreSecretCreateRequest(ctx context.Context, parameters return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "7.4") + reqQP.Set("api-version", "7.5") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // restoreSecretHandleResponse handles the RestoreSecret response. func (client *Client) restoreSecretHandleResponse(resp *http.Response) (RestoreSecretResponse, error) { result := RestoreSecretResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SecretBundle); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.Secret); err != nil { return RestoreSecretResponse{}, err } return result, nil @@ -549,24 +560,29 @@ func (client *Client) restoreSecretHandleResponse(resp *http.Response) (RestoreS // creates a new version of that secret. This operation requires the secrets/set permission. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 7.4 +// Generated from API version 7.5 // - name - The name of the secret. The value you provide may be copied globally for the purpose of running the service. // The value provided should not include personally identifiable or sensitive information. // - parameters - The parameters for setting the secret. // - options - SetSecretOptions contains the optional parameters for the Client.SetSecret method. func (client *Client) SetSecret(ctx context.Context, name string, parameters SetSecretParameters, options *SetSecretOptions) (SetSecretResponse, error) { + var err error + ctx, endSpan := runtime.StartSpan(ctx, "Client.SetSecret", client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.setSecretCreateRequest(ctx, name, parameters, options) if err != nil { return SetSecretResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SetSecretResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SetSecretResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SetSecretResponse{}, err } - return client.setSecretHandleResponse(resp) + resp, err := client.setSecretHandleResponse(httpResp) + return resp, err } // setSecretCreateRequest creates the SetSecret request. @@ -581,48 +597,56 @@ func (client *Client) setSecretCreateRequest(ctx context.Context, name string, p return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "7.4") + reqQP.Set("api-version", "7.5") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // setSecretHandleResponse handles the SetSecret response. func (client *Client) setSecretHandleResponse(resp *http.Response) (SetSecretResponse, error) { result := SetSecretResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SecretBundle); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.Secret); err != nil { return SetSecretResponse{}, err } return result, nil } -// UpdateSecret - The UPDATE operation changes specified attributes of an existing stored secret. Attributes that are not -// specified in the request are left unchanged. The value of a secret itself cannot be changed. +// UpdateSecretProperties - The UPDATE operation changes specified attributes of an existing stored secret. Attributes that +// are not specified in the request are left unchanged. The value of a secret itself cannot be changed. // This operation requires the secrets/set permission. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 7.4 +// Generated from API version 7.5 // - name - The name of the secret. // - version - The version of the secret. // - parameters - The parameters for update secret operation. -// - options - UpdateSecretOptions contains the optional parameters for the Client.UpdateSecret method. -func (client *Client) UpdateSecret(ctx context.Context, name string, version string, parameters UpdateSecretParameters, options *UpdateSecretOptions) (UpdateSecretResponse, error) { - req, err := client.updateSecretCreateRequest(ctx, name, version, parameters, options) +// - options - UpdateSecretPropertiesOptions contains the optional parameters for the Client.UpdateSecretProperties method. +func (client *Client) UpdateSecretProperties(ctx context.Context, name string, version string, parameters UpdateSecretPropertiesParameters, options *UpdateSecretPropertiesOptions) (UpdateSecretPropertiesResponse, error) { + var err error + ctx, endSpan := runtime.StartSpan(ctx, "Client.UpdateSecretProperties", client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateSecretPropertiesCreateRequest(ctx, name, version, parameters, options) if err != nil { - return UpdateSecretResponse{}, err + return UpdateSecretPropertiesResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return UpdateSecretResponse{}, err + return UpdateSecretPropertiesResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return UpdateSecretResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return UpdateSecretPropertiesResponse{}, err } - return client.updateSecretHandleResponse(resp) + resp, err := client.updateSecretPropertiesHandleResponse(httpResp) + return resp, err } -// updateSecretCreateRequest creates the UpdateSecret request. -func (client *Client) updateSecretCreateRequest(ctx context.Context, name string, version string, parameters UpdateSecretParameters, options *UpdateSecretOptions) (*policy.Request, error) { +// updateSecretPropertiesCreateRequest creates the UpdateSecretProperties request. +func (client *Client) updateSecretPropertiesCreateRequest(ctx context.Context, name string, version string, parameters UpdateSecretPropertiesParameters, options *UpdateSecretPropertiesOptions) (*policy.Request, error) { urlPath := "/secrets/{secret-name}/{secret-version}" if name == "" { return nil, errors.New("parameter name cannot be empty") @@ -634,17 +658,20 @@ func (client *Client) updateSecretCreateRequest(ctx context.Context, name string return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "7.4") + reqQP.Set("api-version", "7.5") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } -// updateSecretHandleResponse handles the UpdateSecret response. -func (client *Client) updateSecretHandleResponse(resp *http.Response) (UpdateSecretResponse, error) { - result := UpdateSecretResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SecretBundle); err != nil { - return UpdateSecretResponse{}, err +// updateSecretPropertiesHandleResponse handles the UpdateSecretProperties response. +func (client *Client) updateSecretPropertiesHandleResponse(resp *http.Response) (UpdateSecretPropertiesResponse, error) { + result := UpdateSecretPropertiesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Secret); err != nil { + return UpdateSecretPropertiesResponse{}, err } return result, nil } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/custom_client.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/custom_client.go similarity index 86% rename from vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/custom_client.go rename to vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/custom_client.go index 04500bd08..a4070bda3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/custom_client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/custom_client.go @@ -12,7 +12,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal" + "github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal" ) // ClientOptions contains optional settings for Client. @@ -37,7 +37,12 @@ func NewClient(vaultURL string, credential azcore.TokenCredential, options *Clie DisableChallengeResourceVerification: options.DisableChallengeResourceVerification, }, ) - azcoreClient, err := azcore.NewClient("azsecrets.Client", version, runtime.PipelineOptions{PerRetry: []policy.Policy{authPolicy}}, &options.ClientOptions) + azcoreClient, err := azcore.NewClient(moduleName, version, runtime.PipelineOptions{ + PerRetry: []policy.Policy{authPolicy}, + Tracing: runtime.TracingOptions{ + Namespace: "Microsoft.KeyVault", + }, + }, &options.ClientOptions) if err != nil { return nil, err } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/models.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/models.go new file mode 100644 index 000000000..aff7c87e3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/models.go @@ -0,0 +1,204 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package azsecrets + +import "time" + +// BackupSecretResult - The backup secret result, containing the backup blob. +type BackupSecretResult struct { + // READ-ONLY; The backup blob containing the backed up secret. + Value []byte +} + +// DeletedSecret - A Deleted Secret consisting of its previous id, attributes and its tags, as well as information on when +// it will be purged. +type DeletedSecret struct { + // The secret management attributes. + Attributes *SecretAttributes + + // The content type of the secret. + ContentType *string + + // The secret id. + ID *ID + + // The url of the recovery object, used to identify and recover the deleted secret. + RecoveryID *string + + // Application specific metadata in the form of key-value pairs. + Tags map[string]*string + + // The secret value. + Value *string + + // READ-ONLY; The time when the secret was deleted, in UTC + DeletedDate *time.Time + + // READ-ONLY; If this is a secret backing a KV certificate, then this field specifies the corresponding key backing the KV + // certificate. + KID *ID + + // READ-ONLY; True if the secret's lifetime is managed by key vault. If this is a secret backing a certificate, then managed + // will be true. + Managed *bool + + // READ-ONLY; The time when the secret is scheduled to be purged, in UTC + ScheduledPurgeDate *time.Time +} + +// DeletedSecretProperties - The deleted secret item containing metadata about the deleted secret. +type DeletedSecretProperties struct { + // The secret management attributes. + Attributes *SecretAttributes + + // Type of the secret value such as a password. + ContentType *string + + // Secret identifier. + ID *ID + + // The url of the recovery object, used to identify and recover the deleted secret. + RecoveryID *string + + // Application specific metadata in the form of key-value pairs. + Tags map[string]*string + + // READ-ONLY; The time when the secret was deleted, in UTC + DeletedDate *time.Time + + // READ-ONLY; True if the secret's lifetime is managed by key vault. If this is a key backing a certificate, then managed + // will be true. + Managed *bool + + // READ-ONLY; The time when the secret is scheduled to be purged, in UTC + ScheduledPurgeDate *time.Time +} + +// DeletedSecretPropertiesListResult - The deleted secret list result +type DeletedSecretPropertiesListResult struct { + // READ-ONLY; The URL to get the next set of deleted secrets. + NextLink *string + + // READ-ONLY; A response message containing a list of the deleted secrets in the vault along with a link to the next page + // of deleted secrets + Value []*DeletedSecretProperties +} + +// RestoreSecretParameters - The secret restore parameters. +type RestoreSecretParameters struct { + // REQUIRED; The backup blob associated with a secret bundle. + SecretBackup []byte +} + +// Secret - A secret consisting of a value, id and its attributes. +type Secret struct { + // The secret management attributes. + Attributes *SecretAttributes + + // The content type of the secret. + ContentType *string + + // The secret id. + ID *ID + + // Application specific metadata in the form of key-value pairs. + Tags map[string]*string + + // The secret value. + Value *string + + // READ-ONLY; If this is a secret backing a KV certificate, then this field specifies the corresponding key backing the KV + // certificate. + KID *ID + + // READ-ONLY; True if the secret's lifetime is managed by key vault. If this is a secret backing a certificate, then managed + // will be true. + Managed *bool +} + +// SecretAttributes - The secret management attributes. +type SecretAttributes struct { + // Determines whether the object is enabled. + Enabled *bool + + // Expiry date in UTC. + Expires *time.Time + + // Not before date in UTC. + NotBefore *time.Time + + // READ-ONLY; Creation time in UTC. + Created *time.Time + + // READ-ONLY; softDelete data retention days. Value should be >=7 and <=90 when softDelete enabled, otherwise 0. + RecoverableDays *int32 + + // READ-ONLY; Reflects the deletion recovery level currently in effect for secrets in the current vault. If it contains 'Purgeable', + // the secret can be permanently deleted by a privileged user; otherwise, only the + // system can purge the secret, at the end of the retention interval. + RecoveryLevel *string + + // READ-ONLY; Last updated time in UTC. + Updated *time.Time +} + +// SecretProperties - The secret item containing secret metadata. +type SecretProperties struct { + // The secret management attributes. + Attributes *SecretAttributes + + // Type of the secret value such as a password. + ContentType *string + + // Secret identifier. + ID *ID + + // Application specific metadata in the form of key-value pairs. + Tags map[string]*string + + // READ-ONLY; True if the secret's lifetime is managed by key vault. If this is a key backing a certificate, then managed + // will be true. + Managed *bool +} + +// SecretPropertiesListResult - The secret list result. +type SecretPropertiesListResult struct { + // READ-ONLY; The URL to get the next set of secrets. + NextLink *string + + // READ-ONLY; A response message containing a list of secrets in the key vault along with a link to the next page of secrets. + Value []*SecretProperties +} + +// SetSecretParameters - The secret set parameters. +type SetSecretParameters struct { + // REQUIRED; The value of the secret. + Value *string + + // Type of the secret value such as a password. + ContentType *string + + // The secret management attributes. + SecretAttributes *SecretAttributes + + // Application specific metadata in the form of key-value pairs. + Tags map[string]*string +} + +// UpdateSecretPropertiesParameters - The secret update parameters. +type UpdateSecretPropertiesParameters struct { + // Type of the secret value such as a password. + ContentType *string + + // The secret management attributes. + SecretAttributes *SecretAttributes + + // Application specific metadata in the form of key-value pairs. + Tags map[string]*string +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/models_serde.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/models_serde.go similarity index 89% rename from vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/models_serde.go rename to vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/models_serde.go index 72d554127..077c2a1ee 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/models_serde.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/models_serde.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package azsecrets @@ -44,14 +43,14 @@ func (b *BackupSecretResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DeletedSecretBundle. -func (d DeletedSecretBundle) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeletedSecret. +func (d DeletedSecret) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "attributes", d.Attributes) populate(objectMap, "contentType", d.ContentType) populateTimeUnix(objectMap, "deletedDate", d.DeletedDate) populate(objectMap, "id", d.ID) - populate(objectMap, "kid", d.Kid) + populate(objectMap, "kid", d.KID) populate(objectMap, "managed", d.Managed) populate(objectMap, "recoveryId", d.RecoveryID) populateTimeUnix(objectMap, "scheduledPurgeDate", d.ScheduledPurgeDate) @@ -60,8 +59,8 @@ func (d DeletedSecretBundle) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedSecretBundle. -func (d *DeletedSecretBundle) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedSecret. +func (d *DeletedSecret) 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", d, err) @@ -82,7 +81,7 @@ func (d *DeletedSecretBundle) UnmarshalJSON(data []byte) error { err = unpopulate(val, "ID", &d.ID) delete(rawMsg, key) case "kid": - err = unpopulate(val, "Kid", &d.Kid) + err = unpopulate(val, "KID", &d.KID) delete(rawMsg, key) case "managed": err = unpopulate(val, "Managed", &d.Managed) @@ -107,8 +106,8 @@ func (d *DeletedSecretBundle) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DeletedSecretItem. -func (d DeletedSecretItem) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeletedSecretProperties. +func (d DeletedSecretProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "attributes", d.Attributes) populate(objectMap, "contentType", d.ContentType) @@ -121,8 +120,8 @@ func (d DeletedSecretItem) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedSecretItem. -func (d *DeletedSecretItem) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedSecretProperties. +func (d *DeletedSecretProperties) 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", d, err) @@ -162,16 +161,16 @@ func (d *DeletedSecretItem) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DeletedSecretListResult. -func (d DeletedSecretListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeletedSecretPropertiesListResult. +func (d DeletedSecretPropertiesListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", d.NextLink) populate(objectMap, "value", d.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedSecretListResult. -func (d *DeletedSecretListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedSecretPropertiesListResult. +func (d *DeletedSecretPropertiesListResult) 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", d, err) @@ -196,7 +195,7 @@ func (d *DeletedSecretListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RestoreSecretParameters. func (r RestoreSecretParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateByteArray(objectMap, "value", r.SecretBundleBackup, runtime.Base64URLFormat) + populateByteArray(objectMap, "value", r.SecretBackup, runtime.Base64URLFormat) return json.Marshal(objectMap) } @@ -210,7 +209,7 @@ func (r *RestoreSecretParameters) UnmarshalJSON(data []byte) error { var err error switch key { case "value": - err = runtime.DecodeByteArray(string(val), &r.SecretBundleBackup, runtime.Base64URLFormat) + err = runtime.DecodeByteArray(string(val), &r.SecretBackup, runtime.Base64URLFormat) delete(rawMsg, key) } if err != nil { @@ -220,21 +219,21 @@ func (r *RestoreSecretParameters) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SecretAttributes. -func (s SecretAttributes) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Secret. +func (s Secret) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeUnix(objectMap, "created", s.Created) - populate(objectMap, "enabled", s.Enabled) - populateTimeUnix(objectMap, "exp", s.Expires) - populateTimeUnix(objectMap, "nbf", s.NotBefore) - populate(objectMap, "recoverableDays", s.RecoverableDays) - populate(objectMap, "recoveryLevel", s.RecoveryLevel) - populateTimeUnix(objectMap, "updated", s.Updated) + populate(objectMap, "attributes", s.Attributes) + populate(objectMap, "contentType", s.ContentType) + populate(objectMap, "id", s.ID) + populate(objectMap, "kid", s.KID) + populate(objectMap, "managed", s.Managed) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SecretAttributes. -func (s *SecretAttributes) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Secret. +func (s *Secret) 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", s, err) @@ -242,26 +241,26 @@ func (s *SecretAttributes) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "created": - err = unpopulateTimeUnix(val, "Created", &s.Created) + case "attributes": + err = unpopulate(val, "Attributes", &s.Attributes) delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &s.Enabled) + case "contentType": + err = unpopulate(val, "ContentType", &s.ContentType) delete(rawMsg, key) - case "exp": - err = unpopulateTimeUnix(val, "Expires", &s.Expires) + case "id": + err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) - case "nbf": - err = unpopulateTimeUnix(val, "NotBefore", &s.NotBefore) + case "kid": + err = unpopulate(val, "KID", &s.KID) delete(rawMsg, key) - case "recoverableDays": - err = unpopulate(val, "RecoverableDays", &s.RecoverableDays) + case "managed": + err = unpopulate(val, "Managed", &s.Managed) delete(rawMsg, key) - case "recoveryLevel": - err = unpopulate(val, "RecoveryLevel", &s.RecoveryLevel) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) delete(rawMsg, key) - case "updated": - err = unpopulateTimeUnix(val, "Updated", &s.Updated) + case "value": + err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) } if err != nil { @@ -271,21 +270,21 @@ func (s *SecretAttributes) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SecretBundle. -func (s SecretBundle) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SecretAttributes. +func (s SecretAttributes) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "attributes", s.Attributes) - populate(objectMap, "contentType", s.ContentType) - populate(objectMap, "id", s.ID) - populate(objectMap, "kid", s.Kid) - populate(objectMap, "managed", s.Managed) - populate(objectMap, "tags", s.Tags) - populate(objectMap, "value", s.Value) + populateTimeUnix(objectMap, "created", s.Created) + populate(objectMap, "enabled", s.Enabled) + populateTimeUnix(objectMap, "exp", s.Expires) + populateTimeUnix(objectMap, "nbf", s.NotBefore) + populate(objectMap, "recoverableDays", s.RecoverableDays) + populate(objectMap, "recoveryLevel", s.RecoveryLevel) + populateTimeUnix(objectMap, "updated", s.Updated) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SecretBundle. -func (s *SecretBundle) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SecretAttributes. +func (s *SecretAttributes) 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", s, err) @@ -293,26 +292,26 @@ func (s *SecretBundle) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "attributes": - err = unpopulate(val, "Attributes", &s.Attributes) + case "created": + err = unpopulateTimeUnix(val, "Created", &s.Created) delete(rawMsg, key) - case "contentType": - err = unpopulate(val, "ContentType", &s.ContentType) + case "enabled": + err = unpopulate(val, "Enabled", &s.Enabled) delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &s.ID) + case "exp": + err = unpopulateTimeUnix(val, "Expires", &s.Expires) delete(rawMsg, key) - case "kid": - err = unpopulate(val, "Kid", &s.Kid) + case "nbf": + err = unpopulateTimeUnix(val, "NotBefore", &s.NotBefore) delete(rawMsg, key) - case "managed": - err = unpopulate(val, "Managed", &s.Managed) + case "recoverableDays": + err = unpopulate(val, "RecoverableDays", &s.RecoverableDays) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &s.Tags) + case "recoveryLevel": + err = unpopulate(val, "RecoveryLevel", &s.RecoveryLevel) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) + case "updated": + err = unpopulateTimeUnix(val, "Updated", &s.Updated) delete(rawMsg, key) } if err != nil { @@ -322,8 +321,8 @@ func (s *SecretBundle) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SecretItem. -func (s SecretItem) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SecretProperties. +func (s SecretProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "attributes", s.Attributes) populate(objectMap, "contentType", s.ContentType) @@ -333,8 +332,8 @@ func (s SecretItem) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SecretItem. -func (s *SecretItem) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SecretProperties. +func (s *SecretProperties) 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", s, err) @@ -365,16 +364,16 @@ func (s *SecretItem) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SecretListResult. -func (s SecretListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SecretPropertiesListResult. +func (s SecretPropertiesListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", s.NextLink) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SecretListResult. -func (s *SecretListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SecretPropertiesListResult. +func (s *SecretPropertiesListResult) 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", s, err) @@ -435,8 +434,8 @@ func (s *SetSecretParameters) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type UpdateSecretParameters. -func (u UpdateSecretParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UpdateSecretPropertiesParameters. +func (u UpdateSecretPropertiesParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "contentType", u.ContentType) populate(objectMap, "attributes", u.SecretAttributes) @@ -444,8 +443,8 @@ func (u UpdateSecretParameters) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateSecretParameters. -func (u *UpdateSecretParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateSecretPropertiesParameters. +func (u *UpdateSecretPropertiesParameters) 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", u, err) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/options.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/options.go new file mode 100644 index 000000000..6d35566a5 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/options.go @@ -0,0 +1,71 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package azsecrets + +// BackupSecretOptions contains the optional parameters for the Client.BackupSecret method. +type BackupSecretOptions struct { + // placeholder for future optional parameters +} + +// DeleteSecretOptions contains the optional parameters for the Client.DeleteSecret method. +type DeleteSecretOptions struct { + // placeholder for future optional parameters +} + +// GetDeletedSecretOptions contains the optional parameters for the Client.GetDeletedSecret method. +type GetDeletedSecretOptions struct { + // placeholder for future optional parameters +} + +// GetSecretOptions contains the optional parameters for the Client.GetSecret method. +type GetSecretOptions struct { + // placeholder for future optional parameters +} + +// ListDeletedSecretPropertiesOptions contains the optional parameters for the Client.NewListDeletedSecretPropertiesPager +// method. +type ListDeletedSecretPropertiesOptions struct { + // placeholder for future optional parameters +} + +// ListSecretPropertiesOptions contains the optional parameters for the Client.NewListSecretPropertiesPager method. +type ListSecretPropertiesOptions struct { + // placeholder for future optional parameters +} + +// ListSecretPropertiesVersionsOptions contains the optional parameters for the Client.NewListSecretPropertiesVersionsPager +// method. +type ListSecretPropertiesVersionsOptions struct { + // placeholder for future optional parameters +} + +// PurgeDeletedSecretOptions contains the optional parameters for the Client.PurgeDeletedSecret method. +type PurgeDeletedSecretOptions struct { + // placeholder for future optional parameters +} + +// RecoverDeletedSecretOptions contains the optional parameters for the Client.RecoverDeletedSecret method. +type RecoverDeletedSecretOptions struct { + // placeholder for future optional parameters +} + +// RestoreSecretOptions contains the optional parameters for the Client.RestoreSecret method. +type RestoreSecretOptions struct { + // placeholder for future optional parameters +} + +// SetSecretOptions contains the optional parameters for the Client.SetSecret method. +type SetSecretOptions struct { + // placeholder for future optional parameters +} + +// UpdateSecretPropertiesOptions contains the optional parameters for the Client.UpdateSecretProperties method. +type UpdateSecretPropertiesOptions struct { + // placeholder for future optional parameters +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/response_types.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/response_types.go new file mode 100644 index 000000000..43f00000a --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/response_types.go @@ -0,0 +1,80 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package azsecrets + +// BackupSecretResponse contains the response from method Client.BackupSecret. +type BackupSecretResponse struct { + // The backup secret result, containing the backup blob. + BackupSecretResult +} + +// DeleteSecretResponse contains the response from method Client.DeleteSecret. +type DeleteSecretResponse struct { + // A Deleted Secret consisting of its previous id, attributes and its tags, as well as information on when it will be purged. + DeletedSecret +} + +// GetDeletedSecretResponse contains the response from method Client.GetDeletedSecret. +type GetDeletedSecretResponse struct { + // A Deleted Secret consisting of its previous id, attributes and its tags, as well as information on when it will be purged. + DeletedSecret +} + +// GetSecretResponse contains the response from method Client.GetSecret. +type GetSecretResponse struct { + // A secret consisting of a value, id and its attributes. + Secret +} + +// ListDeletedSecretPropertiesResponse contains the response from method Client.NewListDeletedSecretPropertiesPager. +type ListDeletedSecretPropertiesResponse struct { + // The deleted secret list result + DeletedSecretPropertiesListResult +} + +// ListSecretPropertiesResponse contains the response from method Client.NewListSecretPropertiesPager. +type ListSecretPropertiesResponse struct { + // The secret list result. + SecretPropertiesListResult +} + +// ListSecretPropertiesVersionsResponse contains the response from method Client.NewListSecretPropertiesVersionsPager. +type ListSecretPropertiesVersionsResponse struct { + // The secret list result. + SecretPropertiesListResult +} + +// PurgeDeletedSecretResponse contains the response from method Client.PurgeDeletedSecret. +type PurgeDeletedSecretResponse struct { + // placeholder for future response values +} + +// RecoverDeletedSecretResponse contains the response from method Client.RecoverDeletedSecret. +type RecoverDeletedSecretResponse struct { + // A secret consisting of a value, id and its attributes. + Secret +} + +// RestoreSecretResponse contains the response from method Client.RestoreSecret. +type RestoreSecretResponse struct { + // A secret consisting of a value, id and its attributes. + Secret +} + +// SetSecretResponse contains the response from method Client.SetSecret. +type SetSecretResponse struct { + // A secret consisting of a value, id and its attributes. + Secret +} + +// UpdateSecretPropertiesResponse contains the response from method Client.UpdateSecretProperties. +type UpdateSecretPropertiesResponse struct { + // A secret consisting of a value, id and its attributes. + Secret +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/test-resources.json b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/test-resources.json similarity index 100% rename from vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/test-resources.json rename to vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/test-resources.json diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/time_unix.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/time_unix.go similarity index 94% rename from vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/time_unix.go rename to vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/time_unix.go index ed8ce0f9d..ce0ec3e9a 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/time_unix.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/time_unix.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package azsecrets diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/version.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/version.go similarity index 60% rename from vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/version.go rename to vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/version.go index 885158bcb..2d3ed87cf 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets/version.go @@ -7,6 +7,6 @@ package azsecrets const ( - moduleName = "azsecrets" - version = "v0.12.0" + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets" + version = "v1.1.0" ) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal/CHANGELOG.md similarity index 84% rename from vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal/CHANGELOG.md rename to vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal/CHANGELOG.md index 95d77dc95..8b2eaba74 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal/CHANGELOG.md +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal/CHANGELOG.md @@ -1,5 +1,21 @@ # Release History +## 1.0.0 (2023-08-15) + +### Features Added +* This is the first stable release of the `internal` library for KeyVault. + +### Other Changes +* Upgrade dependencies + +## 0.8.0 (2023-03-08) + +### Breaking Changes +* Moved to new location + +### Other Changes +* Upgrade dependencies + ## 0.7.1 (2022-11-14) ### Bugs Fixed diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal/LICENSE.txt b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal/LICENSE.txt similarity index 100% rename from vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal/LICENSE.txt rename to vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal/LICENSE.txt diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal/README.md b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal/README.md similarity index 86% rename from vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal/README.md rename to vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal/README.md index bd4826705..8516337cf 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal/README.md +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal/README.md @@ -1,7 +1,5 @@ # Key Vault Internal Module for Go -[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal) - This module contains shared code for all the Key Vault SDKs, mainly the challenge authentication policy. ## Contributing diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal/challenge_policy.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal/challenge_policy.go new file mode 100644 index 000000000..f5c8b725f --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal/challenge_policy.go @@ -0,0 +1,175 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +package internal + +import ( + "errors" + "fmt" + "io" + "net/http" + "net/url" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/internal/errorinfo" +) + +const challengeMatchError = `challenge resource "%s" doesn't match the requested domain. Set DisableChallengeResourceVerification to true in your client options to disable. See https://aka.ms/azsdk/blog/vault-uri for more information` + +type KeyVaultChallengePolicyOptions struct { + // DisableChallengeResourceVerification controls whether the policy requires the + // authentication challenge resource to match the Key Vault or Managed HSM domain + DisableChallengeResourceVerification bool +} + +type keyVaultAuthorizer struct { + // tro is the policy's authentication parameters. These are discovered from an authentication challenge + // elicited ahead of the first client request. + tro policy.TokenRequestOptions + // TODO: move into tro once it has a tenant field (https://github.com/Azure/azure-sdk-for-go/issues/19841) + tenantID string + verifyChallengeResource bool +} + +type reqBody struct { + body io.ReadSeekCloser + contentType string +} + +func NewKeyVaultChallengePolicy(cred azcore.TokenCredential, opts *KeyVaultChallengePolicyOptions) policy.Policy { + if opts == nil { + opts = &KeyVaultChallengePolicyOptions{} + } + kv := keyVaultAuthorizer{ + verifyChallengeResource: !opts.DisableChallengeResourceVerification, + } + return runtime.NewBearerTokenPolicy(cred, nil, &policy.BearerTokenOptions{ + AuthorizationHandler: policy.AuthorizationHandler{ + OnRequest: kv.authorize, + OnChallenge: kv.authorizeOnChallenge, + }, + }) +} + +func (k *keyVaultAuthorizer) authorize(req *policy.Request, authNZ func(policy.TokenRequestOptions) error) error { + if len(k.tro.Scopes) == 0 || k.tenantID == "" { + if body := req.Body(); body != nil { + // We don't know the scope or tenant ID because we haven't seen a challenge yet. We elicit one now by sending + // the request without authorization, first removing its body, if any. authorizeOnChallenge will reattach the + // body, authorize the request, and send it again. + rb := reqBody{body, req.Raw().Header.Get("content-type")} + req.SetOperationValue(rb) + if err := req.SetBody(nil, ""); err != nil { + return err + } + } + // returning nil indicates the bearer token policy should send the request + return nil + } + // else we know the auth parameters and can authorize the request as normal + return authNZ(k.tro) +} + +func (k *keyVaultAuthorizer) authorizeOnChallenge(req *policy.Request, res *http.Response, authNZ func(policy.TokenRequestOptions) error) error { + // parse the challenge + if err := k.updateTokenRequestOptions(res, req.Raw()); err != nil { + return err + } + // reattach the request's original body, if it was removed by authorize(). If a bug prevents recovering + // the body, this policy will send the request without it and get a 400 response from Key Vault. + var rb reqBody + if req.OperationValue(&rb) { + if err := req.SetBody(rb.body, rb.contentType); err != nil { + return err + } + } + // authenticate with the parameters supplied by Key Vault, authorize the request, send it again + return authNZ(k.tro) +} + +// parses Tenant ID from auth challenge +// https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000 +func parseTenant(url string) string { + if url == "" { + return "" + } + parts := strings.Split(url, "/") + tenant := parts[3] + tenant = strings.ReplaceAll(tenant, ",", "") + return tenant +} + +type challengePolicyError struct { + err error +} + +func (c *challengePolicyError) Error() string { + return c.err.Error() +} + +func (*challengePolicyError) NonRetriable() { + // marker method +} + +func (c *challengePolicyError) Unwrap() error { + return c.err +} + +var _ errorinfo.NonRetriable = (*challengePolicyError)(nil) + +// updateTokenRequestOptions parses authentication parameters from Key Vault's challenge +func (k *keyVaultAuthorizer) updateTokenRequestOptions(resp *http.Response, req *http.Request) error { + authHeader := resp.Header.Get("WWW-Authenticate") + if authHeader == "" { + return &challengePolicyError{err: errors.New("response has no WWW-Authenticate header for challenge authentication")} + } + + // Strip down to auth and resource + // Format is "Bearer authorization=\"\" resource=\"\"" OR + // "Bearer authorization=\"\" scope=\"\" resource=\"\"" + authHeader = strings.ReplaceAll(authHeader, "Bearer ", "") + + parts := strings.Split(authHeader, " ") + + vals := map[string]string{} + for _, part := range parts { + subParts := strings.Split(part, "=") + if len(subParts) == 2 { + stripped := strings.ReplaceAll(subParts[1], "\"", "") + stripped = strings.TrimSuffix(stripped, ",") + vals[subParts[0]] = stripped + } + } + + k.tenantID = parseTenant(vals["authorization"]) + scope := "" + if v, ok := vals["scope"]; ok { + scope = v + } else if v, ok := vals["resource"]; ok { + scope = v + } + if scope == "" { + return &challengePolicyError{err: errors.New("could not find a valid resource in the WWW-Authenticate header")} + } + if k.verifyChallengeResource { + // the challenge resource's host must match the requested vault's host + parsed, err := url.Parse(scope) + if err != nil { + return &challengePolicyError{err: fmt.Errorf(`invalid challenge resource "%s": %v`, scope, err)} + } + if !strings.HasSuffix(req.URL.Host, "."+parsed.Host) { + return &challengePolicyError{err: fmt.Errorf(challengeMatchError, scope)} + } + } + if !strings.HasSuffix(scope, "/.default") { + scope += "/.default" + } + k.tro.Scopes = []string{scope} + return nil +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal/ci.keyvault.yml b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal/ci.securitykeyvault.yml similarity index 77% rename from vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal/ci.keyvault.yml rename to vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal/ci.securitykeyvault.yml index d72c65013..2f8b8e1a8 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal/ci.keyvault.yml +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal/ci.securitykeyvault.yml @@ -8,7 +8,7 @@ trigger: - release/* paths: include: - - sdk/keyvault/internal + - sdk/security/keyvault/internal pr: branches: @@ -19,10 +19,10 @@ pr: - release/* paths: include: - - sdk/keyvault/internal + - sdk/security/keyvault/internal stages: - template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml parameters: - ServiceDirectory: 'keyvault/internal' + ServiceDirectory: 'security/keyvault/internal' RunLiveTests: false diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal/constants.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal/constants.go similarity index 88% rename from vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal/constants.go rename to vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal/constants.go index cd94eb0d8..f080c819f 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal/constants.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal/constants.go @@ -7,5 +7,5 @@ package internal const ( - version = "v0.7.1" //nolint + version = "v1.0.0" //nolint ) diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal/doc.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal/doc.go similarity index 100% rename from vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal/doc.go rename to vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal/doc.go diff --git a/vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal/parse.go b/vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal/parse.go similarity index 100% rename from vendor/github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal/parse.go rename to vendor/github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal/parse.go diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/CHANGELOG.md deleted file mode 100644 index 52911e4cc..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/applications.go b/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/applications.go deleted file mode 100644 index 1409be13a..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/applications.go +++ /dev/null @@ -1,1161 +0,0 @@ -package graphrbac - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ApplicationsClient is the the Graph RBAC Management Client -type ApplicationsClient struct { - BaseClient -} - -// NewApplicationsClient creates an instance of the ApplicationsClient client. -func NewApplicationsClient(tenantID string) ApplicationsClient { - return NewApplicationsClientWithBaseURI(DefaultBaseURI, tenantID) -} - -// NewApplicationsClientWithBaseURI creates an instance of the ApplicationsClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewApplicationsClientWithBaseURI(baseURI string, tenantID string) ApplicationsClient { - return ApplicationsClient{NewWithBaseURI(baseURI, tenantID)} -} - -// AddOwner add an owner to an application. -// Parameters: -// applicationObjectID - the object ID of the application to which to add the owner. -// parameters - the URL of the owner object, such as -// https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. -func (client ApplicationsClient) AddOwner(ctx context.Context, applicationObjectID string, parameters AddOwnerParameters) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.AddOwner") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.URL", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("graphrbac.ApplicationsClient", "AddOwner", err.Error()) - } - - req, err := client.AddOwnerPreparer(ctx, applicationObjectID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "AddOwner", nil, "Failure preparing request") - return - } - - resp, err := client.AddOwnerSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "AddOwner", resp, "Failure sending request") - return - } - - result, err = client.AddOwnerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "AddOwner", resp, "Failure responding to request") - return - } - - return -} - -// AddOwnerPreparer prepares the AddOwner request. -func (client ApplicationsClient) AddOwnerPreparer(ctx context.Context, applicationObjectID string, parameters AddOwnerParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationObjectId": autorest.Encode("path", applicationObjectID), - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}/$links/owners", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// AddOwnerSender sends the AddOwner request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) AddOwnerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// AddOwnerResponder handles the response to the AddOwner request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) AddOwnerResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Create create a new application. -// Parameters: -// parameters - the parameters for creating an application. -func (client ApplicationsClient) Create(ctx context.Context, parameters ApplicationCreateParameters) (result Application, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.Create") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DisplayName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("graphrbac.ApplicationsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ApplicationsClient) CreatePreparer(ctx context.Context, parameters ApplicationCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/applications", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) CreateResponder(resp *http.Response) (result Application, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete an application. -// Parameters: -// applicationObjectID - application object ID. -func (client ApplicationsClient) Delete(ctx context.Context, applicationObjectID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, applicationObjectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ApplicationsClient) DeletePreparer(ctx context.Context, applicationObjectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationObjectId": autorest.Encode("path", applicationObjectID), - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get an application by object ID. -// Parameters: -// applicationObjectID - application object ID. -func (client ApplicationsClient) Get(ctx context.Context, applicationObjectID string) (result Application, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, applicationObjectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ApplicationsClient) GetPreparer(ctx context.Context, applicationObjectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationObjectId": autorest.Encode("path", applicationObjectID), - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) GetResponder(resp *http.Response) (result Application, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetServicePrincipalsIDByAppID gets an object id for a given application id from the current tenant. -// Parameters: -// applicationID - the application ID. -func (client ApplicationsClient) GetServicePrincipalsIDByAppID(ctx context.Context, applicationID string) (result ServicePrincipalObjectResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.GetServicePrincipalsIDByAppID") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetServicePrincipalsIDByAppIDPreparer(ctx, applicationID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "GetServicePrincipalsIDByAppID", nil, "Failure preparing request") - return - } - - resp, err := client.GetServicePrincipalsIDByAppIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "GetServicePrincipalsIDByAppID", resp, "Failure sending request") - return - } - - result, err = client.GetServicePrincipalsIDByAppIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "GetServicePrincipalsIDByAppID", resp, "Failure responding to request") - return - } - - return -} - -// GetServicePrincipalsIDByAppIDPreparer prepares the GetServicePrincipalsIDByAppID request. -func (client ApplicationsClient) GetServicePrincipalsIDByAppIDPreparer(ctx context.Context, applicationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationID": autorest.Encode("path", applicationID), - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/servicePrincipalsByAppId/{applicationID}/objectId", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetServicePrincipalsIDByAppIDSender sends the GetServicePrincipalsIDByAppID request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) GetServicePrincipalsIDByAppIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetServicePrincipalsIDByAppIDResponder handles the response to the GetServicePrincipalsIDByAppID request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) GetServicePrincipalsIDByAppIDResponder(resp *http.Response) (result ServicePrincipalObjectResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists applications by filter parameters. -// Parameters: -// filter - the filters to apply to the operation. -func (client ApplicationsClient) List(ctx context.Context, filter string) (result ApplicationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.List") - defer func() { - sc := -1 - if result.alr.Response.Response != nil { - sc = result.alr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = func(ctx context.Context, lastResult ApplicationListResult) (ApplicationListResult, error) { - if lastResult.OdataNextLink == nil || len(to.String(lastResult.OdataNextLink)) < 1 { - return ApplicationListResult{}, nil - } - return client.ListNext(ctx, *lastResult.OdataNextLink) - } - req, err := client.ListPreparer(ctx, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.alr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "List", resp, "Failure sending request") - return - } - - result.alr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "List", resp, "Failure responding to request") - return - } - if result.alr.hasNextLink() && result.alr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ApplicationsClient) ListPreparer(ctx context.Context, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/applications", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) ListResponder(resp *http.Response) (result ApplicationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ApplicationsClient) ListComplete(ctx context.Context, filter string) (result ApplicationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, filter) - return -} - -// ListKeyCredentials get the keyCredentials associated with an application. -// Parameters: -// applicationObjectID - application object ID. -func (client ApplicationsClient) ListKeyCredentials(ctx context.Context, applicationObjectID string) (result KeyCredentialListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.ListKeyCredentials") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListKeyCredentialsPreparer(ctx, applicationObjectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListKeyCredentials", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeyCredentialsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListKeyCredentials", resp, "Failure sending request") - return - } - - result, err = client.ListKeyCredentialsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListKeyCredentials", resp, "Failure responding to request") - return - } - - return -} - -// ListKeyCredentialsPreparer prepares the ListKeyCredentials request. -func (client ApplicationsClient) ListKeyCredentialsPreparer(ctx context.Context, applicationObjectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationObjectId": autorest.Encode("path", applicationObjectID), - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}/keyCredentials", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListKeyCredentialsSender sends the ListKeyCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) ListKeyCredentialsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListKeyCredentialsResponder handles the response to the ListKeyCredentials request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) ListKeyCredentialsResponder(resp *http.Response) (result KeyCredentialListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNext gets a list of applications from the current tenant. -// Parameters: -// nextLink - next link for the list operation. -func (client ApplicationsClient) ListNext(ctx context.Context, nextLink string) (result ApplicationListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.ListNext") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListNextPreparer(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListNext", nil, "Failure preparing request") - return - } - - resp, err := client.ListNextSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListNext", resp, "Failure sending request") - return - } - - result, err = client.ListNextResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListNext", resp, "Failure responding to request") - return - } - - return -} - -// ListNextPreparer prepares the ListNext request. -func (client ApplicationsClient) ListNextPreparer(ctx context.Context, nextLink string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "nextLink": nextLink, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/{nextLink}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListNextSender sends the ListNext request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) ListNextSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListNextResponder handles the response to the ListNext request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) ListNextResponder(resp *http.Response) (result ApplicationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListOwners the owners are a set of non-admin users who are allowed to modify this object. -// Parameters: -// applicationObjectID - the object ID of the application for which to get owners. -func (client ApplicationsClient) ListOwners(ctx context.Context, applicationObjectID string) (result DirectoryObjectListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.ListOwners") - defer func() { - sc := -1 - if result.dolr.Response.Response != nil { - sc = result.dolr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listOwnersNextResults - req, err := client.ListOwnersPreparer(ctx, applicationObjectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListOwners", nil, "Failure preparing request") - return - } - - resp, err := client.ListOwnersSender(req) - if err != nil { - result.dolr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListOwners", resp, "Failure sending request") - return - } - - result.dolr, err = client.ListOwnersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListOwners", resp, "Failure responding to request") - return - } - if result.dolr.hasNextLink() && result.dolr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListOwnersPreparer prepares the ListOwners request. -func (client ApplicationsClient) ListOwnersPreparer(ctx context.Context, applicationObjectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationObjectId": autorest.Encode("path", applicationObjectID), - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}/owners", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListOwnersSender sends the ListOwners request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) ListOwnersSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListOwnersResponder handles the response to the ListOwners request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) ListOwnersResponder(resp *http.Response) (result DirectoryObjectListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listOwnersNextResults retrieves the next set of results, if any. -func (client ApplicationsClient) listOwnersNextResults(ctx context.Context, lastResults DirectoryObjectListResult) (result DirectoryObjectListResult, err error) { - req, err := lastResults.directoryObjectListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "listOwnersNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListOwnersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "listOwnersNextResults", resp, "Failure sending next results request") - } - result, err = client.ListOwnersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "listOwnersNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListOwnersComplete enumerates all values, automatically crossing page boundaries as required. -func (client ApplicationsClient) ListOwnersComplete(ctx context.Context, applicationObjectID string) (result DirectoryObjectListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.ListOwners") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListOwners(ctx, applicationObjectID) - return -} - -// ListPasswordCredentials get the passwordCredentials associated with an application. -// Parameters: -// applicationObjectID - application object ID. -func (client ApplicationsClient) ListPasswordCredentials(ctx context.Context, applicationObjectID string) (result PasswordCredentialListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.ListPasswordCredentials") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPasswordCredentialsPreparer(ctx, applicationObjectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListPasswordCredentials", nil, "Failure preparing request") - return - } - - resp, err := client.ListPasswordCredentialsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListPasswordCredentials", resp, "Failure sending request") - return - } - - result, err = client.ListPasswordCredentialsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListPasswordCredentials", resp, "Failure responding to request") - return - } - - return -} - -// ListPasswordCredentialsPreparer prepares the ListPasswordCredentials request. -func (client ApplicationsClient) ListPasswordCredentialsPreparer(ctx context.Context, applicationObjectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationObjectId": autorest.Encode("path", applicationObjectID), - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}/passwordCredentials", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListPasswordCredentialsSender sends the ListPasswordCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) ListPasswordCredentialsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListPasswordCredentialsResponder handles the response to the ListPasswordCredentials request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) ListPasswordCredentialsResponder(resp *http.Response) (result PasswordCredentialListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Patch update an existing application. -// Parameters: -// applicationObjectID - application object ID. -// parameters - parameters to update an existing application. -func (client ApplicationsClient) Patch(ctx context.Context, applicationObjectID string, parameters ApplicationUpdateParameters) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.Patch") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.PatchPreparer(ctx, applicationObjectID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Patch", nil, "Failure preparing request") - return - } - - resp, err := client.PatchSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Patch", resp, "Failure sending request") - return - } - - result, err = client.PatchResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Patch", resp, "Failure responding to request") - return - } - - return -} - -// PatchPreparer prepares the Patch request. -func (client ApplicationsClient) PatchPreparer(ctx context.Context, applicationObjectID string, parameters ApplicationUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationObjectId": autorest.Encode("path", applicationObjectID), - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PatchSender sends the Patch request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) PatchSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// PatchResponder handles the response to the Patch request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) PatchResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// RemoveOwner remove a member from owners. -// Parameters: -// applicationObjectID - the object ID of the application from which to remove the owner. -// ownerObjectID - owner object id -func (client ApplicationsClient) RemoveOwner(ctx context.Context, applicationObjectID string, ownerObjectID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.RemoveOwner") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RemoveOwnerPreparer(ctx, applicationObjectID, ownerObjectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "RemoveOwner", nil, "Failure preparing request") - return - } - - resp, err := client.RemoveOwnerSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "RemoveOwner", resp, "Failure sending request") - return - } - - result, err = client.RemoveOwnerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "RemoveOwner", resp, "Failure responding to request") - return - } - - return -} - -// RemoveOwnerPreparer prepares the RemoveOwner request. -func (client ApplicationsClient) RemoveOwnerPreparer(ctx context.Context, applicationObjectID string, ownerObjectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationObjectId": autorest.Encode("path", applicationObjectID), - "ownerObjectId": autorest.Encode("path", ownerObjectID), - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}/$links/owners/{ownerObjectId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RemoveOwnerSender sends the RemoveOwner request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) RemoveOwnerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// RemoveOwnerResponder handles the response to the RemoveOwner request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) RemoveOwnerResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// UpdateKeyCredentials update the keyCredentials associated with an application. -// Parameters: -// applicationObjectID - application object ID. -// parameters - parameters to update the keyCredentials of an existing application. -func (client ApplicationsClient) UpdateKeyCredentials(ctx context.Context, applicationObjectID string, parameters KeyCredentialsUpdateParameters) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.UpdateKeyCredentials") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdateKeyCredentialsPreparer(ctx, applicationObjectID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "UpdateKeyCredentials", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateKeyCredentialsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "UpdateKeyCredentials", resp, "Failure sending request") - return - } - - result, err = client.UpdateKeyCredentialsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "UpdateKeyCredentials", resp, "Failure responding to request") - return - } - - return -} - -// UpdateKeyCredentialsPreparer prepares the UpdateKeyCredentials request. -func (client ApplicationsClient) UpdateKeyCredentialsPreparer(ctx context.Context, applicationObjectID string, parameters KeyCredentialsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationObjectId": autorest.Encode("path", applicationObjectID), - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}/keyCredentials", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateKeyCredentialsSender sends the UpdateKeyCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) UpdateKeyCredentialsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// UpdateKeyCredentialsResponder handles the response to the UpdateKeyCredentials request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) UpdateKeyCredentialsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// UpdatePasswordCredentials update passwordCredentials associated with an application. -// Parameters: -// applicationObjectID - application object ID. -// parameters - parameters to update passwordCredentials of an existing application. -func (client ApplicationsClient) UpdatePasswordCredentials(ctx context.Context, applicationObjectID string, parameters PasswordCredentialsUpdateParameters) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.UpdatePasswordCredentials") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePasswordCredentialsPreparer(ctx, applicationObjectID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "UpdatePasswordCredentials", nil, "Failure preparing request") - return - } - - resp, err := client.UpdatePasswordCredentialsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "UpdatePasswordCredentials", resp, "Failure sending request") - return - } - - result, err = client.UpdatePasswordCredentialsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "UpdatePasswordCredentials", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePasswordCredentialsPreparer prepares the UpdatePasswordCredentials request. -func (client ApplicationsClient) UpdatePasswordCredentialsPreparer(ctx context.Context, applicationObjectID string, parameters PasswordCredentialsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationObjectId": autorest.Encode("path", applicationObjectID), - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}/passwordCredentials", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdatePasswordCredentialsSender sends the UpdatePasswordCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) UpdatePasswordCredentialsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// UpdatePasswordCredentialsResponder handles the response to the UpdatePasswordCredentials request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) UpdatePasswordCredentialsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/client.go deleted file mode 100644 index 8cecf6457..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package graphrbac implements the Azure ARM Graphrbac service API version 1.6. -// -// The Graph RBAC Management Client -package graphrbac - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Graphrbac - DefaultBaseURI = "https://graph.windows.net" -) - -// BaseClient is the base client for Graphrbac. -type BaseClient struct { - autorest.Client - BaseURI string - TenantID string -} - -// New creates an instance of the BaseClient client. -func New(tenantID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, tenantID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, tenantID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - TenantID: tenantID, - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/dataplane_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/dataplane_meta.json deleted file mode 100644 index 1e5687d47..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/dataplane_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/graphrbac/data-plane/readme.md", - "tag": "1.6", - "use": "@microsoft.azure/autorest.go@2.1.183", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=1.6 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/graphrbac/data-plane/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/deletedapplications.go b/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/deletedapplications.go deleted file mode 100644 index dfb5eda6d..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/deletedapplications.go +++ /dev/null @@ -1,356 +0,0 @@ -package graphrbac - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// DeletedApplicationsClient is the the Graph RBAC Management Client -type DeletedApplicationsClient struct { - BaseClient -} - -// NewDeletedApplicationsClient creates an instance of the DeletedApplicationsClient client. -func NewDeletedApplicationsClient(tenantID string) DeletedApplicationsClient { - return NewDeletedApplicationsClientWithBaseURI(DefaultBaseURI, tenantID) -} - -// NewDeletedApplicationsClientWithBaseURI creates an instance of the DeletedApplicationsClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewDeletedApplicationsClientWithBaseURI(baseURI string, tenantID string) DeletedApplicationsClient { - return DeletedApplicationsClient{NewWithBaseURI(baseURI, tenantID)} -} - -// HardDelete hard-delete an application. -// Parameters: -// applicationObjectID - application object ID. -func (client DeletedApplicationsClient) HardDelete(ctx context.Context, applicationObjectID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeletedApplicationsClient.HardDelete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.HardDeletePreparer(ctx, applicationObjectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.DeletedApplicationsClient", "HardDelete", nil, "Failure preparing request") - return - } - - resp, err := client.HardDeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "graphrbac.DeletedApplicationsClient", "HardDelete", resp, "Failure sending request") - return - } - - result, err = client.HardDeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.DeletedApplicationsClient", "HardDelete", resp, "Failure responding to request") - return - } - - return -} - -// HardDeletePreparer prepares the HardDelete request. -func (client DeletedApplicationsClient) HardDeletePreparer(ctx context.Context, applicationObjectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationObjectId": autorest.Encode("path", applicationObjectID), - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/deletedApplications/{applicationObjectId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// HardDeleteSender sends the HardDelete request. The method will close the -// http.Response Body if it receives an error. -func (client DeletedApplicationsClient) HardDeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// HardDeleteResponder handles the response to the HardDelete request. The method always -// closes the http.Response Body. -func (client DeletedApplicationsClient) HardDeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// List gets a list of deleted applications in the directory. -// Parameters: -// filter - the filter to apply to the operation. -func (client DeletedApplicationsClient) List(ctx context.Context, filter string) (result ApplicationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeletedApplicationsClient.List") - defer func() { - sc := -1 - if result.alr.Response.Response != nil { - sc = result.alr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = func(ctx context.Context, lastResult ApplicationListResult) (ApplicationListResult, error) { - if lastResult.OdataNextLink == nil || len(to.String(lastResult.OdataNextLink)) < 1 { - return ApplicationListResult{}, nil - } - return client.ListNext(ctx, *lastResult.OdataNextLink) - } - req, err := client.ListPreparer(ctx, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.DeletedApplicationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.alr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.DeletedApplicationsClient", "List", resp, "Failure sending request") - return - } - - result.alr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.DeletedApplicationsClient", "List", resp, "Failure responding to request") - return - } - if result.alr.hasNextLink() && result.alr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DeletedApplicationsClient) ListPreparer(ctx context.Context, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/deletedApplications", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client DeletedApplicationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client DeletedApplicationsClient) ListResponder(resp *http.Response) (result ApplicationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client DeletedApplicationsClient) ListComplete(ctx context.Context, filter string) (result ApplicationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeletedApplicationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, filter) - return -} - -// ListNext gets a list of deleted applications in the directory. -// Parameters: -// nextLink - next link for the list operation. -func (client DeletedApplicationsClient) ListNext(ctx context.Context, nextLink string) (result ApplicationListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeletedApplicationsClient.ListNext") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListNextPreparer(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.DeletedApplicationsClient", "ListNext", nil, "Failure preparing request") - return - } - - resp, err := client.ListNextSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.DeletedApplicationsClient", "ListNext", resp, "Failure sending request") - return - } - - result, err = client.ListNextResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.DeletedApplicationsClient", "ListNext", resp, "Failure responding to request") - return - } - - return -} - -// ListNextPreparer prepares the ListNext request. -func (client DeletedApplicationsClient) ListNextPreparer(ctx context.Context, nextLink string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "nextLink": nextLink, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/{nextLink}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListNextSender sends the ListNext request. The method will close the -// http.Response Body if it receives an error. -func (client DeletedApplicationsClient) ListNextSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListNextResponder handles the response to the ListNext request. The method always -// closes the http.Response Body. -func (client DeletedApplicationsClient) ListNextResponder(resp *http.Response) (result ApplicationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Restore restores the deleted application in the directory. -// Parameters: -// objectID - application object ID. -func (client DeletedApplicationsClient) Restore(ctx context.Context, objectID string) (result Application, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeletedApplicationsClient.Restore") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RestorePreparer(ctx, objectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.DeletedApplicationsClient", "Restore", nil, "Failure preparing request") - return - } - - resp, err := client.RestoreSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.DeletedApplicationsClient", "Restore", resp, "Failure sending request") - return - } - - result, err = client.RestoreResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.DeletedApplicationsClient", "Restore", resp, "Failure responding to request") - return - } - - return -} - -// RestorePreparer prepares the Restore request. -func (client DeletedApplicationsClient) RestorePreparer(ctx context.Context, objectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "objectId": autorest.Encode("path", objectID), - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/deletedApplications/{objectId}/restore", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RestoreSender sends the Restore request. The method will close the -// http.Response Body if it receives an error. -func (client DeletedApplicationsClient) RestoreSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// RestoreResponder handles the response to the Restore request. The method always -// closes the http.Response Body. -func (client DeletedApplicationsClient) RestoreResponder(resp *http.Response) (result Application, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/domains.go b/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/domains.go deleted file mode 100644 index 4c1291988..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/domains.go +++ /dev/null @@ -1,181 +0,0 @@ -package graphrbac - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// DomainsClient is the the Graph RBAC Management Client -type DomainsClient struct { - BaseClient -} - -// NewDomainsClient creates an instance of the DomainsClient client. -func NewDomainsClient(tenantID string) DomainsClient { - return NewDomainsClientWithBaseURI(DefaultBaseURI, tenantID) -} - -// NewDomainsClientWithBaseURI creates an instance of the DomainsClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewDomainsClientWithBaseURI(baseURI string, tenantID string) DomainsClient { - return DomainsClient{NewWithBaseURI(baseURI, tenantID)} -} - -// Get gets a specific domain in the current tenant. -// Parameters: -// domainName - name of the domain. -func (client DomainsClient) Get(ctx context.Context, domainName string) (result Domain, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, domainName) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.DomainsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.DomainsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.DomainsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DomainsClient) GetPreparer(ctx context.Context, domainName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainName": autorest.Encode("path", domainName), - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/domains/{domainName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DomainsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DomainsClient) GetResponder(resp *http.Response) (result Domain, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of domains for the current tenant. -// Parameters: -// filter - the filter to apply to the operation. -func (client DomainsClient) List(ctx context.Context, filter string) (result DomainListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.DomainsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.DomainsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.DomainsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DomainsClient) ListPreparer(ctx context.Context, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/domains", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client DomainsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client DomainsClient) ListResponder(resp *http.Response) (result DomainListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/enums.go deleted file mode 100644 index bc867cafb..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/enums.go +++ /dev/null @@ -1,75 +0,0 @@ -package graphrbac - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ConsentType enumerates the values for consent type. -type ConsentType string - -const ( - // AllPrincipals ... - AllPrincipals ConsentType = "AllPrincipals" - // Principal ... - Principal ConsentType = "Principal" -) - -// PossibleConsentTypeValues returns an array of possible values for the ConsentType const type. -func PossibleConsentTypeValues() []ConsentType { - return []ConsentType{AllPrincipals, Principal} -} - -// GroupMembershipClaimTypes enumerates the values for group membership claim types. -type GroupMembershipClaimTypes string - -const ( - // All ... - All GroupMembershipClaimTypes = "All" - // None ... - None GroupMembershipClaimTypes = "None" - // SecurityGroup ... - SecurityGroup GroupMembershipClaimTypes = "SecurityGroup" -) - -// PossibleGroupMembershipClaimTypesValues returns an array of possible values for the GroupMembershipClaimTypes const type. -func PossibleGroupMembershipClaimTypesValues() []GroupMembershipClaimTypes { - return []GroupMembershipClaimTypes{All, None, SecurityGroup} -} - -// ObjectType enumerates the values for object type. -type ObjectType string - -const ( - // ObjectTypeApplication ... - ObjectTypeApplication ObjectType = "Application" - // ObjectTypeDirectoryObject ... - ObjectTypeDirectoryObject ObjectType = "DirectoryObject" - // ObjectTypeGroup ... - ObjectTypeGroup ObjectType = "Group" - // ObjectTypeServicePrincipal ... - ObjectTypeServicePrincipal ObjectType = "ServicePrincipal" - // ObjectTypeUser ... - ObjectTypeUser ObjectType = "User" -) - -// PossibleObjectTypeValues returns an array of possible values for the ObjectType const type. -func PossibleObjectTypeValues() []ObjectType { - return []ObjectType{ObjectTypeApplication, ObjectTypeDirectoryObject, ObjectTypeGroup, ObjectTypeServicePrincipal, ObjectTypeUser} -} - -// UserType enumerates the values for user type. -type UserType string - -const ( - // Guest ... - Guest UserType = "Guest" - // Member ... - Member UserType = "Member" -) - -// PossibleUserTypeValues returns an array of possible values for the UserType const type. -func PossibleUserTypeValues() []UserType { - return []UserType{Guest, Member} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/groups.go b/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/groups.go deleted file mode 100644 index 7d8e52982..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/groups.go +++ /dev/null @@ -1,1212 +0,0 @@ -package graphrbac - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// GroupsClient is the the Graph RBAC Management Client -type GroupsClient struct { - BaseClient -} - -// NewGroupsClient creates an instance of the GroupsClient client. -func NewGroupsClient(tenantID string) GroupsClient { - return NewGroupsClientWithBaseURI(DefaultBaseURI, tenantID) -} - -// NewGroupsClientWithBaseURI creates an instance of the GroupsClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewGroupsClientWithBaseURI(baseURI string, tenantID string) GroupsClient { - return GroupsClient{NewWithBaseURI(baseURI, tenantID)} -} - -// AddMember add a member to a group. -// Parameters: -// groupObjectID - the object ID of the group to which to add the member. -// parameters - the URL of the member object, such as -// https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. -func (client GroupsClient) AddMember(ctx context.Context, groupObjectID string, parameters GroupAddMemberParameters) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.AddMember") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.URL", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("graphrbac.GroupsClient", "AddMember", err.Error()) - } - - req, err := client.AddMemberPreparer(ctx, groupObjectID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "AddMember", nil, "Failure preparing request") - return - } - - resp, err := client.AddMemberSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "AddMember", resp, "Failure sending request") - return - } - - result, err = client.AddMemberResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "AddMember", resp, "Failure responding to request") - return - } - - return -} - -// AddMemberPreparer prepares the AddMember request. -func (client GroupsClient) AddMemberPreparer(ctx context.Context, groupObjectID string, parameters GroupAddMemberParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupObjectId": autorest.Encode("path", groupObjectID), - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/groups/{groupObjectId}/$links/members", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// AddMemberSender sends the AddMember request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) AddMemberSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// AddMemberResponder handles the response to the AddMember request. The method always -// closes the http.Response Body. -func (client GroupsClient) AddMemberResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// AddOwner add an owner to a group. -// Parameters: -// objectID - the object ID of the application to which to add the owner. -// parameters - the URL of the owner object, such as -// https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. -func (client GroupsClient) AddOwner(ctx context.Context, objectID string, parameters AddOwnerParameters) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.AddOwner") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.URL", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("graphrbac.GroupsClient", "AddOwner", err.Error()) - } - - req, err := client.AddOwnerPreparer(ctx, objectID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "AddOwner", nil, "Failure preparing request") - return - } - - resp, err := client.AddOwnerSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "AddOwner", resp, "Failure sending request") - return - } - - result, err = client.AddOwnerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "AddOwner", resp, "Failure responding to request") - return - } - - return -} - -// AddOwnerPreparer prepares the AddOwner request. -func (client GroupsClient) AddOwnerPreparer(ctx context.Context, objectID string, parameters AddOwnerParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "objectId": autorest.Encode("path", objectID), - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/groups/{objectId}/$links/owners", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// AddOwnerSender sends the AddOwner request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) AddOwnerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// AddOwnerResponder handles the response to the AddOwner request. The method always -// closes the http.Response Body. -func (client GroupsClient) AddOwnerResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Create create a group in the directory. -// Parameters: -// parameters - the parameters for the group to create. -func (client GroupsClient) Create(ctx context.Context, parameters GroupCreateParameters) (result ADGroup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.Create") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DisplayName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MailEnabled", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MailNickname", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.SecurityEnabled", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("graphrbac.GroupsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client GroupsClient) CreatePreparer(ctx context.Context, parameters GroupCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/groups", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client GroupsClient) CreateResponder(resp *http.Response) (result ADGroup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a group from the directory. -// Parameters: -// objectID - the object ID of the group to delete. -func (client GroupsClient) Delete(ctx context.Context, objectID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, objectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client GroupsClient) DeletePreparer(ctx context.Context, objectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "objectId": autorest.Encode("path", objectID), - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/groups/{objectId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client GroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets group information from the directory. -// Parameters: -// objectID - the object ID of the user for which to get group information. -func (client GroupsClient) Get(ctx context.Context, objectID string) (result ADGroup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, objectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client GroupsClient) GetPreparer(ctx context.Context, objectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "objectId": autorest.Encode("path", objectID), - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/groups/{objectId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client GroupsClient) GetResponder(resp *http.Response) (result ADGroup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetGroupMembers gets the members of a group. -// Parameters: -// objectID - the object ID of the group whose members should be retrieved. -func (client GroupsClient) GetGroupMembers(ctx context.Context, objectID string) (result DirectoryObjectListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.GetGroupMembers") - defer func() { - sc := -1 - if result.dolr.Response.Response != nil { - sc = result.dolr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = func(ctx context.Context, lastResult DirectoryObjectListResult) (DirectoryObjectListResult, error) { - if lastResult.OdataNextLink == nil || len(to.String(lastResult.OdataNextLink)) < 1 { - return DirectoryObjectListResult{}, nil - } - return client.GetGroupMembersNext(ctx, *lastResult.OdataNextLink) - } - req, err := client.GetGroupMembersPreparer(ctx, objectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetGroupMembers", nil, "Failure preparing request") - return - } - - resp, err := client.GetGroupMembersSender(req) - if err != nil { - result.dolr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetGroupMembers", resp, "Failure sending request") - return - } - - result.dolr, err = client.GetGroupMembersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetGroupMembers", resp, "Failure responding to request") - return - } - if result.dolr.hasNextLink() && result.dolr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// GetGroupMembersPreparer prepares the GetGroupMembers request. -func (client GroupsClient) GetGroupMembersPreparer(ctx context.Context, objectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "objectId": autorest.Encode("path", objectID), - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/groups/{objectId}/members", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetGroupMembersSender sends the GetGroupMembers request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) GetGroupMembersSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetGroupMembersResponder handles the response to the GetGroupMembers request. The method always -// closes the http.Response Body. -func (client GroupsClient) GetGroupMembersResponder(resp *http.Response) (result DirectoryObjectListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetGroupMembersComplete enumerates all values, automatically crossing page boundaries as required. -func (client GroupsClient) GetGroupMembersComplete(ctx context.Context, objectID string) (result DirectoryObjectListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.GetGroupMembers") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.GetGroupMembers(ctx, objectID) - return -} - -// GetGroupMembersNext gets the members of a group. -// Parameters: -// nextLink - next link for the list operation. -func (client GroupsClient) GetGroupMembersNext(ctx context.Context, nextLink string) (result DirectoryObjectListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.GetGroupMembersNext") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetGroupMembersNextPreparer(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetGroupMembersNext", nil, "Failure preparing request") - return - } - - resp, err := client.GetGroupMembersNextSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetGroupMembersNext", resp, "Failure sending request") - return - } - - result, err = client.GetGroupMembersNextResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetGroupMembersNext", resp, "Failure responding to request") - return - } - - return -} - -// GetGroupMembersNextPreparer prepares the GetGroupMembersNext request. -func (client GroupsClient) GetGroupMembersNextPreparer(ctx context.Context, nextLink string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "nextLink": nextLink, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/{nextLink}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetGroupMembersNextSender sends the GetGroupMembersNext request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) GetGroupMembersNextSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetGroupMembersNextResponder handles the response to the GetGroupMembersNext request. The method always -// closes the http.Response Body. -func (client GroupsClient) GetGroupMembersNextResponder(resp *http.Response) (result DirectoryObjectListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMemberGroups gets a collection of object IDs of groups of which the specified group is a member. -// Parameters: -// objectID - the object ID of the group for which to get group membership. -// parameters - group filtering parameters. -func (client GroupsClient) GetMemberGroups(ctx context.Context, objectID string, parameters GroupGetMemberGroupsParameters) (result GroupGetMemberGroupsResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.GetMemberGroups") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SecurityEnabledOnly", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("graphrbac.GroupsClient", "GetMemberGroups", err.Error()) - } - - req, err := client.GetMemberGroupsPreparer(ctx, objectID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetMemberGroups", nil, "Failure preparing request") - return - } - - resp, err := client.GetMemberGroupsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetMemberGroups", resp, "Failure sending request") - return - } - - result, err = client.GetMemberGroupsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetMemberGroups", resp, "Failure responding to request") - return - } - - return -} - -// GetMemberGroupsPreparer prepares the GetMemberGroups request. -func (client GroupsClient) GetMemberGroupsPreparer(ctx context.Context, objectID string, parameters GroupGetMemberGroupsParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "objectId": autorest.Encode("path", objectID), - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/groups/{objectId}/getMemberGroups", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetMemberGroupsSender sends the GetMemberGroups request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) GetMemberGroupsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetMemberGroupsResponder handles the response to the GetMemberGroups request. The method always -// closes the http.Response Body. -func (client GroupsClient) GetMemberGroupsResponder(resp *http.Response) (result GroupGetMemberGroupsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// IsMemberOf checks whether the specified user, group, contact, or service principal is a direct or transitive member -// of the specified group. -// Parameters: -// parameters - the check group membership parameters. -func (client GroupsClient) IsMemberOf(ctx context.Context, parameters CheckGroupMembershipParameters) (result CheckGroupMembershipResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.IsMemberOf") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.GroupID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MemberID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("graphrbac.GroupsClient", "IsMemberOf", err.Error()) - } - - req, err := client.IsMemberOfPreparer(ctx, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "IsMemberOf", nil, "Failure preparing request") - return - } - - resp, err := client.IsMemberOfSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "IsMemberOf", resp, "Failure sending request") - return - } - - result, err = client.IsMemberOfResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "IsMemberOf", resp, "Failure responding to request") - return - } - - return -} - -// IsMemberOfPreparer prepares the IsMemberOf request. -func (client GroupsClient) IsMemberOfPreparer(ctx context.Context, parameters CheckGroupMembershipParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/isMemberOf", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// IsMemberOfSender sends the IsMemberOf request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) IsMemberOfSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// IsMemberOfResponder handles the response to the IsMemberOf request. The method always -// closes the http.Response Body. -func (client GroupsClient) IsMemberOfResponder(resp *http.Response) (result CheckGroupMembershipResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets list of groups for the current tenant. -// Parameters: -// filter - the filter to apply to the operation. -func (client GroupsClient) List(ctx context.Context, filter string) (result GroupListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.List") - defer func() { - sc := -1 - if result.glr.Response.Response != nil { - sc = result.glr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = func(ctx context.Context, lastResult GroupListResult) (GroupListResult, error) { - if lastResult.OdataNextLink == nil || len(to.String(lastResult.OdataNextLink)) < 1 { - return GroupListResult{}, nil - } - return client.ListNext(ctx, *lastResult.OdataNextLink) - } - req, err := client.ListPreparer(ctx, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.glr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "List", resp, "Failure sending request") - return - } - - result.glr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "List", resp, "Failure responding to request") - return - } - if result.glr.hasNextLink() && result.glr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client GroupsClient) ListPreparer(ctx context.Context, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/groups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client GroupsClient) ListResponder(resp *http.Response) (result GroupListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client GroupsClient) ListComplete(ctx context.Context, filter string) (result GroupListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, filter) - return -} - -// ListNext gets a list of groups for the current tenant. -// Parameters: -// nextLink - next link for the list operation. -func (client GroupsClient) ListNext(ctx context.Context, nextLink string) (result GroupListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.ListNext") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListNextPreparer(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "ListNext", nil, "Failure preparing request") - return - } - - resp, err := client.ListNextSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "ListNext", resp, "Failure sending request") - return - } - - result, err = client.ListNextResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "ListNext", resp, "Failure responding to request") - return - } - - return -} - -// ListNextPreparer prepares the ListNext request. -func (client GroupsClient) ListNextPreparer(ctx context.Context, nextLink string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "nextLink": nextLink, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/{nextLink}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListNextSender sends the ListNext request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) ListNextSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListNextResponder handles the response to the ListNext request. The method always -// closes the http.Response Body. -func (client GroupsClient) ListNextResponder(resp *http.Response) (result GroupListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListOwners the owners are a set of non-admin users who are allowed to modify this object. -// Parameters: -// objectID - the object ID of the group for which to get owners. -func (client GroupsClient) ListOwners(ctx context.Context, objectID string) (result DirectoryObjectListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.ListOwners") - defer func() { - sc := -1 - if result.dolr.Response.Response != nil { - sc = result.dolr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listOwnersNextResults - req, err := client.ListOwnersPreparer(ctx, objectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "ListOwners", nil, "Failure preparing request") - return - } - - resp, err := client.ListOwnersSender(req) - if err != nil { - result.dolr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "ListOwners", resp, "Failure sending request") - return - } - - result.dolr, err = client.ListOwnersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "ListOwners", resp, "Failure responding to request") - return - } - if result.dolr.hasNextLink() && result.dolr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListOwnersPreparer prepares the ListOwners request. -func (client GroupsClient) ListOwnersPreparer(ctx context.Context, objectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "objectId": autorest.Encode("path", objectID), - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/groups/{objectId}/owners", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListOwnersSender sends the ListOwners request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) ListOwnersSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListOwnersResponder handles the response to the ListOwners request. The method always -// closes the http.Response Body. -func (client GroupsClient) ListOwnersResponder(resp *http.Response) (result DirectoryObjectListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listOwnersNextResults retrieves the next set of results, if any. -func (client GroupsClient) listOwnersNextResults(ctx context.Context, lastResults DirectoryObjectListResult) (result DirectoryObjectListResult, err error) { - req, err := lastResults.directoryObjectListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "listOwnersNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListOwnersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "listOwnersNextResults", resp, "Failure sending next results request") - } - result, err = client.ListOwnersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "listOwnersNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListOwnersComplete enumerates all values, automatically crossing page boundaries as required. -func (client GroupsClient) ListOwnersComplete(ctx context.Context, objectID string) (result DirectoryObjectListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.ListOwners") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListOwners(ctx, objectID) - return -} - -// RemoveMember remove a member from a group. -// Parameters: -// groupObjectID - the object ID of the group from which to remove the member. -// memberObjectID - member object id -func (client GroupsClient) RemoveMember(ctx context.Context, groupObjectID string, memberObjectID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.RemoveMember") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RemoveMemberPreparer(ctx, groupObjectID, memberObjectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "RemoveMember", nil, "Failure preparing request") - return - } - - resp, err := client.RemoveMemberSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "RemoveMember", resp, "Failure sending request") - return - } - - result, err = client.RemoveMemberResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "RemoveMember", resp, "Failure responding to request") - return - } - - return -} - -// RemoveMemberPreparer prepares the RemoveMember request. -func (client GroupsClient) RemoveMemberPreparer(ctx context.Context, groupObjectID string, memberObjectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupObjectId": autorest.Encode("path", groupObjectID), - "memberObjectId": autorest.Encode("path", memberObjectID), - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/groups/{groupObjectId}/$links/members/{memberObjectId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RemoveMemberSender sends the RemoveMember request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) RemoveMemberSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// RemoveMemberResponder handles the response to the RemoveMember request. The method always -// closes the http.Response Body. -func (client GroupsClient) RemoveMemberResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// RemoveOwner remove a member from owners. -// Parameters: -// objectID - the object ID of the group from which to remove the owner. -// ownerObjectID - owner object id -func (client GroupsClient) RemoveOwner(ctx context.Context, objectID string, ownerObjectID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.RemoveOwner") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RemoveOwnerPreparer(ctx, objectID, ownerObjectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "RemoveOwner", nil, "Failure preparing request") - return - } - - resp, err := client.RemoveOwnerSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "RemoveOwner", resp, "Failure sending request") - return - } - - result, err = client.RemoveOwnerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "RemoveOwner", resp, "Failure responding to request") - return - } - - return -} - -// RemoveOwnerPreparer prepares the RemoveOwner request. -func (client GroupsClient) RemoveOwnerPreparer(ctx context.Context, objectID string, ownerObjectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "objectId": autorest.Encode("path", objectID), - "ownerObjectId": autorest.Encode("path", ownerObjectID), - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/groups/{objectId}/$links/owners/{ownerObjectId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RemoveOwnerSender sends the RemoveOwner request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) RemoveOwnerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// RemoveOwnerResponder handles the response to the RemoveOwner request. The method always -// closes the http.Response Body. -func (client GroupsClient) RemoveOwnerResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/models.go deleted file mode 100644 index 2bbac36f1..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/models.go +++ /dev/null @@ -1,4678 +0,0 @@ -package graphrbac - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac" - -// AddOwnerParameters request parameters for adding a owner to an application. -type AddOwnerParameters struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // URL - A owner object URL, such as "https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd", where "0b1f9851-1bf0-433f-aec3-cb9272f093dc" is the tenantId and "f260bbc4-c254-447b-94cf-293b5ec434dd" is the objectId of the owner (user, application, servicePrincipal, group) to be added. - URL *string `json:"url,omitempty"` -} - -// MarshalJSON is the custom marshaler for AddOwnerParameters. -func (aop AddOwnerParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aop.URL != nil { - objectMap["url"] = aop.URL - } - for k, v := range aop.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AddOwnerParameters struct. -func (aop *AddOwnerParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if aop.AdditionalProperties == nil { - aop.AdditionalProperties = make(map[string]interface{}) - } - aop.AdditionalProperties[k] = additionalProperties - } - case "url": - if v != nil { - var URL string - err = json.Unmarshal(*v, &URL) - if err != nil { - return err - } - aop.URL = &URL - } - } - } - - return nil -} - -// ADGroup active Directory group information. -type ADGroup struct { - autorest.Response `json:"-"` - // DisplayName - The display name of the group. - DisplayName *string `json:"displayName,omitempty"` - // MailEnabled - Whether the group is mail-enabled. Must be false. This is because only pure security groups can be created using the Graph API. - MailEnabled *bool `json:"mailEnabled,omitempty"` - // MailNickname - The mail alias for the group. - MailNickname *string `json:"mailNickname,omitempty"` - // SecurityEnabled - Whether the group is security-enable. - SecurityEnabled *bool `json:"securityEnabled,omitempty"` - // Mail - The primary email address of the group. - Mail *string `json:"mail,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // ObjectID - READ-ONLY; The object ID. - ObjectID *string `json:"objectId,omitempty"` - // DeletionTimestamp - READ-ONLY; The time at which the directory object was deleted. - DeletionTimestamp *date.Time `json:"deletionTimestamp,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeDirectoryObject', 'ObjectTypeApplication', 'ObjectTypeGroup', 'ObjectTypeServicePrincipal', 'ObjectTypeUser' - ObjectType ObjectType `json:"objectType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ADGroup. -func (ag ADGroup) MarshalJSON() ([]byte, error) { - ag.ObjectType = ObjectTypeGroup - objectMap := make(map[string]interface{}) - if ag.DisplayName != nil { - objectMap["displayName"] = ag.DisplayName - } - if ag.MailEnabled != nil { - objectMap["mailEnabled"] = ag.MailEnabled - } - if ag.MailNickname != nil { - objectMap["mailNickname"] = ag.MailNickname - } - if ag.SecurityEnabled != nil { - objectMap["securityEnabled"] = ag.SecurityEnabled - } - if ag.Mail != nil { - objectMap["mail"] = ag.Mail - } - if ag.ObjectType != "" { - objectMap["objectType"] = ag.ObjectType - } - for k, v := range ag.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsApplication is the BasicDirectoryObject implementation for ADGroup. -func (ag ADGroup) AsApplication() (*Application, bool) { - return nil, false -} - -// AsADGroup is the BasicDirectoryObject implementation for ADGroup. -func (ag ADGroup) AsADGroup() (*ADGroup, bool) { - return &ag, true -} - -// AsServicePrincipal is the BasicDirectoryObject implementation for ADGroup. -func (ag ADGroup) AsServicePrincipal() (*ServicePrincipal, bool) { - return nil, false -} - -// AsUser is the BasicDirectoryObject implementation for ADGroup. -func (ag ADGroup) AsUser() (*User, bool) { - return nil, false -} - -// AsDirectoryObject is the BasicDirectoryObject implementation for ADGroup. -func (ag ADGroup) AsDirectoryObject() (*DirectoryObject, bool) { - return nil, false -} - -// AsBasicDirectoryObject is the BasicDirectoryObject implementation for ADGroup. -func (ag ADGroup) AsBasicDirectoryObject() (BasicDirectoryObject, bool) { - return &ag, true -} - -// UnmarshalJSON is the custom unmarshaler for ADGroup struct. -func (ag *ADGroup) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "displayName": - if v != nil { - var displayName string - err = json.Unmarshal(*v, &displayName) - if err != nil { - return err - } - ag.DisplayName = &displayName - } - case "mailEnabled": - if v != nil { - var mailEnabled bool - err = json.Unmarshal(*v, &mailEnabled) - if err != nil { - return err - } - ag.MailEnabled = &mailEnabled - } - case "mailNickname": - if v != nil { - var mailNickname string - err = json.Unmarshal(*v, &mailNickname) - if err != nil { - return err - } - ag.MailNickname = &mailNickname - } - case "securityEnabled": - if v != nil { - var securityEnabled bool - err = json.Unmarshal(*v, &securityEnabled) - if err != nil { - return err - } - ag.SecurityEnabled = &securityEnabled - } - case "mail": - if v != nil { - var mailVar string - err = json.Unmarshal(*v, &mailVar) - if err != nil { - return err - } - ag.Mail = &mailVar - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if ag.AdditionalProperties == nil { - ag.AdditionalProperties = make(map[string]interface{}) - } - ag.AdditionalProperties[k] = additionalProperties - } - case "objectId": - if v != nil { - var objectID string - err = json.Unmarshal(*v, &objectID) - if err != nil { - return err - } - ag.ObjectID = &objectID - } - case "deletionTimestamp": - if v != nil { - var deletionTimestamp date.Time - err = json.Unmarshal(*v, &deletionTimestamp) - if err != nil { - return err - } - ag.DeletionTimestamp = &deletionTimestamp - } - case "objectType": - if v != nil { - var objectType ObjectType - err = json.Unmarshal(*v, &objectType) - if err != nil { - return err - } - ag.ObjectType = objectType - } - } - } - - return nil -} - -// Application active Directory application information. -type Application struct { - autorest.Response `json:"-"` - // AppID - The application ID. - AppID *string `json:"appId,omitempty"` - // AllowGuestsSignIn - A property on the application to indicate if the application accepts other IDPs or not or partially accepts. - AllowGuestsSignIn *bool `json:"allowGuestsSignIn,omitempty"` - // AllowPassthroughUsers - Indicates that the application supports pass through users who have no presence in the resource tenant. - AllowPassthroughUsers *bool `json:"allowPassthroughUsers,omitempty"` - // AppLogoURL - The url for the application logo image stored in a CDN. - AppLogoURL *string `json:"appLogoUrl,omitempty"` - // AppRoles - The collection of application roles that an application may declare. These roles can be assigned to users, groups or service principals. - AppRoles *[]AppRole `json:"appRoles,omitempty"` - // AppPermissions - The application permissions. - AppPermissions *[]string `json:"appPermissions,omitempty"` - // AvailableToOtherTenants - Whether the application is available to other tenants. - AvailableToOtherTenants *bool `json:"availableToOtherTenants,omitempty"` - // DisplayName - The display name of the application. - DisplayName *string `json:"displayName,omitempty"` - // ErrorURL - A URL provided by the author of the application to report errors when using the application. - ErrorURL *string `json:"errorUrl,omitempty"` - // GroupMembershipClaims - Configures the groups claim issued in a user or OAuth 2.0 access token that the app expects. Possible values include: 'None', 'SecurityGroup', 'All' - GroupMembershipClaims GroupMembershipClaimTypes `json:"groupMembershipClaims,omitempty"` - // Homepage - The home page of the application. - Homepage *string `json:"homepage,omitempty"` - // IdentifierUris - A collection of URIs for the application. - IdentifierUris *[]string `json:"identifierUris,omitempty"` - // InformationalUrls - URLs with more information about the application. - InformationalUrls *InformationalURL `json:"informationalUrls,omitempty"` - // IsDeviceOnlyAuthSupported - Specifies whether this application supports device authentication without a user. The default is false. - IsDeviceOnlyAuthSupported *bool `json:"isDeviceOnlyAuthSupported,omitempty"` - // KeyCredentials - A collection of KeyCredential objects. - KeyCredentials *[]KeyCredential `json:"keyCredentials,omitempty"` - // KnownClientApplications - Client applications that are tied to this resource application. Consent to any of the known client applications will result in implicit consent to the resource application through a combined consent dialog (showing the OAuth permission scopes required by the client and the resource). - KnownClientApplications *[]string `json:"knownClientApplications,omitempty"` - // LogoutURL - the url of the logout page - LogoutURL *string `json:"logoutUrl,omitempty"` - // Oauth2AllowImplicitFlow - Whether to allow implicit grant flow for OAuth2 - Oauth2AllowImplicitFlow *bool `json:"oauth2AllowImplicitFlow,omitempty"` - // Oauth2AllowURLPathMatching - Specifies whether during a token Request Azure AD will allow path matching of the redirect URI against the applications collection of replyURLs. The default is false. - Oauth2AllowURLPathMatching *bool `json:"oauth2AllowUrlPathMatching,omitempty"` - // Oauth2Permissions - The collection of OAuth 2.0 permission scopes that the web API (resource) application exposes to client applications. These permission scopes may be granted to client applications during consent. - Oauth2Permissions *[]OAuth2Permission `json:"oauth2Permissions,omitempty"` - // Oauth2RequirePostResponse - Specifies whether, as part of OAuth 2.0 token requests, Azure AD will allow POST requests, as opposed to GET requests. The default is false, which specifies that only GET requests will be allowed. - Oauth2RequirePostResponse *bool `json:"oauth2RequirePostResponse,omitempty"` - // OrgRestrictions - A list of tenants allowed to access application. - OrgRestrictions *[]string `json:"orgRestrictions,omitempty"` - OptionalClaims *OptionalClaims `json:"optionalClaims,omitempty"` - // PasswordCredentials - A collection of PasswordCredential objects - PasswordCredentials *[]PasswordCredential `json:"passwordCredentials,omitempty"` - // PreAuthorizedApplications - list of pre-authorized applications. - PreAuthorizedApplications *[]PreAuthorizedApplication `json:"preAuthorizedApplications,omitempty"` - // PublicClient - Specifies whether this application is a public client (such as an installed application running on a mobile device). Default is false. - PublicClient *bool `json:"publicClient,omitempty"` - // PublisherDomain - Reliable domain which can be used to identify an application. - PublisherDomain *string `json:"publisherDomain,omitempty"` - // ReplyUrls - A collection of reply URLs for the application. - ReplyUrls *[]string `json:"replyUrls,omitempty"` - // RequiredResourceAccess - Specifies resources that this application requires access to and the set of OAuth permission scopes and application roles that it needs under each of those resources. This pre-configuration of required resource access drives the consent experience. - RequiredResourceAccess *[]RequiredResourceAccess `json:"requiredResourceAccess,omitempty"` - // SamlMetadataURL - The URL to the SAML metadata for the application. - SamlMetadataURL *string `json:"samlMetadataUrl,omitempty"` - // SignInAudience - Audience for signing in to the application (AzureADMyOrganization, AzureADAllOrganizations, AzureADAndMicrosoftAccounts). - SignInAudience *string `json:"signInAudience,omitempty"` - // WwwHomepage - The primary Web page. - WwwHomepage *string `json:"wwwHomepage,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // ObjectID - READ-ONLY; The object ID. - ObjectID *string `json:"objectId,omitempty"` - // DeletionTimestamp - READ-ONLY; The time at which the directory object was deleted. - DeletionTimestamp *date.Time `json:"deletionTimestamp,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeDirectoryObject', 'ObjectTypeApplication', 'ObjectTypeGroup', 'ObjectTypeServicePrincipal', 'ObjectTypeUser' - ObjectType ObjectType `json:"objectType,omitempty"` -} - -// MarshalJSON is the custom marshaler for Application. -func (a Application) MarshalJSON() ([]byte, error) { - a.ObjectType = ObjectTypeApplication - objectMap := make(map[string]interface{}) - if a.AppID != nil { - objectMap["appId"] = a.AppID - } - if a.AllowGuestsSignIn != nil { - objectMap["allowGuestsSignIn"] = a.AllowGuestsSignIn - } - if a.AllowPassthroughUsers != nil { - objectMap["allowPassthroughUsers"] = a.AllowPassthroughUsers - } - if a.AppLogoURL != nil { - objectMap["appLogoUrl"] = a.AppLogoURL - } - if a.AppRoles != nil { - objectMap["appRoles"] = a.AppRoles - } - if a.AppPermissions != nil { - objectMap["appPermissions"] = a.AppPermissions - } - if a.AvailableToOtherTenants != nil { - objectMap["availableToOtherTenants"] = a.AvailableToOtherTenants - } - if a.DisplayName != nil { - objectMap["displayName"] = a.DisplayName - } - if a.ErrorURL != nil { - objectMap["errorUrl"] = a.ErrorURL - } - if a.GroupMembershipClaims != "" { - objectMap["groupMembershipClaims"] = a.GroupMembershipClaims - } - if a.Homepage != nil { - objectMap["homepage"] = a.Homepage - } - if a.IdentifierUris != nil { - objectMap["identifierUris"] = a.IdentifierUris - } - if a.InformationalUrls != nil { - objectMap["informationalUrls"] = a.InformationalUrls - } - if a.IsDeviceOnlyAuthSupported != nil { - objectMap["isDeviceOnlyAuthSupported"] = a.IsDeviceOnlyAuthSupported - } - if a.KeyCredentials != nil { - objectMap["keyCredentials"] = a.KeyCredentials - } - if a.KnownClientApplications != nil { - objectMap["knownClientApplications"] = a.KnownClientApplications - } - if a.LogoutURL != nil { - objectMap["logoutUrl"] = a.LogoutURL - } - if a.Oauth2AllowImplicitFlow != nil { - objectMap["oauth2AllowImplicitFlow"] = a.Oauth2AllowImplicitFlow - } - if a.Oauth2AllowURLPathMatching != nil { - objectMap["oauth2AllowUrlPathMatching"] = a.Oauth2AllowURLPathMatching - } - if a.Oauth2Permissions != nil { - objectMap["oauth2Permissions"] = a.Oauth2Permissions - } - if a.Oauth2RequirePostResponse != nil { - objectMap["oauth2RequirePostResponse"] = a.Oauth2RequirePostResponse - } - if a.OrgRestrictions != nil { - objectMap["orgRestrictions"] = a.OrgRestrictions - } - if a.OptionalClaims != nil { - objectMap["optionalClaims"] = a.OptionalClaims - } - if a.PasswordCredentials != nil { - objectMap["passwordCredentials"] = a.PasswordCredentials - } - if a.PreAuthorizedApplications != nil { - objectMap["preAuthorizedApplications"] = a.PreAuthorizedApplications - } - if a.PublicClient != nil { - objectMap["publicClient"] = a.PublicClient - } - if a.PublisherDomain != nil { - objectMap["publisherDomain"] = a.PublisherDomain - } - if a.ReplyUrls != nil { - objectMap["replyUrls"] = a.ReplyUrls - } - if a.RequiredResourceAccess != nil { - objectMap["requiredResourceAccess"] = a.RequiredResourceAccess - } - if a.SamlMetadataURL != nil { - objectMap["samlMetadataUrl"] = a.SamlMetadataURL - } - if a.SignInAudience != nil { - objectMap["signInAudience"] = a.SignInAudience - } - if a.WwwHomepage != nil { - objectMap["wwwHomepage"] = a.WwwHomepage - } - if a.ObjectType != "" { - objectMap["objectType"] = a.ObjectType - } - for k, v := range a.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsApplication is the BasicDirectoryObject implementation for Application. -func (a Application) AsApplication() (*Application, bool) { - return &a, true -} - -// AsADGroup is the BasicDirectoryObject implementation for Application. -func (a Application) AsADGroup() (*ADGroup, bool) { - return nil, false -} - -// AsServicePrincipal is the BasicDirectoryObject implementation for Application. -func (a Application) AsServicePrincipal() (*ServicePrincipal, bool) { - return nil, false -} - -// AsUser is the BasicDirectoryObject implementation for Application. -func (a Application) AsUser() (*User, bool) { - return nil, false -} - -// AsDirectoryObject is the BasicDirectoryObject implementation for Application. -func (a Application) AsDirectoryObject() (*DirectoryObject, bool) { - return nil, false -} - -// AsBasicDirectoryObject is the BasicDirectoryObject implementation for Application. -func (a Application) AsBasicDirectoryObject() (BasicDirectoryObject, bool) { - return &a, true -} - -// UnmarshalJSON is the custom unmarshaler for Application struct. -func (a *Application) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "appId": - if v != nil { - var appID string - err = json.Unmarshal(*v, &appID) - if err != nil { - return err - } - a.AppID = &appID - } - case "allowGuestsSignIn": - if v != nil { - var allowGuestsSignIn bool - err = json.Unmarshal(*v, &allowGuestsSignIn) - if err != nil { - return err - } - a.AllowGuestsSignIn = &allowGuestsSignIn - } - case "allowPassthroughUsers": - if v != nil { - var allowPassthroughUsers bool - err = json.Unmarshal(*v, &allowPassthroughUsers) - if err != nil { - return err - } - a.AllowPassthroughUsers = &allowPassthroughUsers - } - case "appLogoUrl": - if v != nil { - var appLogoURL string - err = json.Unmarshal(*v, &appLogoURL) - if err != nil { - return err - } - a.AppLogoURL = &appLogoURL - } - case "appRoles": - if v != nil { - var appRoles []AppRole - err = json.Unmarshal(*v, &appRoles) - if err != nil { - return err - } - a.AppRoles = &appRoles - } - case "appPermissions": - if v != nil { - var appPermissions []string - err = json.Unmarshal(*v, &appPermissions) - if err != nil { - return err - } - a.AppPermissions = &appPermissions - } - case "availableToOtherTenants": - if v != nil { - var availableToOtherTenants bool - err = json.Unmarshal(*v, &availableToOtherTenants) - if err != nil { - return err - } - a.AvailableToOtherTenants = &availableToOtherTenants - } - case "displayName": - if v != nil { - var displayName string - err = json.Unmarshal(*v, &displayName) - if err != nil { - return err - } - a.DisplayName = &displayName - } - case "errorUrl": - if v != nil { - var errorURL string - err = json.Unmarshal(*v, &errorURL) - if err != nil { - return err - } - a.ErrorURL = &errorURL - } - case "groupMembershipClaims": - if v != nil { - var groupMembershipClaims GroupMembershipClaimTypes - err = json.Unmarshal(*v, &groupMembershipClaims) - if err != nil { - return err - } - a.GroupMembershipClaims = groupMembershipClaims - } - case "homepage": - if v != nil { - var homepage string - err = json.Unmarshal(*v, &homepage) - if err != nil { - return err - } - a.Homepage = &homepage - } - case "identifierUris": - if v != nil { - var identifierUris []string - err = json.Unmarshal(*v, &identifierUris) - if err != nil { - return err - } - a.IdentifierUris = &identifierUris - } - case "informationalUrls": - if v != nil { - var informationalUrls InformationalURL - err = json.Unmarshal(*v, &informationalUrls) - if err != nil { - return err - } - a.InformationalUrls = &informationalUrls - } - case "isDeviceOnlyAuthSupported": - if v != nil { - var isDeviceOnlyAuthSupported bool - err = json.Unmarshal(*v, &isDeviceOnlyAuthSupported) - if err != nil { - return err - } - a.IsDeviceOnlyAuthSupported = &isDeviceOnlyAuthSupported - } - case "keyCredentials": - if v != nil { - var keyCredentials []KeyCredential - err = json.Unmarshal(*v, &keyCredentials) - if err != nil { - return err - } - a.KeyCredentials = &keyCredentials - } - case "knownClientApplications": - if v != nil { - var knownClientApplications []string - err = json.Unmarshal(*v, &knownClientApplications) - if err != nil { - return err - } - a.KnownClientApplications = &knownClientApplications - } - case "logoutUrl": - if v != nil { - var logoutURL string - err = json.Unmarshal(*v, &logoutURL) - if err != nil { - return err - } - a.LogoutURL = &logoutURL - } - case "oauth2AllowImplicitFlow": - if v != nil { - var oauth2AllowImplicitFlow bool - err = json.Unmarshal(*v, &oauth2AllowImplicitFlow) - if err != nil { - return err - } - a.Oauth2AllowImplicitFlow = &oauth2AllowImplicitFlow - } - case "oauth2AllowUrlPathMatching": - if v != nil { - var oauth2AllowURLPathMatching bool - err = json.Unmarshal(*v, &oauth2AllowURLPathMatching) - if err != nil { - return err - } - a.Oauth2AllowURLPathMatching = &oauth2AllowURLPathMatching - } - case "oauth2Permissions": - if v != nil { - var oauth2Permissions []OAuth2Permission - err = json.Unmarshal(*v, &oauth2Permissions) - if err != nil { - return err - } - a.Oauth2Permissions = &oauth2Permissions - } - case "oauth2RequirePostResponse": - if v != nil { - var oauth2RequirePostResponse bool - err = json.Unmarshal(*v, &oauth2RequirePostResponse) - if err != nil { - return err - } - a.Oauth2RequirePostResponse = &oauth2RequirePostResponse - } - case "orgRestrictions": - if v != nil { - var orgRestrictions []string - err = json.Unmarshal(*v, &orgRestrictions) - if err != nil { - return err - } - a.OrgRestrictions = &orgRestrictions - } - case "optionalClaims": - if v != nil { - var optionalClaims OptionalClaims - err = json.Unmarshal(*v, &optionalClaims) - if err != nil { - return err - } - a.OptionalClaims = &optionalClaims - } - case "passwordCredentials": - if v != nil { - var passwordCredentials []PasswordCredential - err = json.Unmarshal(*v, &passwordCredentials) - if err != nil { - return err - } - a.PasswordCredentials = &passwordCredentials - } - case "preAuthorizedApplications": - if v != nil { - var preAuthorizedApplications []PreAuthorizedApplication - err = json.Unmarshal(*v, &preAuthorizedApplications) - if err != nil { - return err - } - a.PreAuthorizedApplications = &preAuthorizedApplications - } - case "publicClient": - if v != nil { - var publicClient bool - err = json.Unmarshal(*v, &publicClient) - if err != nil { - return err - } - a.PublicClient = &publicClient - } - case "publisherDomain": - if v != nil { - var publisherDomain string - err = json.Unmarshal(*v, &publisherDomain) - if err != nil { - return err - } - a.PublisherDomain = &publisherDomain - } - case "replyUrls": - if v != nil { - var replyUrls []string - err = json.Unmarshal(*v, &replyUrls) - if err != nil { - return err - } - a.ReplyUrls = &replyUrls - } - case "requiredResourceAccess": - if v != nil { - var requiredResourceAccess []RequiredResourceAccess - err = json.Unmarshal(*v, &requiredResourceAccess) - if err != nil { - return err - } - a.RequiredResourceAccess = &requiredResourceAccess - } - case "samlMetadataUrl": - if v != nil { - var samlMetadataURL string - err = json.Unmarshal(*v, &samlMetadataURL) - if err != nil { - return err - } - a.SamlMetadataURL = &samlMetadataURL - } - case "signInAudience": - if v != nil { - var signInAudience string - err = json.Unmarshal(*v, &signInAudience) - if err != nil { - return err - } - a.SignInAudience = &signInAudience - } - case "wwwHomepage": - if v != nil { - var wwwHomepage string - err = json.Unmarshal(*v, &wwwHomepage) - if err != nil { - return err - } - a.WwwHomepage = &wwwHomepage - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if a.AdditionalProperties == nil { - a.AdditionalProperties = make(map[string]interface{}) - } - a.AdditionalProperties[k] = additionalProperties - } - case "objectId": - if v != nil { - var objectID string - err = json.Unmarshal(*v, &objectID) - if err != nil { - return err - } - a.ObjectID = &objectID - } - case "deletionTimestamp": - if v != nil { - var deletionTimestamp date.Time - err = json.Unmarshal(*v, &deletionTimestamp) - if err != nil { - return err - } - a.DeletionTimestamp = &deletionTimestamp - } - case "objectType": - if v != nil { - var objectType ObjectType - err = json.Unmarshal(*v, &objectType) - if err != nil { - return err - } - a.ObjectType = objectType - } - } - } - - return nil -} - -// ApplicationBase active Directive Application common properties shared among GET, POST and PATCH -type ApplicationBase struct { - // AllowGuestsSignIn - A property on the application to indicate if the application accepts other IDPs or not or partially accepts. - AllowGuestsSignIn *bool `json:"allowGuestsSignIn,omitempty"` - // AllowPassthroughUsers - Indicates that the application supports pass through users who have no presence in the resource tenant. - AllowPassthroughUsers *bool `json:"allowPassthroughUsers,omitempty"` - // AppLogoURL - The url for the application logo image stored in a CDN. - AppLogoURL *string `json:"appLogoUrl,omitempty"` - // AppRoles - The collection of application roles that an application may declare. These roles can be assigned to users, groups or service principals. - AppRoles *[]AppRole `json:"appRoles,omitempty"` - // AppPermissions - The application permissions. - AppPermissions *[]string `json:"appPermissions,omitempty"` - // AvailableToOtherTenants - Whether the application is available to other tenants. - AvailableToOtherTenants *bool `json:"availableToOtherTenants,omitempty"` - // ErrorURL - A URL provided by the author of the application to report errors when using the application. - ErrorURL *string `json:"errorUrl,omitempty"` - // GroupMembershipClaims - Configures the groups claim issued in a user or OAuth 2.0 access token that the app expects. Possible values include: 'None', 'SecurityGroup', 'All' - GroupMembershipClaims GroupMembershipClaimTypes `json:"groupMembershipClaims,omitempty"` - // Homepage - The home page of the application. - Homepage *string `json:"homepage,omitempty"` - // InformationalUrls - URLs with more information about the application. - InformationalUrls *InformationalURL `json:"informationalUrls,omitempty"` - // IsDeviceOnlyAuthSupported - Specifies whether this application supports device authentication without a user. The default is false. - IsDeviceOnlyAuthSupported *bool `json:"isDeviceOnlyAuthSupported,omitempty"` - // KeyCredentials - A collection of KeyCredential objects. - KeyCredentials *[]KeyCredential `json:"keyCredentials,omitempty"` - // KnownClientApplications - Client applications that are tied to this resource application. Consent to any of the known client applications will result in implicit consent to the resource application through a combined consent dialog (showing the OAuth permission scopes required by the client and the resource). - KnownClientApplications *[]string `json:"knownClientApplications,omitempty"` - // LogoutURL - the url of the logout page - LogoutURL *string `json:"logoutUrl,omitempty"` - // Oauth2AllowImplicitFlow - Whether to allow implicit grant flow for OAuth2 - Oauth2AllowImplicitFlow *bool `json:"oauth2AllowImplicitFlow,omitempty"` - // Oauth2AllowURLPathMatching - Specifies whether during a token Request Azure AD will allow path matching of the redirect URI against the applications collection of replyURLs. The default is false. - Oauth2AllowURLPathMatching *bool `json:"oauth2AllowUrlPathMatching,omitempty"` - // Oauth2Permissions - The collection of OAuth 2.0 permission scopes that the web API (resource) application exposes to client applications. These permission scopes may be granted to client applications during consent. - Oauth2Permissions *[]OAuth2Permission `json:"oauth2Permissions,omitempty"` - // Oauth2RequirePostResponse - Specifies whether, as part of OAuth 2.0 token requests, Azure AD will allow POST requests, as opposed to GET requests. The default is false, which specifies that only GET requests will be allowed. - Oauth2RequirePostResponse *bool `json:"oauth2RequirePostResponse,omitempty"` - // OrgRestrictions - A list of tenants allowed to access application. - OrgRestrictions *[]string `json:"orgRestrictions,omitempty"` - OptionalClaims *OptionalClaims `json:"optionalClaims,omitempty"` - // PasswordCredentials - A collection of PasswordCredential objects - PasswordCredentials *[]PasswordCredential `json:"passwordCredentials,omitempty"` - // PreAuthorizedApplications - list of pre-authorized applications. - PreAuthorizedApplications *[]PreAuthorizedApplication `json:"preAuthorizedApplications,omitempty"` - // PublicClient - Specifies whether this application is a public client (such as an installed application running on a mobile device). Default is false. - PublicClient *bool `json:"publicClient,omitempty"` - // PublisherDomain - Reliable domain which can be used to identify an application. - PublisherDomain *string `json:"publisherDomain,omitempty"` - // ReplyUrls - A collection of reply URLs for the application. - ReplyUrls *[]string `json:"replyUrls,omitempty"` - // RequiredResourceAccess - Specifies resources that this application requires access to and the set of OAuth permission scopes and application roles that it needs under each of those resources. This pre-configuration of required resource access drives the consent experience. - RequiredResourceAccess *[]RequiredResourceAccess `json:"requiredResourceAccess,omitempty"` - // SamlMetadataURL - The URL to the SAML metadata for the application. - SamlMetadataURL *string `json:"samlMetadataUrl,omitempty"` - // SignInAudience - Audience for signing in to the application (AzureADMyOrganization, AzureADAllOrganizations, AzureADAndMicrosoftAccounts). - SignInAudience *string `json:"signInAudience,omitempty"` - // WwwHomepage - The primary Web page. - WwwHomepage *string `json:"wwwHomepage,omitempty"` -} - -// ApplicationCreateParameters request parameters for creating a new application. -type ApplicationCreateParameters struct { - // DisplayName - The display name of the application. - DisplayName *string `json:"displayName,omitempty"` - // IdentifierUris - A collection of URIs for the application. - IdentifierUris *[]string `json:"identifierUris,omitempty"` - // AllowGuestsSignIn - A property on the application to indicate if the application accepts other IDPs or not or partially accepts. - AllowGuestsSignIn *bool `json:"allowGuestsSignIn,omitempty"` - // AllowPassthroughUsers - Indicates that the application supports pass through users who have no presence in the resource tenant. - AllowPassthroughUsers *bool `json:"allowPassthroughUsers,omitempty"` - // AppLogoURL - The url for the application logo image stored in a CDN. - AppLogoURL *string `json:"appLogoUrl,omitempty"` - // AppRoles - The collection of application roles that an application may declare. These roles can be assigned to users, groups or service principals. - AppRoles *[]AppRole `json:"appRoles,omitempty"` - // AppPermissions - The application permissions. - AppPermissions *[]string `json:"appPermissions,omitempty"` - // AvailableToOtherTenants - Whether the application is available to other tenants. - AvailableToOtherTenants *bool `json:"availableToOtherTenants,omitempty"` - // ErrorURL - A URL provided by the author of the application to report errors when using the application. - ErrorURL *string `json:"errorUrl,omitempty"` - // GroupMembershipClaims - Configures the groups claim issued in a user or OAuth 2.0 access token that the app expects. Possible values include: 'None', 'SecurityGroup', 'All' - GroupMembershipClaims GroupMembershipClaimTypes `json:"groupMembershipClaims,omitempty"` - // Homepage - The home page of the application. - Homepage *string `json:"homepage,omitempty"` - // InformationalUrls - URLs with more information about the application. - InformationalUrls *InformationalURL `json:"informationalUrls,omitempty"` - // IsDeviceOnlyAuthSupported - Specifies whether this application supports device authentication without a user. The default is false. - IsDeviceOnlyAuthSupported *bool `json:"isDeviceOnlyAuthSupported,omitempty"` - // KeyCredentials - A collection of KeyCredential objects. - KeyCredentials *[]KeyCredential `json:"keyCredentials,omitempty"` - // KnownClientApplications - Client applications that are tied to this resource application. Consent to any of the known client applications will result in implicit consent to the resource application through a combined consent dialog (showing the OAuth permission scopes required by the client and the resource). - KnownClientApplications *[]string `json:"knownClientApplications,omitempty"` - // LogoutURL - the url of the logout page - LogoutURL *string `json:"logoutUrl,omitempty"` - // Oauth2AllowImplicitFlow - Whether to allow implicit grant flow for OAuth2 - Oauth2AllowImplicitFlow *bool `json:"oauth2AllowImplicitFlow,omitempty"` - // Oauth2AllowURLPathMatching - Specifies whether during a token Request Azure AD will allow path matching of the redirect URI against the applications collection of replyURLs. The default is false. - Oauth2AllowURLPathMatching *bool `json:"oauth2AllowUrlPathMatching,omitempty"` - // Oauth2Permissions - The collection of OAuth 2.0 permission scopes that the web API (resource) application exposes to client applications. These permission scopes may be granted to client applications during consent. - Oauth2Permissions *[]OAuth2Permission `json:"oauth2Permissions,omitempty"` - // Oauth2RequirePostResponse - Specifies whether, as part of OAuth 2.0 token requests, Azure AD will allow POST requests, as opposed to GET requests. The default is false, which specifies that only GET requests will be allowed. - Oauth2RequirePostResponse *bool `json:"oauth2RequirePostResponse,omitempty"` - // OrgRestrictions - A list of tenants allowed to access application. - OrgRestrictions *[]string `json:"orgRestrictions,omitempty"` - OptionalClaims *OptionalClaims `json:"optionalClaims,omitempty"` - // PasswordCredentials - A collection of PasswordCredential objects - PasswordCredentials *[]PasswordCredential `json:"passwordCredentials,omitempty"` - // PreAuthorizedApplications - list of pre-authorized applications. - PreAuthorizedApplications *[]PreAuthorizedApplication `json:"preAuthorizedApplications,omitempty"` - // PublicClient - Specifies whether this application is a public client (such as an installed application running on a mobile device). Default is false. - PublicClient *bool `json:"publicClient,omitempty"` - // PublisherDomain - Reliable domain which can be used to identify an application. - PublisherDomain *string `json:"publisherDomain,omitempty"` - // ReplyUrls - A collection of reply URLs for the application. - ReplyUrls *[]string `json:"replyUrls,omitempty"` - // RequiredResourceAccess - Specifies resources that this application requires access to and the set of OAuth permission scopes and application roles that it needs under each of those resources. This pre-configuration of required resource access drives the consent experience. - RequiredResourceAccess *[]RequiredResourceAccess `json:"requiredResourceAccess,omitempty"` - // SamlMetadataURL - The URL to the SAML metadata for the application. - SamlMetadataURL *string `json:"samlMetadataUrl,omitempty"` - // SignInAudience - Audience for signing in to the application (AzureADMyOrganization, AzureADAllOrganizations, AzureADAndMicrosoftAccounts). - SignInAudience *string `json:"signInAudience,omitempty"` - // WwwHomepage - The primary Web page. - WwwHomepage *string `json:"wwwHomepage,omitempty"` -} - -// ApplicationListResult application list operation result. -type ApplicationListResult struct { - autorest.Response `json:"-"` - // Value - A collection of applications. - Value *[]Application `json:"value,omitempty"` - // OdataNextLink - The URL to get the next set of results. - OdataNextLink *string `json:"odata.nextLink,omitempty"` -} - -// ApplicationListResultIterator provides access to a complete listing of Application values. -type ApplicationListResultIterator struct { - i int - page ApplicationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ApplicationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ApplicationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ApplicationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ApplicationListResultIterator) Response() ApplicationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ApplicationListResultIterator) Value() Application { - if !iter.page.NotDone() { - return Application{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ApplicationListResultIterator type. -func NewApplicationListResultIterator(page ApplicationListResultPage) ApplicationListResultIterator { - return ApplicationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (alr ApplicationListResult) IsEmpty() bool { - return alr.Value == nil || len(*alr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (alr ApplicationListResult) hasNextLink() bool { - return alr.OdataNextLink != nil && len(*alr.OdataNextLink) != 0 -} - -// ApplicationListResultPage contains a page of Application values. -type ApplicationListResultPage struct { - fn func(context.Context, ApplicationListResult) (ApplicationListResult, error) - alr ApplicationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ApplicationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.alr) - if err != nil { - return err - } - page.alr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ApplicationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ApplicationListResultPage) NotDone() bool { - return !page.alr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ApplicationListResultPage) Response() ApplicationListResult { - return page.alr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ApplicationListResultPage) Values() []Application { - if page.alr.IsEmpty() { - return nil - } - return *page.alr.Value -} - -// Creates a new instance of the ApplicationListResultPage type. -func NewApplicationListResultPage(cur ApplicationListResult, getNextPage func(context.Context, ApplicationListResult) (ApplicationListResult, error)) ApplicationListResultPage { - return ApplicationListResultPage{ - fn: getNextPage, - alr: cur, - } -} - -// ApplicationUpdateParameters request parameters for updating a new application. -type ApplicationUpdateParameters struct { - // DisplayName - The display name of the application. - DisplayName *string `json:"displayName,omitempty"` - // IdentifierUris - A collection of URIs for the application. - IdentifierUris *[]string `json:"identifierUris,omitempty"` - // AllowGuestsSignIn - A property on the application to indicate if the application accepts other IDPs or not or partially accepts. - AllowGuestsSignIn *bool `json:"allowGuestsSignIn,omitempty"` - // AllowPassthroughUsers - Indicates that the application supports pass through users who have no presence in the resource tenant. - AllowPassthroughUsers *bool `json:"allowPassthroughUsers,omitempty"` - // AppLogoURL - The url for the application logo image stored in a CDN. - AppLogoURL *string `json:"appLogoUrl,omitempty"` - // AppRoles - The collection of application roles that an application may declare. These roles can be assigned to users, groups or service principals. - AppRoles *[]AppRole `json:"appRoles,omitempty"` - // AppPermissions - The application permissions. - AppPermissions *[]string `json:"appPermissions,omitempty"` - // AvailableToOtherTenants - Whether the application is available to other tenants. - AvailableToOtherTenants *bool `json:"availableToOtherTenants,omitempty"` - // ErrorURL - A URL provided by the author of the application to report errors when using the application. - ErrorURL *string `json:"errorUrl,omitempty"` - // GroupMembershipClaims - Configures the groups claim issued in a user or OAuth 2.0 access token that the app expects. Possible values include: 'None', 'SecurityGroup', 'All' - GroupMembershipClaims GroupMembershipClaimTypes `json:"groupMembershipClaims,omitempty"` - // Homepage - The home page of the application. - Homepage *string `json:"homepage,omitempty"` - // InformationalUrls - URLs with more information about the application. - InformationalUrls *InformationalURL `json:"informationalUrls,omitempty"` - // IsDeviceOnlyAuthSupported - Specifies whether this application supports device authentication without a user. The default is false. - IsDeviceOnlyAuthSupported *bool `json:"isDeviceOnlyAuthSupported,omitempty"` - // KeyCredentials - A collection of KeyCredential objects. - KeyCredentials *[]KeyCredential `json:"keyCredentials,omitempty"` - // KnownClientApplications - Client applications that are tied to this resource application. Consent to any of the known client applications will result in implicit consent to the resource application through a combined consent dialog (showing the OAuth permission scopes required by the client and the resource). - KnownClientApplications *[]string `json:"knownClientApplications,omitempty"` - // LogoutURL - the url of the logout page - LogoutURL *string `json:"logoutUrl,omitempty"` - // Oauth2AllowImplicitFlow - Whether to allow implicit grant flow for OAuth2 - Oauth2AllowImplicitFlow *bool `json:"oauth2AllowImplicitFlow,omitempty"` - // Oauth2AllowURLPathMatching - Specifies whether during a token Request Azure AD will allow path matching of the redirect URI against the applications collection of replyURLs. The default is false. - Oauth2AllowURLPathMatching *bool `json:"oauth2AllowUrlPathMatching,omitempty"` - // Oauth2Permissions - The collection of OAuth 2.0 permission scopes that the web API (resource) application exposes to client applications. These permission scopes may be granted to client applications during consent. - Oauth2Permissions *[]OAuth2Permission `json:"oauth2Permissions,omitempty"` - // Oauth2RequirePostResponse - Specifies whether, as part of OAuth 2.0 token requests, Azure AD will allow POST requests, as opposed to GET requests. The default is false, which specifies that only GET requests will be allowed. - Oauth2RequirePostResponse *bool `json:"oauth2RequirePostResponse,omitempty"` - // OrgRestrictions - A list of tenants allowed to access application. - OrgRestrictions *[]string `json:"orgRestrictions,omitempty"` - OptionalClaims *OptionalClaims `json:"optionalClaims,omitempty"` - // PasswordCredentials - A collection of PasswordCredential objects - PasswordCredentials *[]PasswordCredential `json:"passwordCredentials,omitempty"` - // PreAuthorizedApplications - list of pre-authorized applications. - PreAuthorizedApplications *[]PreAuthorizedApplication `json:"preAuthorizedApplications,omitempty"` - // PublicClient - Specifies whether this application is a public client (such as an installed application running on a mobile device). Default is false. - PublicClient *bool `json:"publicClient,omitempty"` - // PublisherDomain - Reliable domain which can be used to identify an application. - PublisherDomain *string `json:"publisherDomain,omitempty"` - // ReplyUrls - A collection of reply URLs for the application. - ReplyUrls *[]string `json:"replyUrls,omitempty"` - // RequiredResourceAccess - Specifies resources that this application requires access to and the set of OAuth permission scopes and application roles that it needs under each of those resources. This pre-configuration of required resource access drives the consent experience. - RequiredResourceAccess *[]RequiredResourceAccess `json:"requiredResourceAccess,omitempty"` - // SamlMetadataURL - The URL to the SAML metadata for the application. - SamlMetadataURL *string `json:"samlMetadataUrl,omitempty"` - // SignInAudience - Audience for signing in to the application (AzureADMyOrganization, AzureADAllOrganizations, AzureADAndMicrosoftAccounts). - SignInAudience *string `json:"signInAudience,omitempty"` - // WwwHomepage - The primary Web page. - WwwHomepage *string `json:"wwwHomepage,omitempty"` -} - -// AppRole ... -type AppRole struct { - // ID - Unique role identifier inside the appRoles collection. - ID *string `json:"id,omitempty"` - // AllowedMemberTypes - Specifies whether this app role definition can be assigned to users and groups by setting to 'User', or to other applications (that are accessing this application in daemon service scenarios) by setting to 'Application', or to both. - AllowedMemberTypes *[]string `json:"allowedMemberTypes,omitempty"` - // Description - Permission help text that appears in the admin app assignment and consent experiences. - Description *string `json:"description,omitempty"` - // DisplayName - Display name for the permission that appears in the admin consent and app assignment experiences. - DisplayName *string `json:"displayName,omitempty"` - // IsEnabled - When creating or updating a role definition, this must be set to true (which is the default). To delete a role, this must first be set to false. At that point, in a subsequent call, this role may be removed. - IsEnabled *bool `json:"isEnabled,omitempty"` - // Value - Specifies the value of the roles claim that the application should expect in the authentication and access tokens. - Value *string `json:"value,omitempty"` -} - -// CheckGroupMembershipParameters request parameters for IsMemberOf API call. -type CheckGroupMembershipParameters struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // GroupID - The object ID of the group to check. - GroupID *string `json:"groupId,omitempty"` - // MemberID - The object ID of the contact, group, user, or service principal to check for membership in the specified group. - MemberID *string `json:"memberId,omitempty"` -} - -// MarshalJSON is the custom marshaler for CheckGroupMembershipParameters. -func (cgmp CheckGroupMembershipParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cgmp.GroupID != nil { - objectMap["groupId"] = cgmp.GroupID - } - if cgmp.MemberID != nil { - objectMap["memberId"] = cgmp.MemberID - } - for k, v := range cgmp.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CheckGroupMembershipParameters struct. -func (cgmp *CheckGroupMembershipParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if cgmp.AdditionalProperties == nil { - cgmp.AdditionalProperties = make(map[string]interface{}) - } - cgmp.AdditionalProperties[k] = additionalProperties - } - case "groupId": - if v != nil { - var groupID string - err = json.Unmarshal(*v, &groupID) - if err != nil { - return err - } - cgmp.GroupID = &groupID - } - case "memberId": - if v != nil { - var memberID string - err = json.Unmarshal(*v, &memberID) - if err != nil { - return err - } - cgmp.MemberID = &memberID - } - } - } - - return nil -} - -// CheckGroupMembershipResult server response for IsMemberOf API call -type CheckGroupMembershipResult struct { - autorest.Response `json:"-"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Value - True if the specified user, group, contact, or service principal has either direct or transitive membership in the specified group; otherwise, false. - Value *bool `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for CheckGroupMembershipResult. -func (cgmr CheckGroupMembershipResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cgmr.Value != nil { - objectMap["value"] = cgmr.Value - } - for k, v := range cgmr.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CheckGroupMembershipResult struct. -func (cgmr *CheckGroupMembershipResult) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if cgmr.AdditionalProperties == nil { - cgmr.AdditionalProperties = make(map[string]interface{}) - } - cgmr.AdditionalProperties[k] = additionalProperties - } - case "value": - if v != nil { - var value bool - err = json.Unmarshal(*v, &value) - if err != nil { - return err - } - cgmr.Value = &value - } - } - } - - return nil -} - -// BasicDirectoryObject represents an Azure Active Directory object. -type BasicDirectoryObject interface { - AsApplication() (*Application, bool) - AsADGroup() (*ADGroup, bool) - AsServicePrincipal() (*ServicePrincipal, bool) - AsUser() (*User, bool) - AsDirectoryObject() (*DirectoryObject, bool) -} - -// DirectoryObject represents an Azure Active Directory object. -type DirectoryObject struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // ObjectID - READ-ONLY; The object ID. - ObjectID *string `json:"objectId,omitempty"` - // DeletionTimestamp - READ-ONLY; The time at which the directory object was deleted. - DeletionTimestamp *date.Time `json:"deletionTimestamp,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeDirectoryObject', 'ObjectTypeApplication', 'ObjectTypeGroup', 'ObjectTypeServicePrincipal', 'ObjectTypeUser' - ObjectType ObjectType `json:"objectType,omitempty"` -} - -func unmarshalBasicDirectoryObject(body []byte) (BasicDirectoryObject, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["objectType"] { - case string(ObjectTypeApplication): - var a Application - err := json.Unmarshal(body, &a) - return a, err - case string(ObjectTypeGroup): - var ag ADGroup - err := json.Unmarshal(body, &ag) - return ag, err - case string(ObjectTypeServicePrincipal): - var sp ServicePrincipal - err := json.Unmarshal(body, &sp) - return sp, err - case string(ObjectTypeUser): - var u User - err := json.Unmarshal(body, &u) - return u, err - default: - var do DirectoryObject - err := json.Unmarshal(body, &do) - return do, err - } -} -func unmarshalBasicDirectoryObjectArray(body []byte) ([]BasicDirectoryObject, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - doArray := make([]BasicDirectoryObject, len(rawMessages)) - - for index, rawMessage := range rawMessages { - do, err := unmarshalBasicDirectoryObject(*rawMessage) - if err != nil { - return nil, err - } - doArray[index] = do - } - return doArray, nil -} - -// MarshalJSON is the custom marshaler for DirectoryObject. -func (do DirectoryObject) MarshalJSON() ([]byte, error) { - do.ObjectType = ObjectTypeDirectoryObject - objectMap := make(map[string]interface{}) - if do.ObjectType != "" { - objectMap["objectType"] = do.ObjectType - } - for k, v := range do.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsApplication is the BasicDirectoryObject implementation for DirectoryObject. -func (do DirectoryObject) AsApplication() (*Application, bool) { - return nil, false -} - -// AsADGroup is the BasicDirectoryObject implementation for DirectoryObject. -func (do DirectoryObject) AsADGroup() (*ADGroup, bool) { - return nil, false -} - -// AsServicePrincipal is the BasicDirectoryObject implementation for DirectoryObject. -func (do DirectoryObject) AsServicePrincipal() (*ServicePrincipal, bool) { - return nil, false -} - -// AsUser is the BasicDirectoryObject implementation for DirectoryObject. -func (do DirectoryObject) AsUser() (*User, bool) { - return nil, false -} - -// AsDirectoryObject is the BasicDirectoryObject implementation for DirectoryObject. -func (do DirectoryObject) AsDirectoryObject() (*DirectoryObject, bool) { - return &do, true -} - -// AsBasicDirectoryObject is the BasicDirectoryObject implementation for DirectoryObject. -func (do DirectoryObject) AsBasicDirectoryObject() (BasicDirectoryObject, bool) { - return &do, true -} - -// UnmarshalJSON is the custom unmarshaler for DirectoryObject struct. -func (do *DirectoryObject) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if do.AdditionalProperties == nil { - do.AdditionalProperties = make(map[string]interface{}) - } - do.AdditionalProperties[k] = additionalProperties - } - case "objectId": - if v != nil { - var objectID string - err = json.Unmarshal(*v, &objectID) - if err != nil { - return err - } - do.ObjectID = &objectID - } - case "deletionTimestamp": - if v != nil { - var deletionTimestamp date.Time - err = json.Unmarshal(*v, &deletionTimestamp) - if err != nil { - return err - } - do.DeletionTimestamp = &deletionTimestamp - } - case "objectType": - if v != nil { - var objectType ObjectType - err = json.Unmarshal(*v, &objectType) - if err != nil { - return err - } - do.ObjectType = objectType - } - } - } - - return nil -} - -// DirectoryObjectListResult directoryObject list operation result. -type DirectoryObjectListResult struct { - autorest.Response `json:"-"` - // Value - A collection of DirectoryObject. - Value *[]BasicDirectoryObject `json:"value,omitempty"` - // OdataNextLink - The URL to get the next set of results. - OdataNextLink *string `json:"odata.nextLink,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for DirectoryObjectListResult struct. -func (dolr *DirectoryObjectListResult) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "value": - if v != nil { - value, err := unmarshalBasicDirectoryObjectArray(*v) - if err != nil { - return err - } - dolr.Value = &value - } - case "odata.nextLink": - if v != nil { - var odataNextLink string - err = json.Unmarshal(*v, &odataNextLink) - if err != nil { - return err - } - dolr.OdataNextLink = &odataNextLink - } - } - } - - return nil -} - -// DirectoryObjectListResultIterator provides access to a complete listing of DirectoryObject values. -type DirectoryObjectListResultIterator struct { - i int - page DirectoryObjectListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *DirectoryObjectListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DirectoryObjectListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *DirectoryObjectListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DirectoryObjectListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter DirectoryObjectListResultIterator) Response() DirectoryObjectListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter DirectoryObjectListResultIterator) Value() BasicDirectoryObject { - if !iter.page.NotDone() { - return DirectoryObject{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DirectoryObjectListResultIterator type. -func NewDirectoryObjectListResultIterator(page DirectoryObjectListResultPage) DirectoryObjectListResultIterator { - return DirectoryObjectListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dolr DirectoryObjectListResult) IsEmpty() bool { - return dolr.Value == nil || len(*dolr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dolr DirectoryObjectListResult) hasNextLink() bool { - return dolr.OdataNextLink != nil && len(*dolr.OdataNextLink) != 0 -} - -// directoryObjectListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dolr DirectoryObjectListResult) directoryObjectListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dolr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dolr.OdataNextLink))) -} - -// DirectoryObjectListResultPage contains a page of BasicDirectoryObject values. -type DirectoryObjectListResultPage struct { - fn func(context.Context, DirectoryObjectListResult) (DirectoryObjectListResult, error) - dolr DirectoryObjectListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *DirectoryObjectListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DirectoryObjectListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.dolr) - if err != nil { - return err - } - page.dolr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *DirectoryObjectListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DirectoryObjectListResultPage) NotDone() bool { - return !page.dolr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DirectoryObjectListResultPage) Response() DirectoryObjectListResult { - return page.dolr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DirectoryObjectListResultPage) Values() []BasicDirectoryObject { - if page.dolr.IsEmpty() { - return nil - } - return *page.dolr.Value -} - -// Creates a new instance of the DirectoryObjectListResultPage type. -func NewDirectoryObjectListResultPage(cur DirectoryObjectListResult, getNextPage func(context.Context, DirectoryObjectListResult) (DirectoryObjectListResult, error)) DirectoryObjectListResultPage { - return DirectoryObjectListResultPage{ - fn: getNextPage, - dolr: cur, - } -} - -// Domain active Directory Domain information. -type Domain struct { - autorest.Response `json:"-"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // AuthenticationType - READ-ONLY; the type of the authentication into the domain. - AuthenticationType *string `json:"authenticationType,omitempty"` - // IsDefault - READ-ONLY; if this is the default domain in the tenant. - IsDefault *bool `json:"isDefault,omitempty"` - // IsVerified - READ-ONLY; if this domain's ownership is verified. - IsVerified *bool `json:"isVerified,omitempty"` - // Name - the domain name. - Name *string `json:"name,omitempty"` -} - -// MarshalJSON is the custom marshaler for Domain. -func (d Domain) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if d.Name != nil { - objectMap["name"] = d.Name - } - for k, v := range d.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Domain struct. -func (d *Domain) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if d.AdditionalProperties == nil { - d.AdditionalProperties = make(map[string]interface{}) - } - d.AdditionalProperties[k] = additionalProperties - } - case "authenticationType": - if v != nil { - var authenticationType string - err = json.Unmarshal(*v, &authenticationType) - if err != nil { - return err - } - d.AuthenticationType = &authenticationType - } - case "isDefault": - if v != nil { - var isDefault bool - err = json.Unmarshal(*v, &isDefault) - if err != nil { - return err - } - d.IsDefault = &isDefault - } - case "isVerified": - if v != nil { - var isVerified bool - err = json.Unmarshal(*v, &isVerified) - if err != nil { - return err - } - d.IsVerified = &isVerified - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - d.Name = &name - } - } - } - - return nil -} - -// DomainListResult server response for Get tenant domains API call. -type DomainListResult struct { - autorest.Response `json:"-"` - // Value - the list of domains. - Value *[]Domain `json:"value,omitempty"` -} - -// ErrorMessage active Directory error message. -type ErrorMessage struct { - // Message - Error message value. - Message *string `json:"value,omitempty"` -} - -// GetObjectsParameters request parameters for the GetObjectsByObjectIds API. -type GetObjectsParameters struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // ObjectIds - The requested object IDs. - ObjectIds *[]string `json:"objectIds,omitempty"` - // Types - The requested object types. - Types *[]string `json:"types,omitempty"` - // IncludeDirectoryObjectReferences - If true, also searches for object IDs in the partner tenant. - IncludeDirectoryObjectReferences *bool `json:"includeDirectoryObjectReferences,omitempty"` -} - -// MarshalJSON is the custom marshaler for GetObjectsParameters. -func (gop GetObjectsParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gop.ObjectIds != nil { - objectMap["objectIds"] = gop.ObjectIds - } - if gop.Types != nil { - objectMap["types"] = gop.Types - } - if gop.IncludeDirectoryObjectReferences != nil { - objectMap["includeDirectoryObjectReferences"] = gop.IncludeDirectoryObjectReferences - } - for k, v := range gop.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GetObjectsParameters struct. -func (gop *GetObjectsParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if gop.AdditionalProperties == nil { - gop.AdditionalProperties = make(map[string]interface{}) - } - gop.AdditionalProperties[k] = additionalProperties - } - case "objectIds": - if v != nil { - var objectIds []string - err = json.Unmarshal(*v, &objectIds) - if err != nil { - return err - } - gop.ObjectIds = &objectIds - } - case "types": - if v != nil { - var typesVar []string - err = json.Unmarshal(*v, &typesVar) - if err != nil { - return err - } - gop.Types = &typesVar - } - case "includeDirectoryObjectReferences": - if v != nil { - var includeDirectoryObjectReferences bool - err = json.Unmarshal(*v, &includeDirectoryObjectReferences) - if err != nil { - return err - } - gop.IncludeDirectoryObjectReferences = &includeDirectoryObjectReferences - } - } - } - - return nil -} - -// GraphError active Directory error information. -type GraphError struct { - // OdataError - A Graph API error. - *OdataError `json:"odata.error,omitempty"` -} - -// MarshalJSON is the custom marshaler for GraphError. -func (ge GraphError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ge.OdataError != nil { - objectMap["odata.error"] = ge.OdataError - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GraphError struct. -func (ge *GraphError) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "odata.error": - if v != nil { - var odataError OdataError - err = json.Unmarshal(*v, &odataError) - if err != nil { - return err - } - ge.OdataError = &odataError - } - } - } - - return nil -} - -// GroupAddMemberParameters request parameters for adding a member to a group. -type GroupAddMemberParameters struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // URL - A member object URL, such as "https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd", where "0b1f9851-1bf0-433f-aec3-cb9272f093dc" is the tenantId and "f260bbc4-c254-447b-94cf-293b5ec434dd" is the objectId of the member (user, application, servicePrincipal, group) to be added. - URL *string `json:"url,omitempty"` -} - -// MarshalJSON is the custom marshaler for GroupAddMemberParameters. -func (gamp GroupAddMemberParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gamp.URL != nil { - objectMap["url"] = gamp.URL - } - for k, v := range gamp.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GroupAddMemberParameters struct. -func (gamp *GroupAddMemberParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if gamp.AdditionalProperties == nil { - gamp.AdditionalProperties = make(map[string]interface{}) - } - gamp.AdditionalProperties[k] = additionalProperties - } - case "url": - if v != nil { - var URL string - err = json.Unmarshal(*v, &URL) - if err != nil { - return err - } - gamp.URL = &URL - } - } - } - - return nil -} - -// GroupCreateParameters request parameters for creating a new group. -type GroupCreateParameters struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // DisplayName - Group display name - DisplayName *string `json:"displayName,omitempty"` - // MailEnabled - Whether the group is mail-enabled. Must be false. This is because only pure security groups can be created using the Graph API. - MailEnabled *bool `json:"mailEnabled,omitempty"` - // MailNickname - Mail nickname - MailNickname *string `json:"mailNickname,omitempty"` - // SecurityEnabled - Whether the group is a security group. Must be true. This is because only pure security groups can be created using the Graph API. - SecurityEnabled *bool `json:"securityEnabled,omitempty"` -} - -// MarshalJSON is the custom marshaler for GroupCreateParameters. -func (gcp GroupCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gcp.DisplayName != nil { - objectMap["displayName"] = gcp.DisplayName - } - if gcp.MailEnabled != nil { - objectMap["mailEnabled"] = gcp.MailEnabled - } - if gcp.MailNickname != nil { - objectMap["mailNickname"] = gcp.MailNickname - } - if gcp.SecurityEnabled != nil { - objectMap["securityEnabled"] = gcp.SecurityEnabled - } - for k, v := range gcp.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GroupCreateParameters struct. -func (gcp *GroupCreateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if gcp.AdditionalProperties == nil { - gcp.AdditionalProperties = make(map[string]interface{}) - } - gcp.AdditionalProperties[k] = additionalProperties - } - case "displayName": - if v != nil { - var displayName string - err = json.Unmarshal(*v, &displayName) - if err != nil { - return err - } - gcp.DisplayName = &displayName - } - case "mailEnabled": - if v != nil { - var mailEnabled bool - err = json.Unmarshal(*v, &mailEnabled) - if err != nil { - return err - } - gcp.MailEnabled = &mailEnabled - } - case "mailNickname": - if v != nil { - var mailNickname string - err = json.Unmarshal(*v, &mailNickname) - if err != nil { - return err - } - gcp.MailNickname = &mailNickname - } - case "securityEnabled": - if v != nil { - var securityEnabled bool - err = json.Unmarshal(*v, &securityEnabled) - if err != nil { - return err - } - gcp.SecurityEnabled = &securityEnabled - } - } - } - - return nil -} - -// GroupGetMemberGroupsParameters request parameters for GetMemberGroups API call. -type GroupGetMemberGroupsParameters struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // SecurityEnabledOnly - If true, only membership in security-enabled groups should be checked. Otherwise, membership in all groups should be checked. - SecurityEnabledOnly *bool `json:"securityEnabledOnly,omitempty"` -} - -// MarshalJSON is the custom marshaler for GroupGetMemberGroupsParameters. -func (ggmgp GroupGetMemberGroupsParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ggmgp.SecurityEnabledOnly != nil { - objectMap["securityEnabledOnly"] = ggmgp.SecurityEnabledOnly - } - for k, v := range ggmgp.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GroupGetMemberGroupsParameters struct. -func (ggmgp *GroupGetMemberGroupsParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if ggmgp.AdditionalProperties == nil { - ggmgp.AdditionalProperties = make(map[string]interface{}) - } - ggmgp.AdditionalProperties[k] = additionalProperties - } - case "securityEnabledOnly": - if v != nil { - var securityEnabledOnly bool - err = json.Unmarshal(*v, &securityEnabledOnly) - if err != nil { - return err - } - ggmgp.SecurityEnabledOnly = &securityEnabledOnly - } - } - } - - return nil -} - -// GroupGetMemberGroupsResult server response for GetMemberGroups API call. -type GroupGetMemberGroupsResult struct { - autorest.Response `json:"-"` - // Value - A collection of group IDs of which the group is a member. - Value *[]string `json:"value,omitempty"` -} - -// GroupListResult server response for Get tenant groups API call -type GroupListResult struct { - autorest.Response `json:"-"` - // Value - A collection of Active Directory groups. - Value *[]ADGroup `json:"value,omitempty"` - // OdataNextLink - The URL to get the next set of results. - OdataNextLink *string `json:"odata.nextLink,omitempty"` -} - -// GroupListResultIterator provides access to a complete listing of ADGroup values. -type GroupListResultIterator struct { - i int - page GroupListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *GroupListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *GroupListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter GroupListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter GroupListResultIterator) Response() GroupListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter GroupListResultIterator) Value() ADGroup { - if !iter.page.NotDone() { - return ADGroup{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the GroupListResultIterator type. -func NewGroupListResultIterator(page GroupListResultPage) GroupListResultIterator { - return GroupListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (glr GroupListResult) IsEmpty() bool { - return glr.Value == nil || len(*glr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (glr GroupListResult) hasNextLink() bool { - return glr.OdataNextLink != nil && len(*glr.OdataNextLink) != 0 -} - -// GroupListResultPage contains a page of ADGroup values. -type GroupListResultPage struct { - fn func(context.Context, GroupListResult) (GroupListResult, error) - glr GroupListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *GroupListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.glr) - if err != nil { - return err - } - page.glr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *GroupListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page GroupListResultPage) NotDone() bool { - return !page.glr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page GroupListResultPage) Response() GroupListResult { - return page.glr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page GroupListResultPage) Values() []ADGroup { - if page.glr.IsEmpty() { - return nil - } - return *page.glr.Value -} - -// Creates a new instance of the GroupListResultPage type. -func NewGroupListResultPage(cur GroupListResult, getNextPage func(context.Context, GroupListResult) (GroupListResult, error)) GroupListResultPage { - return GroupListResultPage{ - fn: getNextPage, - glr: cur, - } -} - -// InformationalURL represents a group of URIs that provide terms of service, marketing, support and -// privacy policy information about an application. The default value for each string is null. -type InformationalURL struct { - // TermsOfService - The terms of service URI - TermsOfService *string `json:"termsOfService,omitempty"` - // Marketing - The marketing URI - Marketing *string `json:"marketing,omitempty"` - // Privacy - The privacy policy URI - Privacy *string `json:"privacy,omitempty"` - // Support - The support URI - Support *string `json:"support,omitempty"` -} - -// KeyCredential active Directory Key Credential information. -type KeyCredential struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // StartDate - Start date. - StartDate *date.Time `json:"startDate,omitempty"` - // EndDate - End date. - EndDate *date.Time `json:"endDate,omitempty"` - // Value - Key value. - Value *string `json:"value,omitempty"` - // KeyID - Key ID. - KeyID *string `json:"keyId,omitempty"` - // Usage - Usage. Acceptable values are 'Verify' and 'Sign'. - Usage *string `json:"usage,omitempty"` - // Type - Type. Acceptable values are 'AsymmetricX509Cert' and 'Symmetric'. - Type *string `json:"type,omitempty"` - // CustomKeyIdentifier - Custom Key Identifier - CustomKeyIdentifier *string `json:"customKeyIdentifier,omitempty"` -} - -// MarshalJSON is the custom marshaler for KeyCredential. -func (kc KeyCredential) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if kc.StartDate != nil { - objectMap["startDate"] = kc.StartDate - } - if kc.EndDate != nil { - objectMap["endDate"] = kc.EndDate - } - if kc.Value != nil { - objectMap["value"] = kc.Value - } - if kc.KeyID != nil { - objectMap["keyId"] = kc.KeyID - } - if kc.Usage != nil { - objectMap["usage"] = kc.Usage - } - if kc.Type != nil { - objectMap["type"] = kc.Type - } - if kc.CustomKeyIdentifier != nil { - objectMap["customKeyIdentifier"] = kc.CustomKeyIdentifier - } - for k, v := range kc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for KeyCredential struct. -func (kc *KeyCredential) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if kc.AdditionalProperties == nil { - kc.AdditionalProperties = make(map[string]interface{}) - } - kc.AdditionalProperties[k] = additionalProperties - } - case "startDate": - if v != nil { - var startDate date.Time - err = json.Unmarshal(*v, &startDate) - if err != nil { - return err - } - kc.StartDate = &startDate - } - case "endDate": - if v != nil { - var endDate date.Time - err = json.Unmarshal(*v, &endDate) - if err != nil { - return err - } - kc.EndDate = &endDate - } - case "value": - if v != nil { - var value string - err = json.Unmarshal(*v, &value) - if err != nil { - return err - } - kc.Value = &value - } - case "keyId": - if v != nil { - var keyID string - err = json.Unmarshal(*v, &keyID) - if err != nil { - return err - } - kc.KeyID = &keyID - } - case "usage": - if v != nil { - var usage string - err = json.Unmarshal(*v, &usage) - if err != nil { - return err - } - kc.Usage = &usage - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - kc.Type = &typeVar - } - case "customKeyIdentifier": - if v != nil { - var customKeyIdentifier string - err = json.Unmarshal(*v, &customKeyIdentifier) - if err != nil { - return err - } - kc.CustomKeyIdentifier = &customKeyIdentifier - } - } - } - - return nil -} - -// KeyCredentialListResult keyCredential list operation result. -type KeyCredentialListResult struct { - autorest.Response `json:"-"` - // Value - A collection of KeyCredentials. - Value *[]KeyCredential `json:"value,omitempty"` -} - -// KeyCredentialsUpdateParameters request parameters for a KeyCredentials update operation -type KeyCredentialsUpdateParameters struct { - // Value - A collection of KeyCredentials. - Value *[]KeyCredential `json:"value,omitempty"` -} - -// OAuth2Permission represents an OAuth 2.0 delegated permission scope. The specified OAuth 2.0 delegated -// permission scopes may be requested by client applications (through the requiredResourceAccess collection -// on the Application object) when calling a resource application. The oauth2Permissions property of the -// ServicePrincipal entity and of the Application entity is a collection of OAuth2Permission. -type OAuth2Permission struct { - // AdminConsentDescription - Permission help text that appears in the admin consent and app assignment experiences. - AdminConsentDescription *string `json:"adminConsentDescription,omitempty"` - // AdminConsentDisplayName - Display name for the permission that appears in the admin consent and app assignment experiences. - AdminConsentDisplayName *string `json:"adminConsentDisplayName,omitempty"` - // ID - Unique scope permission identifier inside the oauth2Permissions collection. - ID *string `json:"id,omitempty"` - // IsEnabled - When creating or updating a permission, this property must be set to true (which is the default). To delete a permission, this property must first be set to false. At that point, in a subsequent call, the permission may be removed. - IsEnabled *bool `json:"isEnabled,omitempty"` - // Type - Specifies whether this scope permission can be consented to by an end user, or whether it is a tenant-wide permission that must be consented to by a Company Administrator. Possible values are "User" or "Admin". - Type *string `json:"type,omitempty"` - // UserConsentDescription - Permission help text that appears in the end user consent experience. - UserConsentDescription *string `json:"userConsentDescription,omitempty"` - // UserConsentDisplayName - Display name for the permission that appears in the end user consent experience. - UserConsentDisplayName *string `json:"userConsentDisplayName,omitempty"` - // Value - The value of the scope claim that the resource application should expect in the OAuth 2.0 access token. - Value *string `json:"value,omitempty"` -} - -// OAuth2PermissionGrant ... -type OAuth2PermissionGrant struct { - autorest.Response `json:"-"` - // OdataType - Microsoft.DirectoryServices.OAuth2PermissionGrant - OdataType *string `json:"odata.type,omitempty"` - // ClientID - The id of the resource's service principal granted consent to impersonate the user when accessing the resource (represented by the resourceId property). - ClientID *string `json:"clientId,omitempty"` - // ObjectID - The id of the permission grant - ObjectID *string `json:"objectId,omitempty"` - // ConsentType - Indicates if consent was provided by the administrator (on behalf of the organization) or by an individual. Possible values include: 'AllPrincipals', 'Principal' - ConsentType ConsentType `json:"consentType,omitempty"` - // PrincipalID - When consent type is Principal, this property specifies the id of the user that granted consent and applies only for that user. - PrincipalID *string `json:"principalId,omitempty"` - // ResourceID - Object Id of the resource you want to grant - ResourceID *string `json:"resourceId,omitempty"` - // Scope - Specifies the value of the scope claim that the resource application should expect in the OAuth 2.0 access token. For example, User.Read - Scope *string `json:"scope,omitempty"` - // StartTime - Start time for TTL - StartTime *string `json:"startTime,omitempty"` - // ExpiryTime - Expiry time for TTL - ExpiryTime *string `json:"expiryTime,omitempty"` -} - -// OAuth2PermissionGrantListResult server response for get oauth2 permissions grants -type OAuth2PermissionGrantListResult struct { - autorest.Response `json:"-"` - // Value - the list of oauth2 permissions grants - Value *[]OAuth2PermissionGrant `json:"value,omitempty"` - // OdataNextLink - the URL to get the next set of results. - OdataNextLink *string `json:"odata.nextLink,omitempty"` -} - -// OAuth2PermissionGrantListResultIterator provides access to a complete listing of OAuth2PermissionGrant -// values. -type OAuth2PermissionGrantListResultIterator struct { - i int - page OAuth2PermissionGrantListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OAuth2PermissionGrantListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OAuth2PermissionGrantListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OAuth2PermissionGrantListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OAuth2PermissionGrantListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OAuth2PermissionGrantListResultIterator) Response() OAuth2PermissionGrantListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OAuth2PermissionGrantListResultIterator) Value() OAuth2PermissionGrant { - if !iter.page.NotDone() { - return OAuth2PermissionGrant{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OAuth2PermissionGrantListResultIterator type. -func NewOAuth2PermissionGrantListResultIterator(page OAuth2PermissionGrantListResultPage) OAuth2PermissionGrantListResultIterator { - return OAuth2PermissionGrantListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (oa2pglr OAuth2PermissionGrantListResult) IsEmpty() bool { - return oa2pglr.Value == nil || len(*oa2pglr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (oa2pglr OAuth2PermissionGrantListResult) hasNextLink() bool { - return oa2pglr.OdataNextLink != nil && len(*oa2pglr.OdataNextLink) != 0 -} - -// OAuth2PermissionGrantListResultPage contains a page of OAuth2PermissionGrant values. -type OAuth2PermissionGrantListResultPage struct { - fn func(context.Context, OAuth2PermissionGrantListResult) (OAuth2PermissionGrantListResult, error) - oa2pglr OAuth2PermissionGrantListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OAuth2PermissionGrantListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OAuth2PermissionGrantListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.oa2pglr) - if err != nil { - return err - } - page.oa2pglr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OAuth2PermissionGrantListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OAuth2PermissionGrantListResultPage) NotDone() bool { - return !page.oa2pglr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OAuth2PermissionGrantListResultPage) Response() OAuth2PermissionGrantListResult { - return page.oa2pglr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OAuth2PermissionGrantListResultPage) Values() []OAuth2PermissionGrant { - if page.oa2pglr.IsEmpty() { - return nil - } - return *page.oa2pglr.Value -} - -// Creates a new instance of the OAuth2PermissionGrantListResultPage type. -func NewOAuth2PermissionGrantListResultPage(cur OAuth2PermissionGrantListResult, getNextPage func(context.Context, OAuth2PermissionGrantListResult) (OAuth2PermissionGrantListResult, error)) OAuth2PermissionGrantListResultPage { - return OAuth2PermissionGrantListResultPage{ - fn: getNextPage, - oa2pglr: cur, - } -} - -// OdataError active Directory OData error information. -type OdataError struct { - // Code - Error code. - Code *string `json:"code,omitempty"` - // ErrorMessage - Error Message. - *ErrorMessage `json:"message,omitempty"` -} - -// MarshalJSON is the custom marshaler for OdataError. -func (oe OdataError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if oe.Code != nil { - objectMap["code"] = oe.Code - } - if oe.ErrorMessage != nil { - objectMap["message"] = oe.ErrorMessage - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OdataError struct. -func (oe *OdataError) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "code": - if v != nil { - var code string - err = json.Unmarshal(*v, &code) - if err != nil { - return err - } - oe.Code = &code - } - case "message": - if v != nil { - var errorMessage ErrorMessage - err = json.Unmarshal(*v, &errorMessage) - if err != nil { - return err - } - oe.ErrorMessage = &errorMessage - } - } - } - - return nil -} - -// OptionalClaim specifying the claims to be included in a token. -type OptionalClaim struct { - // Name - Claim name. - Name *string `json:"name,omitempty"` - // Source - Claim source. - Source *string `json:"source,omitempty"` - // Essential - Is this a required claim. - Essential *bool `json:"essential,omitempty"` - AdditionalProperties interface{} `json:"additionalProperties,omitempty"` -} - -// OptionalClaims specifying the claims to be included in the token. -type OptionalClaims struct { - // IDToken - Optional claims requested to be included in the id token. - IDToken *[]OptionalClaim `json:"idToken,omitempty"` - // AccessToken - Optional claims requested to be included in the access token. - AccessToken *[]OptionalClaim `json:"accessToken,omitempty"` - // SamlToken - Optional claims requested to be included in the saml token. - SamlToken *[]OptionalClaim `json:"samlToken,omitempty"` -} - -// PasswordCredential active Directory Password Credential information. -type PasswordCredential struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // StartDate - Start date. - StartDate *date.Time `json:"startDate,omitempty"` - // EndDate - End date. - EndDate *date.Time `json:"endDate,omitempty"` - // KeyID - Key ID. - KeyID *string `json:"keyId,omitempty"` - // Value - Key value. - Value *string `json:"value,omitempty"` - // CustomKeyIdentifier - Custom Key Identifier - CustomKeyIdentifier *[]byte `json:"customKeyIdentifier,omitempty"` -} - -// MarshalJSON is the custom marshaler for PasswordCredential. -func (pc PasswordCredential) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pc.StartDate != nil { - objectMap["startDate"] = pc.StartDate - } - if pc.EndDate != nil { - objectMap["endDate"] = pc.EndDate - } - if pc.KeyID != nil { - objectMap["keyId"] = pc.KeyID - } - if pc.Value != nil { - objectMap["value"] = pc.Value - } - if pc.CustomKeyIdentifier != nil { - objectMap["customKeyIdentifier"] = pc.CustomKeyIdentifier - } - for k, v := range pc.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PasswordCredential struct. -func (pc *PasswordCredential) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if pc.AdditionalProperties == nil { - pc.AdditionalProperties = make(map[string]interface{}) - } - pc.AdditionalProperties[k] = additionalProperties - } - case "startDate": - if v != nil { - var startDate date.Time - err = json.Unmarshal(*v, &startDate) - if err != nil { - return err - } - pc.StartDate = &startDate - } - case "endDate": - if v != nil { - var endDate date.Time - err = json.Unmarshal(*v, &endDate) - if err != nil { - return err - } - pc.EndDate = &endDate - } - case "keyId": - if v != nil { - var keyID string - err = json.Unmarshal(*v, &keyID) - if err != nil { - return err - } - pc.KeyID = &keyID - } - case "value": - if v != nil { - var value string - err = json.Unmarshal(*v, &value) - if err != nil { - return err - } - pc.Value = &value - } - case "customKeyIdentifier": - if v != nil { - var customKeyIdentifier []byte - err = json.Unmarshal(*v, &customKeyIdentifier) - if err != nil { - return err - } - pc.CustomKeyIdentifier = &customKeyIdentifier - } - } - } - - return nil -} - -// PasswordCredentialListResult passwordCredential list operation result. -type PasswordCredentialListResult struct { - autorest.Response `json:"-"` - // Value - A collection of PasswordCredentials. - Value *[]PasswordCredential `json:"value,omitempty"` -} - -// PasswordCredentialsUpdateParameters request parameters for a PasswordCredentials update operation. -type PasswordCredentialsUpdateParameters struct { - // Value - A collection of PasswordCredentials. - Value *[]PasswordCredential `json:"value,omitempty"` -} - -// PasswordProfile the password profile associated with a user. -type PasswordProfile struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Password - Password - Password *string `json:"password,omitempty"` - // ForceChangePasswordNextLogin - Whether to force a password change on next login. - ForceChangePasswordNextLogin *bool `json:"forceChangePasswordNextLogin,omitempty"` -} - -// MarshalJSON is the custom marshaler for PasswordProfile. -func (pp PasswordProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pp.Password != nil { - objectMap["password"] = pp.Password - } - if pp.ForceChangePasswordNextLogin != nil { - objectMap["forceChangePasswordNextLogin"] = pp.ForceChangePasswordNextLogin - } - for k, v := range pp.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PasswordProfile struct. -func (pp *PasswordProfile) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if pp.AdditionalProperties == nil { - pp.AdditionalProperties = make(map[string]interface{}) - } - pp.AdditionalProperties[k] = additionalProperties - } - case "password": - if v != nil { - var password string - err = json.Unmarshal(*v, &password) - if err != nil { - return err - } - pp.Password = &password - } - case "forceChangePasswordNextLogin": - if v != nil { - var forceChangePasswordNextLogin bool - err = json.Unmarshal(*v, &forceChangePasswordNextLogin) - if err != nil { - return err - } - pp.ForceChangePasswordNextLogin = &forceChangePasswordNextLogin - } - } - } - - return nil -} - -// PreAuthorizedApplication contains information about pre authorized client application. -type PreAuthorizedApplication struct { - // AppID - Represents the application id. - AppID *string `json:"appId,omitempty"` - // Permissions - Collection of required app permissions/entitlements from the resource application. - Permissions *[]PreAuthorizedApplicationPermission `json:"permissions,omitempty"` - // Extensions - Collection of extensions from the resource application. - Extensions *[]PreAuthorizedApplicationExtension `json:"extensions,omitempty"` -} - -// PreAuthorizedApplicationExtension representation of an app PreAuthorizedApplicationExtension required by -// a pre authorized client app. -type PreAuthorizedApplicationExtension struct { - // Conditions - The extension's conditions. - Conditions *[]string `json:"conditions,omitempty"` -} - -// PreAuthorizedApplicationPermission contains information about the pre-authorized permissions. -type PreAuthorizedApplicationPermission struct { - // DirectAccessGrant - Indicates whether the permission set is DirectAccess or impersonation. - DirectAccessGrant *bool `json:"directAccessGrant,omitempty"` - // AccessGrants - The list of permissions. - AccessGrants *[]string `json:"accessGrants,omitempty"` -} - -// RequiredResourceAccess specifies the set of OAuth 2.0 permission scopes and app roles under the -// specified resource that an application requires access to. The specified OAuth 2.0 permission scopes may -// be requested by client applications (through the requiredResourceAccess collection) when calling a -// resource application. The requiredResourceAccess property of the Application entity is a collection of -// RequiredResourceAccess. -type RequiredResourceAccess struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // ResourceAccess - The list of OAuth2.0 permission scopes and app roles that the application requires from the specified resource. - ResourceAccess *[]ResourceAccess `json:"resourceAccess,omitempty"` - // ResourceAppID - The unique identifier for the resource that the application requires access to. This should be equal to the appId declared on the target resource application. - ResourceAppID *string `json:"resourceAppId,omitempty"` -} - -// MarshalJSON is the custom marshaler for RequiredResourceAccess. -func (rra RequiredResourceAccess) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rra.ResourceAccess != nil { - objectMap["resourceAccess"] = rra.ResourceAccess - } - if rra.ResourceAppID != nil { - objectMap["resourceAppId"] = rra.ResourceAppID - } - for k, v := range rra.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RequiredResourceAccess struct. -func (rra *RequiredResourceAccess) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if rra.AdditionalProperties == nil { - rra.AdditionalProperties = make(map[string]interface{}) - } - rra.AdditionalProperties[k] = additionalProperties - } - case "resourceAccess": - if v != nil { - var resourceAccess []ResourceAccess - err = json.Unmarshal(*v, &resourceAccess) - if err != nil { - return err - } - rra.ResourceAccess = &resourceAccess - } - case "resourceAppId": - if v != nil { - var resourceAppID string - err = json.Unmarshal(*v, &resourceAppID) - if err != nil { - return err - } - rra.ResourceAppID = &resourceAppID - } - } - } - - return nil -} - -// ResourceAccess specifies an OAuth 2.0 permission scope or an app role that an application requires. The -// resourceAccess property of the RequiredResourceAccess type is a collection of ResourceAccess. -type ResourceAccess struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // ID - The unique identifier for one of the OAuth2Permission or AppRole instances that the resource application exposes. - ID *string `json:"id,omitempty"` - // Type - Specifies whether the id property references an OAuth2Permission or an AppRole. Possible values are "scope" or "role". - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceAccess. -func (ra ResourceAccess) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ra.ID != nil { - objectMap["id"] = ra.ID - } - if ra.Type != nil { - objectMap["type"] = ra.Type - } - for k, v := range ra.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ResourceAccess struct. -func (ra *ResourceAccess) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if ra.AdditionalProperties == nil { - ra.AdditionalProperties = make(map[string]interface{}) - } - ra.AdditionalProperties[k] = additionalProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ra.ID = &ID - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ra.Type = &typeVar - } - } - } - - return nil -} - -// ServicePrincipal active Directory service principal information. -type ServicePrincipal struct { - autorest.Response `json:"-"` - // AccountEnabled - whether or not the service principal account is enabled - AccountEnabled *bool `json:"accountEnabled,omitempty"` - // AlternativeNames - alternative names - AlternativeNames *[]string `json:"alternativeNames,omitempty"` - // AppDisplayName - READ-ONLY; The display name exposed by the associated application. - AppDisplayName *string `json:"appDisplayName,omitempty"` - // AppID - The application ID. - AppID *string `json:"appId,omitempty"` - // AppOwnerTenantID - READ-ONLY - AppOwnerTenantID *string `json:"appOwnerTenantId,omitempty"` - // AppRoleAssignmentRequired - Specifies whether an AppRoleAssignment to a user or group is required before Azure AD will issue a user or access token to the application. - AppRoleAssignmentRequired *bool `json:"appRoleAssignmentRequired,omitempty"` - // AppRoles - The collection of application roles that an application may declare. These roles can be assigned to users, groups or service principals. - AppRoles *[]AppRole `json:"appRoles,omitempty"` - // DisplayName - The display name of the service principal. - DisplayName *string `json:"displayName,omitempty"` - // ErrorURL - A URL provided by the author of the associated application to report errors when using the application. - ErrorURL *string `json:"errorUrl,omitempty"` - // Homepage - The URL to the homepage of the associated application. - Homepage *string `json:"homepage,omitempty"` - // KeyCredentials - The collection of key credentials associated with the service principal. - KeyCredentials *[]KeyCredential `json:"keyCredentials,omitempty"` - // LogoutURL - A URL provided by the author of the associated application to logout - LogoutURL *string `json:"logoutUrl,omitempty"` - // Oauth2Permissions - READ-ONLY; The OAuth 2.0 permissions exposed by the associated application. - Oauth2Permissions *[]OAuth2Permission `json:"oauth2Permissions,omitempty"` - // PasswordCredentials - The collection of password credentials associated with the service principal. - PasswordCredentials *[]PasswordCredential `json:"passwordCredentials,omitempty"` - // PreferredTokenSigningKeyThumbprint - The thumbprint of preferred certificate to sign the token - PreferredTokenSigningKeyThumbprint *string `json:"preferredTokenSigningKeyThumbprint,omitempty"` - // PublisherName - The publisher's name of the associated application - PublisherName *string `json:"publisherName,omitempty"` - // ReplyUrls - The URLs that user tokens are sent to for sign in with the associated application. The redirect URIs that the oAuth 2.0 authorization code and access tokens are sent to for the associated application. - ReplyUrls *[]string `json:"replyUrls,omitempty"` - // SamlMetadataURL - The URL to the SAML metadata of the associated application - SamlMetadataURL *string `json:"samlMetadataUrl,omitempty"` - // ServicePrincipalNames - A collection of service principal names. - ServicePrincipalNames *[]string `json:"servicePrincipalNames,omitempty"` - // ServicePrincipalType - the type of the service principal - ServicePrincipalType *string `json:"servicePrincipalType,omitempty"` - // Tags - Optional list of tags that you can apply to your service principals. Not nullable. - Tags *[]string `json:"tags,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // ObjectID - READ-ONLY; The object ID. - ObjectID *string `json:"objectId,omitempty"` - // DeletionTimestamp - READ-ONLY; The time at which the directory object was deleted. - DeletionTimestamp *date.Time `json:"deletionTimestamp,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeDirectoryObject', 'ObjectTypeApplication', 'ObjectTypeGroup', 'ObjectTypeServicePrincipal', 'ObjectTypeUser' - ObjectType ObjectType `json:"objectType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServicePrincipal. -func (sp ServicePrincipal) MarshalJSON() ([]byte, error) { - sp.ObjectType = ObjectTypeServicePrincipal - objectMap := make(map[string]interface{}) - if sp.AccountEnabled != nil { - objectMap["accountEnabled"] = sp.AccountEnabled - } - if sp.AlternativeNames != nil { - objectMap["alternativeNames"] = sp.AlternativeNames - } - if sp.AppID != nil { - objectMap["appId"] = sp.AppID - } - if sp.AppRoleAssignmentRequired != nil { - objectMap["appRoleAssignmentRequired"] = sp.AppRoleAssignmentRequired - } - if sp.AppRoles != nil { - objectMap["appRoles"] = sp.AppRoles - } - if sp.DisplayName != nil { - objectMap["displayName"] = sp.DisplayName - } - if sp.ErrorURL != nil { - objectMap["errorUrl"] = sp.ErrorURL - } - if sp.Homepage != nil { - objectMap["homepage"] = sp.Homepage - } - if sp.KeyCredentials != nil { - objectMap["keyCredentials"] = sp.KeyCredentials - } - if sp.LogoutURL != nil { - objectMap["logoutUrl"] = sp.LogoutURL - } - if sp.PasswordCredentials != nil { - objectMap["passwordCredentials"] = sp.PasswordCredentials - } - if sp.PreferredTokenSigningKeyThumbprint != nil { - objectMap["preferredTokenSigningKeyThumbprint"] = sp.PreferredTokenSigningKeyThumbprint - } - if sp.PublisherName != nil { - objectMap["publisherName"] = sp.PublisherName - } - if sp.ReplyUrls != nil { - objectMap["replyUrls"] = sp.ReplyUrls - } - if sp.SamlMetadataURL != nil { - objectMap["samlMetadataUrl"] = sp.SamlMetadataURL - } - if sp.ServicePrincipalNames != nil { - objectMap["servicePrincipalNames"] = sp.ServicePrincipalNames - } - if sp.ServicePrincipalType != nil { - objectMap["servicePrincipalType"] = sp.ServicePrincipalType - } - if sp.Tags != nil { - objectMap["tags"] = sp.Tags - } - if sp.ObjectType != "" { - objectMap["objectType"] = sp.ObjectType - } - for k, v := range sp.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsApplication is the BasicDirectoryObject implementation for ServicePrincipal. -func (sp ServicePrincipal) AsApplication() (*Application, bool) { - return nil, false -} - -// AsADGroup is the BasicDirectoryObject implementation for ServicePrincipal. -func (sp ServicePrincipal) AsADGroup() (*ADGroup, bool) { - return nil, false -} - -// AsServicePrincipal is the BasicDirectoryObject implementation for ServicePrincipal. -func (sp ServicePrincipal) AsServicePrincipal() (*ServicePrincipal, bool) { - return &sp, true -} - -// AsUser is the BasicDirectoryObject implementation for ServicePrincipal. -func (sp ServicePrincipal) AsUser() (*User, bool) { - return nil, false -} - -// AsDirectoryObject is the BasicDirectoryObject implementation for ServicePrincipal. -func (sp ServicePrincipal) AsDirectoryObject() (*DirectoryObject, bool) { - return nil, false -} - -// AsBasicDirectoryObject is the BasicDirectoryObject implementation for ServicePrincipal. -func (sp ServicePrincipal) AsBasicDirectoryObject() (BasicDirectoryObject, bool) { - return &sp, true -} - -// UnmarshalJSON is the custom unmarshaler for ServicePrincipal struct. -func (sp *ServicePrincipal) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "accountEnabled": - if v != nil { - var accountEnabled bool - err = json.Unmarshal(*v, &accountEnabled) - if err != nil { - return err - } - sp.AccountEnabled = &accountEnabled - } - case "alternativeNames": - if v != nil { - var alternativeNames []string - err = json.Unmarshal(*v, &alternativeNames) - if err != nil { - return err - } - sp.AlternativeNames = &alternativeNames - } - case "appDisplayName": - if v != nil { - var appDisplayName string - err = json.Unmarshal(*v, &appDisplayName) - if err != nil { - return err - } - sp.AppDisplayName = &appDisplayName - } - case "appId": - if v != nil { - var appID string - err = json.Unmarshal(*v, &appID) - if err != nil { - return err - } - sp.AppID = &appID - } - case "appOwnerTenantId": - if v != nil { - var appOwnerTenantID string - err = json.Unmarshal(*v, &appOwnerTenantID) - if err != nil { - return err - } - sp.AppOwnerTenantID = &appOwnerTenantID - } - case "appRoleAssignmentRequired": - if v != nil { - var appRoleAssignmentRequired bool - err = json.Unmarshal(*v, &appRoleAssignmentRequired) - if err != nil { - return err - } - sp.AppRoleAssignmentRequired = &appRoleAssignmentRequired - } - case "appRoles": - if v != nil { - var appRoles []AppRole - err = json.Unmarshal(*v, &appRoles) - if err != nil { - return err - } - sp.AppRoles = &appRoles - } - case "displayName": - if v != nil { - var displayName string - err = json.Unmarshal(*v, &displayName) - if err != nil { - return err - } - sp.DisplayName = &displayName - } - case "errorUrl": - if v != nil { - var errorURL string - err = json.Unmarshal(*v, &errorURL) - if err != nil { - return err - } - sp.ErrorURL = &errorURL - } - case "homepage": - if v != nil { - var homepage string - err = json.Unmarshal(*v, &homepage) - if err != nil { - return err - } - sp.Homepage = &homepage - } - case "keyCredentials": - if v != nil { - var keyCredentials []KeyCredential - err = json.Unmarshal(*v, &keyCredentials) - if err != nil { - return err - } - sp.KeyCredentials = &keyCredentials - } - case "logoutUrl": - if v != nil { - var logoutURL string - err = json.Unmarshal(*v, &logoutURL) - if err != nil { - return err - } - sp.LogoutURL = &logoutURL - } - case "oauth2Permissions": - if v != nil { - var oauth2Permissions []OAuth2Permission - err = json.Unmarshal(*v, &oauth2Permissions) - if err != nil { - return err - } - sp.Oauth2Permissions = &oauth2Permissions - } - case "passwordCredentials": - if v != nil { - var passwordCredentials []PasswordCredential - err = json.Unmarshal(*v, &passwordCredentials) - if err != nil { - return err - } - sp.PasswordCredentials = &passwordCredentials - } - case "preferredTokenSigningKeyThumbprint": - if v != nil { - var preferredTokenSigningKeyThumbprint string - err = json.Unmarshal(*v, &preferredTokenSigningKeyThumbprint) - if err != nil { - return err - } - sp.PreferredTokenSigningKeyThumbprint = &preferredTokenSigningKeyThumbprint - } - case "publisherName": - if v != nil { - var publisherName string - err = json.Unmarshal(*v, &publisherName) - if err != nil { - return err - } - sp.PublisherName = &publisherName - } - case "replyUrls": - if v != nil { - var replyUrls []string - err = json.Unmarshal(*v, &replyUrls) - if err != nil { - return err - } - sp.ReplyUrls = &replyUrls - } - case "samlMetadataUrl": - if v != nil { - var samlMetadataURL string - err = json.Unmarshal(*v, &samlMetadataURL) - if err != nil { - return err - } - sp.SamlMetadataURL = &samlMetadataURL - } - case "servicePrincipalNames": - if v != nil { - var servicePrincipalNames []string - err = json.Unmarshal(*v, &servicePrincipalNames) - if err != nil { - return err - } - sp.ServicePrincipalNames = &servicePrincipalNames - } - case "servicePrincipalType": - if v != nil { - var servicePrincipalType string - err = json.Unmarshal(*v, &servicePrincipalType) - if err != nil { - return err - } - sp.ServicePrincipalType = &servicePrincipalType - } - case "tags": - if v != nil { - var tags []string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sp.Tags = &tags - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if sp.AdditionalProperties == nil { - sp.AdditionalProperties = make(map[string]interface{}) - } - sp.AdditionalProperties[k] = additionalProperties - } - case "objectId": - if v != nil { - var objectID string - err = json.Unmarshal(*v, &objectID) - if err != nil { - return err - } - sp.ObjectID = &objectID - } - case "deletionTimestamp": - if v != nil { - var deletionTimestamp date.Time - err = json.Unmarshal(*v, &deletionTimestamp) - if err != nil { - return err - } - sp.DeletionTimestamp = &deletionTimestamp - } - case "objectType": - if v != nil { - var objectType ObjectType - err = json.Unmarshal(*v, &objectType) - if err != nil { - return err - } - sp.ObjectType = objectType - } - } - } - - return nil -} - -// ServicePrincipalBase active Directory service principal common properties shared among GET, POST and -// PATCH -type ServicePrincipalBase struct { - // AccountEnabled - whether or not the service principal account is enabled - AccountEnabled *bool `json:"accountEnabled,omitempty"` - // AppRoleAssignmentRequired - Specifies whether an AppRoleAssignment to a user or group is required before Azure AD will issue a user or access token to the application. - AppRoleAssignmentRequired *bool `json:"appRoleAssignmentRequired,omitempty"` - // KeyCredentials - The collection of key credentials associated with the service principal. - KeyCredentials *[]KeyCredential `json:"keyCredentials,omitempty"` - // PasswordCredentials - The collection of password credentials associated with the service principal. - PasswordCredentials *[]PasswordCredential `json:"passwordCredentials,omitempty"` - // ServicePrincipalType - the type of the service principal - ServicePrincipalType *string `json:"servicePrincipalType,omitempty"` - // Tags - Optional list of tags that you can apply to your service principals. Not nullable. - Tags *[]string `json:"tags,omitempty"` -} - -// ServicePrincipalCreateParameters request parameters for creating a new service principal. -type ServicePrincipalCreateParameters struct { - // AppID - The application ID. - AppID *string `json:"appId,omitempty"` - // AccountEnabled - whether or not the service principal account is enabled - AccountEnabled *bool `json:"accountEnabled,omitempty"` - // AppRoleAssignmentRequired - Specifies whether an AppRoleAssignment to a user or group is required before Azure AD will issue a user or access token to the application. - AppRoleAssignmentRequired *bool `json:"appRoleAssignmentRequired,omitempty"` - // KeyCredentials - The collection of key credentials associated with the service principal. - KeyCredentials *[]KeyCredential `json:"keyCredentials,omitempty"` - // PasswordCredentials - The collection of password credentials associated with the service principal. - PasswordCredentials *[]PasswordCredential `json:"passwordCredentials,omitempty"` - // ServicePrincipalType - the type of the service principal - ServicePrincipalType *string `json:"servicePrincipalType,omitempty"` - // Tags - Optional list of tags that you can apply to your service principals. Not nullable. - Tags *[]string `json:"tags,omitempty"` -} - -// ServicePrincipalListResult server response for get tenant service principals API call. -type ServicePrincipalListResult struct { - autorest.Response `json:"-"` - // Value - the list of service principals. - Value *[]ServicePrincipal `json:"value,omitempty"` - // OdataNextLink - the URL to get the next set of results. - OdataNextLink *string `json:"odata.nextLink,omitempty"` -} - -// ServicePrincipalListResultIterator provides access to a complete listing of ServicePrincipal values. -type ServicePrincipalListResultIterator struct { - i int - page ServicePrincipalListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ServicePrincipalListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicePrincipalListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ServicePrincipalListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServicePrincipalListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ServicePrincipalListResultIterator) Response() ServicePrincipalListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ServicePrincipalListResultIterator) Value() ServicePrincipal { - if !iter.page.NotDone() { - return ServicePrincipal{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServicePrincipalListResultIterator type. -func NewServicePrincipalListResultIterator(page ServicePrincipalListResultPage) ServicePrincipalListResultIterator { - return ServicePrincipalListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (splr ServicePrincipalListResult) IsEmpty() bool { - return splr.Value == nil || len(*splr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (splr ServicePrincipalListResult) hasNextLink() bool { - return splr.OdataNextLink != nil && len(*splr.OdataNextLink) != 0 -} - -// ServicePrincipalListResultPage contains a page of ServicePrincipal values. -type ServicePrincipalListResultPage struct { - fn func(context.Context, ServicePrincipalListResult) (ServicePrincipalListResult, error) - splr ServicePrincipalListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ServicePrincipalListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicePrincipalListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.splr) - if err != nil { - return err - } - page.splr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ServicePrincipalListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServicePrincipalListResultPage) NotDone() bool { - return !page.splr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServicePrincipalListResultPage) Response() ServicePrincipalListResult { - return page.splr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServicePrincipalListResultPage) Values() []ServicePrincipal { - if page.splr.IsEmpty() { - return nil - } - return *page.splr.Value -} - -// Creates a new instance of the ServicePrincipalListResultPage type. -func NewServicePrincipalListResultPage(cur ServicePrincipalListResult, getNextPage func(context.Context, ServicePrincipalListResult) (ServicePrincipalListResult, error)) ServicePrincipalListResultPage { - return ServicePrincipalListResultPage{ - fn: getNextPage, - splr: cur, - } -} - -// ServicePrincipalObjectResult service Principal Object Result. -type ServicePrincipalObjectResult struct { - autorest.Response `json:"-"` - // Value - The Object ID of the service principal with the specified application ID. - Value *string `json:"value,omitempty"` - // OdataMetadata - The URL representing edm equivalent. - OdataMetadata *string `json:"odata.metadata,omitempty"` -} - -// ServicePrincipalUpdateParameters request parameters for update an existing service principal. -type ServicePrincipalUpdateParameters struct { - // AccountEnabled - whether or not the service principal account is enabled - AccountEnabled *bool `json:"accountEnabled,omitempty"` - // AppRoleAssignmentRequired - Specifies whether an AppRoleAssignment to a user or group is required before Azure AD will issue a user or access token to the application. - AppRoleAssignmentRequired *bool `json:"appRoleAssignmentRequired,omitempty"` - // KeyCredentials - The collection of key credentials associated with the service principal. - KeyCredentials *[]KeyCredential `json:"keyCredentials,omitempty"` - // PasswordCredentials - The collection of password credentials associated with the service principal. - PasswordCredentials *[]PasswordCredential `json:"passwordCredentials,omitempty"` - // ServicePrincipalType - the type of the service principal - ServicePrincipalType *string `json:"servicePrincipalType,omitempty"` - // Tags - Optional list of tags that you can apply to your service principals. Not nullable. - Tags *[]string `json:"tags,omitempty"` -} - -// SignInName contains information about a sign-in name of a local account user in an Azure Active -// Directory B2C tenant. -type SignInName struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // Type - A string value that can be used to classify user sign-in types in your directory, such as 'emailAddress' or 'userName'. - Type *string `json:"type,omitempty"` - // Value - The sign-in used by the local account. Must be unique across the company/tenant. For example, 'johnc@example.com'. - Value *string `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SignInName. -func (sin SignInName) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sin.Type != nil { - objectMap["type"] = sin.Type - } - if sin.Value != nil { - objectMap["value"] = sin.Value - } - for k, v := range sin.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SignInName struct. -func (sin *SignInName) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if sin.AdditionalProperties == nil { - sin.AdditionalProperties = make(map[string]interface{}) - } - sin.AdditionalProperties[k] = additionalProperties - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sin.Type = &typeVar - } - case "value": - if v != nil { - var value string - err = json.Unmarshal(*v, &value) - if err != nil { - return err - } - sin.Value = &value - } - } - } - - return nil -} - -// User active Directory user information. -type User struct { - autorest.Response `json:"-"` - // ImmutableID - This must be specified if you are using a federated domain for the user's userPrincipalName (UPN) property when creating a new user account. It is used to associate an on-premises Active Directory user account with their Azure AD user object. - ImmutableID *string `json:"immutableId,omitempty"` - // UsageLocation - A two letter country code (ISO standard 3166). Required for users that will be assigned licenses due to legal requirement to check for availability of services in countries. Examples include: "US", "JP", and "GB". - UsageLocation *string `json:"usageLocation,omitempty"` - // GivenName - The given name for the user. - GivenName *string `json:"givenName,omitempty"` - // Surname - The user's surname (family name or last name). - Surname *string `json:"surname,omitempty"` - // UserType - A string value that can be used to classify user types in your directory, such as 'Member' and 'Guest'. Possible values include: 'Member', 'Guest' - UserType UserType `json:"userType,omitempty"` - // AccountEnabled - Whether the account is enabled. - AccountEnabled *bool `json:"accountEnabled,omitempty"` - // DisplayName - The display name of the user. - DisplayName *string `json:"displayName,omitempty"` - // UserPrincipalName - The principal name of the user. - UserPrincipalName *string `json:"userPrincipalName,omitempty"` - // MailNickname - The mail alias for the user. - MailNickname *string `json:"mailNickname,omitempty"` - // Mail - The primary email address of the user. - Mail *string `json:"mail,omitempty"` - // SignInNames - The sign-in names of the user. - SignInNames *[]SignInName `json:"signInNames,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // ObjectID - READ-ONLY; The object ID. - ObjectID *string `json:"objectId,omitempty"` - // DeletionTimestamp - READ-ONLY; The time at which the directory object was deleted. - DeletionTimestamp *date.Time `json:"deletionTimestamp,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeDirectoryObject', 'ObjectTypeApplication', 'ObjectTypeGroup', 'ObjectTypeServicePrincipal', 'ObjectTypeUser' - ObjectType ObjectType `json:"objectType,omitempty"` -} - -// MarshalJSON is the custom marshaler for User. -func (u User) MarshalJSON() ([]byte, error) { - u.ObjectType = ObjectTypeUser - objectMap := make(map[string]interface{}) - if u.ImmutableID != nil { - objectMap["immutableId"] = u.ImmutableID - } - if u.UsageLocation != nil { - objectMap["usageLocation"] = u.UsageLocation - } - if u.GivenName != nil { - objectMap["givenName"] = u.GivenName - } - if u.Surname != nil { - objectMap["surname"] = u.Surname - } - if u.UserType != "" { - objectMap["userType"] = u.UserType - } - if u.AccountEnabled != nil { - objectMap["accountEnabled"] = u.AccountEnabled - } - if u.DisplayName != nil { - objectMap["displayName"] = u.DisplayName - } - if u.UserPrincipalName != nil { - objectMap["userPrincipalName"] = u.UserPrincipalName - } - if u.MailNickname != nil { - objectMap["mailNickname"] = u.MailNickname - } - if u.Mail != nil { - objectMap["mail"] = u.Mail - } - if u.SignInNames != nil { - objectMap["signInNames"] = u.SignInNames - } - if u.ObjectType != "" { - objectMap["objectType"] = u.ObjectType - } - for k, v := range u.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// AsApplication is the BasicDirectoryObject implementation for User. -func (u User) AsApplication() (*Application, bool) { - return nil, false -} - -// AsADGroup is the BasicDirectoryObject implementation for User. -func (u User) AsADGroup() (*ADGroup, bool) { - return nil, false -} - -// AsServicePrincipal is the BasicDirectoryObject implementation for User. -func (u User) AsServicePrincipal() (*ServicePrincipal, bool) { - return nil, false -} - -// AsUser is the BasicDirectoryObject implementation for User. -func (u User) AsUser() (*User, bool) { - return &u, true -} - -// AsDirectoryObject is the BasicDirectoryObject implementation for User. -func (u User) AsDirectoryObject() (*DirectoryObject, bool) { - return nil, false -} - -// AsBasicDirectoryObject is the BasicDirectoryObject implementation for User. -func (u User) AsBasicDirectoryObject() (BasicDirectoryObject, bool) { - return &u, true -} - -// UnmarshalJSON is the custom unmarshaler for User struct. -func (u *User) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "immutableId": - if v != nil { - var immutableID string - err = json.Unmarshal(*v, &immutableID) - if err != nil { - return err - } - u.ImmutableID = &immutableID - } - case "usageLocation": - if v != nil { - var usageLocation string - err = json.Unmarshal(*v, &usageLocation) - if err != nil { - return err - } - u.UsageLocation = &usageLocation - } - case "givenName": - if v != nil { - var givenName string - err = json.Unmarshal(*v, &givenName) - if err != nil { - return err - } - u.GivenName = &givenName - } - case "surname": - if v != nil { - var surname string - err = json.Unmarshal(*v, &surname) - if err != nil { - return err - } - u.Surname = &surname - } - case "userType": - if v != nil { - var userType UserType - err = json.Unmarshal(*v, &userType) - if err != nil { - return err - } - u.UserType = userType - } - case "accountEnabled": - if v != nil { - var accountEnabled bool - err = json.Unmarshal(*v, &accountEnabled) - if err != nil { - return err - } - u.AccountEnabled = &accountEnabled - } - case "displayName": - if v != nil { - var displayName string - err = json.Unmarshal(*v, &displayName) - if err != nil { - return err - } - u.DisplayName = &displayName - } - case "userPrincipalName": - if v != nil { - var userPrincipalName string - err = json.Unmarshal(*v, &userPrincipalName) - if err != nil { - return err - } - u.UserPrincipalName = &userPrincipalName - } - case "mailNickname": - if v != nil { - var mailNickname string - err = json.Unmarshal(*v, &mailNickname) - if err != nil { - return err - } - u.MailNickname = &mailNickname - } - case "mail": - if v != nil { - var mailVar string - err = json.Unmarshal(*v, &mailVar) - if err != nil { - return err - } - u.Mail = &mailVar - } - case "signInNames": - if v != nil { - var signInNames []SignInName - err = json.Unmarshal(*v, &signInNames) - if err != nil { - return err - } - u.SignInNames = &signInNames - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if u.AdditionalProperties == nil { - u.AdditionalProperties = make(map[string]interface{}) - } - u.AdditionalProperties[k] = additionalProperties - } - case "objectId": - if v != nil { - var objectID string - err = json.Unmarshal(*v, &objectID) - if err != nil { - return err - } - u.ObjectID = &objectID - } - case "deletionTimestamp": - if v != nil { - var deletionTimestamp date.Time - err = json.Unmarshal(*v, &deletionTimestamp) - if err != nil { - return err - } - u.DeletionTimestamp = &deletionTimestamp - } - case "objectType": - if v != nil { - var objectType ObjectType - err = json.Unmarshal(*v, &objectType) - if err != nil { - return err - } - u.ObjectType = objectType - } - } - } - - return nil -} - -// UserBase ... -type UserBase struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // ImmutableID - This must be specified if you are using a federated domain for the user's userPrincipalName (UPN) property when creating a new user account. It is used to associate an on-premises Active Directory user account with their Azure AD user object. - ImmutableID *string `json:"immutableId,omitempty"` - // UsageLocation - A two letter country code (ISO standard 3166). Required for users that will be assigned licenses due to legal requirement to check for availability of services in countries. Examples include: "US", "JP", and "GB". - UsageLocation *string `json:"usageLocation,omitempty"` - // GivenName - The given name for the user. - GivenName *string `json:"givenName,omitempty"` - // Surname - The user's surname (family name or last name). - Surname *string `json:"surname,omitempty"` - // UserType - A string value that can be used to classify user types in your directory, such as 'Member' and 'Guest'. Possible values include: 'Member', 'Guest' - UserType UserType `json:"userType,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserBase. -func (ub UserBase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ub.ImmutableID != nil { - objectMap["immutableId"] = ub.ImmutableID - } - if ub.UsageLocation != nil { - objectMap["usageLocation"] = ub.UsageLocation - } - if ub.GivenName != nil { - objectMap["givenName"] = ub.GivenName - } - if ub.Surname != nil { - objectMap["surname"] = ub.Surname - } - if ub.UserType != "" { - objectMap["userType"] = ub.UserType - } - for k, v := range ub.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for UserBase struct. -func (ub *UserBase) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if ub.AdditionalProperties == nil { - ub.AdditionalProperties = make(map[string]interface{}) - } - ub.AdditionalProperties[k] = additionalProperties - } - case "immutableId": - if v != nil { - var immutableID string - err = json.Unmarshal(*v, &immutableID) - if err != nil { - return err - } - ub.ImmutableID = &immutableID - } - case "usageLocation": - if v != nil { - var usageLocation string - err = json.Unmarshal(*v, &usageLocation) - if err != nil { - return err - } - ub.UsageLocation = &usageLocation - } - case "givenName": - if v != nil { - var givenName string - err = json.Unmarshal(*v, &givenName) - if err != nil { - return err - } - ub.GivenName = &givenName - } - case "surname": - if v != nil { - var surname string - err = json.Unmarshal(*v, &surname) - if err != nil { - return err - } - ub.Surname = &surname - } - case "userType": - if v != nil { - var userType UserType - err = json.Unmarshal(*v, &userType) - if err != nil { - return err - } - ub.UserType = userType - } - } - } - - return nil -} - -// UserCreateParameters request parameters for creating a new work or school account user. -type UserCreateParameters struct { - // AccountEnabled - Whether the account is enabled. - AccountEnabled *bool `json:"accountEnabled,omitempty"` - // DisplayName - The display name of the user. - DisplayName *string `json:"displayName,omitempty"` - // PasswordProfile - Password Profile - PasswordProfile *PasswordProfile `json:"passwordProfile,omitempty"` - // UserPrincipalName - The user principal name (someuser@contoso.com). It must contain one of the verified domains for the tenant. - UserPrincipalName *string `json:"userPrincipalName,omitempty"` - // MailNickname - The mail alias for the user. - MailNickname *string `json:"mailNickname,omitempty"` - // Mail - The primary email address of the user. - Mail *string `json:"mail,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // ImmutableID - This must be specified if you are using a federated domain for the user's userPrincipalName (UPN) property when creating a new user account. It is used to associate an on-premises Active Directory user account with their Azure AD user object. - ImmutableID *string `json:"immutableId,omitempty"` - // UsageLocation - A two letter country code (ISO standard 3166). Required for users that will be assigned licenses due to legal requirement to check for availability of services in countries. Examples include: "US", "JP", and "GB". - UsageLocation *string `json:"usageLocation,omitempty"` - // GivenName - The given name for the user. - GivenName *string `json:"givenName,omitempty"` - // Surname - The user's surname (family name or last name). - Surname *string `json:"surname,omitempty"` - // UserType - A string value that can be used to classify user types in your directory, such as 'Member' and 'Guest'. Possible values include: 'Member', 'Guest' - UserType UserType `json:"userType,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserCreateParameters. -func (ucp UserCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ucp.AccountEnabled != nil { - objectMap["accountEnabled"] = ucp.AccountEnabled - } - if ucp.DisplayName != nil { - objectMap["displayName"] = ucp.DisplayName - } - if ucp.PasswordProfile != nil { - objectMap["passwordProfile"] = ucp.PasswordProfile - } - if ucp.UserPrincipalName != nil { - objectMap["userPrincipalName"] = ucp.UserPrincipalName - } - if ucp.MailNickname != nil { - objectMap["mailNickname"] = ucp.MailNickname - } - if ucp.Mail != nil { - objectMap["mail"] = ucp.Mail - } - if ucp.ImmutableID != nil { - objectMap["immutableId"] = ucp.ImmutableID - } - if ucp.UsageLocation != nil { - objectMap["usageLocation"] = ucp.UsageLocation - } - if ucp.GivenName != nil { - objectMap["givenName"] = ucp.GivenName - } - if ucp.Surname != nil { - objectMap["surname"] = ucp.Surname - } - if ucp.UserType != "" { - objectMap["userType"] = ucp.UserType - } - for k, v := range ucp.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for UserCreateParameters struct. -func (ucp *UserCreateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "accountEnabled": - if v != nil { - var accountEnabled bool - err = json.Unmarshal(*v, &accountEnabled) - if err != nil { - return err - } - ucp.AccountEnabled = &accountEnabled - } - case "displayName": - if v != nil { - var displayName string - err = json.Unmarshal(*v, &displayName) - if err != nil { - return err - } - ucp.DisplayName = &displayName - } - case "passwordProfile": - if v != nil { - var passwordProfile PasswordProfile - err = json.Unmarshal(*v, &passwordProfile) - if err != nil { - return err - } - ucp.PasswordProfile = &passwordProfile - } - case "userPrincipalName": - if v != nil { - var userPrincipalName string - err = json.Unmarshal(*v, &userPrincipalName) - if err != nil { - return err - } - ucp.UserPrincipalName = &userPrincipalName - } - case "mailNickname": - if v != nil { - var mailNickname string - err = json.Unmarshal(*v, &mailNickname) - if err != nil { - return err - } - ucp.MailNickname = &mailNickname - } - case "mail": - if v != nil { - var mailVar string - err = json.Unmarshal(*v, &mailVar) - if err != nil { - return err - } - ucp.Mail = &mailVar - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if ucp.AdditionalProperties == nil { - ucp.AdditionalProperties = make(map[string]interface{}) - } - ucp.AdditionalProperties[k] = additionalProperties - } - case "immutableId": - if v != nil { - var immutableID string - err = json.Unmarshal(*v, &immutableID) - if err != nil { - return err - } - ucp.ImmutableID = &immutableID - } - case "usageLocation": - if v != nil { - var usageLocation string - err = json.Unmarshal(*v, &usageLocation) - if err != nil { - return err - } - ucp.UsageLocation = &usageLocation - } - case "givenName": - if v != nil { - var givenName string - err = json.Unmarshal(*v, &givenName) - if err != nil { - return err - } - ucp.GivenName = &givenName - } - case "surname": - if v != nil { - var surname string - err = json.Unmarshal(*v, &surname) - if err != nil { - return err - } - ucp.Surname = &surname - } - case "userType": - if v != nil { - var userType UserType - err = json.Unmarshal(*v, &userType) - if err != nil { - return err - } - ucp.UserType = userType - } - } - } - - return nil -} - -// UserGetMemberGroupsParameters request parameters for GetMemberGroups API call. -type UserGetMemberGroupsParameters struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // SecurityEnabledOnly - If true, only membership in security-enabled groups should be checked. Otherwise, membership in all groups should be checked. - SecurityEnabledOnly *bool `json:"securityEnabledOnly,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserGetMemberGroupsParameters. -func (ugmgp UserGetMemberGroupsParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ugmgp.SecurityEnabledOnly != nil { - objectMap["securityEnabledOnly"] = ugmgp.SecurityEnabledOnly - } - for k, v := range ugmgp.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for UserGetMemberGroupsParameters struct. -func (ugmgp *UserGetMemberGroupsParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if ugmgp.AdditionalProperties == nil { - ugmgp.AdditionalProperties = make(map[string]interface{}) - } - ugmgp.AdditionalProperties[k] = additionalProperties - } - case "securityEnabledOnly": - if v != nil { - var securityEnabledOnly bool - err = json.Unmarshal(*v, &securityEnabledOnly) - if err != nil { - return err - } - ugmgp.SecurityEnabledOnly = &securityEnabledOnly - } - } - } - - return nil -} - -// UserGetMemberGroupsResult server response for GetMemberGroups API call. -type UserGetMemberGroupsResult struct { - autorest.Response `json:"-"` - // Value - A collection of group IDs of which the user is a member. - Value *[]string `json:"value,omitempty"` -} - -// UserListResult server response for Get tenant users API call. -type UserListResult struct { - autorest.Response `json:"-"` - // Value - the list of users. - Value *[]User `json:"value,omitempty"` - // OdataNextLink - The URL to get the next set of results. - OdataNextLink *string `json:"odata.nextLink,omitempty"` -} - -// UserListResultIterator provides access to a complete listing of User values. -type UserListResultIterator struct { - i int - page UserListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *UserListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *UserListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter UserListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter UserListResultIterator) Response() UserListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter UserListResultIterator) Value() User { - if !iter.page.NotDone() { - return User{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the UserListResultIterator type. -func NewUserListResultIterator(page UserListResultPage) UserListResultIterator { - return UserListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ulr UserListResult) IsEmpty() bool { - return ulr.Value == nil || len(*ulr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ulr UserListResult) hasNextLink() bool { - return ulr.OdataNextLink != nil && len(*ulr.OdataNextLink) != 0 -} - -// UserListResultPage contains a page of User values. -type UserListResultPage struct { - fn func(context.Context, UserListResult) (UserListResult, error) - ulr UserListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *UserListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ulr) - if err != nil { - return err - } - page.ulr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *UserListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page UserListResultPage) NotDone() bool { - return !page.ulr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page UserListResultPage) Response() UserListResult { - return page.ulr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page UserListResultPage) Values() []User { - if page.ulr.IsEmpty() { - return nil - } - return *page.ulr.Value -} - -// Creates a new instance of the UserListResultPage type. -func NewUserListResultPage(cur UserListResult, getNextPage func(context.Context, UserListResult) (UserListResult, error)) UserListResultPage { - return UserListResultPage{ - fn: getNextPage, - ulr: cur, - } -} - -// UserUpdateParameters request parameters for updating an existing work or school account user. -type UserUpdateParameters struct { - // AccountEnabled - Whether the account is enabled. - AccountEnabled *bool `json:"accountEnabled,omitempty"` - // DisplayName - The display name of the user. - DisplayName *string `json:"displayName,omitempty"` - // PasswordProfile - The password profile of the user. - PasswordProfile *PasswordProfile `json:"passwordProfile,omitempty"` - // UserPrincipalName - The user principal name (someuser@contoso.com). It must contain one of the verified domains for the tenant. - UserPrincipalName *string `json:"userPrincipalName,omitempty"` - // MailNickname - The mail alias for the user. - MailNickname *string `json:"mailNickname,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // ImmutableID - This must be specified if you are using a federated domain for the user's userPrincipalName (UPN) property when creating a new user account. It is used to associate an on-premises Active Directory user account with their Azure AD user object. - ImmutableID *string `json:"immutableId,omitempty"` - // UsageLocation - A two letter country code (ISO standard 3166). Required for users that will be assigned licenses due to legal requirement to check for availability of services in countries. Examples include: "US", "JP", and "GB". - UsageLocation *string `json:"usageLocation,omitempty"` - // GivenName - The given name for the user. - GivenName *string `json:"givenName,omitempty"` - // Surname - The user's surname (family name or last name). - Surname *string `json:"surname,omitempty"` - // UserType - A string value that can be used to classify user types in your directory, such as 'Member' and 'Guest'. Possible values include: 'Member', 'Guest' - UserType UserType `json:"userType,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserUpdateParameters. -func (uup UserUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if uup.AccountEnabled != nil { - objectMap["accountEnabled"] = uup.AccountEnabled - } - if uup.DisplayName != nil { - objectMap["displayName"] = uup.DisplayName - } - if uup.PasswordProfile != nil { - objectMap["passwordProfile"] = uup.PasswordProfile - } - if uup.UserPrincipalName != nil { - objectMap["userPrincipalName"] = uup.UserPrincipalName - } - if uup.MailNickname != nil { - objectMap["mailNickname"] = uup.MailNickname - } - if uup.ImmutableID != nil { - objectMap["immutableId"] = uup.ImmutableID - } - if uup.UsageLocation != nil { - objectMap["usageLocation"] = uup.UsageLocation - } - if uup.GivenName != nil { - objectMap["givenName"] = uup.GivenName - } - if uup.Surname != nil { - objectMap["surname"] = uup.Surname - } - if uup.UserType != "" { - objectMap["userType"] = uup.UserType - } - for k, v := range uup.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for UserUpdateParameters struct. -func (uup *UserUpdateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "accountEnabled": - if v != nil { - var accountEnabled bool - err = json.Unmarshal(*v, &accountEnabled) - if err != nil { - return err - } - uup.AccountEnabled = &accountEnabled - } - case "displayName": - if v != nil { - var displayName string - err = json.Unmarshal(*v, &displayName) - if err != nil { - return err - } - uup.DisplayName = &displayName - } - case "passwordProfile": - if v != nil { - var passwordProfile PasswordProfile - err = json.Unmarshal(*v, &passwordProfile) - if err != nil { - return err - } - uup.PasswordProfile = &passwordProfile - } - case "userPrincipalName": - if v != nil { - var userPrincipalName string - err = json.Unmarshal(*v, &userPrincipalName) - if err != nil { - return err - } - uup.UserPrincipalName = &userPrincipalName - } - case "mailNickname": - if v != nil { - var mailNickname string - err = json.Unmarshal(*v, &mailNickname) - if err != nil { - return err - } - uup.MailNickname = &mailNickname - } - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if uup.AdditionalProperties == nil { - uup.AdditionalProperties = make(map[string]interface{}) - } - uup.AdditionalProperties[k] = additionalProperties - } - case "immutableId": - if v != nil { - var immutableID string - err = json.Unmarshal(*v, &immutableID) - if err != nil { - return err - } - uup.ImmutableID = &immutableID - } - case "usageLocation": - if v != nil { - var usageLocation string - err = json.Unmarshal(*v, &usageLocation) - if err != nil { - return err - } - uup.UsageLocation = &usageLocation - } - case "givenName": - if v != nil { - var givenName string - err = json.Unmarshal(*v, &givenName) - if err != nil { - return err - } - uup.GivenName = &givenName - } - case "surname": - if v != nil { - var surname string - err = json.Unmarshal(*v, &surname) - if err != nil { - return err - } - uup.Surname = &surname - } - case "userType": - if v != nil { - var userType UserType - err = json.Unmarshal(*v, &userType) - if err != nil { - return err - } - uup.UserType = userType - } - } - } - - return nil -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/oauth2permissiongrant.go b/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/oauth2permissiongrant.go deleted file mode 100644 index 30b7d9f64..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/oauth2permissiongrant.go +++ /dev/null @@ -1,360 +0,0 @@ -package graphrbac - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OAuth2PermissionGrantClient is the the Graph RBAC Management Client -type OAuth2PermissionGrantClient struct { - BaseClient -} - -// NewOAuth2PermissionGrantClient creates an instance of the OAuth2PermissionGrantClient client. -func NewOAuth2PermissionGrantClient(tenantID string) OAuth2PermissionGrantClient { - return NewOAuth2PermissionGrantClientWithBaseURI(DefaultBaseURI, tenantID) -} - -// NewOAuth2PermissionGrantClientWithBaseURI creates an instance of the OAuth2PermissionGrantClient client using a -// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, -// Azure stack). -func NewOAuth2PermissionGrantClientWithBaseURI(baseURI string, tenantID string) OAuth2PermissionGrantClient { - return OAuth2PermissionGrantClient{NewWithBaseURI(baseURI, tenantID)} -} - -// Create grants OAuth2 permissions for the relevant resource Ids of an app. -// Parameters: -// body - the relevant app Service Principal Object Id and the Service Principal Object Id you want to grant. -func (client OAuth2PermissionGrantClient) Create(ctx context.Context, body *OAuth2PermissionGrant) (result OAuth2PermissionGrant, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OAuth2PermissionGrantClient.Create") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreatePreparer(ctx, body) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.OAuth2PermissionGrantClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.OAuth2PermissionGrantClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.OAuth2PermissionGrantClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client OAuth2PermissionGrantClient) CreatePreparer(ctx context.Context, body *OAuth2PermissionGrant) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/oauth2PermissionGrants", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if body != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(body)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client OAuth2PermissionGrantClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client OAuth2PermissionGrantClient) CreateResponder(resp *http.Response) (result OAuth2PermissionGrant, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a OAuth2 permission grant for the relevant resource Ids of an app. -// Parameters: -// objectID - the object ID of a permission grant. -func (client OAuth2PermissionGrantClient) Delete(ctx context.Context, objectID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OAuth2PermissionGrantClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, objectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.OAuth2PermissionGrantClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "graphrbac.OAuth2PermissionGrantClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.OAuth2PermissionGrantClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client OAuth2PermissionGrantClient) DeletePreparer(ctx context.Context, objectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "objectId": autorest.Encode("path", objectID), - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/oauth2PermissionGrants/{objectId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client OAuth2PermissionGrantClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client OAuth2PermissionGrantClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// List queries OAuth2 permissions grants for the relevant SP ObjectId of an app. -// Parameters: -// filter - this is the Service Principal ObjectId associated with the app -func (client OAuth2PermissionGrantClient) List(ctx context.Context, filter string) (result OAuth2PermissionGrantListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OAuth2PermissionGrantClient.List") - defer func() { - sc := -1 - if result.oa2pglr.Response.Response != nil { - sc = result.oa2pglr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = func(ctx context.Context, lastResult OAuth2PermissionGrantListResult) (OAuth2PermissionGrantListResult, error) { - if lastResult.OdataNextLink == nil || len(to.String(lastResult.OdataNextLink)) < 1 { - return OAuth2PermissionGrantListResult{}, nil - } - return client.ListNext(ctx, *lastResult.OdataNextLink) - } - req, err := client.ListPreparer(ctx, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.OAuth2PermissionGrantClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.oa2pglr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.OAuth2PermissionGrantClient", "List", resp, "Failure sending request") - return - } - - result.oa2pglr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.OAuth2PermissionGrantClient", "List", resp, "Failure responding to request") - return - } - if result.oa2pglr.hasNextLink() && result.oa2pglr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OAuth2PermissionGrantClient) ListPreparer(ctx context.Context, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/oauth2PermissionGrants", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OAuth2PermissionGrantClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OAuth2PermissionGrantClient) ListResponder(resp *http.Response) (result OAuth2PermissionGrantListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OAuth2PermissionGrantClient) ListComplete(ctx context.Context, filter string) (result OAuth2PermissionGrantListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OAuth2PermissionGrantClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, filter) - return -} - -// ListNext gets the next page of OAuth2 permission grants -// Parameters: -// nextLink - next link for the list operation. -func (client OAuth2PermissionGrantClient) ListNext(ctx context.Context, nextLink string) (result OAuth2PermissionGrantListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OAuth2PermissionGrantClient.ListNext") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListNextPreparer(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.OAuth2PermissionGrantClient", "ListNext", nil, "Failure preparing request") - return - } - - resp, err := client.ListNextSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.OAuth2PermissionGrantClient", "ListNext", resp, "Failure sending request") - return - } - - result, err = client.ListNextResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.OAuth2PermissionGrantClient", "ListNext", resp, "Failure responding to request") - return - } - - return -} - -// ListNextPreparer prepares the ListNext request. -func (client OAuth2PermissionGrantClient) ListNextPreparer(ctx context.Context, nextLink string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "nextLink": nextLink, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/{nextLink}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListNextSender sends the ListNext request. The method will close the -// http.Response Body if it receives an error. -func (client OAuth2PermissionGrantClient) ListNextSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListNextResponder handles the response to the ListNext request. The method always -// closes the http.Response Body. -func (client OAuth2PermissionGrantClient) ListNextResponder(resp *http.Response) (result OAuth2PermissionGrantListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/objects.go b/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/objects.go deleted file mode 100644 index c4b78e94b..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/objects.go +++ /dev/null @@ -1,208 +0,0 @@ -package graphrbac - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ObjectsClient is the the Graph RBAC Management Client -type ObjectsClient struct { - BaseClient -} - -// NewObjectsClient creates an instance of the ObjectsClient client. -func NewObjectsClient(tenantID string) ObjectsClient { - return NewObjectsClientWithBaseURI(DefaultBaseURI, tenantID) -} - -// NewObjectsClientWithBaseURI creates an instance of the ObjectsClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewObjectsClientWithBaseURI(baseURI string, tenantID string) ObjectsClient { - return ObjectsClient{NewWithBaseURI(baseURI, tenantID)} -} - -// GetObjectsByObjectIds gets the directory objects specified in a list of object IDs. You can also specify which -// resource collections (users, groups, etc.) should be searched by specifying the optional types parameter. -// Parameters: -// parameters - objects filtering parameters. -func (client ObjectsClient) GetObjectsByObjectIds(ctx context.Context, parameters GetObjectsParameters) (result DirectoryObjectListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ObjectsClient.GetObjectsByObjectIds") - defer func() { - sc := -1 - if result.dolr.Response.Response != nil { - sc = result.dolr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = func(ctx context.Context, lastResult DirectoryObjectListResult) (DirectoryObjectListResult, error) { - if lastResult.OdataNextLink == nil || len(to.String(lastResult.OdataNextLink)) < 1 { - return DirectoryObjectListResult{}, nil - } - return client.GetObjectsByObjectIdsNext(ctx, *lastResult.OdataNextLink) - } - req, err := client.GetObjectsByObjectIdsPreparer(ctx, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetObjectsByObjectIds", nil, "Failure preparing request") - return - } - - resp, err := client.GetObjectsByObjectIdsSender(req) - if err != nil { - result.dolr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetObjectsByObjectIds", resp, "Failure sending request") - return - } - - result.dolr, err = client.GetObjectsByObjectIdsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetObjectsByObjectIds", resp, "Failure responding to request") - return - } - if result.dolr.hasNextLink() && result.dolr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// GetObjectsByObjectIdsPreparer prepares the GetObjectsByObjectIds request. -func (client ObjectsClient) GetObjectsByObjectIdsPreparer(ctx context.Context, parameters GetObjectsParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/getObjectsByObjectIds", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetObjectsByObjectIdsSender sends the GetObjectsByObjectIds request. The method will close the -// http.Response Body if it receives an error. -func (client ObjectsClient) GetObjectsByObjectIdsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetObjectsByObjectIdsResponder handles the response to the GetObjectsByObjectIds request. The method always -// closes the http.Response Body. -func (client ObjectsClient) GetObjectsByObjectIdsResponder(resp *http.Response) (result DirectoryObjectListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetObjectsByObjectIdsComplete enumerates all values, automatically crossing page boundaries as required. -func (client ObjectsClient) GetObjectsByObjectIdsComplete(ctx context.Context, parameters GetObjectsParameters) (result DirectoryObjectListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ObjectsClient.GetObjectsByObjectIds") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.GetObjectsByObjectIds(ctx, parameters) - return -} - -// GetObjectsByObjectIdsNext gets AD group membership for the specified AD object IDs. -// Parameters: -// nextLink - next link for the list operation. -func (client ObjectsClient) GetObjectsByObjectIdsNext(ctx context.Context, nextLink string) (result DirectoryObjectListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ObjectsClient.GetObjectsByObjectIdsNext") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetObjectsByObjectIdsNextPreparer(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetObjectsByObjectIdsNext", nil, "Failure preparing request") - return - } - - resp, err := client.GetObjectsByObjectIdsNextSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetObjectsByObjectIdsNext", resp, "Failure sending request") - return - } - - result, err = client.GetObjectsByObjectIdsNextResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetObjectsByObjectIdsNext", resp, "Failure responding to request") - return - } - - return -} - -// GetObjectsByObjectIdsNextPreparer prepares the GetObjectsByObjectIdsNext request. -func (client ObjectsClient) GetObjectsByObjectIdsNextPreparer(ctx context.Context, nextLink string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "nextLink": nextLink, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/{nextLink}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetObjectsByObjectIdsNextSender sends the GetObjectsByObjectIdsNext request. The method will close the -// http.Response Body if it receives an error. -func (client ObjectsClient) GetObjectsByObjectIdsNextSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetObjectsByObjectIdsNextResponder handles the response to the GetObjectsByObjectIdsNext request. The method always -// closes the http.Response Body. -func (client ObjectsClient) GetObjectsByObjectIdsNextResponder(resp *http.Response) (result DirectoryObjectListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/serviceprincipals.go b/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/serviceprincipals.go deleted file mode 100644 index 76920172d..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/serviceprincipals.go +++ /dev/null @@ -1,930 +0,0 @@ -package graphrbac - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ServicePrincipalsClient is the the Graph RBAC Management Client -type ServicePrincipalsClient struct { - BaseClient -} - -// NewServicePrincipalsClient creates an instance of the ServicePrincipalsClient client. -func NewServicePrincipalsClient(tenantID string) ServicePrincipalsClient { - return NewServicePrincipalsClientWithBaseURI(DefaultBaseURI, tenantID) -} - -// NewServicePrincipalsClientWithBaseURI creates an instance of the ServicePrincipalsClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewServicePrincipalsClientWithBaseURI(baseURI string, tenantID string) ServicePrincipalsClient { - return ServicePrincipalsClient{NewWithBaseURI(baseURI, tenantID)} -} - -// Create creates a service principal in the directory. -// Parameters: -// parameters - parameters to create a service principal. -func (client ServicePrincipalsClient) Create(ctx context.Context, parameters ServicePrincipalCreateParameters) (result ServicePrincipal, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicePrincipalsClient.Create") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AppID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("graphrbac.ServicePrincipalsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ServicePrincipalsClient) CreatePreparer(ctx context.Context, parameters ServicePrincipalCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/servicePrincipals", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client ServicePrincipalsClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client ServicePrincipalsClient) CreateResponder(resp *http.Response) (result ServicePrincipal, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a service principal from the directory. -// Parameters: -// objectID - the object ID of the service principal to delete. -func (client ServicePrincipalsClient) Delete(ctx context.Context, objectID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicePrincipalsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, objectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServicePrincipalsClient) DeletePreparer(ctx context.Context, objectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "objectId": autorest.Encode("path", objectID), - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/servicePrincipals/{objectId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ServicePrincipalsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ServicePrincipalsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets service principal information from the directory. Query by objectId or pass a filter to query by appId -// Parameters: -// objectID - the object ID of the service principal to get. -func (client ServicePrincipalsClient) Get(ctx context.Context, objectID string) (result ServicePrincipal, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicePrincipalsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, objectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServicePrincipalsClient) GetPreparer(ctx context.Context, objectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "objectId": autorest.Encode("path", objectID), - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/servicePrincipals/{objectId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ServicePrincipalsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ServicePrincipalsClient) GetResponder(resp *http.Response) (result ServicePrincipal, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of service principals from the current tenant. -// Parameters: -// filter - the filter to apply to the operation. -func (client ServicePrincipalsClient) List(ctx context.Context, filter string) (result ServicePrincipalListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicePrincipalsClient.List") - defer func() { - sc := -1 - if result.splr.Response.Response != nil { - sc = result.splr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = func(ctx context.Context, lastResult ServicePrincipalListResult) (ServicePrincipalListResult, error) { - if lastResult.OdataNextLink == nil || len(to.String(lastResult.OdataNextLink)) < 1 { - return ServicePrincipalListResult{}, nil - } - return client.ListNext(ctx, *lastResult.OdataNextLink) - } - req, err := client.ListPreparer(ctx, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.splr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "List", resp, "Failure sending request") - return - } - - result.splr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "List", resp, "Failure responding to request") - return - } - if result.splr.hasNextLink() && result.splr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ServicePrincipalsClient) ListPreparer(ctx context.Context, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/servicePrincipals", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ServicePrincipalsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ServicePrincipalsClient) ListResponder(resp *http.Response) (result ServicePrincipalListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServicePrincipalsClient) ListComplete(ctx context.Context, filter string) (result ServicePrincipalListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicePrincipalsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, filter) - return -} - -// ListKeyCredentials get the keyCredentials associated with the specified service principal. -// Parameters: -// objectID - the object ID of the service principal for which to get keyCredentials. -func (client ServicePrincipalsClient) ListKeyCredentials(ctx context.Context, objectID string) (result KeyCredentialListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicePrincipalsClient.ListKeyCredentials") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListKeyCredentialsPreparer(ctx, objectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListKeyCredentials", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeyCredentialsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListKeyCredentials", resp, "Failure sending request") - return - } - - result, err = client.ListKeyCredentialsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListKeyCredentials", resp, "Failure responding to request") - return - } - - return -} - -// ListKeyCredentialsPreparer prepares the ListKeyCredentials request. -func (client ServicePrincipalsClient) ListKeyCredentialsPreparer(ctx context.Context, objectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "objectId": autorest.Encode("path", objectID), - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/servicePrincipals/{objectId}/keyCredentials", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListKeyCredentialsSender sends the ListKeyCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client ServicePrincipalsClient) ListKeyCredentialsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListKeyCredentialsResponder handles the response to the ListKeyCredentials request. The method always -// closes the http.Response Body. -func (client ServicePrincipalsClient) ListKeyCredentialsResponder(resp *http.Response) (result KeyCredentialListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNext gets a list of service principals from the current tenant. -// Parameters: -// nextLink - next link for the list operation. -func (client ServicePrincipalsClient) ListNext(ctx context.Context, nextLink string) (result ServicePrincipalListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicePrincipalsClient.ListNext") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListNextPreparer(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListNext", nil, "Failure preparing request") - return - } - - resp, err := client.ListNextSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListNext", resp, "Failure sending request") - return - } - - result, err = client.ListNextResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListNext", resp, "Failure responding to request") - return - } - - return -} - -// ListNextPreparer prepares the ListNext request. -func (client ServicePrincipalsClient) ListNextPreparer(ctx context.Context, nextLink string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "nextLink": nextLink, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/{nextLink}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListNextSender sends the ListNext request. The method will close the -// http.Response Body if it receives an error. -func (client ServicePrincipalsClient) ListNextSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListNextResponder handles the response to the ListNext request. The method always -// closes the http.Response Body. -func (client ServicePrincipalsClient) ListNextResponder(resp *http.Response) (result ServicePrincipalListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListOwners the owners are a set of non-admin users who are allowed to modify this object. -// Parameters: -// objectID - the object ID of the service principal for which to get owners. -func (client ServicePrincipalsClient) ListOwners(ctx context.Context, objectID string) (result DirectoryObjectListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicePrincipalsClient.ListOwners") - defer func() { - sc := -1 - if result.dolr.Response.Response != nil { - sc = result.dolr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listOwnersNextResults - req, err := client.ListOwnersPreparer(ctx, objectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListOwners", nil, "Failure preparing request") - return - } - - resp, err := client.ListOwnersSender(req) - if err != nil { - result.dolr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListOwners", resp, "Failure sending request") - return - } - - result.dolr, err = client.ListOwnersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListOwners", resp, "Failure responding to request") - return - } - if result.dolr.hasNextLink() && result.dolr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListOwnersPreparer prepares the ListOwners request. -func (client ServicePrincipalsClient) ListOwnersPreparer(ctx context.Context, objectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "objectId": autorest.Encode("path", objectID), - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/servicePrincipals/{objectId}/owners", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListOwnersSender sends the ListOwners request. The method will close the -// http.Response Body if it receives an error. -func (client ServicePrincipalsClient) ListOwnersSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListOwnersResponder handles the response to the ListOwners request. The method always -// closes the http.Response Body. -func (client ServicePrincipalsClient) ListOwnersResponder(resp *http.Response) (result DirectoryObjectListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listOwnersNextResults retrieves the next set of results, if any. -func (client ServicePrincipalsClient) listOwnersNextResults(ctx context.Context, lastResults DirectoryObjectListResult) (result DirectoryObjectListResult, err error) { - req, err := lastResults.directoryObjectListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "listOwnersNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListOwnersSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "listOwnersNextResults", resp, "Failure sending next results request") - } - result, err = client.ListOwnersResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "listOwnersNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListOwnersComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServicePrincipalsClient) ListOwnersComplete(ctx context.Context, objectID string) (result DirectoryObjectListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicePrincipalsClient.ListOwners") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListOwners(ctx, objectID) - return -} - -// ListPasswordCredentials gets the passwordCredentials associated with a service principal. -// Parameters: -// objectID - the object ID of the service principal. -func (client ServicePrincipalsClient) ListPasswordCredentials(ctx context.Context, objectID string) (result PasswordCredentialListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicePrincipalsClient.ListPasswordCredentials") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPasswordCredentialsPreparer(ctx, objectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListPasswordCredentials", nil, "Failure preparing request") - return - } - - resp, err := client.ListPasswordCredentialsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListPasswordCredentials", resp, "Failure sending request") - return - } - - result, err = client.ListPasswordCredentialsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListPasswordCredentials", resp, "Failure responding to request") - return - } - - return -} - -// ListPasswordCredentialsPreparer prepares the ListPasswordCredentials request. -func (client ServicePrincipalsClient) ListPasswordCredentialsPreparer(ctx context.Context, objectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "objectId": autorest.Encode("path", objectID), - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/servicePrincipals/{objectId}/passwordCredentials", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListPasswordCredentialsSender sends the ListPasswordCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client ServicePrincipalsClient) ListPasswordCredentialsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListPasswordCredentialsResponder handles the response to the ListPasswordCredentials request. The method always -// closes the http.Response Body. -func (client ServicePrincipalsClient) ListPasswordCredentialsResponder(resp *http.Response) (result PasswordCredentialListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates a service principal in the directory. -// Parameters: -// objectID - the object ID of the service principal to delete. -// parameters - parameters to update a service principal. -func (client ServicePrincipalsClient) Update(ctx context.Context, objectID string, parameters ServicePrincipalUpdateParameters) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicePrincipalsClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, objectID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ServicePrincipalsClient) UpdatePreparer(ctx context.Context, objectID string, parameters ServicePrincipalUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "objectId": autorest.Encode("path", objectID), - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/servicePrincipals/{objectId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ServicePrincipalsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ServicePrincipalsClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// UpdateKeyCredentials update the keyCredentials associated with a service principal. -// Parameters: -// objectID - the object ID for which to get service principal information. -// parameters - parameters to update the keyCredentials of an existing service principal. -func (client ServicePrincipalsClient) UpdateKeyCredentials(ctx context.Context, objectID string, parameters KeyCredentialsUpdateParameters) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicePrincipalsClient.UpdateKeyCredentials") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdateKeyCredentialsPreparer(ctx, objectID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "UpdateKeyCredentials", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateKeyCredentialsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "UpdateKeyCredentials", resp, "Failure sending request") - return - } - - result, err = client.UpdateKeyCredentialsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "UpdateKeyCredentials", resp, "Failure responding to request") - return - } - - return -} - -// UpdateKeyCredentialsPreparer prepares the UpdateKeyCredentials request. -func (client ServicePrincipalsClient) UpdateKeyCredentialsPreparer(ctx context.Context, objectID string, parameters KeyCredentialsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "objectId": autorest.Encode("path", objectID), - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/servicePrincipals/{objectId}/keyCredentials", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateKeyCredentialsSender sends the UpdateKeyCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client ServicePrincipalsClient) UpdateKeyCredentialsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// UpdateKeyCredentialsResponder handles the response to the UpdateKeyCredentials request. The method always -// closes the http.Response Body. -func (client ServicePrincipalsClient) UpdateKeyCredentialsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// UpdatePasswordCredentials updates the passwordCredentials associated with a service principal. -// Parameters: -// objectID - the object ID of the service principal. -// parameters - parameters to update the passwordCredentials of an existing service principal. -func (client ServicePrincipalsClient) UpdatePasswordCredentials(ctx context.Context, objectID string, parameters PasswordCredentialsUpdateParameters) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServicePrincipalsClient.UpdatePasswordCredentials") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePasswordCredentialsPreparer(ctx, objectID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "UpdatePasswordCredentials", nil, "Failure preparing request") - return - } - - resp, err := client.UpdatePasswordCredentialsSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "UpdatePasswordCredentials", resp, "Failure sending request") - return - } - - result, err = client.UpdatePasswordCredentialsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "UpdatePasswordCredentials", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePasswordCredentialsPreparer prepares the UpdatePasswordCredentials request. -func (client ServicePrincipalsClient) UpdatePasswordCredentialsPreparer(ctx context.Context, objectID string, parameters PasswordCredentialsUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "objectId": autorest.Encode("path", objectID), - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/servicePrincipals/{objectId}/passwordCredentials", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdatePasswordCredentialsSender sends the UpdatePasswordCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client ServicePrincipalsClient) UpdatePasswordCredentialsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// UpdatePasswordCredentialsResponder handles the response to the UpdatePasswordCredentials request. The method always -// closes the http.Response Body. -func (client ServicePrincipalsClient) UpdatePasswordCredentialsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/signedinuser.go b/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/signedinuser.go deleted file mode 100644 index 312d554de..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/signedinuser.go +++ /dev/null @@ -1,274 +0,0 @@ -package graphrbac - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// SignedInUserClient is the the Graph RBAC Management Client -type SignedInUserClient struct { - BaseClient -} - -// NewSignedInUserClient creates an instance of the SignedInUserClient client. -func NewSignedInUserClient(tenantID string) SignedInUserClient { - return NewSignedInUserClientWithBaseURI(DefaultBaseURI, tenantID) -} - -// NewSignedInUserClientWithBaseURI creates an instance of the SignedInUserClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewSignedInUserClientWithBaseURI(baseURI string, tenantID string) SignedInUserClient { - return SignedInUserClient{NewWithBaseURI(baseURI, tenantID)} -} - -// Get gets the details for the currently logged-in user. -func (client SignedInUserClient) Get(ctx context.Context) (result User, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SignedInUserClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.SignedInUserClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.SignedInUserClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.SignedInUserClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SignedInUserClient) GetPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/me", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client SignedInUserClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client SignedInUserClient) GetResponder(resp *http.Response) (result User, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListOwnedObjects get the list of directory objects that are owned by the user. -func (client SignedInUserClient) ListOwnedObjects(ctx context.Context) (result DirectoryObjectListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SignedInUserClient.ListOwnedObjects") - defer func() { - sc := -1 - if result.dolr.Response.Response != nil { - sc = result.dolr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = func(ctx context.Context, lastResult DirectoryObjectListResult) (DirectoryObjectListResult, error) { - if lastResult.OdataNextLink == nil || len(to.String(lastResult.OdataNextLink)) < 1 { - return DirectoryObjectListResult{}, nil - } - return client.ListOwnedObjectsNext(ctx, *lastResult.OdataNextLink) - } - req, err := client.ListOwnedObjectsPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.SignedInUserClient", "ListOwnedObjects", nil, "Failure preparing request") - return - } - - resp, err := client.ListOwnedObjectsSender(req) - if err != nil { - result.dolr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.SignedInUserClient", "ListOwnedObjects", resp, "Failure sending request") - return - } - - result.dolr, err = client.ListOwnedObjectsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.SignedInUserClient", "ListOwnedObjects", resp, "Failure responding to request") - return - } - if result.dolr.hasNextLink() && result.dolr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListOwnedObjectsPreparer prepares the ListOwnedObjects request. -func (client SignedInUserClient) ListOwnedObjectsPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/me/ownedObjects", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListOwnedObjectsSender sends the ListOwnedObjects request. The method will close the -// http.Response Body if it receives an error. -func (client SignedInUserClient) ListOwnedObjectsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListOwnedObjectsResponder handles the response to the ListOwnedObjects request. The method always -// closes the http.Response Body. -func (client SignedInUserClient) ListOwnedObjectsResponder(resp *http.Response) (result DirectoryObjectListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListOwnedObjectsComplete enumerates all values, automatically crossing page boundaries as required. -func (client SignedInUserClient) ListOwnedObjectsComplete(ctx context.Context) (result DirectoryObjectListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SignedInUserClient.ListOwnedObjects") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListOwnedObjects(ctx) - return -} - -// ListOwnedObjectsNext get the list of directory objects that are owned by the user. -// Parameters: -// nextLink - next link for the list operation. -func (client SignedInUserClient) ListOwnedObjectsNext(ctx context.Context, nextLink string) (result DirectoryObjectListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SignedInUserClient.ListOwnedObjectsNext") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListOwnedObjectsNextPreparer(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.SignedInUserClient", "ListOwnedObjectsNext", nil, "Failure preparing request") - return - } - - resp, err := client.ListOwnedObjectsNextSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.SignedInUserClient", "ListOwnedObjectsNext", resp, "Failure sending request") - return - } - - result, err = client.ListOwnedObjectsNextResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.SignedInUserClient", "ListOwnedObjectsNext", resp, "Failure responding to request") - return - } - - return -} - -// ListOwnedObjectsNextPreparer prepares the ListOwnedObjectsNext request. -func (client SignedInUserClient) ListOwnedObjectsNextPreparer(ctx context.Context, nextLink string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "nextLink": nextLink, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/{nextLink}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListOwnedObjectsNextSender sends the ListOwnedObjectsNext request. The method will close the -// http.Response Body if it receives an error. -func (client SignedInUserClient) ListOwnedObjectsNextSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListOwnedObjectsNextResponder handles the response to the ListOwnedObjectsNext request. The method always -// closes the http.Response Body. -func (client SignedInUserClient) ListOwnedObjectsNextResponder(resp *http.Response) (result DirectoryObjectListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/users.go b/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/users.go deleted file mode 100644 index 42afe2645..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/users.go +++ /dev/null @@ -1,605 +0,0 @@ -package graphrbac - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// UsersClient is the the Graph RBAC Management Client -type UsersClient struct { - BaseClient -} - -// NewUsersClient creates an instance of the UsersClient client. -func NewUsersClient(tenantID string) UsersClient { - return NewUsersClientWithBaseURI(DefaultBaseURI, tenantID) -} - -// NewUsersClientWithBaseURI creates an instance of the UsersClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewUsersClientWithBaseURI(baseURI string, tenantID string) UsersClient { - return UsersClient{NewWithBaseURI(baseURI, tenantID)} -} - -// Create create a new user. -// Parameters: -// parameters - parameters to create a user. -func (client UsersClient) Create(ctx context.Context, parameters UserCreateParameters) (result User, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UsersClient.Create") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.AccountEnabled", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.DisplayName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.PasswordProfile", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.PasswordProfile.Password", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.UserPrincipalName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MailNickname", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("graphrbac.UsersClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client UsersClient) CreatePreparer(ctx context.Context, parameters UserCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/users", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client UsersClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client UsersClient) CreateResponder(resp *http.Response) (result User, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a user. -// Parameters: -// upnOrObjectID - the object ID or principal name of the user to delete. -func (client UsersClient) Delete(ctx context.Context, upnOrObjectID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UsersClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, upnOrObjectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client UsersClient) DeletePreparer(ctx context.Context, upnOrObjectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "tenantID": autorest.Encode("path", client.TenantID), - "upnOrObjectId": autorest.Encode("path", upnOrObjectID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/users/{upnOrObjectId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client UsersClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client UsersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets user information from the directory. -// Parameters: -// upnOrObjectID - the object ID or principal name of the user for which to get information. -func (client UsersClient) Get(ctx context.Context, upnOrObjectID string) (result User, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UsersClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, upnOrObjectID) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client UsersClient) GetPreparer(ctx context.Context, upnOrObjectID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "tenantID": autorest.Encode("path", client.TenantID), - "upnOrObjectId": autorest.Encode("path", upnOrObjectID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/users/{upnOrObjectId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client UsersClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client UsersClient) GetResponder(resp *http.Response) (result User, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMemberGroups gets a collection that contains the object IDs of the groups of which the user is a member. -// Parameters: -// objectID - the object ID of the user for which to get group membership. -// parameters - user filtering parameters. -func (client UsersClient) GetMemberGroups(ctx context.Context, objectID string, parameters UserGetMemberGroupsParameters) (result UserGetMemberGroupsResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UsersClient.GetMemberGroups") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SecurityEnabledOnly", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("graphrbac.UsersClient", "GetMemberGroups", err.Error()) - } - - req, err := client.GetMemberGroupsPreparer(ctx, objectID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "GetMemberGroups", nil, "Failure preparing request") - return - } - - resp, err := client.GetMemberGroupsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "GetMemberGroups", resp, "Failure sending request") - return - } - - result, err = client.GetMemberGroupsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "GetMemberGroups", resp, "Failure responding to request") - return - } - - return -} - -// GetMemberGroupsPreparer prepares the GetMemberGroups request. -func (client UsersClient) GetMemberGroupsPreparer(ctx context.Context, objectID string, parameters UserGetMemberGroupsParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "objectId": autorest.Encode("path", objectID), - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/users/{objectId}/getMemberGroups", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetMemberGroupsSender sends the GetMemberGroups request. The method will close the -// http.Response Body if it receives an error. -func (client UsersClient) GetMemberGroupsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetMemberGroupsResponder handles the response to the GetMemberGroups request. The method always -// closes the http.Response Body. -func (client UsersClient) GetMemberGroupsResponder(resp *http.Response) (result UserGetMemberGroupsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets list of users for the current tenant. -// Parameters: -// filter - the filter to apply to the operation. -// expand - the expand value for the operation result. -func (client UsersClient) List(ctx context.Context, filter string, expand string) (result UserListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UsersClient.List") - defer func() { - sc := -1 - if result.ulr.Response.Response != nil { - sc = result.ulr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = func(ctx context.Context, lastResult UserListResult) (UserListResult, error) { - if lastResult.OdataNextLink == nil || len(to.String(lastResult.OdataNextLink)) < 1 { - return UserListResult{}, nil - } - return client.ListNext(ctx, *lastResult.OdataNextLink) - } - req, err := client.ListPreparer(ctx, filter, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.ulr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "List", resp, "Failure sending request") - return - } - - result.ulr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "List", resp, "Failure responding to request") - return - } - if result.ulr.hasNextLink() && result.ulr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client UsersClient) ListPreparer(ctx context.Context, filter string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/users", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client UsersClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client UsersClient) ListResponder(resp *http.Response) (result UserListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client UsersClient) ListComplete(ctx context.Context, filter string, expand string) (result UserListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UsersClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, filter, expand) - return -} - -// ListNext gets a list of users for the current tenant. -// Parameters: -// nextLink - next link for the list operation. -func (client UsersClient) ListNext(ctx context.Context, nextLink string) (result UserListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UsersClient.ListNext") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListNextPreparer(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "ListNext", nil, "Failure preparing request") - return - } - - resp, err := client.ListNextSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "ListNext", resp, "Failure sending request") - return - } - - result, err = client.ListNextResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "ListNext", resp, "Failure responding to request") - return - } - - return -} - -// ListNextPreparer prepares the ListNext request. -func (client UsersClient) ListNextPreparer(ctx context.Context, nextLink string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "nextLink": nextLink, - "tenantID": autorest.Encode("path", client.TenantID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/{nextLink}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListNextSender sends the ListNext request. The method will close the -// http.Response Body if it receives an error. -func (client UsersClient) ListNextSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListNextResponder handles the response to the ListNext request. The method always -// closes the http.Response Body. -func (client UsersClient) ListNextResponder(resp *http.Response) (result UserListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates a user. -// Parameters: -// upnOrObjectID - the object ID or principal name of the user to update. -// parameters - parameters to update an existing user. -func (client UsersClient) Update(ctx context.Context, upnOrObjectID string, parameters UserUpdateParameters) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UsersClient.Update") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, upnOrObjectID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client UsersClient) UpdatePreparer(ctx context.Context, upnOrObjectID string, parameters UserUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "tenantID": autorest.Encode("path", client.TenantID), - "upnOrObjectId": autorest.Encode("path", upnOrObjectID), - } - - const APIVersion = "1.6" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{tenantID}/users/{upnOrObjectId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client UsersClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client UsersClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/version.go deleted file mode 100644 index b58234fc4..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package graphrbac - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " graphrbac/1.6" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/CHANGELOG.md deleted file mode 100644 index 52911e4cc..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/_meta.json deleted file mode 100644 index ffda37794..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "5fcc6854765009e891052653b304cfe80353430a", - "readme": "/_/azure-rest-api-specs/specification/authorization/resource-manager/readme.md", - "tag": "package-2020-04-01-preview", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2020-04-01-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/authorization/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/classicadministrators.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/classicadministrators.go deleted file mode 100644 index adb9c2979..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/classicadministrators.go +++ /dev/null @@ -1,152 +0,0 @@ -package authorization - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ClassicAdministratorsClient is the client for the ClassicAdministrators methods of the Authorization service. -type ClassicAdministratorsClient struct { - BaseClient -} - -// NewClassicAdministratorsClient creates an instance of the ClassicAdministratorsClient client. -func NewClassicAdministratorsClient(subscriptionID string) ClassicAdministratorsClient { - return NewClassicAdministratorsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewClassicAdministratorsClientWithBaseURI creates an instance of the ClassicAdministratorsClient client using a -// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, -// Azure stack). -func NewClassicAdministratorsClientWithBaseURI(baseURI string, subscriptionID string) ClassicAdministratorsClient { - return ClassicAdministratorsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List gets service administrator, account administrator, and co-administrators for the subscription. -func (client ClassicAdministratorsClient) List(ctx context.Context) (result ClassicAdministratorListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClassicAdministratorsClient.List") - defer func() { - sc := -1 - if result.calr.Response.Response != nil { - sc = result.calr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("authorization.ClassicAdministratorsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.ClassicAdministratorsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.calr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.ClassicAdministratorsClient", "List", resp, "Failure sending request") - return - } - - result.calr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.ClassicAdministratorsClient", "List", resp, "Failure responding to request") - return - } - if result.calr.hasNextLink() && result.calr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ClassicAdministratorsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/classicAdministrators", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ClassicAdministratorsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ClassicAdministratorsClient) ListResponder(resp *http.Response) (result ClassicAdministratorListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client ClassicAdministratorsClient) listNextResults(ctx context.Context, lastResults ClassicAdministratorListResult) (result ClassicAdministratorListResult, err error) { - req, err := lastResults.classicAdministratorListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "authorization.ClassicAdministratorsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "authorization.ClassicAdministratorsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.ClassicAdministratorsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ClassicAdministratorsClient) ListComplete(ctx context.Context) (result ClassicAdministratorListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClassicAdministratorsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/client.go deleted file mode 100644 index 7729c6f3f..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/client.go +++ /dev/null @@ -1,43 +0,0 @@ -// Deprecated: Please note, this package has been deprecated. A replacement package is available [github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization). We strongly encourage you to upgrade to continue receiving updates. See [Migration Guide](https://aka.ms/azsdk/golang/t2/migration) for guidance on upgrading. Refer to our [deprecation policy](https://azure.github.io/azure-sdk/policies_support.html) for more details. -// -// Package authorization implements the Azure ARM Authorization service API version . -// -// -package authorization - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Authorization - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Authorization. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/denyassignments.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/denyassignments.go deleted file mode 100644 index c2a280023..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/denyassignments.go +++ /dev/null @@ -1,726 +0,0 @@ -package authorization - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// DenyAssignmentsClient is the client for the DenyAssignments methods of the Authorization service. -type DenyAssignmentsClient struct { - BaseClient -} - -// NewDenyAssignmentsClient creates an instance of the DenyAssignmentsClient client. -func NewDenyAssignmentsClient(subscriptionID string) DenyAssignmentsClient { - return NewDenyAssignmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDenyAssignmentsClientWithBaseURI creates an instance of the DenyAssignmentsClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewDenyAssignmentsClientWithBaseURI(baseURI string, subscriptionID string) DenyAssignmentsClient { - return DenyAssignmentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get the specified deny assignment. -// Parameters: -// scope - the scope of the deny assignment. -// denyAssignmentID - the ID of the deny assignment to get. -func (client DenyAssignmentsClient) Get(ctx context.Context, scope string, denyAssignmentID string) (result DenyAssignment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DenyAssignmentsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, scope, denyAssignmentID) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DenyAssignmentsClient) GetPreparer(ctx context.Context, scope string, denyAssignmentID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "denyAssignmentId": autorest.Encode("path", denyAssignmentID), - "scope": scope, - } - - const APIVersion = "2018-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DenyAssignmentsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DenyAssignmentsClient) GetResponder(resp *http.Response) (result DenyAssignment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetByID gets a deny assignment by ID. -// Parameters: -// denyAssignmentID - the fully qualified deny assignment ID. For example, use the format, -// /subscriptions/{guid}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for subscription -// level deny assignments, or /providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for tenant -// level deny assignments. -func (client DenyAssignmentsClient) GetByID(ctx context.Context, denyAssignmentID string) (result DenyAssignment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DenyAssignmentsClient.GetByID") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetByIDPreparer(ctx, denyAssignmentID) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "GetByID", nil, "Failure preparing request") - return - } - - resp, err := client.GetByIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "GetByID", resp, "Failure sending request") - return - } - - result, err = client.GetByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "GetByID", resp, "Failure responding to request") - return - } - - return -} - -// GetByIDPreparer prepares the GetByID request. -func (client DenyAssignmentsClient) GetByIDPreparer(ctx context.Context, denyAssignmentID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "denyAssignmentId": denyAssignmentID, - } - - const APIVersion = "2018-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{denyAssignmentId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByIDSender sends the GetByID request. The method will close the -// http.Response Body if it receives an error. -func (client DenyAssignmentsClient) GetByIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetByIDResponder handles the response to the GetByID request. The method always -// closes the http.Response Body. -func (client DenyAssignmentsClient) GetByIDResponder(resp *http.Response) (result DenyAssignment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all deny assignments for the subscription. -// Parameters: -// filter - the filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or -// above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny assignments by name at specified -// scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for -// the specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, -// above and below the scope for the specified principal. This filter is different from the principalId filter -// as it returns not only those deny assignments that contain the specified principal is the Principals list -// but also those deny assignments that contain the specified principal is the ExcludePrincipals list. -// Additionally, when gdprExportPrincipalId filter is used, only the deny assignment name and description -// properties are returned. -func (client DenyAssignmentsClient) List(ctx context.Context, filter string) (result DenyAssignmentListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DenyAssignmentsClient.List") - defer func() { - sc := -1 - if result.dalr.Response.Response != nil { - sc = result.dalr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("authorization.DenyAssignmentsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.dalr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "List", resp, "Failure sending request") - return - } - - result.dalr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "List", resp, "Failure responding to request") - return - } - if result.dalr.hasNextLink() && result.dalr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DenyAssignmentsClient) ListPreparer(ctx context.Context, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/denyAssignments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client DenyAssignmentsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client DenyAssignmentsClient) ListResponder(resp *http.Response) (result DenyAssignmentListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client DenyAssignmentsClient) listNextResults(ctx context.Context, lastResults DenyAssignmentListResult) (result DenyAssignmentListResult, err error) { - req, err := lastResults.denyAssignmentListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client DenyAssignmentsClient) ListComplete(ctx context.Context, filter string) (result DenyAssignmentListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DenyAssignmentsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, filter) - return -} - -// ListForResource gets deny assignments for a resource. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceProviderNamespace - the namespace of the resource provider. -// parentResourcePath - the parent resource identity. -// resourceType - the resource type of the resource. -// resourceName - the name of the resource to get deny assignments for. -// filter - the filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or -// above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny assignments by name at specified -// scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for -// the specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, -// above and below the scope for the specified principal. This filter is different from the principalId filter -// as it returns not only those deny assignments that contain the specified principal is the Principals list -// but also those deny assignments that contain the specified principal is the ExcludePrincipals list. -// Additionally, when gdprExportPrincipalId filter is used, only the deny assignment name and description -// properties are returned. -func (client DenyAssignmentsClient) ListForResource(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (result DenyAssignmentListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DenyAssignmentsClient.ListForResource") - defer func() { - sc := -1 - if result.dalr.Response.Response != nil { - sc = result.dalr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("authorization.DenyAssignmentsClient", "ListForResource", err.Error()) - } - - result.fn = client.listForResourceNextResults - req, err := client.ListForResourcePreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "ListForResource", nil, "Failure preparing request") - return - } - - resp, err := client.ListForResourceSender(req) - if err != nil { - result.dalr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "ListForResource", resp, "Failure sending request") - return - } - - result.dalr, err = client.ListForResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "ListForResource", resp, "Failure responding to request") - return - } - if result.dalr.hasNextLink() && result.dalr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListForResourcePreparer prepares the ListForResource request. -func (client DenyAssignmentsClient) ListForResourcePreparer(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "parentResourcePath": parentResourcePath, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), - "resourceType": resourceType, - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/denyAssignments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListForResourceSender sends the ListForResource request. The method will close the -// http.Response Body if it receives an error. -func (client DenyAssignmentsClient) ListForResourceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListForResourceResponder handles the response to the ListForResource request. The method always -// closes the http.Response Body. -func (client DenyAssignmentsClient) ListForResourceResponder(resp *http.Response) (result DenyAssignmentListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listForResourceNextResults retrieves the next set of results, if any. -func (client DenyAssignmentsClient) listForResourceNextResults(ctx context.Context, lastResults DenyAssignmentListResult) (result DenyAssignmentListResult, err error) { - req, err := lastResults.denyAssignmentListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "listForResourceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListForResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "listForResourceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListForResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "listForResourceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListForResourceComplete enumerates all values, automatically crossing page boundaries as required. -func (client DenyAssignmentsClient) ListForResourceComplete(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (result DenyAssignmentListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DenyAssignmentsClient.ListForResource") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListForResource(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) - return -} - -// ListForResourceGroup gets deny assignments for a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// filter - the filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or -// above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny assignments by name at specified -// scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for -// the specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, -// above and below the scope for the specified principal. This filter is different from the principalId filter -// as it returns not only those deny assignments that contain the specified principal is the Principals list -// but also those deny assignments that contain the specified principal is the ExcludePrincipals list. -// Additionally, when gdprExportPrincipalId filter is used, only the deny assignment name and description -// properties are returned. -func (client DenyAssignmentsClient) ListForResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result DenyAssignmentListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DenyAssignmentsClient.ListForResourceGroup") - defer func() { - sc := -1 - if result.dalr.Response.Response != nil { - sc = result.dalr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("authorization.DenyAssignmentsClient", "ListForResourceGroup", err.Error()) - } - - result.fn = client.listForResourceGroupNextResults - req, err := client.ListForResourceGroupPreparer(ctx, resourceGroupName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "ListForResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListForResourceGroupSender(req) - if err != nil { - result.dalr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "ListForResourceGroup", resp, "Failure sending request") - return - } - - result.dalr, err = client.ListForResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "ListForResourceGroup", resp, "Failure responding to request") - return - } - if result.dalr.hasNextLink() && result.dalr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListForResourceGroupPreparer prepares the ListForResourceGroup request. -func (client DenyAssignmentsClient) ListForResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/denyAssignments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListForResourceGroupSender sends the ListForResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client DenyAssignmentsClient) ListForResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListForResourceGroupResponder handles the response to the ListForResourceGroup request. The method always -// closes the http.Response Body. -func (client DenyAssignmentsClient) ListForResourceGroupResponder(resp *http.Response) (result DenyAssignmentListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listForResourceGroupNextResults retrieves the next set of results, if any. -func (client DenyAssignmentsClient) listForResourceGroupNextResults(ctx context.Context, lastResults DenyAssignmentListResult) (result DenyAssignmentListResult, err error) { - req, err := lastResults.denyAssignmentListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "listForResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListForResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "listForResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListForResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "listForResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListForResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client DenyAssignmentsClient) ListForResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string) (result DenyAssignmentListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DenyAssignmentsClient.ListForResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListForResourceGroup(ctx, resourceGroupName, filter) - return -} - -// ListForScope gets deny assignments for a scope. -// Parameters: -// scope - the scope of the deny assignments. -// filter - the filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or -// above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny assignments by name at specified -// scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for -// the specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, -// above and below the scope for the specified principal. This filter is different from the principalId filter -// as it returns not only those deny assignments that contain the specified principal is the Principals list -// but also those deny assignments that contain the specified principal is the ExcludePrincipals list. -// Additionally, when gdprExportPrincipalId filter is used, only the deny assignment name and description -// properties are returned. -func (client DenyAssignmentsClient) ListForScope(ctx context.Context, scope string, filter string) (result DenyAssignmentListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DenyAssignmentsClient.ListForScope") - defer func() { - sc := -1 - if result.dalr.Response.Response != nil { - sc = result.dalr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listForScopeNextResults - req, err := client.ListForScopePreparer(ctx, scope, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "ListForScope", nil, "Failure preparing request") - return - } - - resp, err := client.ListForScopeSender(req) - if err != nil { - result.dalr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "ListForScope", resp, "Failure sending request") - return - } - - result.dalr, err = client.ListForScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "ListForScope", resp, "Failure responding to request") - return - } - if result.dalr.hasNextLink() && result.dalr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListForScopePreparer prepares the ListForScope request. -func (client DenyAssignmentsClient) ListForScopePreparer(ctx context.Context, scope string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "scope": scope, - } - - const APIVersion = "2018-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/denyAssignments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListForScopeSender sends the ListForScope request. The method will close the -// http.Response Body if it receives an error. -func (client DenyAssignmentsClient) ListForScopeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListForScopeResponder handles the response to the ListForScope request. The method always -// closes the http.Response Body. -func (client DenyAssignmentsClient) ListForScopeResponder(resp *http.Response) (result DenyAssignmentListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listForScopeNextResults retrieves the next set of results, if any. -func (client DenyAssignmentsClient) listForScopeNextResults(ctx context.Context, lastResults DenyAssignmentListResult) (result DenyAssignmentListResult, err error) { - req, err := lastResults.denyAssignmentListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "listForScopeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListForScopeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "listForScopeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListForScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "listForScopeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListForScopeComplete enumerates all values, automatically crossing page boundaries as required. -func (client DenyAssignmentsClient) ListForScopeComplete(ctx context.Context, scope string, filter string) (result DenyAssignmentListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DenyAssignmentsClient.ListForScope") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListForScope(ctx, scope, filter) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/enums.go deleted file mode 100644 index f0c637120..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/enums.go +++ /dev/null @@ -1,38 +0,0 @@ -package authorization - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// PrincipalType enumerates the values for principal type. -type PrincipalType string - -const ( - // Application ... - Application PrincipalType = "Application" - // DirectoryObjectOrGroup ... - DirectoryObjectOrGroup PrincipalType = "DirectoryObjectOrGroup" - // DirectoryRoleTemplate ... - DirectoryRoleTemplate PrincipalType = "DirectoryRoleTemplate" - // Everyone ... - Everyone PrincipalType = "Everyone" - // ForeignGroup ... - ForeignGroup PrincipalType = "ForeignGroup" - // Group ... - Group PrincipalType = "Group" - // MSI ... - MSI PrincipalType = "MSI" - // ServicePrincipal ... - ServicePrincipal PrincipalType = "ServicePrincipal" - // Unknown ... - Unknown PrincipalType = "Unknown" - // User ... - User PrincipalType = "User" -) - -// PossiblePrincipalTypeValues returns an array of possible values for the PrincipalType const type. -func PossiblePrincipalTypeValues() []PrincipalType { - return []PrincipalType{Application, DirectoryObjectOrGroup, DirectoryRoleTemplate, Everyone, ForeignGroup, Group, MSI, ServicePrincipal, Unknown, User} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/globaladministrator.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/globaladministrator.go deleted file mode 100644 index 562717c16..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/globaladministrator.go +++ /dev/null @@ -1,98 +0,0 @@ -package authorization - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// GlobalAdministratorClient is the client for the GlobalAdministrator methods of the Authorization service. -type GlobalAdministratorClient struct { - BaseClient -} - -// NewGlobalAdministratorClient creates an instance of the GlobalAdministratorClient client. -func NewGlobalAdministratorClient(subscriptionID string) GlobalAdministratorClient { - return NewGlobalAdministratorClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGlobalAdministratorClientWithBaseURI creates an instance of the GlobalAdministratorClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewGlobalAdministratorClientWithBaseURI(baseURI string, subscriptionID string) GlobalAdministratorClient { - return GlobalAdministratorClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ElevateAccess elevates access for a Global Administrator. -func (client GlobalAdministratorClient) ElevateAccess(ctx context.Context) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GlobalAdministratorClient.ElevateAccess") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ElevateAccessPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.GlobalAdministratorClient", "ElevateAccess", nil, "Failure preparing request") - return - } - - resp, err := client.ElevateAccessSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "authorization.GlobalAdministratorClient", "ElevateAccess", resp, "Failure sending request") - return - } - - result, err = client.ElevateAccessResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.GlobalAdministratorClient", "ElevateAccess", resp, "Failure responding to request") - return - } - - return -} - -// ElevateAccessPreparer prepares the ElevateAccess request. -func (client GlobalAdministratorClient) ElevateAccessPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2015-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Authorization/elevateAccess"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ElevateAccessSender sends the ElevateAccess request. The method will close the -// http.Response Body if it receives an error. -func (client GlobalAdministratorClient) ElevateAccessSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ElevateAccessResponder handles the response to the ElevateAccess request. The method always -// closes the http.Response Body. -func (client GlobalAdministratorClient) ElevateAccessResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/models.go deleted file mode 100644 index 20d9e396b..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/models.go +++ /dev/null @@ -1,1574 +0,0 @@ -package authorization - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization" - -// ClassicAdministrator classic Administrators -type ClassicAdministrator struct { - // ID - The ID of the administrator. - ID *string `json:"id,omitempty"` - // Name - The name of the administrator. - Name *string `json:"name,omitempty"` - // Type - The type of the administrator. - Type *string `json:"type,omitempty"` - // ClassicAdministratorProperties - Properties for the classic administrator. - *ClassicAdministratorProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ClassicAdministrator. -func (ca ClassicAdministrator) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ca.ID != nil { - objectMap["id"] = ca.ID - } - if ca.Name != nil { - objectMap["name"] = ca.Name - } - if ca.Type != nil { - objectMap["type"] = ca.Type - } - if ca.ClassicAdministratorProperties != nil { - objectMap["properties"] = ca.ClassicAdministratorProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ClassicAdministrator struct. -func (ca *ClassicAdministrator) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ca.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ca.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ca.Type = &typeVar - } - case "properties": - if v != nil { - var classicAdministratorProperties ClassicAdministratorProperties - err = json.Unmarshal(*v, &classicAdministratorProperties) - if err != nil { - return err - } - ca.ClassicAdministratorProperties = &classicAdministratorProperties - } - } - } - - return nil -} - -// ClassicAdministratorListResult classicAdministrator list result information. -type ClassicAdministratorListResult struct { - autorest.Response `json:"-"` - // Value - An array of administrators. - Value *[]ClassicAdministrator `json:"value,omitempty"` - // NextLink - The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ClassicAdministratorListResultIterator provides access to a complete listing of ClassicAdministrator -// values. -type ClassicAdministratorListResultIterator struct { - i int - page ClassicAdministratorListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ClassicAdministratorListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClassicAdministratorListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ClassicAdministratorListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ClassicAdministratorListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ClassicAdministratorListResultIterator) Response() ClassicAdministratorListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ClassicAdministratorListResultIterator) Value() ClassicAdministrator { - if !iter.page.NotDone() { - return ClassicAdministrator{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ClassicAdministratorListResultIterator type. -func NewClassicAdministratorListResultIterator(page ClassicAdministratorListResultPage) ClassicAdministratorListResultIterator { - return ClassicAdministratorListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (calr ClassicAdministratorListResult) IsEmpty() bool { - return calr.Value == nil || len(*calr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (calr ClassicAdministratorListResult) hasNextLink() bool { - return calr.NextLink != nil && len(*calr.NextLink) != 0 -} - -// classicAdministratorListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (calr ClassicAdministratorListResult) classicAdministratorListResultPreparer(ctx context.Context) (*http.Request, error) { - if !calr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(calr.NextLink))) -} - -// ClassicAdministratorListResultPage contains a page of ClassicAdministrator values. -type ClassicAdministratorListResultPage struct { - fn func(context.Context, ClassicAdministratorListResult) (ClassicAdministratorListResult, error) - calr ClassicAdministratorListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ClassicAdministratorListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClassicAdministratorListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.calr) - if err != nil { - return err - } - page.calr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ClassicAdministratorListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ClassicAdministratorListResultPage) NotDone() bool { - return !page.calr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ClassicAdministratorListResultPage) Response() ClassicAdministratorListResult { - return page.calr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ClassicAdministratorListResultPage) Values() []ClassicAdministrator { - if page.calr.IsEmpty() { - return nil - } - return *page.calr.Value -} - -// Creates a new instance of the ClassicAdministratorListResultPage type. -func NewClassicAdministratorListResultPage(cur ClassicAdministratorListResult, getNextPage func(context.Context, ClassicAdministratorListResult) (ClassicAdministratorListResult, error)) ClassicAdministratorListResultPage { - return ClassicAdministratorListResultPage{ - fn: getNextPage, - calr: cur, - } -} - -// ClassicAdministratorProperties classic Administrator properties. -type ClassicAdministratorProperties struct { - // EmailAddress - The email address of the administrator. - EmailAddress *string `json:"emailAddress,omitempty"` - // Role - The role of the administrator. - Role *string `json:"role,omitempty"` -} - -// DenyAssignment deny Assignment -type DenyAssignment struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; The deny assignment ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The deny assignment name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The deny assignment type. - Type *string `json:"type,omitempty"` - // DenyAssignmentProperties - Deny assignment properties. - *DenyAssignmentProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for DenyAssignment. -func (da DenyAssignment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if da.DenyAssignmentProperties != nil { - objectMap["properties"] = da.DenyAssignmentProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DenyAssignment struct. -func (da *DenyAssignment) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - da.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - da.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - da.Type = &typeVar - } - case "properties": - if v != nil { - var denyAssignmentProperties DenyAssignmentProperties - err = json.Unmarshal(*v, &denyAssignmentProperties) - if err != nil { - return err - } - da.DenyAssignmentProperties = &denyAssignmentProperties - } - } - } - - return nil -} - -// DenyAssignmentFilter deny Assignments filter -type DenyAssignmentFilter struct { - // DenyAssignmentName - Return deny assignment with specified name. - DenyAssignmentName *string `json:"denyAssignmentName,omitempty"` - // PrincipalID - Return all deny assignments where the specified principal is listed in the principals list of deny assignments. - PrincipalID *string `json:"principalId,omitempty"` - // GdprExportPrincipalID - Return all deny assignments where the specified principal is listed either in the principals list or exclude principals list of deny assignments. - GdprExportPrincipalID *string `json:"gdprExportPrincipalId,omitempty"` -} - -// DenyAssignmentListResult deny assignment list operation result. -type DenyAssignmentListResult struct { - autorest.Response `json:"-"` - // Value - Deny assignment list. - Value *[]DenyAssignment `json:"value,omitempty"` - // NextLink - The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// DenyAssignmentListResultIterator provides access to a complete listing of DenyAssignment values. -type DenyAssignmentListResultIterator struct { - i int - page DenyAssignmentListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *DenyAssignmentListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DenyAssignmentListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *DenyAssignmentListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DenyAssignmentListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter DenyAssignmentListResultIterator) Response() DenyAssignmentListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter DenyAssignmentListResultIterator) Value() DenyAssignment { - if !iter.page.NotDone() { - return DenyAssignment{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DenyAssignmentListResultIterator type. -func NewDenyAssignmentListResultIterator(page DenyAssignmentListResultPage) DenyAssignmentListResultIterator { - return DenyAssignmentListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dalr DenyAssignmentListResult) IsEmpty() bool { - return dalr.Value == nil || len(*dalr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dalr DenyAssignmentListResult) hasNextLink() bool { - return dalr.NextLink != nil && len(*dalr.NextLink) != 0 -} - -// denyAssignmentListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dalr DenyAssignmentListResult) denyAssignmentListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dalr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dalr.NextLink))) -} - -// DenyAssignmentListResultPage contains a page of DenyAssignment values. -type DenyAssignmentListResultPage struct { - fn func(context.Context, DenyAssignmentListResult) (DenyAssignmentListResult, error) - dalr DenyAssignmentListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *DenyAssignmentListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DenyAssignmentListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.dalr) - if err != nil { - return err - } - page.dalr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *DenyAssignmentListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DenyAssignmentListResultPage) NotDone() bool { - return !page.dalr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DenyAssignmentListResultPage) Response() DenyAssignmentListResult { - return page.dalr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DenyAssignmentListResultPage) Values() []DenyAssignment { - if page.dalr.IsEmpty() { - return nil - } - return *page.dalr.Value -} - -// Creates a new instance of the DenyAssignmentListResultPage type. -func NewDenyAssignmentListResultPage(cur DenyAssignmentListResult, getNextPage func(context.Context, DenyAssignmentListResult) (DenyAssignmentListResult, error)) DenyAssignmentListResultPage { - return DenyAssignmentListResultPage{ - fn: getNextPage, - dalr: cur, - } -} - -// DenyAssignmentPermission deny assignment permissions. -type DenyAssignmentPermission struct { - // Actions - Actions to which the deny assignment does not grant access. - Actions *[]string `json:"actions,omitempty"` - // NotActions - Actions to exclude from that the deny assignment does not grant access. - NotActions *[]string `json:"notActions,omitempty"` - // DataActions - Data actions to which the deny assignment does not grant access. - DataActions *[]string `json:"dataActions,omitempty"` - // NotDataActions - Data actions to exclude from that the deny assignment does not grant access. - NotDataActions *[]string `json:"notDataActions,omitempty"` -} - -// DenyAssignmentProperties deny assignment properties. -type DenyAssignmentProperties struct { - // DenyAssignmentName - The display name of the deny assignment. - DenyAssignmentName *string `json:"denyAssignmentName,omitempty"` - // Description - The description of the deny assignment. - Description *string `json:"description,omitempty"` - // Permissions - An array of permissions that are denied by the deny assignment. - Permissions *[]DenyAssignmentPermission `json:"permissions,omitempty"` - // Scope - The deny assignment scope. - Scope *string `json:"scope,omitempty"` - // DoNotApplyToChildScopes - Determines if the deny assignment applies to child scopes. Default value is false. - DoNotApplyToChildScopes *bool `json:"doNotApplyToChildScopes,omitempty"` - // Principals - Array of principals to which the deny assignment applies. - Principals *[]Principal `json:"principals,omitempty"` - // ExcludePrincipals - Array of principals to which the deny assignment does not apply. - ExcludePrincipals *[]Principal `json:"excludePrincipals,omitempty"` - // IsSystemProtected - Specifies whether this deny assignment was created by Azure and cannot be edited or deleted. - IsSystemProtected *bool `json:"isSystemProtected,omitempty"` -} - -// ErrorAdditionalInfo the resource management error additional info. -type ErrorAdditionalInfo struct { - // Type - READ-ONLY; The additional info type. - Type *string `json:"type,omitempty"` - // Info - READ-ONLY; The additional info. - Info interface{} `json:"info,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. -func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorDetail the error detail. -type ErrorDetail struct { - // Code - READ-ONLY; The error code. - Code *string `json:"code,omitempty"` - // Message - READ-ONLY; The error message. - Message *string `json:"message,omitempty"` - // Target - READ-ONLY; The error target. - Target *string `json:"target,omitempty"` - // Details - READ-ONLY; The error details. - Details *[]ErrorDetail `json:"details,omitempty"` - // AdditionalInfo - READ-ONLY; The error additional info. - AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorDetail. -func (ed ErrorDetail) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for -// failed operations. (This also follows the OData error response format.). -type ErrorResponse struct { - // Error - The error object. - Error *ErrorDetail `json:"error,omitempty"` -} - -// Permission role definition permissions. -type Permission struct { - // Actions - Allowed actions. - Actions *[]string `json:"actions,omitempty"` - // NotActions - Denied actions. - NotActions *[]string `json:"notActions,omitempty"` - // DataActions - Allowed Data actions. - DataActions *[]string `json:"dataActions,omitempty"` - // NotDataActions - Denied Data actions. - NotDataActions *[]string `json:"notDataActions,omitempty"` -} - -// PermissionGetResult permissions information. -type PermissionGetResult struct { - autorest.Response `json:"-"` - // Value - An array of permissions. - Value *[]Permission `json:"value,omitempty"` - // NextLink - The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// PermissionGetResultIterator provides access to a complete listing of Permission values. -type PermissionGetResultIterator struct { - i int - page PermissionGetResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *PermissionGetResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PermissionGetResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *PermissionGetResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PermissionGetResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter PermissionGetResultIterator) Response() PermissionGetResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter PermissionGetResultIterator) Value() Permission { - if !iter.page.NotDone() { - return Permission{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PermissionGetResultIterator type. -func NewPermissionGetResultIterator(page PermissionGetResultPage) PermissionGetResultIterator { - return PermissionGetResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (pgr PermissionGetResult) IsEmpty() bool { - return pgr.Value == nil || len(*pgr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (pgr PermissionGetResult) hasNextLink() bool { - return pgr.NextLink != nil && len(*pgr.NextLink) != 0 -} - -// permissionGetResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (pgr PermissionGetResult) permissionGetResultPreparer(ctx context.Context) (*http.Request, error) { - if !pgr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(pgr.NextLink))) -} - -// PermissionGetResultPage contains a page of Permission values. -type PermissionGetResultPage struct { - fn func(context.Context, PermissionGetResult) (PermissionGetResult, error) - pgr PermissionGetResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *PermissionGetResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PermissionGetResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.pgr) - if err != nil { - return err - } - page.pgr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *PermissionGetResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PermissionGetResultPage) NotDone() bool { - return !page.pgr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PermissionGetResultPage) Response() PermissionGetResult { - return page.pgr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PermissionGetResultPage) Values() []Permission { - if page.pgr.IsEmpty() { - return nil - } - return *page.pgr.Value -} - -// Creates a new instance of the PermissionGetResultPage type. -func NewPermissionGetResultPage(cur PermissionGetResult, getNextPage func(context.Context, PermissionGetResult) (PermissionGetResult, error)) PermissionGetResultPage { - return PermissionGetResultPage{ - fn: getNextPage, - pgr: cur, - } -} - -// Principal deny assignment principal. -type Principal struct { - // ID - READ-ONLY; Object ID of the Azure AD principal (user, group, or service principal) to which the deny assignment applies. An empty guid '00000000-0000-0000-0000-000000000000' as principal id and principal type as 'Everyone' represents all users, groups and service principals. - ID *string `json:"id,omitempty"` - // Type - READ-ONLY; Type of object represented by principal id (user, group, or service principal). An empty guid '00000000-0000-0000-0000-000000000000' as principal id and principal type as 'Everyone' represents all users, groups and service principals. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Principal. -func (p Principal) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ProviderOperation operation -type ProviderOperation struct { - // Name - The operation name. - Name *string `json:"name,omitempty"` - // DisplayName - The operation display name. - DisplayName *string `json:"displayName,omitempty"` - // Description - The operation description. - Description *string `json:"description,omitempty"` - // Origin - The operation origin. - Origin *string `json:"origin,omitempty"` - // Properties - The operation properties. - Properties interface{} `json:"properties,omitempty"` - // IsDataAction - The dataAction flag to specify the operation type. - IsDataAction *bool `json:"isDataAction,omitempty"` -} - -// ProviderOperationsMetadata provider Operations metadata -type ProviderOperationsMetadata struct { - autorest.Response `json:"-"` - // ID - The provider id. - ID *string `json:"id,omitempty"` - // Name - The provider name. - Name *string `json:"name,omitempty"` - // Type - The provider type. - Type *string `json:"type,omitempty"` - // DisplayName - The provider display name. - DisplayName *string `json:"displayName,omitempty"` - // ResourceTypes - The provider resource types - ResourceTypes *[]ResourceType `json:"resourceTypes,omitempty"` - // Operations - The provider operations. - Operations *[]ProviderOperation `json:"operations,omitempty"` -} - -// ProviderOperationsMetadataListResult provider operations metadata list -type ProviderOperationsMetadataListResult struct { - autorest.Response `json:"-"` - // Value - The list of providers. - Value *[]ProviderOperationsMetadata `json:"value,omitempty"` - // NextLink - The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ProviderOperationsMetadataListResultIterator provides access to a complete listing of -// ProviderOperationsMetadata values. -type ProviderOperationsMetadataListResultIterator struct { - i int - page ProviderOperationsMetadataListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ProviderOperationsMetadataListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProviderOperationsMetadataListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ProviderOperationsMetadataListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ProviderOperationsMetadataListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ProviderOperationsMetadataListResultIterator) Response() ProviderOperationsMetadataListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ProviderOperationsMetadataListResultIterator) Value() ProviderOperationsMetadata { - if !iter.page.NotDone() { - return ProviderOperationsMetadata{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ProviderOperationsMetadataListResultIterator type. -func NewProviderOperationsMetadataListResultIterator(page ProviderOperationsMetadataListResultPage) ProviderOperationsMetadataListResultIterator { - return ProviderOperationsMetadataListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (pomlr ProviderOperationsMetadataListResult) IsEmpty() bool { - return pomlr.Value == nil || len(*pomlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (pomlr ProviderOperationsMetadataListResult) hasNextLink() bool { - return pomlr.NextLink != nil && len(*pomlr.NextLink) != 0 -} - -// providerOperationsMetadataListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (pomlr ProviderOperationsMetadataListResult) providerOperationsMetadataListResultPreparer(ctx context.Context) (*http.Request, error) { - if !pomlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(pomlr.NextLink))) -} - -// ProviderOperationsMetadataListResultPage contains a page of ProviderOperationsMetadata values. -type ProviderOperationsMetadataListResultPage struct { - fn func(context.Context, ProviderOperationsMetadataListResult) (ProviderOperationsMetadataListResult, error) - pomlr ProviderOperationsMetadataListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ProviderOperationsMetadataListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProviderOperationsMetadataListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.pomlr) - if err != nil { - return err - } - page.pomlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ProviderOperationsMetadataListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ProviderOperationsMetadataListResultPage) NotDone() bool { - return !page.pomlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ProviderOperationsMetadataListResultPage) Response() ProviderOperationsMetadataListResult { - return page.pomlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ProviderOperationsMetadataListResultPage) Values() []ProviderOperationsMetadata { - if page.pomlr.IsEmpty() { - return nil - } - return *page.pomlr.Value -} - -// Creates a new instance of the ProviderOperationsMetadataListResultPage type. -func NewProviderOperationsMetadataListResultPage(cur ProviderOperationsMetadataListResult, getNextPage func(context.Context, ProviderOperationsMetadataListResult) (ProviderOperationsMetadataListResult, error)) ProviderOperationsMetadataListResultPage { - return ProviderOperationsMetadataListResultPage{ - fn: getNextPage, - pomlr: cur, - } -} - -// ResourceType resource Type -type ResourceType struct { - // Name - The resource type name. - Name *string `json:"name,omitempty"` - // DisplayName - The resource type display name. - DisplayName *string `json:"displayName,omitempty"` - // Operations - The resource type operations. - Operations *[]ProviderOperation `json:"operations,omitempty"` -} - -// RoleAssignment role Assignments -type RoleAssignment struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; The role assignment ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The role assignment name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The role assignment type. - Type *string `json:"type,omitempty"` - // RoleAssignmentPropertiesWithScope - Role assignment properties. - *RoleAssignmentPropertiesWithScope `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for RoleAssignment. -func (ra RoleAssignment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ra.RoleAssignmentPropertiesWithScope != nil { - objectMap["properties"] = ra.RoleAssignmentPropertiesWithScope - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RoleAssignment struct. -func (ra *RoleAssignment) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ra.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ra.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ra.Type = &typeVar - } - case "properties": - if v != nil { - var roleAssignmentPropertiesWithScope RoleAssignmentPropertiesWithScope - err = json.Unmarshal(*v, &roleAssignmentPropertiesWithScope) - if err != nil { - return err - } - ra.RoleAssignmentPropertiesWithScope = &roleAssignmentPropertiesWithScope - } - } - } - - return nil -} - -// RoleAssignmentCreateParameters role assignment create parameters. -type RoleAssignmentCreateParameters struct { - // RoleAssignmentProperties - Role assignment properties. - *RoleAssignmentProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for RoleAssignmentCreateParameters. -func (racp RoleAssignmentCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if racp.RoleAssignmentProperties != nil { - objectMap["properties"] = racp.RoleAssignmentProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RoleAssignmentCreateParameters struct. -func (racp *RoleAssignmentCreateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var roleAssignmentProperties RoleAssignmentProperties - err = json.Unmarshal(*v, &roleAssignmentProperties) - if err != nil { - return err - } - racp.RoleAssignmentProperties = &roleAssignmentProperties - } - } - } - - return nil -} - -// RoleAssignmentFilter role Assignments filter -type RoleAssignmentFilter struct { - // PrincipalID - Returns role assignment of the specific principal. - PrincipalID *string `json:"principalId,omitempty"` - // CanDelegate - The Delegation flag for the role assignment - CanDelegate *bool `json:"canDelegate,omitempty"` -} - -// RoleAssignmentListResult role assignment list operation result. -type RoleAssignmentListResult struct { - autorest.Response `json:"-"` - // Value - Role assignment list. - Value *[]RoleAssignment `json:"value,omitempty"` - // NextLink - The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// RoleAssignmentListResultIterator provides access to a complete listing of RoleAssignment values. -type RoleAssignmentListResultIterator struct { - i int - page RoleAssignmentListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *RoleAssignmentListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *RoleAssignmentListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RoleAssignmentListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter RoleAssignmentListResultIterator) Response() RoleAssignmentListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter RoleAssignmentListResultIterator) Value() RoleAssignment { - if !iter.page.NotDone() { - return RoleAssignment{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RoleAssignmentListResultIterator type. -func NewRoleAssignmentListResultIterator(page RoleAssignmentListResultPage) RoleAssignmentListResultIterator { - return RoleAssignmentListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ralr RoleAssignmentListResult) IsEmpty() bool { - return ralr.Value == nil || len(*ralr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ralr RoleAssignmentListResult) hasNextLink() bool { - return ralr.NextLink != nil && len(*ralr.NextLink) != 0 -} - -// roleAssignmentListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ralr RoleAssignmentListResult) roleAssignmentListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ralr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ralr.NextLink))) -} - -// RoleAssignmentListResultPage contains a page of RoleAssignment values. -type RoleAssignmentListResultPage struct { - fn func(context.Context, RoleAssignmentListResult) (RoleAssignmentListResult, error) - ralr RoleAssignmentListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *RoleAssignmentListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ralr) - if err != nil { - return err - } - page.ralr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *RoleAssignmentListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RoleAssignmentListResultPage) NotDone() bool { - return !page.ralr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RoleAssignmentListResultPage) Response() RoleAssignmentListResult { - return page.ralr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RoleAssignmentListResultPage) Values() []RoleAssignment { - if page.ralr.IsEmpty() { - return nil - } - return *page.ralr.Value -} - -// Creates a new instance of the RoleAssignmentListResultPage type. -func NewRoleAssignmentListResultPage(cur RoleAssignmentListResult, getNextPage func(context.Context, RoleAssignmentListResult) (RoleAssignmentListResult, error)) RoleAssignmentListResultPage { - return RoleAssignmentListResultPage{ - fn: getNextPage, - ralr: cur, - } -} - -// RoleAssignmentMetricsResult role Assignment Metrics -type RoleAssignmentMetricsResult struct { - autorest.Response `json:"-"` - // SubscriptionID - READ-ONLY; The subscription ID. - SubscriptionID *string `json:"subscriptionId,omitempty"` - // RoleAssignmentsLimit - READ-ONLY; The role assignment limit. - RoleAssignmentsLimit *int64 `json:"roleAssignmentsLimit,omitempty"` - // RoleAssignmentsCurrentCount - READ-ONLY; The number of current role assignments. - RoleAssignmentsCurrentCount *int64 `json:"roleAssignmentsCurrentCount,omitempty"` - // RoleAssignmentsRemainingCount - READ-ONLY; The number of remaining role assignments available. - RoleAssignmentsRemainingCount *int64 `json:"roleAssignmentsRemainingCount,omitempty"` -} - -// MarshalJSON is the custom marshaler for RoleAssignmentMetricsResult. -func (ramr RoleAssignmentMetricsResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RoleAssignmentProperties role assignment properties. -type RoleAssignmentProperties struct { - // RoleDefinitionID - The role definition ID used in the role assignment. - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` - // PrincipalID - The principal ID assigned to the role. This maps to the ID inside the Active Directory. It can point to a user, service principal, or security group. - PrincipalID *string `json:"principalId,omitempty"` - // PrincipalType - The principal type of the assigned principal ID. Possible values include: 'User', 'Group', 'ServicePrincipal', 'Unknown', 'DirectoryRoleTemplate', 'ForeignGroup', 'Application', 'MSI', 'DirectoryObjectOrGroup', 'Everyone' - PrincipalType PrincipalType `json:"principalType,omitempty"` - // CanDelegate - The delegation flag used for creating a role assignment - CanDelegate *bool `json:"canDelegate,omitempty"` - // Description - Description of role assignment - Description *string `json:"description,omitempty"` - // Condition - The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container' - Condition *string `json:"condition,omitempty"` - // ConditionVersion - Version of the condition. Currently accepted value is '2.0' - ConditionVersion *string `json:"conditionVersion,omitempty"` - // DelegatedManagedIdentityResourceID - Id of the delegated managed identity resource - DelegatedManagedIdentityResourceID *string `json:"delegatedManagedIdentityResourceId,omitempty"` -} - -// RoleAssignmentPropertiesWithScope role assignment properties with scope. -type RoleAssignmentPropertiesWithScope struct { - // Scope - The role assignment scope. - Scope *string `json:"scope,omitempty"` - // RoleDefinitionID - The role definition ID. - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` - // PrincipalID - The principal ID. - PrincipalID *string `json:"principalId,omitempty"` - // PrincipalType - The principal type of the assigned principal ID. Possible values include: 'User', 'Group', 'ServicePrincipal', 'Unknown', 'DirectoryRoleTemplate', 'ForeignGroup', 'Application', 'MSI', 'DirectoryObjectOrGroup', 'Everyone' - PrincipalType PrincipalType `json:"principalType,omitempty"` - // CanDelegate - The Delegation flag for the role assignment - CanDelegate *bool `json:"canDelegate,omitempty"` - // Description - Description of role assignment - Description *string `json:"description,omitempty"` - // Condition - The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container' - Condition *string `json:"condition,omitempty"` - // ConditionVersion - Version of the condition. Currently accepted value is '2.0' - ConditionVersion *string `json:"conditionVersion,omitempty"` - // CreatedOn - Time it was created - CreatedOn *date.Time `json:"createdOn,omitempty"` - // UpdatedOn - Time it was updated - UpdatedOn *date.Time `json:"updatedOn,omitempty"` - // CreatedBy - Id of the user who created the assignment - CreatedBy *string `json:"createdBy,omitempty"` - // UpdatedBy - Id of the user who updated the assignment - UpdatedBy *string `json:"updatedBy,omitempty"` - // DelegatedManagedIdentityResourceID - Id of the delegated managed identity resource - DelegatedManagedIdentityResourceID *string `json:"delegatedManagedIdentityResourceId,omitempty"` -} - -// RoleDefinition role definition. -type RoleDefinition struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; The role definition ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The role definition name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The role definition type. - Type *string `json:"type,omitempty"` - // RoleDefinitionProperties - Role definition properties. - *RoleDefinitionProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for RoleDefinition. -func (rd RoleDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rd.RoleDefinitionProperties != nil { - objectMap["properties"] = rd.RoleDefinitionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RoleDefinition struct. -func (rd *RoleDefinition) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rd.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rd.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rd.Type = &typeVar - } - case "properties": - if v != nil { - var roleDefinitionProperties RoleDefinitionProperties - err = json.Unmarshal(*v, &roleDefinitionProperties) - if err != nil { - return err - } - rd.RoleDefinitionProperties = &roleDefinitionProperties - } - } - } - - return nil -} - -// RoleDefinitionFilter role Definitions filter -type RoleDefinitionFilter struct { - // RoleName - Returns role definition with the specific name. - RoleName *string `json:"roleName,omitempty"` - // Type - Returns role definition with the specific type. - Type *string `json:"type,omitempty"` -} - -// RoleDefinitionListResult role definition list operation result. -type RoleDefinitionListResult struct { - autorest.Response `json:"-"` - // Value - Role definition list. - Value *[]RoleDefinition `json:"value,omitempty"` - // NextLink - The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// RoleDefinitionListResultIterator provides access to a complete listing of RoleDefinition values. -type RoleDefinitionListResultIterator struct { - i int - page RoleDefinitionListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *RoleDefinitionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RoleDefinitionListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *RoleDefinitionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RoleDefinitionListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter RoleDefinitionListResultIterator) Response() RoleDefinitionListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter RoleDefinitionListResultIterator) Value() RoleDefinition { - if !iter.page.NotDone() { - return RoleDefinition{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RoleDefinitionListResultIterator type. -func NewRoleDefinitionListResultIterator(page RoleDefinitionListResultPage) RoleDefinitionListResultIterator { - return RoleDefinitionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rdlr RoleDefinitionListResult) IsEmpty() bool { - return rdlr.Value == nil || len(*rdlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rdlr RoleDefinitionListResult) hasNextLink() bool { - return rdlr.NextLink != nil && len(*rdlr.NextLink) != 0 -} - -// roleDefinitionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rdlr RoleDefinitionListResult) roleDefinitionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !rdlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rdlr.NextLink))) -} - -// RoleDefinitionListResultPage contains a page of RoleDefinition values. -type RoleDefinitionListResultPage struct { - fn func(context.Context, RoleDefinitionListResult) (RoleDefinitionListResult, error) - rdlr RoleDefinitionListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *RoleDefinitionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RoleDefinitionListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.rdlr) - if err != nil { - return err - } - page.rdlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *RoleDefinitionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RoleDefinitionListResultPage) NotDone() bool { - return !page.rdlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RoleDefinitionListResultPage) Response() RoleDefinitionListResult { - return page.rdlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RoleDefinitionListResultPage) Values() []RoleDefinition { - if page.rdlr.IsEmpty() { - return nil - } - return *page.rdlr.Value -} - -// Creates a new instance of the RoleDefinitionListResultPage type. -func NewRoleDefinitionListResultPage(cur RoleDefinitionListResult, getNextPage func(context.Context, RoleDefinitionListResult) (RoleDefinitionListResult, error)) RoleDefinitionListResultPage { - return RoleDefinitionListResultPage{ - fn: getNextPage, - rdlr: cur, - } -} - -// RoleDefinitionProperties role definition properties. -type RoleDefinitionProperties struct { - // RoleName - The role name. - RoleName *string `json:"roleName,omitempty"` - // Description - The role definition description. - Description *string `json:"description,omitempty"` - // RoleType - The role type. - RoleType *string `json:"type,omitempty"` - // Permissions - Role definition permissions. - Permissions *[]Permission `json:"permissions,omitempty"` - // AssignableScopes - Role definition assignable scopes. - AssignableScopes *[]string `json:"assignableScopes,omitempty"` -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/permissions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/permissions.go deleted file mode 100644 index 8c6135300..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/permissions.go +++ /dev/null @@ -1,292 +0,0 @@ -package authorization - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PermissionsClient is the client for the Permissions methods of the Authorization service. -type PermissionsClient struct { - BaseClient -} - -// NewPermissionsClient creates an instance of the PermissionsClient client. -func NewPermissionsClient(subscriptionID string) PermissionsClient { - return NewPermissionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPermissionsClientWithBaseURI creates an instance of the PermissionsClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewPermissionsClientWithBaseURI(baseURI string, subscriptionID string) PermissionsClient { - return PermissionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListForResource gets all permissions the caller has for a resource. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceProviderNamespace - the namespace of the resource provider. -// parentResourcePath - the parent resource identity. -// resourceType - the resource type of the resource. -// resourceName - the name of the resource to get the permissions for. -func (client PermissionsClient) ListForResource(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (result PermissionGetResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PermissionsClient.ListForResource") - defer func() { - sc := -1 - if result.pgr.Response.Response != nil { - sc = result.pgr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("authorization.PermissionsClient", "ListForResource", err.Error()) - } - - result.fn = client.listForResourceNextResults - req, err := client.ListForResourcePreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResource", nil, "Failure preparing request") - return - } - - resp, err := client.ListForResourceSender(req) - if err != nil { - result.pgr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResource", resp, "Failure sending request") - return - } - - result.pgr, err = client.ListForResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResource", resp, "Failure responding to request") - return - } - if result.pgr.hasNextLink() && result.pgr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListForResourcePreparer prepares the ListForResource request. -func (client PermissionsClient) ListForResourcePreparer(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "parentResourcePath": parentResourcePath, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), - "resourceType": resourceType, - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListForResourceSender sends the ListForResource request. The method will close the -// http.Response Body if it receives an error. -func (client PermissionsClient) ListForResourceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListForResourceResponder handles the response to the ListForResource request. The method always -// closes the http.Response Body. -func (client PermissionsClient) ListForResourceResponder(resp *http.Response) (result PermissionGetResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listForResourceNextResults retrieves the next set of results, if any. -func (client PermissionsClient) listForResourceNextResults(ctx context.Context, lastResults PermissionGetResult) (result PermissionGetResult, err error) { - req, err := lastResults.permissionGetResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "authorization.PermissionsClient", "listForResourceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListForResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "authorization.PermissionsClient", "listForResourceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListForResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.PermissionsClient", "listForResourceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListForResourceComplete enumerates all values, automatically crossing page boundaries as required. -func (client PermissionsClient) ListForResourceComplete(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (result PermissionGetResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PermissionsClient.ListForResource") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListForResource(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName) - return -} - -// ListForResourceGroup gets all permissions the caller has for a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client PermissionsClient) ListForResourceGroup(ctx context.Context, resourceGroupName string) (result PermissionGetResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PermissionsClient.ListForResourceGroup") - defer func() { - sc := -1 - if result.pgr.Response.Response != nil { - sc = result.pgr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("authorization.PermissionsClient", "ListForResourceGroup", err.Error()) - } - - result.fn = client.listForResourceGroupNextResults - req, err := client.ListForResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListForResourceGroupSender(req) - if err != nil { - result.pgr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResourceGroup", resp, "Failure sending request") - return - } - - result.pgr, err = client.ListForResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResourceGroup", resp, "Failure responding to request") - return - } - if result.pgr.hasNextLink() && result.pgr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListForResourceGroupPreparer prepares the ListForResourceGroup request. -func (client PermissionsClient) ListForResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListForResourceGroupSender sends the ListForResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client PermissionsClient) ListForResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListForResourceGroupResponder handles the response to the ListForResourceGroup request. The method always -// closes the http.Response Body. -func (client PermissionsClient) ListForResourceGroupResponder(resp *http.Response) (result PermissionGetResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listForResourceGroupNextResults retrieves the next set of results, if any. -func (client PermissionsClient) listForResourceGroupNextResults(ctx context.Context, lastResults PermissionGetResult) (result PermissionGetResult, err error) { - req, err := lastResults.permissionGetResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "authorization.PermissionsClient", "listForResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListForResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "authorization.PermissionsClient", "listForResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListForResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.PermissionsClient", "listForResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListForResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client PermissionsClient) ListForResourceGroupComplete(ctx context.Context, resourceGroupName string) (result PermissionGetResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PermissionsClient.ListForResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListForResourceGroup(ctx, resourceGroupName) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/provideroperationsmetadata.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/provideroperationsmetadata.go deleted file mode 100644 index 359c843c0..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/provideroperationsmetadata.go +++ /dev/null @@ -1,228 +0,0 @@ -package authorization - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ProviderOperationsMetadataClient is the client for the ProviderOperationsMetadata methods of the Authorization -// service. -type ProviderOperationsMetadataClient struct { - BaseClient -} - -// NewProviderOperationsMetadataClient creates an instance of the ProviderOperationsMetadataClient client. -func NewProviderOperationsMetadataClient(subscriptionID string) ProviderOperationsMetadataClient { - return NewProviderOperationsMetadataClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProviderOperationsMetadataClientWithBaseURI creates an instance of the ProviderOperationsMetadataClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewProviderOperationsMetadataClientWithBaseURI(baseURI string, subscriptionID string) ProviderOperationsMetadataClient { - return ProviderOperationsMetadataClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets provider operations metadata for the specified resource provider. -// Parameters: -// resourceProviderNamespace - the namespace of the resource provider. -// expand - specifies whether to expand the values. -func (client ProviderOperationsMetadataClient) Get(ctx context.Context, resourceProviderNamespace string, expand string) (result ProviderOperationsMetadata, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProviderOperationsMetadataClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceProviderNamespace, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ProviderOperationsMetadataClient) GetPreparer(ctx context.Context, resourceProviderNamespace string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), - } - - const APIVersion = "2018-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } else { - queryParameters["$expand"] = autorest.Encode("query", "resourceTypes") - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ProviderOperationsMetadataClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ProviderOperationsMetadataClient) GetResponder(resp *http.Response) (result ProviderOperationsMetadata, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets provider operations metadata for all resource providers. -// Parameters: -// expand - specifies whether to expand the values. -func (client ProviderOperationsMetadataClient) List(ctx context.Context, expand string) (result ProviderOperationsMetadataListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProviderOperationsMetadataClient.List") - defer func() { - sc := -1 - if result.pomlr.Response.Response != nil { - sc = result.pomlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.pomlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "List", resp, "Failure sending request") - return - } - - result.pomlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "List", resp, "Failure responding to request") - return - } - if result.pomlr.hasNextLink() && result.pomlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ProviderOperationsMetadataClient) ListPreparer(ctx context.Context, expand string) (*http.Request, error) { - const APIVersion = "2018-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } else { - queryParameters["$expand"] = autorest.Encode("query", "resourceTypes") - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Authorization/providerOperations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ProviderOperationsMetadataClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ProviderOperationsMetadataClient) ListResponder(resp *http.Response) (result ProviderOperationsMetadataListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client ProviderOperationsMetadataClient) listNextResults(ctx context.Context, lastResults ProviderOperationsMetadataListResult) (result ProviderOperationsMetadataListResult, err error) { - req, err := lastResults.providerOperationsMetadataListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ProviderOperationsMetadataClient) ListComplete(ctx context.Context, expand string) (result ProviderOperationsMetadataListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProviderOperationsMetadataClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, expand) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/roleassignmentmetrics.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/roleassignmentmetrics.go deleted file mode 100644 index 5059d51a0..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/roleassignmentmetrics.go +++ /dev/null @@ -1,110 +0,0 @@ -package authorization - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// RoleAssignmentMetricsClient is the client for the RoleAssignmentMetrics methods of the Authorization service. -type RoleAssignmentMetricsClient struct { - BaseClient -} - -// NewRoleAssignmentMetricsClient creates an instance of the RoleAssignmentMetricsClient client. -func NewRoleAssignmentMetricsClient(subscriptionID string) RoleAssignmentMetricsClient { - return NewRoleAssignmentMetricsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRoleAssignmentMetricsClientWithBaseURI creates an instance of the RoleAssignmentMetricsClient client using a -// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, -// Azure stack). -func NewRoleAssignmentMetricsClientWithBaseURI(baseURI string, subscriptionID string) RoleAssignmentMetricsClient { - return RoleAssignmentMetricsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetMetricsForSubscription get role assignment usage metrics for a subscription -func (client RoleAssignmentMetricsClient) GetMetricsForSubscription(ctx context.Context) (result RoleAssignmentMetricsResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentMetricsClient.GetMetricsForSubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("authorization.RoleAssignmentMetricsClient", "GetMetricsForSubscription", err.Error()) - } - - req, err := client.GetMetricsForSubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentMetricsClient", "GetMetricsForSubscription", nil, "Failure preparing request") - return - } - - resp, err := client.GetMetricsForSubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentMetricsClient", "GetMetricsForSubscription", resp, "Failure sending request") - return - } - - result, err = client.GetMetricsForSubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentMetricsClient", "GetMetricsForSubscription", resp, "Failure responding to request") - return - } - - return -} - -// GetMetricsForSubscriptionPreparer prepares the GetMetricsForSubscription request. -func (client RoleAssignmentMetricsClient) GetMetricsForSubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignmentsUsageMetrics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetMetricsForSubscriptionSender sends the GetMetricsForSubscription request. The method will close the -// http.Response Body if it receives an error. -func (client RoleAssignmentMetricsClient) GetMetricsForSubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetMetricsForSubscriptionResponder handles the response to the GetMetricsForSubscription request. The method always -// closes the http.Response Body. -func (client RoleAssignmentMetricsClient) GetMetricsForSubscriptionResponder(resp *http.Response) (result RoleAssignmentMetricsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/roleassignments.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/roleassignments.go deleted file mode 100644 index 53a25d6a5..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/roleassignments.go +++ /dev/null @@ -1,1055 +0,0 @@ -package authorization - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// RoleAssignmentsClient is the client for the RoleAssignments methods of the Authorization service. -type RoleAssignmentsClient struct { - BaseClient -} - -// NewRoleAssignmentsClient creates an instance of the RoleAssignmentsClient client. -func NewRoleAssignmentsClient(subscriptionID string) RoleAssignmentsClient { - return NewRoleAssignmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRoleAssignmentsClientWithBaseURI creates an instance of the RoleAssignmentsClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewRoleAssignmentsClientWithBaseURI(baseURI string, subscriptionID string) RoleAssignmentsClient { - return RoleAssignmentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create a role assignment. -// Parameters: -// scope - the scope of the role assignment to create. The scope can be any REST resource instance. For -// example, use '/subscriptions/{subscription-id}/' for a subscription, -// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and -// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' -// for a resource. -// roleAssignmentName - the name of the role assignment to create. It can be any valid GUID. -// parameters - parameters for the role assignment. -func (client RoleAssignmentsClient) Create(ctx context.Context, scope string, roleAssignmentName string, parameters RoleAssignmentCreateParameters) (result RoleAssignment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.Create") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.RoleAssignmentProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.RoleAssignmentProperties.RoleDefinitionID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.RoleAssignmentProperties.PrincipalID", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("authorization.RoleAssignmentsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, scope, roleAssignmentName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client RoleAssignmentsClient) CreatePreparer(ctx context.Context, scope string, roleAssignmentName string, parameters RoleAssignmentCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "roleAssignmentName": autorest.Encode("path", roleAssignmentName), - "scope": scope, - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client RoleAssignmentsClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client RoleAssignmentsClient) CreateResponder(resp *http.Response) (result RoleAssignment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateByID creates a role assignment by ID. -// Parameters: -// roleID - the ID of the role assignment to create. -// parameters - parameters for the role assignment. -func (client RoleAssignmentsClient) CreateByID(ctx context.Context, roleID string, parameters RoleAssignmentCreateParameters) (result RoleAssignment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.CreateByID") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.RoleAssignmentProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.RoleAssignmentProperties.RoleDefinitionID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.RoleAssignmentProperties.PrincipalID", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("authorization.RoleAssignmentsClient", "CreateByID", err.Error()) - } - - req, err := client.CreateByIDPreparer(ctx, roleID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "CreateByID", nil, "Failure preparing request") - return - } - - resp, err := client.CreateByIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "CreateByID", resp, "Failure sending request") - return - } - - result, err = client.CreateByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "CreateByID", resp, "Failure responding to request") - return - } - - return -} - -// CreateByIDPreparer prepares the CreateByID request. -func (client RoleAssignmentsClient) CreateByIDPreparer(ctx context.Context, roleID string, parameters RoleAssignmentCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "roleId": roleID, - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{roleId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateByIDSender sends the CreateByID request. The method will close the -// http.Response Body if it receives an error. -func (client RoleAssignmentsClient) CreateByIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CreateByIDResponder handles the response to the CreateByID request. The method always -// closes the http.Response Body. -func (client RoleAssignmentsClient) CreateByIDResponder(resp *http.Response) (result RoleAssignment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a role assignment. -// Parameters: -// scope - the scope of the role assignment to delete. -// roleAssignmentName - the name of the role assignment to delete. -// tenantID - tenant ID for cross-tenant request -func (client RoleAssignmentsClient) Delete(ctx context.Context, scope string, roleAssignmentName string, tenantID string) (result RoleAssignment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.Delete") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, scope, roleAssignmentName, tenantID) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client RoleAssignmentsClient) DeletePreparer(ctx context.Context, scope string, roleAssignmentName string, tenantID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "roleAssignmentName": autorest.Encode("path", roleAssignmentName), - "scope": scope, - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(tenantID) > 0 { - queryParameters["tenantId"] = autorest.Encode("query", tenantID) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client RoleAssignmentsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client RoleAssignmentsClient) DeleteResponder(resp *http.Response) (result RoleAssignment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteByID delete a role assignment. -// Parameters: -// roleID - the ID of the role assignment to delete. -// tenantID - tenant ID for cross-tenant request -func (client RoleAssignmentsClient) DeleteByID(ctx context.Context, roleID string, tenantID string) (result RoleAssignment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.DeleteByID") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeleteByIDPreparer(ctx, roleID, tenantID) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "DeleteByID", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteByIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "DeleteByID", resp, "Failure sending request") - return - } - - result, err = client.DeleteByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "DeleteByID", resp, "Failure responding to request") - return - } - - return -} - -// DeleteByIDPreparer prepares the DeleteByID request. -func (client RoleAssignmentsClient) DeleteByIDPreparer(ctx context.Context, roleID string, tenantID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "roleId": roleID, - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(tenantID) > 0 { - queryParameters["tenantId"] = autorest.Encode("query", tenantID) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{roleId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteByIDSender sends the DeleteByID request. The method will close the -// http.Response Body if it receives an error. -func (client RoleAssignmentsClient) DeleteByIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// DeleteByIDResponder handles the response to the DeleteByID request. The method always -// closes the http.Response Body. -func (client RoleAssignmentsClient) DeleteByIDResponder(resp *http.Response) (result RoleAssignment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get the specified role assignment. -// Parameters: -// scope - the scope of the role assignment. -// roleAssignmentName - the name of the role assignment to get. -// tenantID - tenant ID for cross-tenant request -func (client RoleAssignmentsClient) Get(ctx context.Context, scope string, roleAssignmentName string, tenantID string) (result RoleAssignment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, scope, roleAssignmentName, tenantID) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RoleAssignmentsClient) GetPreparer(ctx context.Context, scope string, roleAssignmentName string, tenantID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "roleAssignmentName": autorest.Encode("path", roleAssignmentName), - "scope": scope, - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(tenantID) > 0 { - queryParameters["tenantId"] = autorest.Encode("query", tenantID) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client RoleAssignmentsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client RoleAssignmentsClient) GetResponder(resp *http.Response) (result RoleAssignment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetByID gets a role assignment by ID. -// Parameters: -// roleID - the ID of the role assignment to get. -// tenantID - tenant ID for cross-tenant request -func (client RoleAssignmentsClient) GetByID(ctx context.Context, roleID string, tenantID string) (result RoleAssignment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.GetByID") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetByIDPreparer(ctx, roleID, tenantID) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "GetByID", nil, "Failure preparing request") - return - } - - resp, err := client.GetByIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "GetByID", resp, "Failure sending request") - return - } - - result, err = client.GetByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "GetByID", resp, "Failure responding to request") - return - } - - return -} - -// GetByIDPreparer prepares the GetByID request. -func (client RoleAssignmentsClient) GetByIDPreparer(ctx context.Context, roleID string, tenantID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "roleId": roleID, - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(tenantID) > 0 { - queryParameters["tenantId"] = autorest.Encode("query", tenantID) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{roleId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByIDSender sends the GetByID request. The method will close the -// http.Response Body if it receives an error. -func (client RoleAssignmentsClient) GetByIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetByIDResponder handles the response to the GetByID request. The method always -// closes the http.Response Body. -func (client RoleAssignmentsClient) GetByIDResponder(resp *http.Response) (result RoleAssignment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all role assignments for the subscription. -// Parameters: -// filter - the filter to apply on the operation. Use $filter=atScope() to return all role assignments at or -// above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope -// for the specified principal. -// tenantID - tenant ID for cross-tenant request -func (client RoleAssignmentsClient) List(ctx context.Context, filter string, tenantID string) (result RoleAssignmentListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.List") - defer func() { - sc := -1 - if result.ralr.Response.Response != nil { - sc = result.ralr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("authorization.RoleAssignmentsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, filter, tenantID) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.ralr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "List", resp, "Failure sending request") - return - } - - result.ralr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "List", resp, "Failure responding to request") - return - } - if result.ralr.hasNextLink() && result.ralr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client RoleAssignmentsClient) ListPreparer(ctx context.Context, filter string, tenantID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(tenantID) > 0 { - queryParameters["tenantId"] = autorest.Encode("query", tenantID) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client RoleAssignmentsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client RoleAssignmentsClient) ListResponder(resp *http.Response) (result RoleAssignmentListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client RoleAssignmentsClient) listNextResults(ctx context.Context, lastResults RoleAssignmentListResult) (result RoleAssignmentListResult, err error) { - req, err := lastResults.roleAssignmentListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client RoleAssignmentsClient) ListComplete(ctx context.Context, filter string, tenantID string) (result RoleAssignmentListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, filter, tenantID) - return -} - -// ListForResource list role assignments for a resource. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceProviderNamespace - the namespace of the resource provider. -// parentResourcePath - the parent resource identity. -// resourceType - the resource type of the resource. -// resourceName - the name of the resource to get role assignments for. -// filter - the filter to apply on the operation. Use $filter=atScope() to return all role assignments at or -// above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope -// for the specified principal. -// tenantID - tenant ID for cross-tenant request -func (client RoleAssignmentsClient) ListForResource(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string, tenantID string) (result RoleAssignmentListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.ListForResource") - defer func() { - sc := -1 - if result.ralr.Response.Response != nil { - sc = result.ralr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("authorization.RoleAssignmentsClient", "ListForResource", err.Error()) - } - - result.fn = client.listForResourceNextResults - req, err := client.ListForResourcePreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter, tenantID) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResource", nil, "Failure preparing request") - return - } - - resp, err := client.ListForResourceSender(req) - if err != nil { - result.ralr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResource", resp, "Failure sending request") - return - } - - result.ralr, err = client.ListForResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResource", resp, "Failure responding to request") - return - } - if result.ralr.hasNextLink() && result.ralr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListForResourcePreparer prepares the ListForResource request. -func (client RoleAssignmentsClient) ListForResourcePreparer(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string, tenantID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "parentResourcePath": parentResourcePath, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), - "resourceType": resourceType, - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(tenantID) > 0 { - queryParameters["tenantId"] = autorest.Encode("query", tenantID) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListForResourceSender sends the ListForResource request. The method will close the -// http.Response Body if it receives an error. -func (client RoleAssignmentsClient) ListForResourceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListForResourceResponder handles the response to the ListForResource request. The method always -// closes the http.Response Body. -func (client RoleAssignmentsClient) ListForResourceResponder(resp *http.Response) (result RoleAssignmentListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listForResourceNextResults retrieves the next set of results, if any. -func (client RoleAssignmentsClient) listForResourceNextResults(ctx context.Context, lastResults RoleAssignmentListResult) (result RoleAssignmentListResult, err error) { - req, err := lastResults.roleAssignmentListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "listForResourceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListForResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "listForResourceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListForResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "listForResourceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListForResourceComplete enumerates all values, automatically crossing page boundaries as required. -func (client RoleAssignmentsClient) ListForResourceComplete(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string, tenantID string) (result RoleAssignmentListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.ListForResource") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListForResource(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter, tenantID) - return -} - -// ListForResourceGroup list role assignments for a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// filter - the filter to apply on the operation. Use $filter=atScope() to return all role assignments at or -// above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope -// for the specified principal. -// tenantID - tenant ID for cross-tenant request -func (client RoleAssignmentsClient) ListForResourceGroup(ctx context.Context, resourceGroupName string, filter string, tenantID string) (result RoleAssignmentListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.ListForResourceGroup") - defer func() { - sc := -1 - if result.ralr.Response.Response != nil { - sc = result.ralr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("authorization.RoleAssignmentsClient", "ListForResourceGroup", err.Error()) - } - - result.fn = client.listForResourceGroupNextResults - req, err := client.ListForResourceGroupPreparer(ctx, resourceGroupName, filter, tenantID) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListForResourceGroupSender(req) - if err != nil { - result.ralr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResourceGroup", resp, "Failure sending request") - return - } - - result.ralr, err = client.ListForResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResourceGroup", resp, "Failure responding to request") - return - } - if result.ralr.hasNextLink() && result.ralr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListForResourceGroupPreparer prepares the ListForResourceGroup request. -func (client RoleAssignmentsClient) ListForResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, tenantID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(tenantID) > 0 { - queryParameters["tenantId"] = autorest.Encode("query", tenantID) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListForResourceGroupSender sends the ListForResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client RoleAssignmentsClient) ListForResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListForResourceGroupResponder handles the response to the ListForResourceGroup request. The method always -// closes the http.Response Body. -func (client RoleAssignmentsClient) ListForResourceGroupResponder(resp *http.Response) (result RoleAssignmentListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listForResourceGroupNextResults retrieves the next set of results, if any. -func (client RoleAssignmentsClient) listForResourceGroupNextResults(ctx context.Context, lastResults RoleAssignmentListResult) (result RoleAssignmentListResult, err error) { - req, err := lastResults.roleAssignmentListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "listForResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListForResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "listForResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListForResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "listForResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListForResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client RoleAssignmentsClient) ListForResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, tenantID string) (result RoleAssignmentListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.ListForResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListForResourceGroup(ctx, resourceGroupName, filter, tenantID) - return -} - -// ListForScope gets role assignments for a scope. -// Parameters: -// scope - the scope of the role assignments. -// filter - the filter to apply on the operation. Use $filter=atScope() to return all role assignments at or -// above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope -// for the specified principal. -// tenantID - tenant ID for cross-tenant request -func (client RoleAssignmentsClient) ListForScope(ctx context.Context, scope string, filter string, tenantID string) (result RoleAssignmentListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.ListForScope") - defer func() { - sc := -1 - if result.ralr.Response.Response != nil { - sc = result.ralr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listForScopeNextResults - req, err := client.ListForScopePreparer(ctx, scope, filter, tenantID) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForScope", nil, "Failure preparing request") - return - } - - resp, err := client.ListForScopeSender(req) - if err != nil { - result.ralr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForScope", resp, "Failure sending request") - return - } - - result.ralr, err = client.ListForScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForScope", resp, "Failure responding to request") - return - } - if result.ralr.hasNextLink() && result.ralr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListForScopePreparer prepares the ListForScope request. -func (client RoleAssignmentsClient) ListForScopePreparer(ctx context.Context, scope string, filter string, tenantID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "scope": scope, - } - - const APIVersion = "2020-04-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(tenantID) > 0 { - queryParameters["tenantId"] = autorest.Encode("query", tenantID) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleAssignments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListForScopeSender sends the ListForScope request. The method will close the -// http.Response Body if it receives an error. -func (client RoleAssignmentsClient) ListForScopeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListForScopeResponder handles the response to the ListForScope request. The method always -// closes the http.Response Body. -func (client RoleAssignmentsClient) ListForScopeResponder(resp *http.Response) (result RoleAssignmentListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listForScopeNextResults retrieves the next set of results, if any. -func (client RoleAssignmentsClient) listForScopeNextResults(ctx context.Context, lastResults RoleAssignmentListResult) (result RoleAssignmentListResult, err error) { - req, err := lastResults.roleAssignmentListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "listForScopeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListForScopeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "listForScopeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListForScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "listForScopeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListForScopeComplete enumerates all values, automatically crossing page boundaries as required. -func (client RoleAssignmentsClient) ListForScopeComplete(ctx context.Context, scope string, filter string, tenantID string) (result RoleAssignmentListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.ListForScope") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListForScope(ctx, scope, filter, tenantID) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/roledefinitions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/roledefinitions.go deleted file mode 100644 index 445a59445..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/roledefinitions.go +++ /dev/null @@ -1,458 +0,0 @@ -package authorization - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// RoleDefinitionsClient is the client for the RoleDefinitions methods of the Authorization service. -type RoleDefinitionsClient struct { - BaseClient -} - -// NewRoleDefinitionsClient creates an instance of the RoleDefinitionsClient client. -func NewRoleDefinitionsClient(subscriptionID string) RoleDefinitionsClient { - return NewRoleDefinitionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRoleDefinitionsClientWithBaseURI creates an instance of the RoleDefinitionsClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewRoleDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) RoleDefinitionsClient { - return RoleDefinitionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a role definition. -// Parameters: -// scope - the scope of the role definition. -// roleDefinitionID - the ID of the role definition. -// roleDefinition - the values for the role definition. -func (client RoleDefinitionsClient) CreateOrUpdate(ctx context.Context, scope string, roleDefinitionID string, roleDefinition RoleDefinition) (result RoleDefinition, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RoleDefinitionsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, scope, roleDefinitionID, roleDefinition) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client RoleDefinitionsClient) CreateOrUpdatePreparer(ctx context.Context, scope string, roleDefinitionID string, roleDefinition RoleDefinition) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "roleDefinitionId": autorest.Encode("path", roleDefinitionID), - "scope": scope, - } - - const APIVersion = "2018-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - roleDefinition.ID = nil - roleDefinition.Name = nil - roleDefinition.Type = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}", pathParameters), - autorest.WithJSON(roleDefinition), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client RoleDefinitionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client RoleDefinitionsClient) CreateOrUpdateResponder(resp *http.Response) (result RoleDefinition, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a role definition. -// Parameters: -// scope - the scope of the role definition. -// roleDefinitionID - the ID of the role definition to delete. -func (client RoleDefinitionsClient) Delete(ctx context.Context, scope string, roleDefinitionID string) (result RoleDefinition, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RoleDefinitionsClient.Delete") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, scope, roleDefinitionID) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client RoleDefinitionsClient) DeletePreparer(ctx context.Context, scope string, roleDefinitionID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "roleDefinitionId": autorest.Encode("path", roleDefinitionID), - "scope": scope, - } - - const APIVersion = "2018-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client RoleDefinitionsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client RoleDefinitionsClient) DeleteResponder(resp *http.Response) (result RoleDefinition, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get role definition by name (GUID). -// Parameters: -// scope - the scope of the role definition. -// roleDefinitionID - the ID of the role definition. -func (client RoleDefinitionsClient) Get(ctx context.Context, scope string, roleDefinitionID string) (result RoleDefinition, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RoleDefinitionsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, scope, roleDefinitionID) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RoleDefinitionsClient) GetPreparer(ctx context.Context, scope string, roleDefinitionID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "roleDefinitionId": autorest.Encode("path", roleDefinitionID), - "scope": scope, - } - - const APIVersion = "2018-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client RoleDefinitionsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client RoleDefinitionsClient) GetResponder(resp *http.Response) (result RoleDefinition, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetByID gets a role definition by ID. -// Parameters: -// roleID - the fully qualified role definition ID. Use the format, -// /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for subscription -// level role definitions, or /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for tenant -// level role definitions. -func (client RoleDefinitionsClient) GetByID(ctx context.Context, roleID string) (result RoleDefinition, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RoleDefinitionsClient.GetByID") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetByIDPreparer(ctx, roleID) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "GetByID", nil, "Failure preparing request") - return - } - - resp, err := client.GetByIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "GetByID", resp, "Failure sending request") - return - } - - result, err = client.GetByIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "GetByID", resp, "Failure responding to request") - return - } - - return -} - -// GetByIDPreparer prepares the GetByID request. -func (client RoleDefinitionsClient) GetByIDPreparer(ctx context.Context, roleID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "roleId": roleID, - } - - const APIVersion = "2018-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{roleId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByIDSender sends the GetByID request. The method will close the -// http.Response Body if it receives an error. -func (client RoleDefinitionsClient) GetByIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetByIDResponder handles the response to the GetByID request. The method always -// closes the http.Response Body. -func (client RoleDefinitionsClient) GetByIDResponder(resp *http.Response) (result RoleDefinition, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get all role definitions that are applicable at scope and above. -// Parameters: -// scope - the scope of the role definition. -// filter - the filter to apply on the operation. Use atScopeAndBelow filter to search below the given scope as -// well. -func (client RoleDefinitionsClient) List(ctx context.Context, scope string, filter string) (result RoleDefinitionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RoleDefinitionsClient.List") - defer func() { - sc := -1 - if result.rdlr.Response.Response != nil { - sc = result.rdlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, scope, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rdlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "List", resp, "Failure sending request") - return - } - - result.rdlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "List", resp, "Failure responding to request") - return - } - if result.rdlr.hasNextLink() && result.rdlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client RoleDefinitionsClient) ListPreparer(ctx context.Context, scope string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "scope": scope, - } - - const APIVersion = "2018-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleDefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client RoleDefinitionsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client RoleDefinitionsClient) ListResponder(resp *http.Response) (result RoleDefinitionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client RoleDefinitionsClient) listNextResults(ctx context.Context, lastResults RoleDefinitionListResult) (result RoleDefinitionListResult, err error) { - req, err := lastResults.roleDefinitionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client RoleDefinitionsClient) ListComplete(ctx context.Context, scope string, filter string) (result RoleDefinitionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RoleDefinitionsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, scope, filter) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/version.go deleted file mode 100644 index 4d61dff46..000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package authorization - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " authorization/2020-04-01-preview" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/vendor/github.com/satori/go.uuid/.travis.yml b/vendor/github.com/satori/go.uuid/.travis.yml deleted file mode 100644 index 20dd53b8d..000000000 --- a/vendor/github.com/satori/go.uuid/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -language: go -sudo: false -go: - - 1.2 - - 1.3 - - 1.4 - - 1.5 - - 1.6 - - 1.7 - - 1.8 - - 1.9 - - tip -matrix: - allow_failures: - - go: tip - fast_finish: true -before_install: - - go get github.com/mattn/goveralls - - go get golang.org/x/tools/cmd/cover -script: - - $HOME/gopath/bin/goveralls -service=travis-ci -notifications: - email: false diff --git a/vendor/github.com/satori/go.uuid/LICENSE b/vendor/github.com/satori/go.uuid/LICENSE deleted file mode 100644 index 926d54987..000000000 --- a/vendor/github.com/satori/go.uuid/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (C) 2013-2018 by Maxim Bublis - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/satori/go.uuid/README.md b/vendor/github.com/satori/go.uuid/README.md deleted file mode 100644 index 7b1a722df..000000000 --- a/vendor/github.com/satori/go.uuid/README.md +++ /dev/null @@ -1,65 +0,0 @@ -# UUID package for Go language - -[![Build Status](https://travis-ci.org/satori/go.uuid.png?branch=master)](https://travis-ci.org/satori/go.uuid) -[![Coverage Status](https://coveralls.io/repos/github/satori/go.uuid/badge.svg?branch=master)](https://coveralls.io/github/satori/go.uuid) -[![GoDoc](http://godoc.org/github.com/satori/go.uuid?status.png)](http://godoc.org/github.com/satori/go.uuid) - -This package provides pure Go implementation of Universally Unique Identifier (UUID). Supported both creation and parsing of UUIDs. - -With 100% test coverage and benchmarks out of box. - -Supported versions: -* Version 1, based on timestamp and MAC address (RFC 4122) -* Version 2, based on timestamp, MAC address and POSIX UID/GID (DCE 1.1) -* Version 3, based on MD5 hashing (RFC 4122) -* Version 4, based on random numbers (RFC 4122) -* Version 5, based on SHA-1 hashing (RFC 4122) - -## Installation - -Use the `go` command: - - $ go get github.com/satori/go.uuid - -## Requirements - -UUID package requires Go >= 1.2. - -## Example - -```go -package main - -import ( - "fmt" - "github.com/satori/go.uuid" -) - -func main() { - // Creating UUID Version 4 - u1 := uuid.NewV4() - fmt.Printf("UUIDv4: %s\n", u1) - - // Parsing UUID from string input - u2, err := uuid.FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8") - if err != nil { - fmt.Printf("Something gone wrong: %s", err) - } - fmt.Printf("Successfully parsed: %s", u2) -} -``` - -## Documentation - -[Documentation](http://godoc.org/github.com/satori/go.uuid) is hosted at GoDoc project. - -## Links -* [RFC 4122](http://tools.ietf.org/html/rfc4122) -* [DCE 1.1: Authentication and Security Services](http://pubs.opengroup.org/onlinepubs/9696989899/chap5.htm#tagcjh_08_02_01_01) - -## Copyright - -Copyright (C) 2013-2018 by Maxim Bublis . - -UUID package released under MIT License. -See [LICENSE](https://github.com/satori/go.uuid/blob/master/LICENSE) for details. diff --git a/vendor/github.com/satori/go.uuid/codec.go b/vendor/github.com/satori/go.uuid/codec.go deleted file mode 100644 index 656892c53..000000000 --- a/vendor/github.com/satori/go.uuid/codec.go +++ /dev/null @@ -1,206 +0,0 @@ -// Copyright (C) 2013-2018 by Maxim Bublis -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -package uuid - -import ( - "bytes" - "encoding/hex" - "fmt" -) - -// FromBytes returns UUID converted from raw byte slice input. -// It will return error if the slice isn't 16 bytes long. -func FromBytes(input []byte) (u UUID, err error) { - err = u.UnmarshalBinary(input) - return -} - -// FromBytesOrNil returns UUID converted from raw byte slice input. -// Same behavior as FromBytes, but returns a Nil UUID on error. -func FromBytesOrNil(input []byte) UUID { - uuid, err := FromBytes(input) - if err != nil { - return Nil - } - return uuid -} - -// FromString returns UUID parsed from string input. -// Input is expected in a form accepted by UnmarshalText. -func FromString(input string) (u UUID, err error) { - err = u.UnmarshalText([]byte(input)) - return -} - -// FromStringOrNil returns UUID parsed from string input. -// Same behavior as FromString, but returns a Nil UUID on error. -func FromStringOrNil(input string) UUID { - uuid, err := FromString(input) - if err != nil { - return Nil - } - return uuid -} - -// MarshalText implements the encoding.TextMarshaler interface. -// The encoding is the same as returned by String. -func (u UUID) MarshalText() (text []byte, err error) { - text = []byte(u.String()) - return -} - -// UnmarshalText implements the encoding.TextUnmarshaler interface. -// Following formats are supported: -// "6ba7b810-9dad-11d1-80b4-00c04fd430c8", -// "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}", -// "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8" -// "6ba7b8109dad11d180b400c04fd430c8" -// ABNF for supported UUID text representation follows: -// uuid := canonical | hashlike | braced | urn -// plain := canonical | hashlike -// canonical := 4hexoct '-' 2hexoct '-' 2hexoct '-' 6hexoct -// hashlike := 12hexoct -// braced := '{' plain '}' -// urn := URN ':' UUID-NID ':' plain -// URN := 'urn' -// UUID-NID := 'uuid' -// 12hexoct := 6hexoct 6hexoct -// 6hexoct := 4hexoct 2hexoct -// 4hexoct := 2hexoct 2hexoct -// 2hexoct := hexoct hexoct -// hexoct := hexdig hexdig -// hexdig := '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | -// 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | -// 'A' | 'B' | 'C' | 'D' | 'E' | 'F' -func (u *UUID) UnmarshalText(text []byte) (err error) { - switch len(text) { - case 32: - return u.decodeHashLike(text) - case 36: - return u.decodeCanonical(text) - case 38: - return u.decodeBraced(text) - case 41: - fallthrough - case 45: - return u.decodeURN(text) - default: - return fmt.Errorf("uuid: incorrect UUID length: %s", text) - } -} - -// decodeCanonical decodes UUID string in format -// "6ba7b810-9dad-11d1-80b4-00c04fd430c8". -func (u *UUID) decodeCanonical(t []byte) (err error) { - if t[8] != '-' || t[13] != '-' || t[18] != '-' || t[23] != '-' { - return fmt.Errorf("uuid: incorrect UUID format %s", t) - } - - src := t[:] - dst := u[:] - - for i, byteGroup := range byteGroups { - if i > 0 { - src = src[1:] // skip dash - } - _, err = hex.Decode(dst[:byteGroup/2], src[:byteGroup]) - if err != nil { - return - } - src = src[byteGroup:] - dst = dst[byteGroup/2:] - } - - return -} - -// decodeHashLike decodes UUID string in format -// "6ba7b8109dad11d180b400c04fd430c8". -func (u *UUID) decodeHashLike(t []byte) (err error) { - src := t[:] - dst := u[:] - - if _, err = hex.Decode(dst, src); err != nil { - return err - } - return -} - -// decodeBraced decodes UUID string in format -// "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}" or in format -// "{6ba7b8109dad11d180b400c04fd430c8}". -func (u *UUID) decodeBraced(t []byte) (err error) { - l := len(t) - - if t[0] != '{' || t[l-1] != '}' { - return fmt.Errorf("uuid: incorrect UUID format %s", t) - } - - return u.decodePlain(t[1 : l-1]) -} - -// decodeURN decodes UUID string in format -// "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8" or in format -// "urn:uuid:6ba7b8109dad11d180b400c04fd430c8". -func (u *UUID) decodeURN(t []byte) (err error) { - total := len(t) - - urn_uuid_prefix := t[:9] - - if !bytes.Equal(urn_uuid_prefix, urnPrefix) { - return fmt.Errorf("uuid: incorrect UUID format: %s", t) - } - - return u.decodePlain(t[9:total]) -} - -// decodePlain decodes UUID string in canonical format -// "6ba7b810-9dad-11d1-80b4-00c04fd430c8" or in hash-like format -// "6ba7b8109dad11d180b400c04fd430c8". -func (u *UUID) decodePlain(t []byte) (err error) { - switch len(t) { - case 32: - return u.decodeHashLike(t) - case 36: - return u.decodeCanonical(t) - default: - return fmt.Errorf("uuid: incorrrect UUID length: %s", t) - } -} - -// MarshalBinary implements the encoding.BinaryMarshaler interface. -func (u UUID) MarshalBinary() (data []byte, err error) { - data = u.Bytes() - return -} - -// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface. -// It will return error if the slice isn't 16 bytes long. -func (u *UUID) UnmarshalBinary(data []byte) (err error) { - if len(data) != Size { - err = fmt.Errorf("uuid: UUID must be exactly 16 bytes long, got %d bytes", len(data)) - return - } - copy(u[:], data) - - return -} diff --git a/vendor/github.com/satori/go.uuid/generator.go b/vendor/github.com/satori/go.uuid/generator.go deleted file mode 100644 index 3f2f1da2d..000000000 --- a/vendor/github.com/satori/go.uuid/generator.go +++ /dev/null @@ -1,239 +0,0 @@ -// Copyright (C) 2013-2018 by Maxim Bublis -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -package uuid - -import ( - "crypto/md5" - "crypto/rand" - "crypto/sha1" - "encoding/binary" - "hash" - "net" - "os" - "sync" - "time" -) - -// Difference in 100-nanosecond intervals between -// UUID epoch (October 15, 1582) and Unix epoch (January 1, 1970). -const epochStart = 122192928000000000 - -var ( - global = newDefaultGenerator() - - epochFunc = unixTimeFunc - posixUID = uint32(os.Getuid()) - posixGID = uint32(os.Getgid()) -) - -// NewV1 returns UUID based on current timestamp and MAC address. -func NewV1() UUID { - return global.NewV1() -} - -// NewV2 returns DCE Security UUID based on POSIX UID/GID. -func NewV2(domain byte) UUID { - return global.NewV2(domain) -} - -// NewV3 returns UUID based on MD5 hash of namespace UUID and name. -func NewV3(ns UUID, name string) UUID { - return global.NewV3(ns, name) -} - -// NewV4 returns random generated UUID. -func NewV4() UUID { - return global.NewV4() -} - -// NewV5 returns UUID based on SHA-1 hash of namespace UUID and name. -func NewV5(ns UUID, name string) UUID { - return global.NewV5(ns, name) -} - -// Generator provides interface for generating UUIDs. -type Generator interface { - NewV1() UUID - NewV2(domain byte) UUID - NewV3(ns UUID, name string) UUID - NewV4() UUID - NewV5(ns UUID, name string) UUID -} - -// Default generator implementation. -type generator struct { - storageOnce sync.Once - storageMutex sync.Mutex - - lastTime uint64 - clockSequence uint16 - hardwareAddr [6]byte -} - -func newDefaultGenerator() Generator { - return &generator{} -} - -// NewV1 returns UUID based on current timestamp and MAC address. -func (g *generator) NewV1() UUID { - u := UUID{} - - timeNow, clockSeq, hardwareAddr := g.getStorage() - - binary.BigEndian.PutUint32(u[0:], uint32(timeNow)) - binary.BigEndian.PutUint16(u[4:], uint16(timeNow>>32)) - binary.BigEndian.PutUint16(u[6:], uint16(timeNow>>48)) - binary.BigEndian.PutUint16(u[8:], clockSeq) - - copy(u[10:], hardwareAddr) - - u.SetVersion(V1) - u.SetVariant(VariantRFC4122) - - return u -} - -// NewV2 returns DCE Security UUID based on POSIX UID/GID. -func (g *generator) NewV2(domain byte) UUID { - u := UUID{} - - timeNow, clockSeq, hardwareAddr := g.getStorage() - - switch domain { - case DomainPerson: - binary.BigEndian.PutUint32(u[0:], posixUID) - case DomainGroup: - binary.BigEndian.PutUint32(u[0:], posixGID) - } - - binary.BigEndian.PutUint16(u[4:], uint16(timeNow>>32)) - binary.BigEndian.PutUint16(u[6:], uint16(timeNow>>48)) - binary.BigEndian.PutUint16(u[8:], clockSeq) - u[9] = domain - - copy(u[10:], hardwareAddr) - - u.SetVersion(V2) - u.SetVariant(VariantRFC4122) - - return u -} - -// NewV3 returns UUID based on MD5 hash of namespace UUID and name. -func (g *generator) NewV3(ns UUID, name string) UUID { - u := newFromHash(md5.New(), ns, name) - u.SetVersion(V3) - u.SetVariant(VariantRFC4122) - - return u -} - -// NewV4 returns random generated UUID. -func (g *generator) NewV4() UUID { - u := UUID{} - g.safeRandom(u[:]) - u.SetVersion(V4) - u.SetVariant(VariantRFC4122) - - return u -} - -// NewV5 returns UUID based on SHA-1 hash of namespace UUID and name. -func (g *generator) NewV5(ns UUID, name string) UUID { - u := newFromHash(sha1.New(), ns, name) - u.SetVersion(V5) - u.SetVariant(VariantRFC4122) - - return u -} - -func (g *generator) initStorage() { - g.initClockSequence() - g.initHardwareAddr() -} - -func (g *generator) initClockSequence() { - buf := make([]byte, 2) - g.safeRandom(buf) - g.clockSequence = binary.BigEndian.Uint16(buf) -} - -func (g *generator) initHardwareAddr() { - interfaces, err := net.Interfaces() - if err == nil { - for _, iface := range interfaces { - if len(iface.HardwareAddr) >= 6 { - copy(g.hardwareAddr[:], iface.HardwareAddr) - return - } - } - } - - // Initialize hardwareAddr randomly in case - // of real network interfaces absence - g.safeRandom(g.hardwareAddr[:]) - - // Set multicast bit as recommended in RFC 4122 - g.hardwareAddr[0] |= 0x01 -} - -func (g *generator) safeRandom(dest []byte) { - if _, err := rand.Read(dest); err != nil { - panic(err) - } -} - -// Returns UUID v1/v2 storage state. -// Returns epoch timestamp, clock sequence, and hardware address. -func (g *generator) getStorage() (uint64, uint16, []byte) { - g.storageOnce.Do(g.initStorage) - - g.storageMutex.Lock() - defer g.storageMutex.Unlock() - - timeNow := epochFunc() - // Clock changed backwards since last UUID generation. - // Should increase clock sequence. - if timeNow <= g.lastTime { - g.clockSequence++ - } - g.lastTime = timeNow - - return timeNow, g.clockSequence, g.hardwareAddr[:] -} - -// Returns difference in 100-nanosecond intervals between -// UUID epoch (October 15, 1582) and current time. -// This is default epoch calculation function. -func unixTimeFunc() uint64 { - return epochStart + uint64(time.Now().UnixNano()/100) -} - -// Returns UUID based on hashing of namespace UUID and name. -func newFromHash(h hash.Hash, ns UUID, name string) UUID { - u := UUID{} - h.Write(ns[:]) - h.Write([]byte(name)) - copy(u[:], h.Sum(nil)) - - return u -} diff --git a/vendor/github.com/satori/go.uuid/sql.go b/vendor/github.com/satori/go.uuid/sql.go deleted file mode 100644 index 56759d390..000000000 --- a/vendor/github.com/satori/go.uuid/sql.go +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (C) 2013-2018 by Maxim Bublis -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -package uuid - -import ( - "database/sql/driver" - "fmt" -) - -// Value implements the driver.Valuer interface. -func (u UUID) Value() (driver.Value, error) { - return u.String(), nil -} - -// Scan implements the sql.Scanner interface. -// A 16-byte slice is handled by UnmarshalBinary, while -// a longer byte slice or a string is handled by UnmarshalText. -func (u *UUID) Scan(src interface{}) error { - switch src := src.(type) { - case []byte: - if len(src) == Size { - return u.UnmarshalBinary(src) - } - return u.UnmarshalText(src) - - case string: - return u.UnmarshalText([]byte(src)) - } - - return fmt.Errorf("uuid: cannot convert %T to UUID", src) -} - -// NullUUID can be used with the standard sql package to represent a -// UUID value that can be NULL in the database -type NullUUID struct { - UUID UUID - Valid bool -} - -// Value implements the driver.Valuer interface. -func (u NullUUID) Value() (driver.Value, error) { - if !u.Valid { - return nil, nil - } - // Delegate to UUID Value function - return u.UUID.Value() -} - -// Scan implements the sql.Scanner interface. -func (u *NullUUID) Scan(src interface{}) error { - if src == nil { - u.UUID, u.Valid = Nil, false - return nil - } - - // Delegate to UUID Scan function - u.Valid = true - return u.UUID.Scan(src) -} diff --git a/vendor/github.com/satori/go.uuid/uuid.go b/vendor/github.com/satori/go.uuid/uuid.go deleted file mode 100644 index a2b8e2ca2..000000000 --- a/vendor/github.com/satori/go.uuid/uuid.go +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright (C) 2013-2018 by Maxim Bublis -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -// Package uuid provides implementation of Universally Unique Identifier (UUID). -// Supported versions are 1, 3, 4 and 5 (as specified in RFC 4122) and -// version 2 (as specified in DCE 1.1). -package uuid - -import ( - "bytes" - "encoding/hex" -) - -// Size of a UUID in bytes. -const Size = 16 - -// UUID representation compliant with specification -// described in RFC 4122. -type UUID [Size]byte - -// UUID versions -const ( - _ byte = iota - V1 - V2 - V3 - V4 - V5 -) - -// UUID layout variants. -const ( - VariantNCS byte = iota - VariantRFC4122 - VariantMicrosoft - VariantFuture -) - -// UUID DCE domains. -const ( - DomainPerson = iota - DomainGroup - DomainOrg -) - -// String parse helpers. -var ( - urnPrefix = []byte("urn:uuid:") - byteGroups = []int{8, 4, 4, 4, 12} -) - -// Nil is special form of UUID that is specified to have all -// 128 bits set to zero. -var Nil = UUID{} - -// Predefined namespace UUIDs. -var ( - NamespaceDNS = Must(FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8")) - NamespaceURL = Must(FromString("6ba7b811-9dad-11d1-80b4-00c04fd430c8")) - NamespaceOID = Must(FromString("6ba7b812-9dad-11d1-80b4-00c04fd430c8")) - NamespaceX500 = Must(FromString("6ba7b814-9dad-11d1-80b4-00c04fd430c8")) -) - -// Equal returns true if u1 and u2 equals, otherwise returns false. -func Equal(u1 UUID, u2 UUID) bool { - return bytes.Equal(u1[:], u2[:]) -} - -// Version returns algorithm version used to generate UUID. -func (u UUID) Version() byte { - return u[6] >> 4 -} - -// Variant returns UUID layout variant. -func (u UUID) Variant() byte { - switch { - case (u[8] >> 7) == 0x00: - return VariantNCS - case (u[8] >> 6) == 0x02: - return VariantRFC4122 - case (u[8] >> 5) == 0x06: - return VariantMicrosoft - case (u[8] >> 5) == 0x07: - fallthrough - default: - return VariantFuture - } -} - -// Bytes returns bytes slice representation of UUID. -func (u UUID) Bytes() []byte { - return u[:] -} - -// Returns canonical string representation of UUID: -// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. -func (u UUID) String() string { - buf := make([]byte, 36) - - hex.Encode(buf[0:8], u[0:4]) - buf[8] = '-' - hex.Encode(buf[9:13], u[4:6]) - buf[13] = '-' - hex.Encode(buf[14:18], u[6:8]) - buf[18] = '-' - hex.Encode(buf[19:23], u[8:10]) - buf[23] = '-' - hex.Encode(buf[24:], u[10:]) - - return string(buf) -} - -// SetVersion sets version bits. -func (u *UUID) SetVersion(v byte) { - u[6] = (u[6] & 0x0f) | (v << 4) -} - -// SetVariant sets variant bits. -func (u *UUID) SetVariant(v byte) { - switch v { - case VariantNCS: - u[8] = (u[8]&(0xff>>1) | (0x00 << 7)) - case VariantRFC4122: - u[8] = (u[8]&(0xff>>2) | (0x02 << 6)) - case VariantMicrosoft: - u[8] = (u[8]&(0xff>>3) | (0x06 << 5)) - case VariantFuture: - fallthrough - default: - u[8] = (u[8]&(0xff>>3) | (0x07 << 5)) - } -} - -// Must is a helper that wraps a call to a function returning (UUID, error) -// and panics if the error is non-nil. It is intended for use in variable -// initializations such as -// var packageUUID = uuid.Must(uuid.FromString("123e4567-e89b-12d3-a456-426655440000")); -func Must(u UUID, err error) UUID { - if err != nil { - panic(err) - } - return u -} diff --git a/vendor/go.opentelemetry.io/otel/.golangci.yml b/vendor/go.opentelemetry.io/otel/.golangci.yml index 6d9c8b649..d9abe194d 100644 --- a/vendor/go.opentelemetry.io/otel/.golangci.yml +++ b/vendor/go.opentelemetry.io/otel/.golangci.yml @@ -9,6 +9,8 @@ linters: disable-all: true # Specifically enable linters we want to use. enable: + - asasalint + - bodyclose - depguard - errcheck - errorlint diff --git a/vendor/go.opentelemetry.io/otel/CHANGELOG.md b/vendor/go.opentelemetry.io/otel/CHANGELOG.md index c01e6998e..6107c17b8 100644 --- a/vendor/go.opentelemetry.io/otel/CHANGELOG.md +++ b/vendor/go.opentelemetry.io/otel/CHANGELOG.md @@ -8,6 +8,64 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] + + + +## [1.29.0/0.51.0/0.5.0] 2024-08-23 + +This release is the last to support [Go 1.21]. +The next release will require at least [Go 1.22]. + +### Added + +- Add MacOS ARM64 platform to the compatibility testing suite. (#5577) +- Add `InstrumentationScope` field to `SpanStub` in `go.opentelemetry.io/otel/sdk/trace/tracetest`, as a replacement for the deprecated `InstrumentationLibrary`. (#5627) +- Make the initial release of `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc`. + This new module contains an OTLP exporter that transmits log telemetry using gRPC. + This module is unstable and breaking changes may be introduced. + See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. (#5629) +- Add `Walk` function to `TraceState` in `go.opentelemetry.io/otel/trace` to iterate all the key-value pairs. (#5651) +- Bridge the trace state in `go.opentelemetry.io/otel/bridge/opencensus`. (#5651) +- Zero value of `SimpleProcessor` in `go.opentelemetry.io/otel/sdk/log` no longer panics. (#5665) +- The `FilterProcessor` interface type is added in `go.opentelemetry.io/otel/sdk/log/internal/x`. + This is an optional and experimental interface that log `Processor`s can implement to instruct the `Logger` if a `Record` will be processed or not. + It replaces the existing `Enabled` method that is removed from the `Processor` interface itself. + It does not fall within the scope of the OpenTelemetry Go versioning and stability [policy](./VERSIONING.md) and it may be changed in backwards incompatible ways or removed in feature releases. (#5692) +- Support [Go 1.23]. (#5720) + +### Changed + +- `NewMemberRaw`, `NewKeyProperty` and `NewKeyValuePropertyRaw` in `go.opentelemetry.io/otel/baggage` allow UTF-8 string in key. (#5132) +- `Processor.OnEmit` in `go.opentelemetry.io/otel/sdk/log` now accepts a pointer to `Record` instead of a value so that the record modifications done in a processor are propagated to subsequent registered processors. (#5636) +- `SimpleProcessor.Enabled` in `go.opentelemetry.io/otel/sdk/log` now returns `false` if the exporter is `nil`. (#5665) +- Update the concurrency requirements of `Exporter` in `go.opentelemetry.io/otel/sdk/log`. (#5666) +- `SimpleProcessor` in `go.opentelemetry.io/otel/sdk/log` synchronizes `OnEmit` calls. (#5666) +- The `Processor` interface in `go.opentelemetry.io/otel/sdk/log` no longer includes the `Enabled` method. + See the `FilterProcessor` interface type added in `go.opentelemetry.io/otel/sdk/log/internal/x` to continue providing this functionality. (#5692) +- The `SimpleProcessor` type in `go.opentelemetry.io/otel/sdk/log` is no longer comparable. (#5693) +- The `BatchProcessor` type in `go.opentelemetry.io/otel/sdk/log` is no longer comparable. (#5693) + +### Fixed + +- Correct comments for the priority of the `WithEndpoint` and `WithEndpointURL` options and their corresponding environment variables in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#5584) +- Pass the underlying error rather than a generic retry-able failure in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`, `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp` and `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#5541) +- Correct the `Tracer`, `Meter`, and `Logger` names used in `go.opentelemetry.io/otel/example/dice`. (#5612) +- Correct the `Tracer` names used in `go.opentelemetry.io/otel/example/namedtracer`. (#5612) +- Correct the `Tracer` name used in `go.opentelemetry.io/otel/example/opencensus`. (#5612) +- Correct the `Tracer` and `Meter` names used in `go.opentelemetry.io/otel/example/otel-collector`. (#5612) +- Correct the `Tracer` names used in `go.opentelemetry.io/otel/example/passthrough`. (#5612) +- Correct the `Meter` name used in `go.opentelemetry.io/otel/example/prometheus`. (#5612) +- Correct the `Tracer` names used in `go.opentelemetry.io/otel/example/zipkin`. (#5612) +- Correct comments for the priority of the `WithEndpoint` and `WithEndpointURL` options and their corresponding environment variables in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#5641) +- Correct comments for the priority of the `WithEndpoint` and `WithEndpointURL` options and their corresponding environment variables in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#5650) +- Stop percent encoding header environment variables in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`, `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`, `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` (#5705) +- Remove invalid environment variable header keys in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`, `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`, `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` (#5705) + +### Removed + +- The `Enabled` method of the `SimpleProcessor` in `go.opentelemetry.io/otel/sdk/log` is removed. (#5692) +- The `Enabled` method of the `BatchProcessor` in `go.opentelemetry.io/otel/sdk/log` is removed. (#5692) + ## [1.28.0/0.50.0/0.4.0] 2024-07-02 ### Added @@ -49,6 +107,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Fix stale timestamps reported by the last-value aggregation. (#5517) - Indicate the `Exporter` in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp` must be created by the `New` method. (#5521) - Improved performance in all `{Bool,Int64,Float64,String}SliceValue` functions of `go.opentelemetry.io/attributes` by reducing the number of allocations. (#5549) +- Replace invalid percent-encoded octet sequences with replacement char in `go.opentelemetry.io/otel/baggage`. (#5528) ## [1.27.0/0.49.0/0.3.0] 2024-05-21 @@ -175,7 +234,7 @@ The next release will require at least [Go 1.21]. This module includes OpenTelemetry Go's implementation of the Logs Bridge API. This module is in an alpha state, it is subject to breaking changes. See our [versioning policy](./VERSIONING.md) for more info. (#4961) -- ARM64 platform to the compatibility testing suite. (#4994) +- Add ARM64 platform to the compatibility testing suite. (#4994) ### Fixed @@ -3003,7 +3062,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.28.0...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.29.0...HEAD +[1.29.0/0.51.0/0.5.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.29.0 [1.28.0/0.50.0/0.4.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.28.0 [1.27.0/0.49.0/0.3.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.27.0 [1.26.0/0.48.0/0.2.0-alpha]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.26.0 @@ -3086,6 +3146,9 @@ It contains api and sdk for trace and meter. [0.1.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.1.1 [0.1.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.1.0 + + +[Go 1.23]: https://go.dev/doc/go1.23 [Go 1.22]: https://go.dev/doc/go1.22 [Go 1.21]: https://go.dev/doc/go1.21 [Go 1.20]: https://go.dev/doc/go1.20 diff --git a/vendor/go.opentelemetry.io/otel/CODEOWNERS b/vendor/go.opentelemetry.io/otel/CODEOWNERS index 202554933..5904bb707 100644 --- a/vendor/go.opentelemetry.io/otel/CODEOWNERS +++ b/vendor/go.opentelemetry.io/otel/CODEOWNERS @@ -5,7 +5,7 @@ ##################################################### # # Learn about membership in OpenTelemetry community: -# https://github.com/open-telemetry/community/blob/main/community-membership.md +# https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md # # # Learn about CODEOWNERS file format: diff --git a/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md b/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md index b86572f58..b7402576f 100644 --- a/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md +++ b/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md @@ -650,7 +650,7 @@ should be canceled. ### Become an Approver or a Maintainer See the [community membership document in OpenTelemetry community -repo](https://github.com/open-telemetry/community/blob/main/community-membership.md). +repo](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md). [Approver]: #approvers [Maintainer]: #maintainers diff --git a/vendor/go.opentelemetry.io/otel/Makefile b/vendor/go.opentelemetry.io/otel/Makefile index f33619f76..070b1e57d 100644 --- a/vendor/go.opentelemetry.io/otel/Makefile +++ b/vendor/go.opentelemetry.io/otel/Makefile @@ -178,17 +178,14 @@ test-coverage: $(GOCOVMERGE) done; \ $(GOCOVMERGE) $$(find . -name coverage.out) > coverage.txt -# Adding a directory will include all benchmarks in that directory if a filter is not specified. -BENCHMARK_TARGETS := sdk/trace .PHONY: benchmark -benchmark: $(BENCHMARK_TARGETS:%=benchmark/%) -BENCHMARK_FILTER = . -# You can override the filter for a particular directory by adding a rule here. -benchmark/sdk/trace: BENCHMARK_FILTER = SpanWithAttributes_8/AlwaysSample +benchmark: $(OTEL_GO_MOD_DIRS:%=benchmark/%) benchmark/%: - @echo "$(GO) test -timeout $(TIMEOUT)s -run=xxxxxMatchNothingxxxxx -bench=$(BENCHMARK_FILTER) $*..." \ + @echo "$(GO) test -run=xxxxxMatchNothingxxxxx -bench=. $*..." \ && cd $* \ - $(foreach filter, $(BENCHMARK_FILTER), && $(GO) test -timeout $(TIMEOUT)s -run=xxxxxMatchNothingxxxxx -bench=$(filter)) + && $(GO) list ./... \ + | grep -v third_party \ + | xargs $(GO) test -run=xxxxxMatchNothingxxxxx -bench=. .PHONY: golangci-lint golangci-lint-fix golangci-lint-fix: ARGS=--fix diff --git a/vendor/go.opentelemetry.io/otel/README.md b/vendor/go.opentelemetry.io/otel/README.md index 5a8909317..657df3471 100644 --- a/vendor/go.opentelemetry.io/otel/README.md +++ b/vendor/go.opentelemetry.io/otel/README.md @@ -47,20 +47,29 @@ stop ensuring compatibility with these versions in the following manner: Currently, this project supports the following environments. -| OS | Go Version | Architecture | -|---------|------------|--------------| -| Ubuntu | 1.22 | amd64 | -| Ubuntu | 1.21 | amd64 | -| Ubuntu | 1.22 | 386 | -| Ubuntu | 1.21 | 386 | -| Linux | 1.22 | arm64 | -| Linux | 1.21 | arm64 | -| MacOS | 1.22 | amd64 | -| MacOS | 1.21 | amd64 | -| Windows | 1.22 | amd64 | -| Windows | 1.21 | amd64 | -| Windows | 1.22 | 386 | -| Windows | 1.21 | 386 | +| OS | Go Version | Architecture | +|----------|------------|--------------| +| Ubuntu | 1.23 | amd64 | +| Ubuntu | 1.22 | amd64 | +| Ubuntu | 1.21 | amd64 | +| Ubuntu | 1.23 | 386 | +| Ubuntu | 1.22 | 386 | +| Ubuntu | 1.21 | 386 | +| Linux | 1.23 | arm64 | +| Linux | 1.22 | arm64 | +| Linux | 1.21 | arm64 | +| macOS 13 | 1.23 | amd64 | +| macOS 13 | 1.22 | amd64 | +| macOS 13 | 1.21 | amd64 | +| macOS | 1.23 | arm64 | +| macOS | 1.22 | arm64 | +| macOS | 1.21 | arm64 | +| Windows | 1.23 | amd64 | +| Windows | 1.22 | amd64 | +| Windows | 1.21 | amd64 | +| Windows | 1.23 | 386 | +| Windows | 1.22 | 386 | +| Windows | 1.21 | 386 | While this project should work for other systems, no compatibility guarantees are made for those systems currently. diff --git a/vendor/go.opentelemetry.io/otel/RELEASING.md b/vendor/go.opentelemetry.io/otel/RELEASING.md index 940f57f3d..59992984d 100644 --- a/vendor/go.opentelemetry.io/otel/RELEASING.md +++ b/vendor/go.opentelemetry.io/otel/RELEASING.md @@ -69,6 +69,7 @@ Update go.mod for submodules to depend on the new release which will happen in t ``` - Move all the `Unreleased` changes into a new section following the title scheme (`[] - `). + - Make sure the new section is under the comment for released section, like ``, so it is protected from being overwritten in the future. - Update all the appropriate links at the bottom. 4. Push the changes to upstream and create a Pull Request on GitHub. diff --git a/vendor/go.opentelemetry.io/otel/baggage/baggage.go b/vendor/go.opentelemetry.io/otel/baggage/baggage.go index c40c896cc..b3569e95e 100644 --- a/vendor/go.opentelemetry.io/otel/baggage/baggage.go +++ b/vendor/go.opentelemetry.io/otel/baggage/baggage.go @@ -44,9 +44,15 @@ type Property struct { // NewKeyProperty returns a new Property for key. // +// The passed key must be valid, non-empty UTF-8 string. // If key is invalid, an error will be returned. +// However, the specific Propagators that are used to transmit baggage entries across +// component boundaries may impose their own restrictions on Property key. +// For example, the W3C Baggage specification restricts the Property keys to strings that +// satisfy the token definition from RFC7230, Section 3.2.6. +// For maximum compatibility, alpha-numeric value are strongly recommended to be used as Property key. func NewKeyProperty(key string) (Property, error) { - if !validateKey(key) { + if !validateBaggageName(key) { return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidKey, key) } @@ -62,6 +68,10 @@ func NewKeyProperty(key string) (Property, error) { // Notice: Consider using [NewKeyValuePropertyRaw] instead // that does not require percent-encoding of the value. func NewKeyValueProperty(key, value string) (Property, error) { + if !validateKey(key) { + return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidKey, key) + } + if !validateValue(value) { return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidValue, value) } @@ -74,11 +84,20 @@ func NewKeyValueProperty(key, value string) (Property, error) { // NewKeyValuePropertyRaw returns a new Property for key with value. // -// The passed key must be compliant with W3C Baggage specification. +// The passed key must be valid, non-empty UTF-8 string. +// The passed value must be valid UTF-8 string. +// However, the specific Propagators that are used to transmit baggage entries across +// component boundaries may impose their own restrictions on Property key. +// For example, the W3C Baggage specification restricts the Property keys to strings that +// satisfy the token definition from RFC7230, Section 3.2.6. +// For maximum compatibility, alpha-numeric value are strongly recommended to be used as Property key. func NewKeyValuePropertyRaw(key, value string) (Property, error) { - if !validateKey(key) { + if !validateBaggageName(key) { return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidKey, key) } + if !validateBaggageValue(value) { + return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidValue, value) + } p := Property{ key: key, @@ -115,12 +134,15 @@ func (p Property) validate() error { return fmt.Errorf("invalid property: %w", err) } - if !validateKey(p.key) { + if !validateBaggageName(p.key) { return errFunc(fmt.Errorf("%w: %q", errInvalidKey, p.key)) } if !p.hasValue && p.value != "" { return errFunc(errors.New("inconsistent value")) } + if p.hasValue && !validateBaggageValue(p.value) { + return errFunc(fmt.Errorf("%w: %q", errInvalidValue, p.value)) + } return nil } @@ -138,7 +160,15 @@ func (p Property) Value() (string, bool) { // String encodes Property into a header string compliant with the W3C Baggage // specification. +// It would return empty string if the key is invalid with the W3C Baggage +// specification. This could happen for a UTF-8 key, as it may contain +// invalid characters. func (p Property) String() string { + // W3C Baggage specification does not allow percent-encoded keys. + if !validateKey(p.key) { + return "" + } + if p.hasValue { return fmt.Sprintf("%s%s%v", p.key, keyValueDelimiter, valueEscape(p.value)) } @@ -203,9 +233,14 @@ func (p properties) validate() error { // String encodes properties into a header string compliant with the W3C Baggage // specification. func (p properties) String() string { - props := make([]string, len(p)) - for i, prop := range p { - props[i] = prop.String() + props := make([]string, 0, len(p)) + for _, prop := range p { + s := prop.String() + + // Ignored empty properties. + if s != "" { + props = append(props, s) + } } return strings.Join(props, propertyDelimiter) } @@ -230,6 +265,10 @@ type Member struct { // Notice: Consider using [NewMemberRaw] instead // that does not require percent-encoding of the value. func NewMember(key, value string, props ...Property) (Member, error) { + if !validateKey(key) { + return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidKey, key) + } + if !validateValue(value) { return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, value) } @@ -242,7 +281,13 @@ func NewMember(key, value string, props ...Property) (Member, error) { // NewMemberRaw returns a new Member from the passed arguments. // -// The passed key must be compliant with W3C Baggage specification. +// The passed key must be valid, non-empty UTF-8 string. +// The passed value must be valid UTF-8 string. +// However, the specific Propagators that are used to transmit baggage entries across +// component boundaries may impose their own restrictions on baggage key. +// For example, the W3C Baggage specification restricts the baggage keys to strings that +// satisfy the token definition from RFC7230, Section 3.2.6. +// For maximum compatibility, alpha-numeric value are strongly recommended to be used as baggage key. func NewMemberRaw(key, value string, props ...Property) (Member, error) { m := Member{ key: key, @@ -294,19 +339,45 @@ func parseMember(member string) (Member, error) { return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidKey, key) } - val := strings.TrimSpace(v) - if !validateValue(val) { + rawVal := strings.TrimSpace(v) + if !validateValue(rawVal) { return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, v) } // Decode a percent-encoded value. - value, err := url.PathUnescape(val) + unescapeVal, err := url.PathUnescape(rawVal) if err != nil { return newInvalidMember(), fmt.Errorf("%w: %w", errInvalidValue, err) } + + value := replaceInvalidUTF8Sequences(len(rawVal), unescapeVal) return Member{key: key, value: value, properties: props, hasData: true}, nil } +// replaceInvalidUTF8Sequences replaces invalid UTF-8 sequences with '�'. +func replaceInvalidUTF8Sequences(cap int, unescapeVal string) string { + if utf8.ValidString(unescapeVal) { + return unescapeVal + } + // W3C baggage spec: + // https://github.com/w3c/baggage/blob/8c215efbeebd3fa4b1aceb937a747e56444f22f3/baggage/HTTP_HEADER_FORMAT.md?plain=1#L69 + + var b strings.Builder + b.Grow(cap) + for i := 0; i < len(unescapeVal); { + r, size := utf8.DecodeRuneInString(unescapeVal[i:]) + if r == utf8.RuneError && size == 1 { + // Invalid UTF-8 sequence found, replace it with '�' + _, _ = b.WriteString("�") + } else { + _, _ = b.WriteRune(r) + } + i += size + } + + return b.String() +} + // validate ensures m conforms to the W3C Baggage specification. // A key must be an ASCII string, returning an error otherwise. func (m Member) validate() error { @@ -314,9 +385,12 @@ func (m Member) validate() error { return fmt.Errorf("%w: %q", errInvalidMember, m) } - if !validateKey(m.key) { + if !validateBaggageName(m.key) { return fmt.Errorf("%w: %q", errInvalidKey, m.key) } + if !validateBaggageValue(m.value) { + return fmt.Errorf("%w: %q", errInvalidValue, m.value) + } return m.properties.validate() } @@ -331,10 +405,15 @@ func (m Member) Properties() []Property { return m.properties.Copy() } // String encodes Member into a header string compliant with the W3C Baggage // specification. +// It would return empty string if the key is invalid with the W3C Baggage +// specification. This could happen for a UTF-8 key, as it may contain +// invalid characters. func (m Member) String() string { - // A key is just an ASCII string. A value is restricted to be - // US-ASCII characters excluding CTLs, whitespace, - // DQUOTE, comma, semicolon, and backslash. + // W3C Baggage specification does not allow percent-encoded keys. + if !validateKey(m.key) { + return "" + } + s := m.key + keyValueDelimiter + valueEscape(m.value) if len(m.properties) > 0 { s += propertyDelimiter + m.properties.String() @@ -448,7 +527,7 @@ func (b Baggage) Member(key string) Member { } // Members returns all the baggage list-members. -// The order of the returned list-members does not have significance. +// The order of the returned list-members is not significant. // // The returned members are not validated, as we assume the validation happened // when they were added to the Baggage. @@ -469,8 +548,8 @@ func (b Baggage) Members() []Member { return members } -// SetMember returns a copy the Baggage with the member included. If the -// baggage contains a Member with the same key the existing Member is +// SetMember returns a copy of the Baggage with the member included. If the +// baggage contains a Member with the same key, the existing Member is // replaced. // // If member is invalid according to the W3C Baggage specification, an error @@ -528,14 +607,22 @@ func (b Baggage) Len() int { // String encodes Baggage into a header string compliant with the W3C Baggage // specification. +// It would ignore members where the member key is invalid with the W3C Baggage +// specification. This could happen for a UTF-8 key, as it may contain +// invalid characters. func (b Baggage) String() string { members := make([]string, 0, len(b.list)) for k, v := range b.list { - members = append(members, Member{ + s := Member{ key: k, value: v.Value, properties: fromInternalProperties(v.Properties), - }.String()) + }.String() + + // Ignored empty members. + if s != "" { + members = append(members, s) + } } return strings.Join(members, listDelimiter) } @@ -607,10 +694,12 @@ func parsePropertyInternal(s string) (p Property, ok bool) { } // Decode a percent-encoded value. - value, err := url.PathUnescape(s[valueStart:valueEnd]) + rawVal := s[valueStart:valueEnd] + unescapeVal, err := url.PathUnescape(rawVal) if err != nil { return } + value := replaceInvalidUTF8Sequences(len(rawVal), unescapeVal) ok = true p.key = s[keyStart:keyEnd] @@ -720,6 +809,24 @@ var safeKeyCharset = [utf8.RuneSelf]bool{ '~': true, } +// validateBaggageName checks if the string is a valid OpenTelemetry Baggage name. +// Baggage name is a valid, non-empty UTF-8 string. +func validateBaggageName(s string) bool { + if len(s) == 0 { + return false + } + + return utf8.ValidString(s) +} + +// validateBaggageValue checks if the string is a valid OpenTelemetry Baggage value. +// Baggage value is a valid UTF-8 strings. +// Empty string is also a valid UTF-8 string. +func validateBaggageValue(s string) bool { + return utf8.ValidString(s) +} + +// validateKey checks if the string is a valid W3C Baggage key. func validateKey(s string) bool { if len(s) == 0 { return false @@ -738,6 +845,7 @@ func validateKeyChar(c int32) bool { return c >= 0 && c < int32(utf8.RuneSelf) && safeKeyCharset[c] } +// validateValue checks if the string is a valid W3C Baggage value. func validateValue(s string) bool { for _, c := range s { if !validateValueChar(c) { diff --git a/vendor/go.opentelemetry.io/otel/codes/codes.go b/vendor/go.opentelemetry.io/otel/codes/codes.go index df29d96a6..2acbac354 100644 --- a/vendor/go.opentelemetry.io/otel/codes/codes.go +++ b/vendor/go.opentelemetry.io/otel/codes/codes.go @@ -83,7 +83,7 @@ func (c *Code) UnmarshalJSON(b []byte) error { return fmt.Errorf("invalid code: %q", ci) } - *c = Code(ci) + *c = Code(ci) // nolint: gosec // Bit size of 32 check above. return nil } return fmt.Errorf("invalid code: %q", string(b)) diff --git a/vendor/go.opentelemetry.io/otel/doc.go b/vendor/go.opentelemetry.io/otel/doc.go index 441c59501..921f85961 100644 --- a/vendor/go.opentelemetry.io/otel/doc.go +++ b/vendor/go.opentelemetry.io/otel/doc.go @@ -17,6 +17,8 @@ To read more about tracing, see go.opentelemetry.io/otel/trace. To read more about metrics, see go.opentelemetry.io/otel/metric. +To read more about logs, see go.opentelemetry.io/otel/log. + To read more about propagation, see go.opentelemetry.io/otel/propagation and go.opentelemetry.io/otel/baggage. */ diff --git a/vendor/go.opentelemetry.io/otel/internal/rawhelpers.go b/vendor/go.opentelemetry.io/otel/internal/rawhelpers.go index 3e7bb3b35..9b1da2c02 100644 --- a/vendor/go.opentelemetry.io/otel/internal/rawhelpers.go +++ b/vendor/go.opentelemetry.io/otel/internal/rawhelpers.go @@ -24,7 +24,8 @@ func Int64ToRaw(i int64) uint64 { } func RawToInt64(r uint64) int64 { - return int64(r) + // Assumes original was a valid int64 (overflow not checked). + return int64(r) // nolint: gosec } func Float64ToRaw(f float64) uint64 { @@ -36,9 +37,11 @@ func RawToFloat64(r uint64) float64 { } func RawPtrToFloat64Ptr(r *uint64) *float64 { - return (*float64)(unsafe.Pointer(r)) + // Assumes original was a valid *float64 (overflow not checked). + return (*float64)(unsafe.Pointer(r)) // nolint: gosec } func RawPtrToInt64Ptr(r *uint64) *int64 { - return (*int64)(unsafe.Pointer(r)) + // Assumes original was a valid *int64 (overflow not checked). + return (*int64)(unsafe.Pointer(r)) // nolint: gosec } diff --git a/vendor/go.opentelemetry.io/otel/metric/meter.go b/vendor/go.opentelemetry.io/otel/metric/meter.go index 6a7991e01..14e08c24a 100644 --- a/vendor/go.opentelemetry.io/otel/metric/meter.go +++ b/vendor/go.opentelemetry.io/otel/metric/meter.go @@ -52,6 +52,7 @@ type Meter interface { // See the Instrument Name section of the package documentation for more // information. Int64Counter(name string, options ...Int64CounterOption) (Int64Counter, error) + // Int64UpDownCounter returns a new Int64UpDownCounter instrument // identified by name and configured with options. The instrument is used // to synchronously record int64 measurements during a computational @@ -61,6 +62,7 @@ type Meter interface { // See the Instrument Name section of the package documentation for more // information. Int64UpDownCounter(name string, options ...Int64UpDownCounterOption) (Int64UpDownCounter, error) + // Int64Histogram returns a new Int64Histogram instrument identified by // name and configured with options. The instrument is used to // synchronously record the distribution of int64 measurements during a @@ -70,6 +72,7 @@ type Meter interface { // See the Instrument Name section of the package documentation for more // information. Int64Histogram(name string, options ...Int64HistogramOption) (Int64Histogram, error) + // Int64Gauge returns a new Int64Gauge instrument identified by name and // configured with options. The instrument is used to synchronously record // instantaneous int64 measurements during a computational operation. @@ -78,6 +81,7 @@ type Meter interface { // See the Instrument Name section of the package documentation for more // information. Int64Gauge(name string, options ...Int64GaugeOption) (Int64Gauge, error) + // Int64ObservableCounter returns a new Int64ObservableCounter identified // by name and configured with options. The instrument is used to // asynchronously record increasing int64 measurements once per a @@ -92,6 +96,7 @@ type Meter interface { // See the Instrument Name section of the package documentation for more // information. Int64ObservableCounter(name string, options ...Int64ObservableCounterOption) (Int64ObservableCounter, error) + // Int64ObservableUpDownCounter returns a new Int64ObservableUpDownCounter // instrument identified by name and configured with options. The // instrument is used to asynchronously record int64 measurements once per @@ -106,6 +111,7 @@ type Meter interface { // See the Instrument Name section of the package documentation for more // information. Int64ObservableUpDownCounter(name string, options ...Int64ObservableUpDownCounterOption) (Int64ObservableUpDownCounter, error) + // Int64ObservableGauge returns a new Int64ObservableGauge instrument // identified by name and configured with options. The instrument is used // to asynchronously record instantaneous int64 measurements once per a @@ -130,6 +136,7 @@ type Meter interface { // See the Instrument Name section of the package documentation for more // information. Float64Counter(name string, options ...Float64CounterOption) (Float64Counter, error) + // Float64UpDownCounter returns a new Float64UpDownCounter instrument // identified by name and configured with options. The instrument is used // to synchronously record float64 measurements during a computational @@ -139,6 +146,7 @@ type Meter interface { // See the Instrument Name section of the package documentation for more // information. Float64UpDownCounter(name string, options ...Float64UpDownCounterOption) (Float64UpDownCounter, error) + // Float64Histogram returns a new Float64Histogram instrument identified by // name and configured with options. The instrument is used to // synchronously record the distribution of float64 measurements during a @@ -148,6 +156,7 @@ type Meter interface { // See the Instrument Name section of the package documentation for more // information. Float64Histogram(name string, options ...Float64HistogramOption) (Float64Histogram, error) + // Float64Gauge returns a new Float64Gauge instrument identified by name and // configured with options. The instrument is used to synchronously record // instantaneous float64 measurements during a computational operation. @@ -156,6 +165,7 @@ type Meter interface { // See the Instrument Name section of the package documentation for more // information. Float64Gauge(name string, options ...Float64GaugeOption) (Float64Gauge, error) + // Float64ObservableCounter returns a new Float64ObservableCounter // instrument identified by name and configured with options. The // instrument is used to asynchronously record increasing float64 @@ -170,6 +180,7 @@ type Meter interface { // See the Instrument Name section of the package documentation for more // information. Float64ObservableCounter(name string, options ...Float64ObservableCounterOption) (Float64ObservableCounter, error) + // Float64ObservableUpDownCounter returns a new // Float64ObservableUpDownCounter instrument identified by name and // configured with options. The instrument is used to asynchronously record @@ -184,6 +195,7 @@ type Meter interface { // See the Instrument Name section of the package documentation for more // information. Float64ObservableUpDownCounter(name string, options ...Float64ObservableUpDownCounterOption) (Float64ObservableUpDownCounter, error) + // Float64ObservableGauge returns a new Float64ObservableGauge instrument // identified by name and configured with options. The instrument is used // to asynchronously record instantaneous float64 measurements once per a @@ -242,6 +254,7 @@ type Observer interface { // ObserveFloat64 records the float64 value for obsrv. ObserveFloat64(obsrv Float64Observable, value float64, opts ...ObserveOption) + // ObserveInt64 records the int64 value for obsrv. ObserveInt64(obsrv Int64Observable, value int64, opts ...ObserveOption) } diff --git a/vendor/go.opentelemetry.io/otel/semconv/internal/http.go b/vendor/go.opentelemetry.io/otel/semconv/internal/http.go index ada857995..d5197e16c 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/internal/http.go +++ b/vendor/go.opentelemetry.io/otel/semconv/internal/http.go @@ -115,7 +115,7 @@ func hostIPNamePort(hostWithPort string) (ip string, name string, port int) { name = hostPart } if parsedPort, err = strconv.ParseUint(portPart, 10, 16); err == nil { - port = int(parsedPort) + port = int(parsedPort) // nolint: gosec // Bit size of 16 checked above. } return } diff --git a/vendor/go.opentelemetry.io/otel/trace/provider.go b/vendor/go.opentelemetry.io/otel/trace/provider.go new file mode 100644 index 000000000..ef85cb70c --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/provider.go @@ -0,0 +1,59 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package trace // import "go.opentelemetry.io/otel/trace" + +import "go.opentelemetry.io/otel/trace/embedded" + +// TracerProvider provides Tracers that are used by instrumentation code to +// trace computational workflows. +// +// A TracerProvider is the collection destination of all Spans from Tracers it +// provides, it represents a unique telemetry collection pipeline. How that +// pipeline is defined, meaning how those Spans are collected, processed, and +// where they are exported, depends on its implementation. Instrumentation +// authors do not need to define this implementation, rather just use the +// provided Tracers to instrument code. +// +// Commonly, instrumentation code will accept a TracerProvider implementation +// at runtime from its users or it can simply use the globally registered one +// (see https://pkg.go.dev/go.opentelemetry.io/otel#GetTracerProvider). +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type TracerProvider interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.TracerProvider + + // Tracer returns a unique Tracer scoped to be used by instrumentation code + // to trace computational workflows. The scope and identity of that + // instrumentation code is uniquely defined by the name and options passed. + // + // The passed name needs to uniquely identify instrumentation code. + // Therefore, it is recommended that name is the Go package name of the + // library providing instrumentation (note: not the code being + // instrumented). Instrumentation libraries can have multiple versions, + // therefore, the WithInstrumentationVersion option should be used to + // distinguish these different codebases. Additionally, instrumentation + // libraries may sometimes use traces to communicate different domains of + // workflow data (i.e. using spans to communicate workflow events only). If + // this is the case, the WithScopeAttributes option should be used to + // uniquely identify Tracers that handle the different domains of workflow + // data. + // + // If the same name and options are passed multiple times, the same Tracer + // will be returned (it is up to the implementation if this will be the + // same underlying instance of that Tracer or not). It is not necessary to + // call this multiple times with the same name and options to get an + // up-to-date Tracer. All implementations will ensure any TracerProvider + // configuration changes are propagated to all provided Tracers. + // + // If name is empty, then an implementation defined default name will be + // used instead. + // + // This method is safe to call concurrently. + Tracer(name string, options ...TracerOption) Tracer +} diff --git a/vendor/go.opentelemetry.io/otel/trace/span.go b/vendor/go.opentelemetry.io/otel/trace/span.go new file mode 100644 index 000000000..d3aa476ee --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/span.go @@ -0,0 +1,177 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package trace // import "go.opentelemetry.io/otel/trace" + +import ( + "context" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/trace/embedded" +) + +// Span is the individual component of a trace. It represents a single named +// and timed operation of a workflow that is traced. A Tracer is used to +// create a Span and it is then up to the operation the Span represents to +// properly end the Span when the operation itself ends. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Span interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Span + + // End completes the Span. The Span is considered complete and ready to be + // delivered through the rest of the telemetry pipeline after this method + // is called. Therefore, updates to the Span are not allowed after this + // method has been called. + End(options ...SpanEndOption) + + // AddEvent adds an event with the provided name and options. + AddEvent(name string, options ...EventOption) + + // AddLink adds a link. + // Adding links at span creation using WithLinks is preferred to calling AddLink + // later, for contexts that are available during span creation, because head + // sampling decisions can only consider information present during span creation. + AddLink(link Link) + + // IsRecording returns the recording state of the Span. It will return + // true if the Span is active and events can be recorded. + IsRecording() bool + + // RecordError will record err as an exception span event for this span. An + // additional call to SetStatus is required if the Status of the Span should + // be set to Error, as this method does not change the Span status. If this + // span is not being recorded or err is nil then this method does nothing. + RecordError(err error, options ...EventOption) + + // SpanContext returns the SpanContext of the Span. The returned SpanContext + // is usable even after the End method has been called for the Span. + SpanContext() SpanContext + + // SetStatus sets the status of the Span in the form of a code and a + // description, provided the status hasn't already been set to a higher + // value before (OK > Error > Unset). The description is only included in a + // status when the code is for an error. + SetStatus(code codes.Code, description string) + + // SetName sets the Span name. + SetName(name string) + + // SetAttributes sets kv as attributes of the Span. If a key from kv + // already exists for an attribute of the Span it will be overwritten with + // the value contained in kv. + SetAttributes(kv ...attribute.KeyValue) + + // TracerProvider returns a TracerProvider that can be used to generate + // additional Spans on the same telemetry pipeline as the current Span. + TracerProvider() TracerProvider +} + +// Link is the relationship between two Spans. The relationship can be within +// the same Trace or across different Traces. +// +// For example, a Link is used in the following situations: +// +// 1. Batch Processing: A batch of operations may contain operations +// associated with one or more traces/spans. Since there can only be one +// parent SpanContext, a Link is used to keep reference to the +// SpanContext of all operations in the batch. +// 2. Public Endpoint: A SpanContext for an in incoming client request on a +// public endpoint should be considered untrusted. In such a case, a new +// trace with its own identity and sampling decision needs to be created, +// but this new trace needs to be related to the original trace in some +// form. A Link is used to keep reference to the original SpanContext and +// track the relationship. +type Link struct { + // SpanContext of the linked Span. + SpanContext SpanContext + + // Attributes describe the aspects of the link. + Attributes []attribute.KeyValue +} + +// LinkFromContext returns a link encapsulating the SpanContext in the provided +// ctx. +func LinkFromContext(ctx context.Context, attrs ...attribute.KeyValue) Link { + return Link{ + SpanContext: SpanContextFromContext(ctx), + Attributes: attrs, + } +} + +// SpanKind is the role a Span plays in a Trace. +type SpanKind int + +// As a convenience, these match the proto definition, see +// https://github.com/open-telemetry/opentelemetry-proto/blob/30d237e1ff3ab7aa50e0922b5bebdd93505090af/opentelemetry/proto/trace/v1/trace.proto#L101-L129 +// +// The unspecified value is not a valid `SpanKind`. Use `ValidateSpanKind()` +// to coerce a span kind to a valid value. +const ( + // SpanKindUnspecified is an unspecified SpanKind and is not a valid + // SpanKind. SpanKindUnspecified should be replaced with SpanKindInternal + // if it is received. + SpanKindUnspecified SpanKind = 0 + // SpanKindInternal is a SpanKind for a Span that represents an internal + // operation within an application. + SpanKindInternal SpanKind = 1 + // SpanKindServer is a SpanKind for a Span that represents the operation + // of handling a request from a client. + SpanKindServer SpanKind = 2 + // SpanKindClient is a SpanKind for a Span that represents the operation + // of client making a request to a server. + SpanKindClient SpanKind = 3 + // SpanKindProducer is a SpanKind for a Span that represents the operation + // of a producer sending a message to a message broker. Unlike + // SpanKindClient and SpanKindServer, there is often no direct + // relationship between this kind of Span and a SpanKindConsumer kind. A + // SpanKindProducer Span will end once the message is accepted by the + // message broker which might not overlap with the processing of that + // message. + SpanKindProducer SpanKind = 4 + // SpanKindConsumer is a SpanKind for a Span that represents the operation + // of a consumer receiving a message from a message broker. Like + // SpanKindProducer Spans, there is often no direct relationship between + // this Span and the Span that produced the message. + SpanKindConsumer SpanKind = 5 +) + +// ValidateSpanKind returns a valid span kind value. This will coerce +// invalid values into the default value, SpanKindInternal. +func ValidateSpanKind(spanKind SpanKind) SpanKind { + switch spanKind { + case SpanKindInternal, + SpanKindServer, + SpanKindClient, + SpanKindProducer, + SpanKindConsumer: + // valid + return spanKind + default: + return SpanKindInternal + } +} + +// String returns the specified name of the SpanKind in lower-case. +func (sk SpanKind) String() string { + switch sk { + case SpanKindInternal: + return "internal" + case SpanKindServer: + return "server" + case SpanKindClient: + return "client" + case SpanKindProducer: + return "producer" + case SpanKindConsumer: + return "consumer" + default: + return "unspecified" + } +} diff --git a/vendor/go.opentelemetry.io/otel/trace/trace.go b/vendor/go.opentelemetry.io/otel/trace/trace.go index 28877d4ab..d49adf671 100644 --- a/vendor/go.opentelemetry.io/otel/trace/trace.go +++ b/vendor/go.opentelemetry.io/otel/trace/trace.go @@ -5,13 +5,8 @@ package trace // import "go.opentelemetry.io/otel/trace" import ( "bytes" - "context" "encoding/hex" "encoding/json" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/trace/embedded" ) const ( @@ -326,247 +321,3 @@ func (sc SpanContext) MarshalJSON() ([]byte, error) { Remote: sc.remote, }) } - -// Span is the individual component of a trace. It represents a single named -// and timed operation of a workflow that is traced. A Tracer is used to -// create a Span and it is then up to the operation the Span represents to -// properly end the Span when the operation itself ends. -// -// Warning: Methods may be added to this interface in minor releases. See -// package documentation on API implementation for information on how to set -// default behavior for unimplemented methods. -type Span interface { - // Users of the interface can ignore this. This embedded type is only used - // by implementations of this interface. See the "API Implementations" - // section of the package documentation for more information. - embedded.Span - - // End completes the Span. The Span is considered complete and ready to be - // delivered through the rest of the telemetry pipeline after this method - // is called. Therefore, updates to the Span are not allowed after this - // method has been called. - End(options ...SpanEndOption) - - // AddEvent adds an event with the provided name and options. - AddEvent(name string, options ...EventOption) - - // AddLink adds a link. - // Adding links at span creation using WithLinks is preferred to calling AddLink - // later, for contexts that are available during span creation, because head - // sampling decisions can only consider information present during span creation. - AddLink(link Link) - - // IsRecording returns the recording state of the Span. It will return - // true if the Span is active and events can be recorded. - IsRecording() bool - - // RecordError will record err as an exception span event for this span. An - // additional call to SetStatus is required if the Status of the Span should - // be set to Error, as this method does not change the Span status. If this - // span is not being recorded or err is nil then this method does nothing. - RecordError(err error, options ...EventOption) - - // SpanContext returns the SpanContext of the Span. The returned SpanContext - // is usable even after the End method has been called for the Span. - SpanContext() SpanContext - - // SetStatus sets the status of the Span in the form of a code and a - // description, provided the status hasn't already been set to a higher - // value before (OK > Error > Unset). The description is only included in a - // status when the code is for an error. - SetStatus(code codes.Code, description string) - - // SetName sets the Span name. - SetName(name string) - - // SetAttributes sets kv as attributes of the Span. If a key from kv - // already exists for an attribute of the Span it will be overwritten with - // the value contained in kv. - SetAttributes(kv ...attribute.KeyValue) - - // TracerProvider returns a TracerProvider that can be used to generate - // additional Spans on the same telemetry pipeline as the current Span. - TracerProvider() TracerProvider -} - -// Link is the relationship between two Spans. The relationship can be within -// the same Trace or across different Traces. -// -// For example, a Link is used in the following situations: -// -// 1. Batch Processing: A batch of operations may contain operations -// associated with one or more traces/spans. Since there can only be one -// parent SpanContext, a Link is used to keep reference to the -// SpanContext of all operations in the batch. -// 2. Public Endpoint: A SpanContext for an in incoming client request on a -// public endpoint should be considered untrusted. In such a case, a new -// trace with its own identity and sampling decision needs to be created, -// but this new trace needs to be related to the original trace in some -// form. A Link is used to keep reference to the original SpanContext and -// track the relationship. -type Link struct { - // SpanContext of the linked Span. - SpanContext SpanContext - - // Attributes describe the aspects of the link. - Attributes []attribute.KeyValue -} - -// LinkFromContext returns a link encapsulating the SpanContext in the provided ctx. -func LinkFromContext(ctx context.Context, attrs ...attribute.KeyValue) Link { - return Link{ - SpanContext: SpanContextFromContext(ctx), - Attributes: attrs, - } -} - -// SpanKind is the role a Span plays in a Trace. -type SpanKind int - -// As a convenience, these match the proto definition, see -// https://github.com/open-telemetry/opentelemetry-proto/blob/30d237e1ff3ab7aa50e0922b5bebdd93505090af/opentelemetry/proto/trace/v1/trace.proto#L101-L129 -// -// The unspecified value is not a valid `SpanKind`. Use `ValidateSpanKind()` -// to coerce a span kind to a valid value. -const ( - // SpanKindUnspecified is an unspecified SpanKind and is not a valid - // SpanKind. SpanKindUnspecified should be replaced with SpanKindInternal - // if it is received. - SpanKindUnspecified SpanKind = 0 - // SpanKindInternal is a SpanKind for a Span that represents an internal - // operation within an application. - SpanKindInternal SpanKind = 1 - // SpanKindServer is a SpanKind for a Span that represents the operation - // of handling a request from a client. - SpanKindServer SpanKind = 2 - // SpanKindClient is a SpanKind for a Span that represents the operation - // of client making a request to a server. - SpanKindClient SpanKind = 3 - // SpanKindProducer is a SpanKind for a Span that represents the operation - // of a producer sending a message to a message broker. Unlike - // SpanKindClient and SpanKindServer, there is often no direct - // relationship between this kind of Span and a SpanKindConsumer kind. A - // SpanKindProducer Span will end once the message is accepted by the - // message broker which might not overlap with the processing of that - // message. - SpanKindProducer SpanKind = 4 - // SpanKindConsumer is a SpanKind for a Span that represents the operation - // of a consumer receiving a message from a message broker. Like - // SpanKindProducer Spans, there is often no direct relationship between - // this Span and the Span that produced the message. - SpanKindConsumer SpanKind = 5 -) - -// ValidateSpanKind returns a valid span kind value. This will coerce -// invalid values into the default value, SpanKindInternal. -func ValidateSpanKind(spanKind SpanKind) SpanKind { - switch spanKind { - case SpanKindInternal, - SpanKindServer, - SpanKindClient, - SpanKindProducer, - SpanKindConsumer: - // valid - return spanKind - default: - return SpanKindInternal - } -} - -// String returns the specified name of the SpanKind in lower-case. -func (sk SpanKind) String() string { - switch sk { - case SpanKindInternal: - return "internal" - case SpanKindServer: - return "server" - case SpanKindClient: - return "client" - case SpanKindProducer: - return "producer" - case SpanKindConsumer: - return "consumer" - default: - return "unspecified" - } -} - -// Tracer is the creator of Spans. -// -// Warning: Methods may be added to this interface in minor releases. See -// package documentation on API implementation for information on how to set -// default behavior for unimplemented methods. -type Tracer interface { - // Users of the interface can ignore this. This embedded type is only used - // by implementations of this interface. See the "API Implementations" - // section of the package documentation for more information. - embedded.Tracer - - // Start creates a span and a context.Context containing the newly-created span. - // - // If the context.Context provided in `ctx` contains a Span then the newly-created - // Span will be a child of that span, otherwise it will be a root span. This behavior - // can be overridden by providing `WithNewRoot()` as a SpanOption, causing the - // newly-created Span to be a root span even if `ctx` contains a Span. - // - // When creating a Span it is recommended to provide all known span attributes using - // the `WithAttributes()` SpanOption as samplers will only have access to the - // attributes provided when a Span is created. - // - // Any Span that is created MUST also be ended. This is the responsibility of the user. - // Implementations of this API may leak memory or other resources if Spans are not ended. - Start(ctx context.Context, spanName string, opts ...SpanStartOption) (context.Context, Span) -} - -// TracerProvider provides Tracers that are used by instrumentation code to -// trace computational workflows. -// -// A TracerProvider is the collection destination of all Spans from Tracers it -// provides, it represents a unique telemetry collection pipeline. How that -// pipeline is defined, meaning how those Spans are collected, processed, and -// where they are exported, depends on its implementation. Instrumentation -// authors do not need to define this implementation, rather just use the -// provided Tracers to instrument code. -// -// Commonly, instrumentation code will accept a TracerProvider implementation -// at runtime from its users or it can simply use the globally registered one -// (see https://pkg.go.dev/go.opentelemetry.io/otel#GetTracerProvider). -// -// Warning: Methods may be added to this interface in minor releases. See -// package documentation on API implementation for information on how to set -// default behavior for unimplemented methods. -type TracerProvider interface { - // Users of the interface can ignore this. This embedded type is only used - // by implementations of this interface. See the "API Implementations" - // section of the package documentation for more information. - embedded.TracerProvider - - // Tracer returns a unique Tracer scoped to be used by instrumentation code - // to trace computational workflows. The scope and identity of that - // instrumentation code is uniquely defined by the name and options passed. - // - // The passed name needs to uniquely identify instrumentation code. - // Therefore, it is recommended that name is the Go package name of the - // library providing instrumentation (note: not the code being - // instrumented). Instrumentation libraries can have multiple versions, - // therefore, the WithInstrumentationVersion option should be used to - // distinguish these different codebases. Additionally, instrumentation - // libraries may sometimes use traces to communicate different domains of - // workflow data (i.e. using spans to communicate workflow events only). If - // this is the case, the WithScopeAttributes option should be used to - // uniquely identify Tracers that handle the different domains of workflow - // data. - // - // If the same name and options are passed multiple times, the same Tracer - // will be returned (it is up to the implementation if this will be the - // same underlying instance of that Tracer or not). It is not necessary to - // call this multiple times with the same name and options to get an - // up-to-date Tracer. All implementations will ensure any TracerProvider - // configuration changes are propagated to all provided Tracers. - // - // If name is empty, then an implementation defined default name will be - // used instead. - // - // This method is safe to call concurrently. - Tracer(name string, options ...TracerOption) Tracer -} diff --git a/vendor/go.opentelemetry.io/otel/trace/tracer.go b/vendor/go.opentelemetry.io/otel/trace/tracer.go new file mode 100644 index 000000000..77952d2a0 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/trace/tracer.go @@ -0,0 +1,37 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package trace // import "go.opentelemetry.io/otel/trace" + +import ( + "context" + + "go.opentelemetry.io/otel/trace/embedded" +) + +// Tracer is the creator of Spans. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Tracer interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Tracer + + // Start creates a span and a context.Context containing the newly-created span. + // + // If the context.Context provided in `ctx` contains a Span then the newly-created + // Span will be a child of that span, otherwise it will be a root span. This behavior + // can be overridden by providing `WithNewRoot()` as a SpanOption, causing the + // newly-created Span to be a root span even if `ctx` contains a Span. + // + // When creating a Span it is recommended to provide all known span attributes using + // the `WithAttributes()` SpanOption as samplers will only have access to the + // attributes provided when a Span is created. + // + // Any Span that is created MUST also be ended. This is the responsibility of the user. + // Implementations of this API may leak memory or other resources if Spans are not ended. + Start(ctx context.Context, spanName string, opts ...SpanStartOption) (context.Context, Span) +} diff --git a/vendor/go.opentelemetry.io/otel/trace/tracestate.go b/vendor/go.opentelemetry.io/otel/trace/tracestate.go index 20b5cf243..dc5e34cad 100644 --- a/vendor/go.opentelemetry.io/otel/trace/tracestate.go +++ b/vendor/go.opentelemetry.io/otel/trace/tracestate.go @@ -260,6 +260,16 @@ func (ts TraceState) Get(key string) string { return "" } +// Walk walks all key value pairs in the TraceState by calling f +// Iteration stops if f returns false. +func (ts TraceState) Walk(f func(key, value string) bool) { + for _, m := range ts.list { + if !f(m.Key, m.Value) { + break + } + } +} + // Insert adds a new list-member defined by the key/value pair to the // TraceState. If a list-member already exists for the given key, that // list-member's value is updated. The new or updated list-member is always diff --git a/vendor/go.opentelemetry.io/otel/verify_released_changelog.sh b/vendor/go.opentelemetry.io/otel/verify_released_changelog.sh new file mode 100644 index 000000000..c9b7cdbbf --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/verify_released_changelog.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +set -euo pipefail + +TARGET="${1:?Must provide target ref}" + +FILE="CHANGELOG.md" +TEMP_DIR=$(mktemp -d) +echo "Temp folder: $TEMP_DIR" + +# Only the latest commit of the feature branch is available +# automatically. To diff with the base branch, we need to +# fetch that too (and we only need its latest commit). +git fetch origin "${TARGET}" --depth=1 + +# Checkout the previous version on the base branch of the changelog to tmpfolder +git --work-tree="$TEMP_DIR" checkout FETCH_HEAD $FILE + +PREVIOUS_FILE="$TEMP_DIR/$FILE" +CURRENT_FILE="$FILE" +PREVIOUS_LOCKED_FILE="$TEMP_DIR/previous_locked_section.md" +CURRENT_LOCKED_FILE="$TEMP_DIR/current_locked_section.md" + +# Extract released sections from the previous version +awk '/^/ {flag=1} /^/ {flag=0} flag' "$PREVIOUS_FILE" > "$PREVIOUS_LOCKED_FILE" + +# Extract released sections from the current version +awk '/^/ {flag=1} /^/ {flag=0} flag' "$CURRENT_FILE" > "$CURRENT_LOCKED_FILE" + +# Compare the released sections +if ! diff -q "$PREVIOUS_LOCKED_FILE" "$CURRENT_LOCKED_FILE"; then + echo "Error: The released sections of the changelog file have been modified." + diff "$PREVIOUS_LOCKED_FILE" "$CURRENT_LOCKED_FILE" + rm -rf "$TEMP_DIR" + false +fi + +rm -rf "$TEMP_DIR" +echo "The released sections remain unchanged." diff --git a/vendor/go.opentelemetry.io/otel/version.go b/vendor/go.opentelemetry.io/otel/version.go index ab2896052..f67039ed1 100644 --- a/vendor/go.opentelemetry.io/otel/version.go +++ b/vendor/go.opentelemetry.io/otel/version.go @@ -5,5 +5,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.28.0" + return "1.29.0" } diff --git a/vendor/go.opentelemetry.io/otel/versions.yaml b/vendor/go.opentelemetry.io/otel/versions.yaml index 241cfc82a..3ba611d71 100644 --- a/vendor/go.opentelemetry.io/otel/versions.yaml +++ b/vendor/go.opentelemetry.io/otel/versions.yaml @@ -3,7 +3,7 @@ module-sets: stable-v1: - version: v1.28.0 + version: v1.29.0 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opencensus @@ -29,15 +29,16 @@ module-sets: - go.opentelemetry.io/otel/sdk/metric - go.opentelemetry.io/otel/trace experimental-metrics: - version: v0.50.0 + version: v0.51.0 modules: - go.opentelemetry.io/otel/example/prometheus - go.opentelemetry.io/otel/exporters/prometheus experimental-logs: - version: v0.4.0 + version: v0.5.0 modules: - go.opentelemetry.io/otel/log - go.opentelemetry.io/otel/sdk/log + - go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc - go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp - go.opentelemetry.io/otel/exporters/stdout/stdoutlog experimental-schema: @@ -46,4 +47,3 @@ module-sets: - go.opentelemetry.io/otel/schema excluded-modules: - go.opentelemetry.io/otel/internal/tools - - go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc diff --git a/vendor/golang.org/x/time/LICENSE b/vendor/golang.org/x/time/LICENSE index 6a66aea5e..2a7cf70da 100644 --- a/vendor/golang.org/x/time/LICENSE +++ b/vendor/golang.org/x/time/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer. copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/vendor/modules.txt b/vendor/modules.txt index 1f1c238e2..5003c1027 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -2,16 +2,14 @@ ## explicit github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2022-08-01/compute github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2021-10-01/containerservice -github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac github.com/Azure/azure-sdk-for-go/services/keyvault/2016-10-01/keyvault github.com/Azure/azure-sdk-for-go/services/msi/mgmt/2018-11-30/msi github.com/Azure/azure-sdk-for-go/services/network/mgmt/2022-07-01/network -github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2017-05-10/resources github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage github.com/Azure/azure-sdk-for-go/storage github.com/Azure/azure-sdk-for-go/version -# github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 +# github.com/Azure/azure-sdk-for-go/sdk/azcore v1.14.0 ## explicit; go 1.18 github.com/Azure/azure-sdk-for-go/sdk/azcore github.com/Azure/azure-sdk-for-go/sdk/azcore/arm @@ -47,12 +45,9 @@ github.com/Azure/azure-sdk-for-go/sdk/internal/log github.com/Azure/azure-sdk-for-go/sdk/internal/poller github.com/Azure/azure-sdk-for-go/sdk/internal/temporal github.com/Azure/azure-sdk-for-go/sdk/internal/uuid -# github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets v0.12.0 +# github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2 v2.2.0 ## explicit; go 1.18 -github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets -# github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.7.1 -## explicit; go 1.18 -github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2 # github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 v5.7.0 ## explicit; go 1.18 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 @@ -77,6 +72,12 @@ github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources # github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.6.0 ## explicit; go 1.18 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage +# github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets v1.1.0 +## explicit; go 1.18 +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets +# github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.0.0 +## explicit; go 1.18 +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal # github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.3.2 ## explicit; go 1.18 github.com/Azure/azure-sdk-for-go/sdk/storage/azblob @@ -431,9 +432,6 @@ github.com/prometheus/common/model github.com/prometheus/procfs github.com/prometheus/procfs/internal/fs github.com/prometheus/procfs/internal/util -# github.com/satori/go.uuid v1.2.0 -## explicit -github.com/satori/go.uuid # github.com/spf13/cobra v1.8.1 ## explicit; go 1.15 github.com/spf13/cobra @@ -477,7 +475,7 @@ go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/inte ## explicit; go 1.20 go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil -# go.opentelemetry.io/otel v1.28.0 +# go.opentelemetry.io/otel v1.29.0 ## explicit; go 1.21 go.opentelemetry.io/otel go.opentelemetry.io/otel/attribute @@ -503,7 +501,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/metric v1.28.0 +# go.opentelemetry.io/otel/metric v1.29.0 ## explicit; go 1.21 go.opentelemetry.io/otel/metric go.opentelemetry.io/otel/metric/embedded @@ -516,7 +514,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/trace v1.28.0 +# go.opentelemetry.io/otel/trace v1.29.0 ## explicit; go 1.21 go.opentelemetry.io/otel/trace go.opentelemetry.io/otel/trace/embedded @@ -629,7 +627,7 @@ golang.org/x/text/transform golang.org/x/text/unicode/bidi golang.org/x/text/unicode/norm golang.org/x/text/width -# golang.org/x/time v0.5.0 +# golang.org/x/time v0.6.0 ## explicit; go 1.18 golang.org/x/time/rate # golang.org/x/tools v0.24.0 @@ -1451,7 +1449,7 @@ k8s.io/kube-openapi/pkg/validation/errors k8s.io/kube-openapi/pkg/validation/spec k8s.io/kube-openapi/pkg/validation/strfmt k8s.io/kube-openapi/pkg/validation/strfmt/bson -# k8s.io/kubectl v0.0.0 => k8s.io/kubectl v0.29.7 +# k8s.io/kubectl v0.30.3 => k8s.io/kubectl v0.29.7 ## explicit; go 1.21 k8s.io/kubectl/pkg/scale k8s.io/kubectl/pkg/util/podutils @@ -1459,7 +1457,7 @@ k8s.io/kubectl/pkg/util/podutils ## explicit; go 1.21 k8s.io/kubelet/pkg/apis k8s.io/kubelet/pkg/apis/stats/v1alpha1 -# k8s.io/kubernetes v1.29.7 +# k8s.io/kubernetes v1.30.3 => k8s.io/kubernetes v1.29.7 ## explicit; go 1.21 k8s.io/kubernetes/pkg/api/legacyscheme k8s.io/kubernetes/pkg/api/service @@ -1527,10 +1525,10 @@ k8s.io/kubernetes/test/utils k8s.io/kubernetes/test/utils/format k8s.io/kubernetes/test/utils/image k8s.io/kubernetes/test/utils/kubeconfig -# k8s.io/mount-utils v0.29.7 => k8s.io/mount-utils v0.29.7 +# k8s.io/mount-utils v0.30.3 => k8s.io/mount-utils v0.29.7 ## explicit; go 1.21 k8s.io/mount-utils -# k8s.io/pod-security-admission v0.29.7 => k8s.io/pod-security-admission v0.29.7 +# k8s.io/pod-security-admission v0.30.3 => k8s.io/pod-security-admission v0.29.7 ## explicit; go 1.21 k8s.io/pod-security-admission/api k8s.io/pod-security-admission/policy @@ -1621,8 +1619,8 @@ 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.0.33 -## explicit; go 1.22.5 +# sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.0.49 +## explicit; go 1.22 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 @@ -1651,6 +1649,8 @@ sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipaddressclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipprefixclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/registryclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/resourcegroupclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/roleassignmentclient +sigs.k8s.io/cloud-provider-azure/pkg/azclient/roledefinitionclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/routetableclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/secretclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/securitygroupclient @@ -1705,6 +1705,7 @@ sigs.k8s.io/yaml/goyaml.v2 # k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.29.7 # k8s.io/kubectl => k8s.io/kubectl v0.29.7 # k8s.io/kubelet => k8s.io/kubelet v0.29.7 +# k8s.io/kubernetes => k8s.io/kubernetes v1.29.7 # k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.29.7 # k8s.io/metrics => k8s.io/metrics v0.29.7 # k8s.io/mount-utils => k8s.io/mount-utils v0.29.7 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 e0efaecec..d3faf00a0 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/Makefile +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/Makefile @@ -103,6 +103,8 @@ generatecode: build ## Generate client $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault --package-alias armkeyvault --resource Vault --subresource Secret --client-name SecretsClient --verbs get,createorupdate,delete,list $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault --package-alias armkeyvault --resource Vault --client-name VaultsClient --verbs get,createorupdate,delete,list $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources --package-alias armresources --resource Provider --client-name ProvidersClient + $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2 --package-alias armauthorization --resource RoleAssignment --client-name RoleAssignmentsClient + $(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2 --package-alias armauthorization --resource RoleDefinition --client-name RoleDefinitionsClient .PHONY: generateimpl diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient/zz_generated_client.go index e7f50321b..6ef064c1d 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient/zz_generated_client.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient/zz_generated_client.go @@ -58,7 +58,7 @@ const ListOperationName = "AccountsClient.List" // List gets a list of Account in the resource group. func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armstorage.Account, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "Account", "list") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, ListOperationName, client.tracer, nil) defer endSpan(err) pager := client.AccountsClient.NewListByResourceGroupPager(resourceGroupName, nil) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/armauth/expire_early_wrapper.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/armauth/expire_early_wrapper.go deleted file mode 100644 index 843be4aa5..000000000 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/armauth/expire_early_wrapper.go +++ /dev/null @@ -1,57 +0,0 @@ -/* -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 armauth - -import ( - "context" - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" -) - -// expireEarlyTokenCredential is a wrapper around the azcore.TokenCredential that -// returns an earlier ExpiresOn timestamp to avoid conditions like clockSkew, or a race -// condition during polling. -// See: https://github.com/hashicorp/terraform-provider-azurerm/issues/20834 for more details -type expireEarlyTokenCredential struct { - cred azcore.TokenCredential -} - -func NewExpireEarlyTokenWrapper(cred azcore.TokenCredential) azcore.TokenCredential { - return &expireEarlyTokenCredential{ - cred: cred, - } -} - -func (w *expireEarlyTokenCredential) GetToken(ctx context.Context, options policy.TokenRequestOptions) (azcore.AccessToken, error) { - token, err := w.cred.GetToken(ctx, options) - if err != nil { - return azcore.AccessToken{}, err - } - - twoHoursFromNow := time.Now().Add(2 * time.Hour) - // IMDS may have the MI token already, and have an expiration of less than 2h when we receive the token. We don't want to set that value beyond the ExpiresOn time and potentially miss a refresh - // So we just return earlier here. See discussion here: https://github.com/Azure/karpenter-provider-azure/pull/391/files#r1648633051 - if token.ExpiresOn.Before(twoHoursFromNow) { - return token, nil - } - // If the token expires in more than 2 hours, this means we are taking in a new token with a fresh 24h expiration time or one already in the cache that hasn't been modified by us, so we want to set that to two hours so - // we can refresh it early to avoid the polling bugs mentioned in the above issue - token.ExpiresOn = twoHoursFromNow - return token, nil -} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/armauth/keyvault_credential.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/armauth/keyvault_credential.go index 5e9ab48fa..4bf94b349 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/armauth/keyvault_credential.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/armauth/keyvault_credential.go @@ -25,7 +25,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets" + "github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets" "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" "sigs.k8s.io/cloud-provider-azure/pkg/azclient/vaultclient" @@ -44,7 +44,6 @@ func (s SecretResourceID) String() string { type KeyVaultCredential struct { secretClient *azsecrets.Client - vaultURI string secretResourceID SecretResourceID mtx sync.RWMutex @@ -155,7 +154,7 @@ func (c *KeyVaultCredential) refreshToken(ctx context.Context) (*azcore.AccessTo return cloneAccessToken(c.token), nil } -func (c *KeyVaultCredential) GetToken(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) { +func (c *KeyVaultCredential) GetToken(ctx context.Context, _ policy.TokenRequestOptions) (azcore.AccessToken, error) { token, err := c.refreshToken(ctx) if err != nil { return azcore.AccessToken{}, fmt.Errorf("refresh token: %w", err) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/auth.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/auth.go index f73d50f34..30e520f8d 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/auth.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/auth.go @@ -83,7 +83,6 @@ func NewAuthProvider(armConfig *ARMClientConfig, config *AzureAuthConfig, client if err != nil { return nil, err } - managedIdentityCredential = armauth.NewExpireEarlyTokenWrapper(managedIdentityCredential) } var ( diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/availabilitysetclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/availabilitysetclient/zz_generated_client.go index f0fc1b9b0..1dfb50f0b 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/availabilitysetclient/zz_generated_client.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/availabilitysetclient/zz_generated_client.go @@ -59,7 +59,7 @@ const GetOperationName = "AvailabilitySetsClient.Get" func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string) (result *armcompute.AvailabilitySet, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "AvailabilitySet", "get") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, GetOperationName, client.tracer, nil) defer endSpan(err) resp, err := client.AvailabilitySetsClient.Get(ctx, resourceGroupName, resourceName, nil) @@ -75,7 +75,7 @@ const ListOperationName = "AvailabilitySetsClient.List" // List gets a list of AvailabilitySet in the resource group. func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armcompute.AvailabilitySet, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "AvailabilitySet", "list") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, ListOperationName, client.tracer, nil) defer endSpan(err) pager := client.AvailabilitySetsClient.NewListPager(resourceGroupName, nil) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobcontainerclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobcontainerclient/zz_generated_client.go index 3f9d5ecad..773f2d5a2 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobcontainerclient/zz_generated_client.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/blobcontainerclient/zz_generated_client.go @@ -59,7 +59,7 @@ const GetOperationName = "BlobContainersClient.Get" func (client *Client) Get(ctx context.Context, resourceGroupName string, parentResourceName string, resourceName string) (result *armstorage.BlobContainer, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "BlobContainer", "get") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, GetOperationName, client.tracer, nil) defer endSpan(err) resp, err := client.BlobContainersClient.Get(ctx, resourceGroupName, parentResourceName, resourceName, nil) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/cloud.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/cloud.go index 2e7d88324..ca1c877c5 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/cloud.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/cloud.go @@ -81,7 +81,7 @@ func AzureCloudConfigFromURL(endpoint string) (*cloud.Configuration, error) { // does not contain the endpoint, and this is not accounted for. This // ultimately unsets it for the returned config, causing the bootstrap of // the provider to fail. Instead, check if the endpoint is returned, and if - // it is not then set it. + // It is not then set it. if len(metadata[0].ResourceManager) == 0 { metadata[0].ResourceManager = endpoint } diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/deploymentclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/deploymentclient/zz_generated_client.go index 2986e50df..bbbe659d6 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/deploymentclient/zz_generated_client.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/deploymentclient/zz_generated_client.go @@ -58,7 +58,7 @@ const DeleteOperationName = "DeploymentsClient.Delete" // Delete deletes a Deployment by name. func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) (err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "Deployment", "delete") - defer metricsCtx.Observe(ctx, err) + 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, resourceName, nil)).WaitforPollerResp(ctx) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/diskclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/diskclient/zz_generated_client.go index 7b7798433..82544a7ad 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/diskclient/zz_generated_client.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/diskclient/zz_generated_client.go @@ -59,7 +59,7 @@ const GetOperationName = "DisksClient.Get" func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string) (result *armcompute.Disk, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "Disk", "get") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, GetOperationName, client.tracer, nil) defer endSpan(err) resp, err := client.DisksClient.Get(ctx, resourceGroupName, resourceName, nil) @@ -75,7 +75,7 @@ const CreateOrUpdateOperationName = "DisksClient.Create" // CreateOrUpdate creates or updates a Disk. func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource armcompute.Disk) (result *armcompute.Disk, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "Disk", "create_or_update") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, CreateOrUpdateOperationName, client.tracer, nil) defer endSpan(err) resp, err := utils.NewPollerWrapper(client.DisksClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx) @@ -93,7 +93,7 @@ const DeleteOperationName = "DisksClient.Delete" // Delete deletes a Disk by name. func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) (err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "Disk", "delete") - defer metricsCtx.Observe(ctx, err) + 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, resourceName, nil)).WaitforPollerResp(ctx) @@ -105,7 +105,7 @@ const ListOperationName = "DisksClient.List" // List gets a list of Disk in the resource group. func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armcompute.Disk, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "Disk", "list") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, ListOperationName, client.tracer, nil) defer endSpan(err) pager := client.DisksClient.NewListByResourceGroupPager(resourceGroupName, nil) 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 f51b85dc8..697f9d24d 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 @@ -37,6 +37,7 @@ import ( "sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipprefixclient" "sigs.k8s.io/cloud-provider-azure/pkg/azclient/registryclient" "sigs.k8s.io/cloud-provider-azure/pkg/azclient/resourcegroupclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/roleassignmentclient" "sigs.k8s.io/cloud-provider-azure/pkg/azclient/routetableclient" "sigs.k8s.io/cloud-provider-azure/pkg/azclient/secretclient" "sigs.k8s.io/cloud-provider-azure/pkg/azclient/securitygroupclient" @@ -75,6 +76,7 @@ type ClientFactory interface { GetPublicIPPrefixClient() publicipprefixclient.Interface GetRegistryClient() registryclient.Interface GetResourceGroupClient() resourcegroupclient.Interface + GetRoleAssignmentClient() roleassignmentclient.Interface GetRouteTableClient() routetableclient.Interface GetSecretClient() secretclient.Interface GetSecurityGroupClient() securitygroupclient.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 1c2f36ee1..6a3df53a3 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 @@ -45,6 +45,7 @@ import ( "sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipprefixclient" "sigs.k8s.io/cloud-provider-azure/pkg/azclient/registryclient" "sigs.k8s.io/cloud-provider-azure/pkg/azclient/resourcegroupclient" + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/roleassignmentclient" "sigs.k8s.io/cloud-provider-azure/pkg/azclient/routetableclient" "sigs.k8s.io/cloud-provider-azure/pkg/azclient/secretclient" "sigs.k8s.io/cloud-provider-azure/pkg/azclient/securitygroupclient" @@ -83,6 +84,7 @@ type ClientFactoryImpl struct { publicipprefixclientInterface publicipprefixclient.Interface registryclientInterface registryclient.Interface resourcegroupclientInterface resourcegroupclient.Interface + roleassignmentclientInterface roleassignmentclient.Interface routetableclientInterface routetableclient.Interface secretclientInterface secretclient.Interface securitygroupclientInterface securitygroupclient.Interface @@ -228,6 +230,12 @@ func NewClientFactory(config *ClientFactoryConfig, armConfig *ARMClientConfig, c return nil, err } + //initialize roleassignmentclient + factory.roleassignmentclientInterface, err = factory.createRoleAssignmentClient(config.SubscriptionID) + if err != nil { + return nil, err + } + //initialize routetableclient factory.routetableclientInterface, err = factory.createRouteTableClient(config.SubscriptionID) if err != nil { @@ -797,6 +805,25 @@ func (factory *ClientFactoryImpl) GetResourceGroupClient() resourcegroupclient.I return factory.resourcegroupclientInterface } +func (factory *ClientFactoryImpl) createRoleAssignmentClient(subscription string) (roleassignmentclient.Interface, error) { + //initialize roleassignmentclient + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + if err != nil { + return nil, err + } + + for _, optionMutFn := range factory.clientOptionsMutFn { + if optionMutFn != nil { + optionMutFn(options) + } + } + return roleassignmentclient.New(subscription, factory.cred, options) +} + +func (factory *ClientFactoryImpl) GetRoleAssignmentClient() roleassignmentclient.Interface { + return factory.roleassignmentclientInterface +} + func (factory *ClientFactoryImpl) createRouteTableClient(subscription string) (routetableclient.Interface, error) { //initialize routetableclient options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/zz_generated_client.go index 70a329fea..0958e890a 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/zz_generated_client.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/zz_generated_client.go @@ -59,7 +59,7 @@ const GetOperationName = "FileSharesClient.Get" func (client *Client) Get(ctx context.Context, resourceGroupName string, parentResourceName string, resourceName string) (result *armstorage.FileShare, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "FileShare", "get") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, GetOperationName, client.tracer, nil) defer endSpan(err) resp, err := client.FileSharesClient.Get(ctx, resourceGroupName, parentResourceName, resourceName, nil) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/interfaceclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/interfaceclient/zz_generated_client.go index 7445cb465..c4b21f87a 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/interfaceclient/zz_generated_client.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/interfaceclient/zz_generated_client.go @@ -62,7 +62,7 @@ func (client *Client) Get(ctx context.Context, resourceGroupName string, resourc ops = &armnetwork.InterfacesClientGetOptions{Expand: expand} } metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "Interface", "get") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, GetOperationName, client.tracer, nil) defer endSpan(err) resp, err := client.InterfacesClient.Get(ctx, resourceGroupName, resourceName, ops) @@ -78,7 +78,7 @@ const CreateOrUpdateOperationName = "InterfacesClient.Create" // CreateOrUpdate creates or updates a Interface. func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource armnetwork.Interface) (result *armnetwork.Interface, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "Interface", "create_or_update") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, CreateOrUpdateOperationName, client.tracer, nil) defer endSpan(err) resp, err := utils.NewPollerWrapper(client.InterfacesClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx) @@ -96,7 +96,7 @@ const DeleteOperationName = "InterfacesClient.Delete" // Delete deletes a Interface by name. func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) (err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "Interface", "delete") - defer metricsCtx.Observe(ctx, err) + 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, resourceName, nil)).WaitforPollerResp(ctx) @@ -108,7 +108,7 @@ const ListOperationName = "InterfacesClient.List" // List gets a list of Interface in the resource group. func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armnetwork.Interface, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "Interface", "list") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, ListOperationName, client.tracer, nil) defer endSpan(err) pager := client.InterfacesClient.NewListPager(resourceGroupName, nil) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/ipgroupclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/ipgroupclient/zz_generated_client.go index 0d67f6bf8..c7113d95d 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/ipgroupclient/zz_generated_client.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/ipgroupclient/zz_generated_client.go @@ -62,7 +62,7 @@ func (client *Client) Get(ctx context.Context, resourceGroupName string, resourc ops = &armnetwork.IPGroupsClientGetOptions{Expand: expand} } metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "IPGroup", "get") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, GetOperationName, client.tracer, nil) defer endSpan(err) resp, err := client.IPGroupsClient.Get(ctx, resourceGroupName, resourceName, ops) @@ -78,7 +78,7 @@ const CreateOrUpdateOperationName = "IPGroupsClient.Create" // CreateOrUpdate creates or updates a IPGroup. func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource armnetwork.IPGroup) (result *armnetwork.IPGroup, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "IPGroup", "create_or_update") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, CreateOrUpdateOperationName, client.tracer, nil) defer endSpan(err) resp, err := utils.NewPollerWrapper(client.IPGroupsClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx) @@ -96,7 +96,7 @@ const DeleteOperationName = "IPGroupsClient.Delete" // Delete deletes a IPGroup by name. func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) (err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "IPGroup", "delete") - defer metricsCtx.Observe(ctx, err) + 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, resourceName, nil)).WaitforPollerResp(ctx) @@ -108,7 +108,7 @@ const ListOperationName = "IPGroupsClient.List" // List gets a list of IPGroup in the resource group. func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armnetwork.IPGroup, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "IPGroup", "list") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, ListOperationName, client.tracer, nil) defer endSpan(err) pager := client.IPGroupsClient.NewListByResourceGroupPager(resourceGroupName, nil) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/loadbalancerclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/loadbalancerclient/zz_generated_client.go index 6c10935a6..6915db95d 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/loadbalancerclient/zz_generated_client.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/loadbalancerclient/zz_generated_client.go @@ -62,7 +62,7 @@ func (client *Client) Get(ctx context.Context, resourceGroupName string, resourc ops = &armnetwork.LoadBalancersClientGetOptions{Expand: expand} } metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "LoadBalancer", "get") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, GetOperationName, client.tracer, nil) defer endSpan(err) resp, err := client.LoadBalancersClient.Get(ctx, resourceGroupName, resourceName, ops) @@ -78,7 +78,7 @@ const CreateOrUpdateOperationName = "LoadBalancersClient.Create" // CreateOrUpdate creates or updates a LoadBalancer. func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource armnetwork.LoadBalancer) (result *armnetwork.LoadBalancer, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "LoadBalancer", "create_or_update") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, CreateOrUpdateOperationName, client.tracer, nil) defer endSpan(err) resp, err := utils.NewPollerWrapper(client.LoadBalancersClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx) @@ -96,7 +96,7 @@ const DeleteOperationName = "LoadBalancersClient.Delete" // Delete deletes a LoadBalancer by name. func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) (err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "LoadBalancer", "delete") - defer metricsCtx.Observe(ctx, err) + 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, resourceName, nil)).WaitforPollerResp(ctx) @@ -108,7 +108,7 @@ const ListOperationName = "LoadBalancersClient.List" // List gets a list of LoadBalancer in the resource group. func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armnetwork.LoadBalancer, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "LoadBalancer", "list") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, ListOperationName, client.tracer, nil) defer endSpan(err) pager := client.LoadBalancersClient.NewListPager(resourceGroupName, nil) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/managedclusterclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/managedclusterclient/zz_generated_client.go index 9f1cc82e9..ad1a0b35d 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/managedclusterclient/zz_generated_client.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/managedclusterclient/zz_generated_client.go @@ -59,7 +59,7 @@ const GetOperationName = "ManagedClustersClient.Get" func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string) (result *armcontainerservice.ManagedCluster, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "ManagedCluster", "get") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, GetOperationName, client.tracer, nil) defer endSpan(err) resp, err := client.ManagedClustersClient.Get(ctx, resourceGroupName, resourceName, nil) @@ -75,7 +75,7 @@ const CreateOrUpdateOperationName = "ManagedClustersClient.Create" // CreateOrUpdate creates or updates a ManagedCluster. func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource armcontainerservice.ManagedCluster) (result *armcontainerservice.ManagedCluster, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "ManagedCluster", "create_or_update") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, CreateOrUpdateOperationName, client.tracer, nil) defer endSpan(err) resp, err := utils.NewPollerWrapper(client.ManagedClustersClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx) @@ -93,7 +93,7 @@ const DeleteOperationName = "ManagedClustersClient.Delete" // Delete deletes a ManagedCluster by name. func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) (err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "ManagedCluster", "delete") - defer metricsCtx.Observe(ctx, err) + 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, resourceName, nil)).WaitforPollerResp(ctx) @@ -105,7 +105,7 @@ const ListOperationName = "ManagedClustersClient.List" // List gets a list of ManagedCluster in the resource group. func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armcontainerservice.ManagedCluster, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "ManagedCluster", "list") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, ListOperationName, client.tracer, nil) defer endSpan(err) pager := client.ManagedClustersClient.NewListByResourceGroupPager(resourceGroupName, nil) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/metrics/metrics.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/metrics/metrics.go index ee25b950e..f6dadcb16 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/metrics/metrics.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/metrics/metrics.go @@ -47,14 +47,19 @@ type ARMContext struct { // BeginARMRequest creates a new ARMContext for an ARM request. func BeginARMRequest(subscriptionID, resourceGroup, resource, method string) *ARMContext { + return BeginARMRequestWithAttributes( + attribute.String("subscription_id", subscriptionID), + attribute.String("resource_group", strings.ToLower(resourceGroup)), + attribute.String("resource", resource), + attribute.String("method", method), + ) +} + +// BeginARMRequest creates a new ARMContext for an ARM request. +func BeginARMRequestWithAttributes(attributes ...attribute.KeyValue) *ARMContext { return &ARMContext{ - startedAt: time.Now(), - attributes: []attribute.KeyValue{ - attribute.String("subscription_id", subscriptionID), - attribute.String("resource_group", strings.ToLower(resourceGroup)), - attribute.String("resource", resource), - attribute.String("method", method), - }, + startedAt: time.Now(), + attributes: attributes, } } 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 8e0445440..7d7f0cac8 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 @@ -49,6 +49,7 @@ import ( publicipprefixclient "sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipprefixclient" registryclient "sigs.k8s.io/cloud-provider-azure/pkg/azclient/registryclient" resourcegroupclient "sigs.k8s.io/cloud-provider-azure/pkg/azclient/resourcegroupclient" + roleassignmentclient "sigs.k8s.io/cloud-provider-azure/pkg/azclient/roleassignmentclient" routetableclient "sigs.k8s.io/cloud-provider-azure/pkg/azclient/routetableclient" secretclient "sigs.k8s.io/cloud-provider-azure/pkg/azclient/secretclient" securitygroupclient "sigs.k8s.io/cloud-provider-azure/pkg/azclient/securitygroupclient" @@ -412,6 +413,20 @@ func (mr *MockClientFactoryMockRecorder) GetResourceGroupClient() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetResourceGroupClient", reflect.TypeOf((*MockClientFactory)(nil).GetResourceGroupClient)) } +// GetRoleAssignmentClient mocks base method. +func (m *MockClientFactory) GetRoleAssignmentClient() roleassignmentclient.Interface { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetRoleAssignmentClient") + ret0, _ := ret[0].(roleassignmentclient.Interface) + return ret0 +} + +// GetRoleAssignmentClient indicates an expected call of GetRoleAssignmentClient. +func (mr *MockClientFactoryMockRecorder) GetRoleAssignmentClient() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRoleAssignmentClient", reflect.TypeOf((*MockClientFactory)(nil).GetRoleAssignmentClient)) +} + // GetRouteTableClient mocks base method. func (m *MockClientFactory) GetRouteTableClient() routetableclient.Interface { m.ctrl.T.Helper() diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/policy/ratelimit/flowcontrol/throttle.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/policy/ratelimit/flowcontrol/throttle.go index b5989aeae..fc7550c3b 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/policy/ratelimit/flowcontrol/throttle.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/policy/ratelimit/flowcontrol/throttle.go @@ -28,7 +28,7 @@ import ( type PassiveRateLimiter interface { // TryAccept returns true if a token is taken immediately. Otherwise, - // it returns false. + // It returns false. TryAccept() bool // Stop stops the rate limiter, subsequent calls to CanAccept will return false Stop() @@ -40,7 +40,7 @@ type RateLimiter interface { PassiveRateLimiter // Accept returns once a token becomes available. Accept() - // Wait returns nil if a token is taken before the Context is done. + // Wait returns nil if a token is taken before the context is done. Wait(ctx context.Context) error } @@ -65,7 +65,7 @@ func NewTokenBucketRateLimiter(qps float32, burst int) RateLimiter { return newTokenBucketRateLimiterWithClock(limiter, clock.RealClock{}, qps) } -// NewTokenBucketPassiveRateLimiter is similar to NewTokenBucketRateLimiter except that it returns +// NewTokenBucketPassiveRateLimiter is similar to NewTokenBucketRateLimiter except thatginkgo.It returns // a PassiveRateLimiter which does not have Accept() and Wait() methods. func NewTokenBucketPassiveRateLimiter(qps float32, burst int) PassiveRateLimiter { limiter := rate.NewLimiter(rate.Limit(qps), burst) @@ -88,7 +88,7 @@ func NewTokenBucketRateLimiterWithClock(qps float32, burst int, c Clock) RateLim } // NewTokenBucketPassiveRateLimiterWithClock is similar to NewTokenBucketRateLimiterWithClock -// except that it returns a PassiveRateLimiter which does not have Accept() and Wait() methods +// except thatginkgo.It returns a PassiveRateLimiter which does not have Accept() and Wait() methods // and uses a PassiveClock. func NewTokenBucketPassiveRateLimiterWithClock(qps float32, burst int, c clock.PassiveClock) PassiveRateLimiter { limiter := rate.NewLimiter(rate.Limit(qps), burst) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privateendpointclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privateendpointclient/zz_generated_client.go index c9762a9cd..accdbc3ad 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privateendpointclient/zz_generated_client.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privateendpointclient/zz_generated_client.go @@ -62,7 +62,7 @@ func (client *Client) Get(ctx context.Context, resourceGroupName string, resourc ops = &armnetwork.PrivateEndpointsClientGetOptions{Expand: expand} } metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "PrivateEndpoint", "get") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, GetOperationName, client.tracer, nil) defer endSpan(err) resp, err := client.PrivateEndpointsClient.Get(ctx, resourceGroupName, resourceName, ops) @@ -78,7 +78,7 @@ const CreateOrUpdateOperationName = "PrivateEndpointsClient.Create" // CreateOrUpdate creates or updates a PrivateEndpoint. func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource armnetwork.PrivateEndpoint) (result *armnetwork.PrivateEndpoint, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "PrivateEndpoint", "create_or_update") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, CreateOrUpdateOperationName, client.tracer, nil) defer endSpan(err) resp, err := utils.NewPollerWrapper(client.PrivateEndpointsClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatelinkserviceclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatelinkserviceclient/zz_generated_client.go index 96a853de8..ccaca3ced 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatelinkserviceclient/zz_generated_client.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatelinkserviceclient/zz_generated_client.go @@ -62,7 +62,7 @@ func (client *Client) Get(ctx context.Context, resourceGroupName string, resourc ops = &armnetwork.PrivateLinkServicesClientGetOptions{Expand: expand} } metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "PrivateLinkService", "get") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, GetOperationName, client.tracer, nil) defer endSpan(err) resp, err := client.PrivateLinkServicesClient.Get(ctx, resourceGroupName, resourceName, ops) @@ -78,7 +78,7 @@ const CreateOrUpdateOperationName = "PrivateLinkServicesClient.Create" // CreateOrUpdate creates or updates a PrivateLinkService. func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource armnetwork.PrivateLinkService) (result *armnetwork.PrivateLinkService, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "PrivateLinkService", "create_or_update") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, CreateOrUpdateOperationName, client.tracer, nil) defer endSpan(err) resp, err := utils.NewPollerWrapper(client.PrivateLinkServicesClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx) @@ -96,7 +96,7 @@ const DeleteOperationName = "PrivateLinkServicesClient.Delete" // Delete deletes a PrivateLinkService by name. func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) (err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "PrivateLinkService", "delete") - defer metricsCtx.Observe(ctx, err) + 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, resourceName, nil)).WaitforPollerResp(ctx) @@ -108,7 +108,7 @@ const ListOperationName = "PrivateLinkServicesClient.List" // List gets a list of PrivateLinkService in the resource group. func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armnetwork.PrivateLinkService, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "PrivateLinkService", "list") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, ListOperationName, client.tracer, nil) defer endSpan(err) pager := client.PrivateLinkServicesClient.NewListPager(resourceGroupName, nil) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatezoneclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatezoneclient/zz_generated_client.go index 2a6b6dae2..30f780178 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatezoneclient/zz_generated_client.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/privatezoneclient/zz_generated_client.go @@ -59,7 +59,7 @@ const GetOperationName = "PrivateZonesClient.Get" func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string) (result *armprivatedns.PrivateZone, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "PrivateZone", "get") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, GetOperationName, client.tracer, nil) defer endSpan(err) resp, err := client.PrivateZonesClient.Get(ctx, resourceGroupName, resourceName, nil) @@ -75,7 +75,7 @@ const CreateOrUpdateOperationName = "PrivateZonesClient.Create" // CreateOrUpdate creates or updates a PrivateZone. func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource armprivatedns.PrivateZone) (result *armprivatedns.PrivateZone, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "PrivateZone", "create_or_update") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, CreateOrUpdateOperationName, client.tracer, nil) defer endSpan(err) resp, err := utils.NewPollerWrapper(client.PrivateZonesClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipaddressclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipaddressclient/zz_generated_client.go index 0b52e4f08..1d326a00a 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipaddressclient/zz_generated_client.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipaddressclient/zz_generated_client.go @@ -62,7 +62,7 @@ func (client *Client) Get(ctx context.Context, resourceGroupName string, resourc ops = &armnetwork.PublicIPAddressesClientGetOptions{Expand: expand} } metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "PublicIPAddress", "get") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, GetOperationName, client.tracer, nil) defer endSpan(err) resp, err := client.PublicIPAddressesClient.Get(ctx, resourceGroupName, resourceName, ops) @@ -78,7 +78,7 @@ const CreateOrUpdateOperationName = "PublicIPAddressesClient.Create" // CreateOrUpdate creates or updates a PublicIPAddress. func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource armnetwork.PublicIPAddress) (result *armnetwork.PublicIPAddress, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "PublicIPAddress", "create_or_update") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, CreateOrUpdateOperationName, client.tracer, nil) defer endSpan(err) resp, err := utils.NewPollerWrapper(client.PublicIPAddressesClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx) @@ -96,7 +96,7 @@ const DeleteOperationName = "PublicIPAddressesClient.Delete" // Delete deletes a PublicIPAddress by name. func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) (err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "PublicIPAddress", "delete") - defer metricsCtx.Observe(ctx, err) + 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, resourceName, nil)).WaitforPollerResp(ctx) @@ -108,7 +108,7 @@ const ListOperationName = "PublicIPAddressesClient.List" // List gets a list of PublicIPAddress in the resource group. func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armnetwork.PublicIPAddress, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "PublicIPAddress", "list") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, ListOperationName, client.tracer, nil) defer endSpan(err) pager := client.PublicIPAddressesClient.NewListPager(resourceGroupName, nil) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipprefixclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipprefixclient/zz_generated_client.go index 66c77f7cf..632896f63 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipprefixclient/zz_generated_client.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/publicipprefixclient/zz_generated_client.go @@ -62,7 +62,7 @@ func (client *Client) Get(ctx context.Context, resourceGroupName string, resourc ops = &armnetwork.PublicIPPrefixesClientGetOptions{Expand: expand} } metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "PublicIPPrefix", "get") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, GetOperationName, client.tracer, nil) defer endSpan(err) resp, err := client.PublicIPPrefixesClient.Get(ctx, resourceGroupName, resourceName, ops) @@ -78,7 +78,7 @@ const CreateOrUpdateOperationName = "PublicIPPrefixesClient.Create" // CreateOrUpdate creates or updates a PublicIPPrefix. func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource armnetwork.PublicIPPrefix) (result *armnetwork.PublicIPPrefix, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "PublicIPPrefix", "create_or_update") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, CreateOrUpdateOperationName, client.tracer, nil) defer endSpan(err) resp, err := utils.NewPollerWrapper(client.PublicIPPrefixesClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx) @@ -96,7 +96,7 @@ const DeleteOperationName = "PublicIPPrefixesClient.Delete" // Delete deletes a PublicIPPrefix by name. func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) (err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "PublicIPPrefix", "delete") - defer metricsCtx.Observe(ctx, err) + 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, resourceName, nil)).WaitforPollerResp(ctx) @@ -108,7 +108,7 @@ const ListOperationName = "PublicIPPrefixesClient.List" // List gets a list of PublicIPPrefix in the resource group. func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armnetwork.PublicIPPrefix, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "PublicIPPrefix", "list") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, ListOperationName, client.tracer, nil) defer endSpan(err) pager := client.PublicIPPrefixesClient.NewListPager(resourceGroupName, nil) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/registryclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/registryclient/zz_generated_client.go index e9baef2de..6f857a99d 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/registryclient/zz_generated_client.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/registryclient/zz_generated_client.go @@ -59,7 +59,7 @@ const GetOperationName = "RegistriesClient.Get" func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string) (result *armcontainerregistry.Registry, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "Registry", "get") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, GetOperationName, client.tracer, nil) defer endSpan(err) resp, err := client.RegistriesClient.Get(ctx, resourceGroupName, resourceName, nil) @@ -75,7 +75,7 @@ const DeleteOperationName = "RegistriesClient.Delete" // Delete deletes a Registry by name. func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) (err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "Registry", "delete") - defer metricsCtx.Observe(ctx, err) + 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, resourceName, nil)).WaitforPollerResp(ctx) @@ -87,7 +87,7 @@ const ListOperationName = "RegistriesClient.List" // List gets a list of Registry in the resource group. func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armcontainerregistry.Registry, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "Registry", "list") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, ListOperationName, client.tracer, nil) defer endSpan(err) pager := client.RegistriesClient.NewListByResourceGroupPager(resourceGroupName, nil) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/roleassignmentclient/custom.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/roleassignmentclient/custom.go new file mode 100644 index 000000000..3506235ae --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/roleassignmentclient/custom.go @@ -0,0 +1,72 @@ +/* +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 roleassignmentclient + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + armauthorization "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/metrics" +) + +// Get gets a role assignment. +const GetOperationName = "RoleAssignmentsClient.Get" + +func (client *Client) Get(ctx context.Context, scope string, roleAssignmentName string, options *armauthorization.RoleAssignmentsClientGetOptions) (result *armauthorization.RoleAssignment, err error) { + metricsCtx := metrics.BeginARMRequest(client.subscriptionID, scope, "RoleAssignment", "get") + defer func() { metricsCtx.Observe(ctx, err) }() + ctx, endSpan := runtime.StartSpan(ctx, GetOperationName, client.tracer, nil) + defer endSpan(err) + resp, err := client.RoleAssignmentsClient.Get(ctx, scope, roleAssignmentName, options) + if err != nil { + return nil, err + } + return &resp.RoleAssignment, nil +} + +const DeleteOperationName = "RoleAssignmentsClient.Delete" + +// Delete deletes a Subnet by name. +func (client *Client) Delete(ctx context.Context, scope string, roleAssignmentName string, options *armauthorization.RoleAssignmentsClientDeleteOptions) (result *armauthorization.RoleAssignment, err error) { + metricsCtx := metrics.BeginARMRequest(client.subscriptionID, scope, "RoleAssignment", "delete") + defer func() { metricsCtx.Observe(ctx, err) }() + ctx, endSpan := runtime.StartSpan(ctx, DeleteOperationName, client.tracer, nil) + defer endSpan(err) + resp, err := client.RoleAssignmentsClient.Delete(ctx, scope, roleAssignmentName, options) + if err != nil { + return nil, err + } + return &resp.RoleAssignment, nil +} + +const CreateOrUpdateOperationName = "RoleAssignmentsClient.Create" + +// CreateOrUpdate creates or updates a Subnet. +func (client *Client) Create(ctx context.Context, scope string, roleAssignmentName string, parameters armauthorization.RoleAssignmentCreateParameters) (result *armauthorization.RoleAssignment, err error) { + metricsCtx := metrics.BeginARMRequest(client.subscriptionID, scope, "RoleAssignment", "create") + defer func() { metricsCtx.Observe(ctx, err) }() + ctx, endSpan := runtime.StartSpan(ctx, CreateOrUpdateOperationName, client.tracer, nil) + defer endSpan(err) + resp, err := client.RoleAssignmentsClient.Create(ctx, scope, roleAssignmentName, parameters, nil) + if err != nil { + return nil, err + } + return &resp.RoleAssignment, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/roleassignmentclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/roleassignmentclient/interface.go new file mode 100644 index 000000000..9f77b123e --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/roleassignmentclient/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 roleassignmentclient + +import ( + "context" + + armauthorization "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" +) + +// +azure:client:verbs=,resource=RoleAssignment,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2,packageAlias=armauthorization,clientName=RoleAssignmentsClient,expand=false +type Interface interface { + Get(ctx context.Context, scope string, roleAssignmentName string, options *armauthorization.RoleAssignmentsClientGetOptions) (*armauthorization.RoleAssignment, error) + Create(ctx context.Context, scope string, roleAssignmentName string, parameters armauthorization.RoleAssignmentCreateParameters) (*armauthorization.RoleAssignment, error) + Delete(ctx context.Context, scope string, roleAssignmentName string, options *armauthorization.RoleAssignmentsClientDeleteOptions) (*armauthorization.RoleAssignment, error) +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/roleassignmentclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/roleassignmentclient/zz_generated_client.go new file mode 100644 index 000000000..3ea3b2f13 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/roleassignmentclient/zz_generated_client.go @@ -0,0 +1,50 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS 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 ( + "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/tracing" + armauthorization "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +type Client struct { + *armauthorization.RoleAssignmentsClient + 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 := armauthorization.NewRoleAssignmentsClient(subscriptionID, credential, options) + if err != nil { + return nil, err + } + return &Client{ + RoleAssignmentsClient: client, + subscriptionID: subscriptionID, + tracer: tr, + }, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/roledefinitionclient/custom.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/roledefinitionclient/custom.go new file mode 100644 index 000000000..8ab58f54d --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/roledefinitionclient/custom.go @@ -0,0 +1,47 @@ +/* +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 roledefinitionclient + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + armauthorization "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" + "go.opentelemetry.io/otel/attribute" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/metrics" +) + +const ListOperationName = "RoleDefinitionsClient.List" + +// List gets a list of RoleDefinition in the resource group. +func (client *Client) List(ctx context.Context, scopeName string, option *armauthorization.RoleDefinitionsClientListOptions) (result []*armauthorization.RoleDefinition, err error) { + metricsCtx := metrics.BeginARMRequestWithAttributes(attribute.String("resource", "RoleDefinition"), attribute.String("method", "list")) + defer func() { metricsCtx.Observe(ctx, err) }() + ctx, endSpan := runtime.StartSpan(ctx, ListOperationName, client.tracer, nil) + defer endSpan(err) + pager := client.RoleDefinitionsClient.NewListPager(scopeName, option) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + return nil, err + } + result = append(result, nextResult.Value...) + } + return result, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/roledefinitionclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/roledefinitionclient/interface.go new file mode 100644 index 000000000..8e850c6c6 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/roledefinitionclient/interface.go @@ -0,0 +1,29 @@ +/* +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 roledefinitionclient + +import ( + "context" + + armauthorization "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" +) + +// +azure:client:verbs=,resource=RoleDefinition,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2,packageAlias=armauthorization,clientName=RoleDefinitionsClient,expand=false,outOfSubscriptionScope=true +type Interface interface { + List(ctx context.Context, scope string, option *armauthorization.RoleDefinitionsClientListOptions) (result []*armauthorization.RoleDefinition, rerr error) +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/roledefinitionclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/roledefinitionclient/zz_generated_client.go new file mode 100644 index 000000000..8d94af4a5 --- /dev/null +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/roledefinitionclient/zz_generated_client.go @@ -0,0 +1,50 @@ +// /* +// Copyright The Kubernetes Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS 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 roledefinitionclient + +import ( + "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/tracing" + armauthorization "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" + + "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" +) + +type Client struct { + *armauthorization.RoleDefinitionsClient + + 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 := armauthorization.NewRoleDefinitionsClient(credential, options) + if err != nil { + return nil, err + } + return &Client{ + RoleDefinitionsClient: client, + + tracer: tr, + }, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/routetableclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/routetableclient/zz_generated_client.go index b7b7b4325..93969942d 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/routetableclient/zz_generated_client.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/routetableclient/zz_generated_client.go @@ -59,7 +59,7 @@ const GetOperationName = "RouteTablesClient.Get" func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string) (result *armnetwork.RouteTable, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "RouteTable", "get") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, GetOperationName, client.tracer, nil) defer endSpan(err) resp, err := client.RouteTablesClient.Get(ctx, resourceGroupName, resourceName, nil) @@ -75,7 +75,7 @@ const CreateOrUpdateOperationName = "RouteTablesClient.Create" // CreateOrUpdate creates or updates a RouteTable. func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource armnetwork.RouteTable) (result *armnetwork.RouteTable, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "RouteTable", "create_or_update") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, CreateOrUpdateOperationName, client.tracer, nil) defer endSpan(err) resp, err := utils.NewPollerWrapper(client.RouteTablesClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx) @@ -93,7 +93,7 @@ const DeleteOperationName = "RouteTablesClient.Delete" // Delete deletes a RouteTable by name. func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) (err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "RouteTable", "delete") - defer metricsCtx.Observe(ctx, err) + 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, resourceName, nil)).WaitforPollerResp(ctx) @@ -105,7 +105,7 @@ const ListOperationName = "RouteTablesClient.List" // List gets a list of RouteTable in the resource group. func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armnetwork.RouteTable, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "RouteTable", "list") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, ListOperationName, client.tracer, nil) defer endSpan(err) pager := client.RouteTablesClient.NewListPager(resourceGroupName, nil) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/secretclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/secretclient/zz_generated_client.go index 4514565f2..68ce641c4 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/secretclient/zz_generated_client.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/secretclient/zz_generated_client.go @@ -59,7 +59,7 @@ const GetOperationName = "SecretsClient.Get" func (client *Client) Get(ctx context.Context, resourceGroupName string, parentResourceName string, resourceName string) (result *armkeyvault.Secret, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "Secret", "get") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, GetOperationName, client.tracer, nil) defer endSpan(err) resp, err := client.SecretsClient.Get(ctx, resourceGroupName, parentResourceName, resourceName, nil) @@ -75,7 +75,7 @@ const ListOperationName = "SecretsClient.List" // List gets a list of Secret in the resource group. func (client *Client) List(ctx context.Context, resourceGroupName string, parentResourceName string) (result []*armkeyvault.Secret, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "Secret", "list") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, ListOperationName, client.tracer, nil) defer endSpan(err) pager := client.SecretsClient.NewListPager(resourceGroupName, parentResourceName, nil) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/securitygroupclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/securitygroupclient/zz_generated_client.go index c95f57140..a757ab458 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/securitygroupclient/zz_generated_client.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/securitygroupclient/zz_generated_client.go @@ -59,7 +59,7 @@ const GetOperationName = "SecurityGroupsClient.Get" func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string) (result *armnetwork.SecurityGroup, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "SecurityGroup", "get") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, GetOperationName, client.tracer, nil) defer endSpan(err) resp, err := client.SecurityGroupsClient.Get(ctx, resourceGroupName, resourceName, nil) @@ -75,7 +75,7 @@ const CreateOrUpdateOperationName = "SecurityGroupsClient.Create" // CreateOrUpdate creates or updates a SecurityGroup. func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource armnetwork.SecurityGroup) (result *armnetwork.SecurityGroup, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "SecurityGroup", "create_or_update") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, CreateOrUpdateOperationName, client.tracer, nil) defer endSpan(err) resp, err := utils.NewPollerWrapper(client.SecurityGroupsClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx) @@ -93,7 +93,7 @@ const DeleteOperationName = "SecurityGroupsClient.Delete" // Delete deletes a SecurityGroup by name. func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) (err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "SecurityGroup", "delete") - defer metricsCtx.Observe(ctx, err) + 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, resourceName, nil)).WaitforPollerResp(ctx) @@ -105,7 +105,7 @@ const ListOperationName = "SecurityGroupsClient.List" // List gets a list of SecurityGroup in the resource group. func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armnetwork.SecurityGroup, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "SecurityGroup", "list") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, ListOperationName, client.tracer, nil) defer endSpan(err) pager := client.SecurityGroupsClient.NewListPager(resourceGroupName, nil) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/snapshotclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/snapshotclient/zz_generated_client.go index a916b0487..c21cccda5 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/snapshotclient/zz_generated_client.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/snapshotclient/zz_generated_client.go @@ -59,7 +59,7 @@ const GetOperationName = "SnapshotsClient.Get" func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string) (result *armcompute.Snapshot, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "Snapshot", "get") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, GetOperationName, client.tracer, nil) defer endSpan(err) resp, err := client.SnapshotsClient.Get(ctx, resourceGroupName, resourceName, nil) @@ -75,7 +75,7 @@ const CreateOrUpdateOperationName = "SnapshotsClient.Create" // CreateOrUpdate creates or updates a Snapshot. func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource armcompute.Snapshot) (result *armcompute.Snapshot, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "Snapshot", "create_or_update") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, CreateOrUpdateOperationName, client.tracer, nil) defer endSpan(err) resp, err := utils.NewPollerWrapper(client.SnapshotsClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx) @@ -93,7 +93,7 @@ const DeleteOperationName = "SnapshotsClient.Delete" // Delete deletes a Snapshot by name. func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) (err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "Snapshot", "delete") - defer metricsCtx.Observe(ctx, err) + 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, resourceName, nil)).WaitforPollerResp(ctx) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/sshpublickeyresourceclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/sshpublickeyresourceclient/zz_generated_client.go index e285b64d9..64b8fba29 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/sshpublickeyresourceclient/zz_generated_client.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/sshpublickeyresourceclient/zz_generated_client.go @@ -59,7 +59,7 @@ const GetOperationName = "SSHPublicKeysClient.Get" func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string) (result *armcompute.SSHPublicKeyResource, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "SSHPublicKeyResource", "get") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, GetOperationName, client.tracer, nil) defer endSpan(err) resp, err := client.SSHPublicKeysClient.Get(ctx, resourceGroupName, resourceName, nil) @@ -75,7 +75,7 @@ const ListOperationName = "SSHPublicKeysClient.List" // List gets a list of SSHPublicKeyResource in the resource group. func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armcompute.SSHPublicKeyResource, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "SSHPublicKeyResource", "list") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, ListOperationName, client.tracer, nil) defer endSpan(err) pager := client.SSHPublicKeysClient.NewListByResourceGroupPager(resourceGroupName, nil) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/subnetclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/subnetclient/zz_generated_client.go index b27971af8..ecf73a021 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/subnetclient/zz_generated_client.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/subnetclient/zz_generated_client.go @@ -62,7 +62,7 @@ func (client *Client) Get(ctx context.Context, resourceGroupName string, parentR ops = &armnetwork.SubnetsClientGetOptions{Expand: expand} } metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "Subnet", "get") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, GetOperationName, client.tracer, nil) defer endSpan(err) resp, err := client.SubnetsClient.Get(ctx, resourceGroupName, parentResourceName, resourceName, ops) @@ -78,7 +78,7 @@ const CreateOrUpdateOperationName = "SubnetsClient.Create" // CreateOrUpdate creates or updates a Subnet. func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parentResourceName string, resource armnetwork.Subnet) (result *armnetwork.Subnet, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "Subnet", "create_or_update") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, CreateOrUpdateOperationName, client.tracer, nil) defer endSpan(err) resp, err := utils.NewPollerWrapper(client.SubnetsClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, parentResourceName, resource, nil)).WaitforPollerResp(ctx) @@ -96,7 +96,7 @@ const DeleteOperationName = "SubnetsClient.Delete" // Delete deletes a Subnet by name. func (client *Client) Delete(ctx context.Context, resourceGroupName string, parentResourceName string, resourceName string) (err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "Subnet", "delete") - defer metricsCtx.Observe(ctx, err) + 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) @@ -108,7 +108,7 @@ const ListOperationName = "SubnetsClient.List" // List gets a list of Subnet in the resource group. func (client *Client) List(ctx context.Context, resourceGroupName string, parentResourceName string) (result []*armnetwork.Subnet, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "Subnet", "list") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, ListOperationName, client.tracer, nil) defer endSpan(err) pager := client.SubnetsClient.NewListPager(resourceGroupName, parentResourceName, nil) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/ctx.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/ctx.go index 40b0b7d65..9a8c6a3f4 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/ctx.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils/ctx.go @@ -18,11 +18,13 @@ package utils import "context" -var ( - ctxKeyClientName = struct{}{} - ctxKeyMethodRequest = struct{}{} - ctxKeyResourceGroupName = struct{}{} - ctxKeySubscriptionID = struct{}{} +type key string + +const ( + ctxKeyClientName key = "ClientName" + ctxKeyMethodRequest key = "MethodRequest" + ctxKeyResourceGroupName key = "ResourceGroupName" + ctxKeySubscriptionID key = "SubscriptionID" ) func ContextWithClientName(ctx context.Context, clientName string) context.Context { diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/vaultclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/vaultclient/zz_generated_client.go index 4de6eb694..3244f3e56 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/vaultclient/zz_generated_client.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/vaultclient/zz_generated_client.go @@ -59,7 +59,7 @@ const GetOperationName = "VaultsClient.Get" func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string) (result *armkeyvault.Vault, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "Vault", "get") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, GetOperationName, client.tracer, nil) defer endSpan(err) resp, err := client.VaultsClient.Get(ctx, resourceGroupName, resourceName, nil) @@ -75,7 +75,7 @@ const ListOperationName = "VaultsClient.List" // List gets a list of Vault in the resource group. func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armkeyvault.Vault, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "Vault", "list") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, ListOperationName, client.tracer, nil) defer endSpan(err) pager := client.VaultsClient.NewListByResourceGroupPager(resourceGroupName, nil) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachineclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachineclient/zz_generated_client.go index 8202b7dcc..0f9750551 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachineclient/zz_generated_client.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachineclient/zz_generated_client.go @@ -58,7 +58,7 @@ const CreateOrUpdateOperationName = "VirtualMachinesClient.Create" // CreateOrUpdate creates or updates a VirtualMachine. func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource armcompute.VirtualMachine) (result *armcompute.VirtualMachine, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "VirtualMachine", "create_or_update") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, CreateOrUpdateOperationName, client.tracer, nil) defer endSpan(err) resp, err := utils.NewPollerWrapper(client.VirtualMachinesClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx) @@ -76,7 +76,7 @@ const DeleteOperationName = "VirtualMachinesClient.Delete" // Delete deletes a VirtualMachine by name. func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) (err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "VirtualMachine", "delete") - defer metricsCtx.Observe(ctx, err) + 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, resourceName, nil)).WaitforPollerResp(ctx) @@ -88,7 +88,7 @@ const ListOperationName = "VirtualMachinesClient.List" // List gets a list of VirtualMachine in the resource group. func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armcompute.VirtualMachine, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "VirtualMachine", "list") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, ListOperationName, client.tracer, nil) defer endSpan(err) pager := client.VirtualMachinesClient.NewListPager(resourceGroupName, nil) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetclient/zz_generated_client.go index 97392cd58..0d4684499 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetclient/zz_generated_client.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetclient/zz_generated_client.go @@ -58,7 +58,7 @@ const CreateOrUpdateOperationName = "VirtualMachineScaleSetsClient.Create" // CreateOrUpdate creates or updates a VirtualMachineScaleSet. func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource armcompute.VirtualMachineScaleSet) (result *armcompute.VirtualMachineScaleSet, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "VirtualMachineScaleSet", "create_or_update") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, CreateOrUpdateOperationName, client.tracer, nil) defer endSpan(err) resp, err := utils.NewPollerWrapper(client.VirtualMachineScaleSetsClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx) @@ -76,7 +76,7 @@ const DeleteOperationName = "VirtualMachineScaleSetsClient.Delete" // Delete deletes a VirtualMachineScaleSet by name. func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) (err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "VirtualMachineScaleSet", "delete") - defer metricsCtx.Observe(ctx, err) + 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, resourceName, nil)).WaitforPollerResp(ctx) @@ -88,7 +88,7 @@ const ListOperationName = "VirtualMachineScaleSetsClient.List" // List gets a list of VirtualMachineScaleSet in the resource group. func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armcompute.VirtualMachineScaleSet, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "VirtualMachineScaleSet", "list") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, ListOperationName, client.tracer, nil) defer endSpan(err) pager := client.VirtualMachineScaleSetsClient.NewListPager(resourceGroupName, nil) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetvmclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetvmclient/zz_generated_client.go index f2f4dde4b..b83b49d4a 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetvmclient/zz_generated_client.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualmachinescalesetvmclient/zz_generated_client.go @@ -59,7 +59,7 @@ const GetOperationName = "VirtualMachineScaleSetVMsClient.Get" func (client *Client) Get(ctx context.Context, resourceGroupName string, parentResourceName string, resourceName string) (result *armcompute.VirtualMachineScaleSetVM, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "VirtualMachineScaleSetVM", "get") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, GetOperationName, client.tracer, nil) defer endSpan(err) resp, err := client.VirtualMachineScaleSetVMsClient.Get(ctx, resourceGroupName, parentResourceName, resourceName, nil) @@ -75,7 +75,7 @@ const DeleteOperationName = "VirtualMachineScaleSetVMsClient.Delete" // Delete deletes a VirtualMachineScaleSetVM by name. func (client *Client) Delete(ctx context.Context, resourceGroupName string, parentResourceName string, resourceName string) (err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "VirtualMachineScaleSetVM", "delete") - defer metricsCtx.Observe(ctx, err) + 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) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworkclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworkclient/zz_generated_client.go index 962887cae..5f5bfe979 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworkclient/zz_generated_client.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworkclient/zz_generated_client.go @@ -62,7 +62,7 @@ func (client *Client) Get(ctx context.Context, resourceGroupName string, resourc ops = &armnetwork.VirtualNetworksClientGetOptions{Expand: expand} } metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "VirtualNetwork", "get") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, GetOperationName, client.tracer, nil) defer endSpan(err) resp, err := client.VirtualNetworksClient.Get(ctx, resourceGroupName, resourceName, ops) @@ -78,7 +78,7 @@ const CreateOrUpdateOperationName = "VirtualNetworksClient.Create" // CreateOrUpdate creates or updates a VirtualNetwork. func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, resource armnetwork.VirtualNetwork) (result *armnetwork.VirtualNetwork, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "VirtualNetwork", "create_or_update") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, CreateOrUpdateOperationName, client.tracer, nil) defer endSpan(err) resp, err := utils.NewPollerWrapper(client.VirtualNetworksClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, resource, nil)).WaitforPollerResp(ctx) @@ -96,7 +96,7 @@ const DeleteOperationName = "VirtualNetworksClient.Delete" // Delete deletes a VirtualNetwork by name. func (client *Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) (err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "VirtualNetwork", "delete") - defer metricsCtx.Observe(ctx, err) + 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, resourceName, nil)).WaitforPollerResp(ctx) @@ -108,7 +108,7 @@ const ListOperationName = "VirtualNetworksClient.List" // List gets a list of VirtualNetwork in the resource group. func (client *Client) List(ctx context.Context, resourceGroupName string) (result []*armnetwork.VirtualNetwork, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "VirtualNetwork", "list") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, ListOperationName, client.tracer, nil) defer endSpan(err) pager := client.VirtualNetworksClient.NewListPager(resourceGroupName, nil) 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 f79c7bb8e..ff6151c96 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 @@ -59,7 +59,7 @@ const GetOperationName = "VirtualNetworkLinksClient.Get" func (client *Client) Get(ctx context.Context, resourceGroupName string, parentResourceName string, resourceName string) (result *armprivatedns.VirtualNetworkLink, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "VirtualNetworkLink", "get") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, GetOperationName, client.tracer, nil) defer endSpan(err) resp, err := client.VirtualNetworkLinksClient.Get(ctx, resourceGroupName, parentResourceName, resourceName, nil) @@ -75,7 +75,7 @@ const CreateOrUpdateOperationName = "VirtualNetworkLinksClient.Create" // CreateOrUpdate creates or updates a VirtualNetworkLink. func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parentResourceName string, resource armprivatedns.VirtualNetworkLink) (result *armprivatedns.VirtualNetworkLink, err error) { metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "VirtualNetworkLink", "create_or_update") - defer metricsCtx.Observe(ctx, err) + defer func() { metricsCtx.Observe(ctx, err) }() ctx, endSpan := runtime.StartSpan(ctx, CreateOrUpdateOperationName, client.tracer, nil) defer endSpan(err) resp, err := utils.NewPollerWrapper(client.VirtualNetworkLinksClient.BeginCreateOrUpdate(ctx, resourceGroupName, resourceName, parentResourceName, resource, nil)).WaitforPollerResp(ctx)