@@ -39,6 +39,14 @@ func (a *mqlAzureSubscriptionAksServiceCluster) id() (string, error) {
3939 return a .Id .Data , nil
4040}
4141
42+ func (a * mqlAzureSubscriptionAksServiceClusterAadProfile ) id () (string , error ) {
43+ return a .Id .Data , nil
44+ }
45+
46+ func (a * mqlAzureSubscriptionAksServiceClusterAutoUpgradeProfile ) id () (string , error ) {
47+ return a .Id .Data , nil
48+ }
49+
4250func (a * mqlAzureSubscriptionAksService ) clusters () ([]any , error ) {
4351 conn := a .MqlRuntime .Connection .(* connection.AzureConnection )
4452 ctx := context .Background ()
@@ -127,6 +135,66 @@ func (a *mqlAzureSubscriptionAksService) clusters() ([]any, error) {
127135 }
128136 }
129137
138+ var defenderEnabled , imageCleanerEnabled , workloadIdentityEnabled , azureKeyVaultKmsEnabled * bool
139+ var imageCleanerIntervalHours * int32
140+ var azureKeyVaultKmsNetworkAccess * string
141+ if entry .Properties .SecurityProfile != nil {
142+ sp := entry .Properties .SecurityProfile
143+ if sp .Defender != nil && sp .Defender .SecurityMonitoring != nil {
144+ defenderEnabled = sp .Defender .SecurityMonitoring .Enabled
145+ }
146+ if sp .ImageCleaner != nil {
147+ imageCleanerEnabled = sp .ImageCleaner .Enabled
148+ imageCleanerIntervalHours = sp .ImageCleaner .IntervalHours
149+ }
150+ if sp .WorkloadIdentity != nil {
151+ workloadIdentityEnabled = sp .WorkloadIdentity .Enabled
152+ }
153+ if sp .AzureKeyVaultKms != nil {
154+ azureKeyVaultKmsEnabled = sp .AzureKeyVaultKms .Enabled
155+ azureKeyVaultKmsNetworkAccess = (* string )(sp .AzureKeyVaultKms .KeyVaultNetworkAccess )
156+ }
157+ }
158+
159+ // Create AAD Profile sub-resource
160+ var aadProfileData * llx.RawData = llx .NilData
161+ if entry .Properties .AADProfile != nil {
162+ aadP := entry .Properties .AADProfile
163+ adminGroupObjectIDs := []any {}
164+ for _ , gid := range aadP .AdminGroupObjectIDs {
165+ if gid != nil {
166+ adminGroupObjectIDs = append (adminGroupObjectIDs , * gid )
167+ }
168+ }
169+ aadRes , err := CreateResource (a .MqlRuntime , "azure.subscription.aksService.cluster.aadProfile" ,
170+ map [string ]* llx.RawData {
171+ "id" : llx .StringData (* entry .ID + "/aadProfile" ),
172+ "managed" : llx .BoolDataPtr (aadP .Managed ),
173+ "enableAzureRBAC" : llx .BoolDataPtr (aadP .EnableAzureRBAC ),
174+ "adminGroupObjectIDs" : llx .ArrayData (adminGroupObjectIDs , types .String ),
175+ })
176+ if err != nil {
177+ return nil , err
178+ }
179+ aadProfileData = llx .ResourceData (aadRes , "azure.subscription.aksService.cluster.aadProfile" )
180+ }
181+
182+ // Create Auto-Upgrade Profile sub-resource
183+ var autoUpgradeProfileData * llx.RawData = llx .NilData
184+ if entry .Properties .AutoUpgradeProfile != nil {
185+ aup := entry .Properties .AutoUpgradeProfile
186+ autoUpgradeRes , err := CreateResource (a .MqlRuntime , "azure.subscription.aksService.cluster.autoUpgradeProfile" ,
187+ map [string ]* llx.RawData {
188+ "id" : llx .StringData (* entry .ID + "/autoUpgradeProfile" ),
189+ "upgradeChannel" : llx .StringDataPtr ((* string )(aup .UpgradeChannel )),
190+ "nodeOSUpgradeChannel" : llx .StringDataPtr ((* string )(aup .NodeOSUpgradeChannel )),
191+ })
192+ if err != nil {
193+ return nil , err
194+ }
195+ autoUpgradeProfileData = llx .ResourceData (autoUpgradeRes , "azure.subscription.aksService.cluster.autoUpgradeProfile" )
196+ }
197+
130198 mqlAksCluster , err := CreateResource (a .MqlRuntime , "azure.subscription.aksService.cluster" ,
131199 map [string ]* llx.RawData {
132200 "id" : llx .StringDataPtr (entry .ID ),
@@ -155,6 +223,16 @@ func (a *mqlAzureSubscriptionAksService) clusters() ([]any, error) {
155223 "disableRunCommand" : llx .BoolDataPtr (disableRunCommand ),
156224 "apiServerAuthorizedIPRanges" : llx .ArrayData (apiServerAuthorizedIPRanges , types .String ),
157225 "privateDnsZone" : llx .StringDataPtr (privateDnsZone ),
226+ "defenderEnabled" : llx .BoolDataPtr (defenderEnabled ),
227+ "imageCleanerEnabled" : llx .BoolDataPtr (imageCleanerEnabled ),
228+ "imageCleanerIntervalHours" : llx .IntDataDefault (imageCleanerIntervalHours , 0 ),
229+ "workloadIdentityEnabled" : llx .BoolDataPtr (workloadIdentityEnabled ),
230+ "azureKeyVaultKmsEnabled" : llx .BoolDataPtr (azureKeyVaultKmsEnabled ),
231+ "azureKeyVaultKmsNetworkAccess" : llx .StringDataPtr (azureKeyVaultKmsNetworkAccess ),
232+ "disableLocalAccounts" : llx .BoolDataPtr (entry .Properties .DisableLocalAccounts ),
233+ "publicNetworkAccess" : llx .StringDataPtr ((* string )(entry .Properties .PublicNetworkAccess )),
234+ "aadProfile" : aadProfileData ,
235+ "autoUpgradeProfile" : autoUpgradeProfileData ,
158236 })
159237 if err != nil {
160238 return nil , err
0 commit comments