@@ -3,8 +3,8 @@ package main
33import (
44 "context"
55 "github.com/Azure/azure-sdk-for-go/profiles/latest/authorization/mgmt/authorization"
6- "github.com/Azure/azure-sdk-for-go/profiles/latest/resources/mgmt/subscriptions"
76 "github.com/Azure/azure-sdk-for-go/profiles/latest/graphrbac/graphrbac"
7+ "github.com/Azure/azure-sdk-for-go/profiles/latest/resources/mgmt/subscriptions"
88 "github.com/Azure/go-autorest/autorest/azure/auth"
99 "github.com/prometheus/client_golang/prometheus"
1010 "os"
@@ -20,7 +20,7 @@ type MetricsCollectorAzureRmIam struct {
2020 prometheus struct {
2121 roleAssignment * prometheus.GaugeVec
2222 roleDefinition * prometheus.GaugeVec
23- principal * prometheus.GaugeVec
23+ principal * prometheus.GaugeVec
2424 }
2525}
2626
@@ -91,7 +91,6 @@ func (m *MetricsCollectorAzureRmIam) Collect(ctx context.Context, callback chan<
9191 m .collectRoleAssignments (ctx , callback , subscription )
9292}
9393
94-
9594func (m * MetricsCollectorAzureRmIam ) collectRoleDefinitions (ctx context.Context , callback chan <- func (), subscription subscriptions.Subscription ) {
9695 client := authorization .NewRoleDefinitionsClient (* subscription .SubscriptionID )
9796 client .Authorizer = AzureAuthorizer
@@ -168,7 +167,7 @@ func (m *MetricsCollectorAzureRmIam) collectRoleAssignments(ctx context.Context,
168167}
169168
170169func (m * MetricsCollectorAzureRmIam ) collectPrincipals (ctx context.Context , callback chan <- func (), subscription subscriptions.Subscription , principalIdList []string ) {
171- var infoLabels * prometheus.Labels
170+ var infoLabels * prometheus.Labels
172171 infoMetric := MetricCollectorList {}
173172
174173 opts := graphrbac.GetObjectsParameters {
@@ -187,24 +186,24 @@ func (m *MetricsCollectorAzureRmIam) collectPrincipals(ctx context.Context, call
187186
188187 if object , valid := val .AsADGroup (); valid {
189188 infoLabels = & prometheus.Labels {
190- "subscriptionID" : * subscription .SubscriptionID ,
191- "principalID" : stringPtrToString (object .ObjectID ),
192- "principalName" : stringPtrToString (object .DisplayName ),
193- "principalType" : string (object .ObjectType ),
189+ "subscriptionID" : * subscription .SubscriptionID ,
190+ "principalID" : stringPtrToString (object .ObjectID ),
191+ "principalName" : stringPtrToString (object .DisplayName ),
192+ "principalType" : string (object .ObjectType ),
194193 }
195194 } else if object , valid := val .AsApplication (); valid {
196195 infoLabels = & prometheus.Labels {
197- "subscriptionID" : * subscription .SubscriptionID ,
198- "principalID" : stringPtrToString (object .ObjectID ),
199- "principalName" : stringPtrToString (object .DisplayName ),
200- "principalType" : string (object .ObjectType ),
196+ "subscriptionID" : * subscription .SubscriptionID ,
197+ "principalID" : stringPtrToString (object .ObjectID ),
198+ "principalName" : stringPtrToString (object .DisplayName ),
199+ "principalType" : string (object .ObjectType ),
201200 }
202201 } else if object , valid := val .AsServicePrincipal (); valid {
203202 infoLabels = & prometheus.Labels {
204- "subscriptionID" : * subscription .SubscriptionID ,
205- "principalID" : stringPtrToString (object .ObjectID ),
206- "principalName" : stringPtrToString (object .DisplayName ),
207- "principalType" : string (object .ObjectType ),
203+ "subscriptionID" : * subscription .SubscriptionID ,
204+ "principalID" : stringPtrToString (object .ObjectID ),
205+ "principalName" : stringPtrToString (object .DisplayName ),
206+ "principalType" : string (object .ObjectType ),
208207 }
209208 } else if object , valid := val .AsUser (); valid {
210209 infoLabels = & prometheus.Labels {
0 commit comments