Skip to content

Commit 98392d9

Browse files
authored
Revert "Remove the deprecated properties fields in the" (#5909)
* Revert "Remove the deprecated properties fields in the" This reverts commit 2faa2cd. Signed-off-by: Jay Mundrawala <jay@mondoo.com> * Revert "Remove deprecated microsoft.domaindnsrecord.properties" This reverts commit 66108e9. --------- Signed-off-by: Jay Mundrawala <jay@mondoo.com>
1 parent 02ca770 commit 98392d9

File tree

5 files changed

+102
-0
lines changed

5 files changed

+102
-0
lines changed

providers/ms365/resources/devicemanagement.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ func (a *mqlMicrosoftDevicemanagement) deviceConfigurations() ([]any, error) {
139139
res := []any{}
140140
configurations := resp.GetValue()
141141
for _, configuration := range configurations {
142+
properties := getConfigurationProperties(configuration)
142143
mqlResource, err := CreateResource(a.MqlRuntime, "microsoft.devicemanagement.deviceconfiguration",
143144
map[string]*llx.RawData{
144145
"id": llx.StringDataPtr(configuration.GetId()),
@@ -147,6 +148,7 @@ func (a *mqlMicrosoftDevicemanagement) deviceConfigurations() ([]any, error) {
147148
"description": llx.StringDataPtr(configuration.GetDescription()),
148149
"displayName": llx.StringDataPtr(configuration.GetDisplayName()),
149150
"version": llx.IntDataDefault(configuration.GetVersion(), 0),
151+
"properties": llx.DictData(properties),
150152
})
151153
if err != nil {
152154
return nil, err
@@ -217,6 +219,7 @@ func (a *mqlMicrosoftDevicemanagement) deviceCompliancePolicies() ([]any, error)
217219
if err != nil {
218220
return nil, err
219221
}
222+
properties := getComplianceProperties(compliancePolicy)
220223
mqlResource, err := CreateResource(a.MqlRuntime, "microsoft.devicemanagement.devicecompliancepolicy",
221224
map[string]*llx.RawData{
222225
"id": llx.StringDataPtr(compliancePolicy.GetId()),
@@ -226,6 +229,7 @@ func (a *mqlMicrosoftDevicemanagement) deviceCompliancePolicies() ([]any, error)
226229
"lastModifiedDateTime": llx.TimeDataPtr(compliancePolicy.GetLastModifiedDateTime()),
227230
"version": llx.IntDataDefault(compliancePolicy.GetVersion(), 0),
228231
"assignments": llx.ArrayData(assignments, types.Any),
232+
"properties": llx.DictData(properties),
229233
})
230234
if err != nil {
231235
return nil, err

providers/ms365/resources/domains.go

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"context"
88

99
"github.com/microsoftgraph/msgraph-sdk-go/domains"
10+
"github.com/microsoftgraph/msgraph-sdk-go/models"
1011
"go.mondoo.com/cnquery/v12/llx"
1112
"go.mondoo.com/cnquery/v12/providers/ms365/connection"
1213
"go.mondoo.com/cnquery/v12/types"
@@ -79,6 +80,7 @@ func (a *mqlMicrosoftDomain) serviceConfigurationRecords() ([]any, error) {
7980
res := []any{}
8081
records := resp.GetValue()
8182
for _, record := range records {
83+
properties := getDomainsDnsRecordProperties(record)
8284
mqlResource, err := CreateResource(a.MqlRuntime, "microsoft.domaindnsrecord",
8385
map[string]*llx.RawData{
8486
"id": llx.StringDataPtr(record.GetId()),
@@ -87,6 +89,7 @@ func (a *mqlMicrosoftDomain) serviceConfigurationRecords() ([]any, error) {
8789
"recordType": llx.StringDataPtr(record.GetRecordType()),
8890
"supportedService": llx.StringDataPtr(record.GetSupportedService()),
8991
"ttl": llx.IntDataDefault(record.GetTtl(), 0),
92+
"properties": llx.DictData(properties),
9093
})
9194
if err != nil {
9295
return nil, err
@@ -96,3 +99,53 @@ func (a *mqlMicrosoftDomain) serviceConfigurationRecords() ([]any, error) {
9699

97100
return res, nil
98101
}
102+
103+
func getDomainsDnsRecordProperties(record models.DomainDnsRecordable) map[string]interface{} {
104+
props := map[string]interface{}{}
105+
if record.GetOdataType() != nil {
106+
props["@odata.type"] = *record.GetOdataType()
107+
}
108+
txtRecord, ok := record.(*models.DomainDnsTxtRecord)
109+
if ok {
110+
if txtRecord.GetText() != nil {
111+
props["text"] = *txtRecord.GetText()
112+
}
113+
}
114+
mxRecord, ok := record.(*models.DomainDnsMxRecord)
115+
if ok {
116+
if mxRecord.GetMailExchange() != nil {
117+
props["mailExchange"] = *mxRecord.GetMailExchange()
118+
}
119+
if mxRecord.GetPreference() != nil {
120+
props["preference"] = *mxRecord.GetPreference()
121+
}
122+
}
123+
cNameRecord, ok := record.(*models.DomainDnsCnameRecord)
124+
if ok {
125+
if cNameRecord.GetCanonicalName() != nil {
126+
props["canonicalName"] = *cNameRecord.GetCanonicalName()
127+
}
128+
}
129+
srvRecord, ok := record.(*models.DomainDnsSrvRecord)
130+
if ok {
131+
if srvRecord.GetNameTarget() != nil {
132+
props["nameTarget"] = *srvRecord.GetNameTarget()
133+
}
134+
if srvRecord.GetPort() != nil {
135+
props["port"] = *srvRecord.GetPort()
136+
}
137+
if srvRecord.GetPriority() != nil {
138+
props["priority"] = *srvRecord.GetPriority()
139+
}
140+
if srvRecord.GetProtocol() != nil {
141+
props["protocol"] = *srvRecord.GetProtocol()
142+
}
143+
if srvRecord.GetService() != nil {
144+
props["service"] = *srvRecord.GetService()
145+
}
146+
if srvRecord.GetWeight() != nil {
147+
props["weight"] = *srvRecord.GetWeight()
148+
}
149+
}
150+
return props
151+
}

providers/ms365/resources/ms365.lr

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,8 @@ private microsoft.domaindnsrecord @defaults("id label") {
860860
supportedService string
861861
// Domain record TTL
862862
ttl int
863+
// Deprecated; kept for backwards compatibility
864+
properties dict
863865
}
864866

865867
// Microsoft Entra ID application registration
@@ -1413,6 +1415,8 @@ private microsoft.devicemanagement.deviceconfiguration @defaults("id displayName
14131415
displayName string
14141416
// Device configuration version
14151417
version int
1418+
// Deprecated; kept for backwards compatibility
1419+
properties dict
14161420
}
14171421

14181422
// Microsoft device compliance policy
@@ -1431,6 +1435,8 @@ private microsoft.devicemanagement.devicecompliancepolicy @defaults("id displayN
14311435
version int
14321436
// Device compliance policy assignments
14331437
assignments []dict
1438+
// Deprecated; kept for backwards compatibility
1439+
properties dict
14341440
}
14351441

14361442
// Microsoft 365 Exchange Online

providers/ms365/resources/ms365.lr.go

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

providers/ms365/resources/ms365.lr.manifest.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ resources:
304304
displayName: {}
305305
id: {}
306306
lastModifiedDateTime: {}
307+
properties: {}
307308
version: {}
308309
is_private: true
309310
min_mondoo_version: 9.0.0
@@ -314,6 +315,7 @@ resources:
314315
displayName: {}
315316
id: {}
316317
lastModifiedDateTime: {}
318+
properties: {}
317319
version: {}
318320
is_private: true
319321
min_mondoo_version: 9.0.0
@@ -377,6 +379,7 @@ resources:
377379
id: {}
378380
isOptional: {}
379381
label: {}
382+
properties: {}
380383
recordType: {}
381384
supportedService: {}
382385
ttl: {}

0 commit comments

Comments
 (0)