go.mondoo.com/cnquery@v0.0.0-20231005093811-59568235f6ea/providers/network/resources/network.lr.go (about) 1 // Copyright (c) Mondoo, Inc. 2 // SPDX-License-Identifier: BUSL-1.1 3 4 // Code generated by resources. DO NOT EDIT. 5 6 package resources 7 8 import ( 9 "errors" 10 "time" 11 12 "go.mondoo.com/cnquery/llx" 13 "go.mondoo.com/cnquery/providers-sdk/v1/plugin" 14 "go.mondoo.com/cnquery/types" 15 ) 16 17 var resourceFactories map[string]plugin.ResourceFactory 18 19 func init() { 20 resourceFactories = map[string]plugin.ResourceFactory { 21 "socket": { 22 // to override args, implement: initSocket(runtime *plugin.Runtime, args map[string]*llx.RawData) (map[string]*llx.RawData, plugin.Resource, error) 23 Create: createSocket, 24 }, 25 "tls": { 26 Init: initTls, 27 Create: createTls, 28 }, 29 "certificates": { 30 // to override args, implement: initCertificates(runtime *plugin.Runtime, args map[string]*llx.RawData) (map[string]*llx.RawData, plugin.Resource, error) 31 Create: createCertificates, 32 }, 33 "certificate": { 34 // to override args, implement: initCertificate(runtime *plugin.Runtime, args map[string]*llx.RawData) (map[string]*llx.RawData, plugin.Resource, error) 35 Create: createCertificate, 36 }, 37 "pkix.name": { 38 // to override args, implement: initPkixName(runtime *plugin.Runtime, args map[string]*llx.RawData) (map[string]*llx.RawData, plugin.Resource, error) 39 Create: createPkixName, 40 }, 41 "pkix.extension": { 42 // to override args, implement: initPkixExtension(runtime *plugin.Runtime, args map[string]*llx.RawData) (map[string]*llx.RawData, plugin.Resource, error) 43 Create: createPkixExtension, 44 }, 45 "openpgp.entities": { 46 // to override args, implement: initOpenpgpEntities(runtime *plugin.Runtime, args map[string]*llx.RawData) (map[string]*llx.RawData, plugin.Resource, error) 47 Create: createOpenpgpEntities, 48 }, 49 "openpgp.entity": { 50 // to override args, implement: initOpenpgpEntity(runtime *plugin.Runtime, args map[string]*llx.RawData) (map[string]*llx.RawData, plugin.Resource, error) 51 Create: createOpenpgpEntity, 52 }, 53 "openpgp.publicKey": { 54 // to override args, implement: initOpenpgpPublicKey(runtime *plugin.Runtime, args map[string]*llx.RawData) (map[string]*llx.RawData, plugin.Resource, error) 55 Create: createOpenpgpPublicKey, 56 }, 57 "openpgp.identity": { 58 // to override args, implement: initOpenpgpIdentity(runtime *plugin.Runtime, args map[string]*llx.RawData) (map[string]*llx.RawData, plugin.Resource, error) 59 Create: createOpenpgpIdentity, 60 }, 61 "openpgp.signature": { 62 // to override args, implement: initOpenpgpSignature(runtime *plugin.Runtime, args map[string]*llx.RawData) (map[string]*llx.RawData, plugin.Resource, error) 63 Create: createOpenpgpSignature, 64 }, 65 "domainName": { 66 Init: initDomainName, 67 Create: createDomainName, 68 }, 69 "dns": { 70 Init: initDns, 71 Create: createDns, 72 }, 73 "dns.record": { 74 // to override args, implement: initDnsRecord(runtime *plugin.Runtime, args map[string]*llx.RawData) (map[string]*llx.RawData, plugin.Resource, error) 75 Create: createDnsRecord, 76 }, 77 "dns.mxRecord": { 78 // to override args, implement: initDnsMxRecord(runtime *plugin.Runtime, args map[string]*llx.RawData) (map[string]*llx.RawData, plugin.Resource, error) 79 Create: createDnsMxRecord, 80 }, 81 "dns.dkimRecord": { 82 // to override args, implement: initDnsDkimRecord(runtime *plugin.Runtime, args map[string]*llx.RawData) (map[string]*llx.RawData, plugin.Resource, error) 83 Create: createDnsDkimRecord, 84 }, 85 } 86 } 87 88 // NewResource is used by the runtime of this plugin to create new resources. 89 // Its arguments may be provided by users. This function is generally not 90 // used by initializing resources from recordings or from lists. 91 func NewResource(runtime *plugin.Runtime, name string, args map[string]*llx.RawData) (plugin.Resource, error) { 92 f, ok := resourceFactories[name] 93 if !ok { 94 return nil, errors.New("cannot find resource " + name + " in this provider") 95 } 96 97 if f.Init != nil { 98 cargs, res, err := f.Init(runtime, args) 99 if err != nil { 100 return res, err 101 } 102 103 if res != nil { 104 id := name+"\x00"+res.MqlID() 105 if x, ok := runtime.Resources.Get(id); ok { 106 return x, nil 107 } 108 runtime.Resources.Set(id, res) 109 return res, nil 110 } 111 112 args = cargs 113 } 114 115 res, err := f.Create(runtime, args) 116 if err != nil { 117 return nil, err 118 } 119 120 id := name+"\x00"+res.MqlID() 121 if x, ok := runtime.Resources.Get(id); ok { 122 return x, nil 123 } 124 125 runtime.Resources.Set(id, res) 126 return res, nil 127 } 128 129 // CreateResource is used by the runtime of this plugin to create resources. 130 // Its arguments must be complete and pre-processed. This method is used 131 // for initializing resources from recordings or from lists. 132 func CreateResource(runtime *plugin.Runtime, name string, args map[string]*llx.RawData) (plugin.Resource, error) { 133 f, ok := resourceFactories[name] 134 if !ok { 135 return nil, errors.New("cannot find resource " + name + " in this provider") 136 } 137 138 res, err := f.Create(runtime, args) 139 if err != nil { 140 return nil, err 141 } 142 143 id := name+"\x00"+res.MqlID() 144 if x, ok := runtime.Resources.Get(id); ok { 145 return x, nil 146 } 147 148 runtime.Resources.Set(id, res) 149 return res, nil 150 } 151 152 var getDataFields = map[string]func(r plugin.Resource) *plugin.DataRes{ 153 "socket.protocol": func(r plugin.Resource) *plugin.DataRes { 154 return (r.(*mqlSocket).GetProtocol()).ToDataRes(types.String) 155 }, 156 "socket.port": func(r plugin.Resource) *plugin.DataRes { 157 return (r.(*mqlSocket).GetPort()).ToDataRes(types.Int) 158 }, 159 "socket.address": func(r plugin.Resource) *plugin.DataRes { 160 return (r.(*mqlSocket).GetAddress()).ToDataRes(types.String) 161 }, 162 "tls.socket": func(r plugin.Resource) *plugin.DataRes { 163 return (r.(*mqlTls).GetSocket()).ToDataRes(types.Resource("socket")) 164 }, 165 "tls.domainName": func(r plugin.Resource) *plugin.DataRes { 166 return (r.(*mqlTls).GetDomainName()).ToDataRes(types.String) 167 }, 168 "tls.params": func(r plugin.Resource) *plugin.DataRes { 169 return (r.(*mqlTls).GetParams()).ToDataRes(types.Dict) 170 }, 171 "tls.versions": func(r plugin.Resource) *plugin.DataRes { 172 return (r.(*mqlTls).GetVersions()).ToDataRes(types.Array(types.String)) 173 }, 174 "tls.ciphers": func(r plugin.Resource) *plugin.DataRes { 175 return (r.(*mqlTls).GetCiphers()).ToDataRes(types.Array(types.String)) 176 }, 177 "tls.extensions": func(r plugin.Resource) *plugin.DataRes { 178 return (r.(*mqlTls).GetExtensions()).ToDataRes(types.Array(types.String)) 179 }, 180 "tls.certificates": func(r plugin.Resource) *plugin.DataRes { 181 return (r.(*mqlTls).GetCertificates()).ToDataRes(types.Array(types.Resource("certificate"))) 182 }, 183 "tls.nonSniCertificates": func(r plugin.Resource) *plugin.DataRes { 184 return (r.(*mqlTls).GetNonSniCertificates()).ToDataRes(types.Array(types.Resource("certificate"))) 185 }, 186 "certificates.pem": func(r plugin.Resource) *plugin.DataRes { 187 return (r.(*mqlCertificates).GetPem()).ToDataRes(types.String) 188 }, 189 "certificates.list": func(r plugin.Resource) *plugin.DataRes { 190 return (r.(*mqlCertificates).GetList()).ToDataRes(types.Array(types.Resource("certificate"))) 191 }, 192 "certificate.pem": func(r plugin.Resource) *plugin.DataRes { 193 return (r.(*mqlCertificate).GetPem()).ToDataRes(types.String) 194 }, 195 "certificate.fingerprints": func(r plugin.Resource) *plugin.DataRes { 196 return (r.(*mqlCertificate).GetFingerprints()).ToDataRes(types.Map(types.String, types.String)) 197 }, 198 "certificate.serial": func(r plugin.Resource) *plugin.DataRes { 199 return (r.(*mqlCertificate).GetSerial()).ToDataRes(types.String) 200 }, 201 "certificate.subjectKeyID": func(r plugin.Resource) *plugin.DataRes { 202 return (r.(*mqlCertificate).GetSubjectKeyID()).ToDataRes(types.String) 203 }, 204 "certificate.authorityKeyID": func(r plugin.Resource) *plugin.DataRes { 205 return (r.(*mqlCertificate).GetAuthorityKeyID()).ToDataRes(types.String) 206 }, 207 "certificate.subject": func(r plugin.Resource) *plugin.DataRes { 208 return (r.(*mqlCertificate).GetSubject()).ToDataRes(types.Resource("pkix.name")) 209 }, 210 "certificate.issuer": func(r plugin.Resource) *plugin.DataRes { 211 return (r.(*mqlCertificate).GetIssuer()).ToDataRes(types.Resource("pkix.name")) 212 }, 213 "certificate.version": func(r plugin.Resource) *plugin.DataRes { 214 return (r.(*mqlCertificate).GetVersion()).ToDataRes(types.Int) 215 }, 216 "certificate.notBefore": func(r plugin.Resource) *plugin.DataRes { 217 return (r.(*mqlCertificate).GetNotBefore()).ToDataRes(types.Time) 218 }, 219 "certificate.notAfter": func(r plugin.Resource) *plugin.DataRes { 220 return (r.(*mqlCertificate).GetNotAfter()).ToDataRes(types.Time) 221 }, 222 "certificate.expiresIn": func(r plugin.Resource) *plugin.DataRes { 223 return (r.(*mqlCertificate).GetExpiresIn()).ToDataRes(types.Time) 224 }, 225 "certificate.signature": func(r plugin.Resource) *plugin.DataRes { 226 return (r.(*mqlCertificate).GetSignature()).ToDataRes(types.String) 227 }, 228 "certificate.signingAlgorithm": func(r plugin.Resource) *plugin.DataRes { 229 return (r.(*mqlCertificate).GetSigningAlgorithm()).ToDataRes(types.String) 230 }, 231 "certificate.isCA": func(r plugin.Resource) *plugin.DataRes { 232 return (r.(*mqlCertificate).GetIsCA()).ToDataRes(types.Bool) 233 }, 234 "certificate.keyUsage": func(r plugin.Resource) *plugin.DataRes { 235 return (r.(*mqlCertificate).GetKeyUsage()).ToDataRes(types.Array(types.String)) 236 }, 237 "certificate.extendedKeyUsage": func(r plugin.Resource) *plugin.DataRes { 238 return (r.(*mqlCertificate).GetExtendedKeyUsage()).ToDataRes(types.Array(types.String)) 239 }, 240 "certificate.extensions": func(r plugin.Resource) *plugin.DataRes { 241 return (r.(*mqlCertificate).GetExtensions()).ToDataRes(types.Array(types.Resource("pkix.extension"))) 242 }, 243 "certificate.policyIdentifier": func(r plugin.Resource) *plugin.DataRes { 244 return (r.(*mqlCertificate).GetPolicyIdentifier()).ToDataRes(types.Array(types.String)) 245 }, 246 "certificate.crlDistributionPoints": func(r plugin.Resource) *plugin.DataRes { 247 return (r.(*mqlCertificate).GetCrlDistributionPoints()).ToDataRes(types.Array(types.String)) 248 }, 249 "certificate.ocspServer": func(r plugin.Resource) *plugin.DataRes { 250 return (r.(*mqlCertificate).GetOcspServer()).ToDataRes(types.Array(types.String)) 251 }, 252 "certificate.issuingCertificateUrl": func(r plugin.Resource) *plugin.DataRes { 253 return (r.(*mqlCertificate).GetIssuingCertificateUrl()).ToDataRes(types.Array(types.String)) 254 }, 255 "certificate.isRevoked": func(r plugin.Resource) *plugin.DataRes { 256 return (r.(*mqlCertificate).GetIsRevoked()).ToDataRes(types.Bool) 257 }, 258 "certificate.revokedAt": func(r plugin.Resource) *plugin.DataRes { 259 return (r.(*mqlCertificate).GetRevokedAt()).ToDataRes(types.Time) 260 }, 261 "certificate.isVerified": func(r plugin.Resource) *plugin.DataRes { 262 return (r.(*mqlCertificate).GetIsVerified()).ToDataRes(types.Bool) 263 }, 264 "pkix.name.id": func(r plugin.Resource) *plugin.DataRes { 265 return (r.(*mqlPkixName).GetId()).ToDataRes(types.String) 266 }, 267 "pkix.name.dn": func(r plugin.Resource) *plugin.DataRes { 268 return (r.(*mqlPkixName).GetDn()).ToDataRes(types.String) 269 }, 270 "pkix.name.serialNumber": func(r plugin.Resource) *plugin.DataRes { 271 return (r.(*mqlPkixName).GetSerialNumber()).ToDataRes(types.String) 272 }, 273 "pkix.name.commonName": func(r plugin.Resource) *plugin.DataRes { 274 return (r.(*mqlPkixName).GetCommonName()).ToDataRes(types.String) 275 }, 276 "pkix.name.country": func(r plugin.Resource) *plugin.DataRes { 277 return (r.(*mqlPkixName).GetCountry()).ToDataRes(types.Array(types.String)) 278 }, 279 "pkix.name.organization": func(r plugin.Resource) *plugin.DataRes { 280 return (r.(*mqlPkixName).GetOrganization()).ToDataRes(types.Array(types.String)) 281 }, 282 "pkix.name.organizationalUnit": func(r plugin.Resource) *plugin.DataRes { 283 return (r.(*mqlPkixName).GetOrganizationalUnit()).ToDataRes(types.Array(types.String)) 284 }, 285 "pkix.name.locality": func(r plugin.Resource) *plugin.DataRes { 286 return (r.(*mqlPkixName).GetLocality()).ToDataRes(types.Array(types.String)) 287 }, 288 "pkix.name.province": func(r plugin.Resource) *plugin.DataRes { 289 return (r.(*mqlPkixName).GetProvince()).ToDataRes(types.Array(types.String)) 290 }, 291 "pkix.name.streetAddress": func(r plugin.Resource) *plugin.DataRes { 292 return (r.(*mqlPkixName).GetStreetAddress()).ToDataRes(types.Array(types.String)) 293 }, 294 "pkix.name.postalCode": func(r plugin.Resource) *plugin.DataRes { 295 return (r.(*mqlPkixName).GetPostalCode()).ToDataRes(types.Array(types.String)) 296 }, 297 "pkix.name.names": func(r plugin.Resource) *plugin.DataRes { 298 return (r.(*mqlPkixName).GetNames()).ToDataRes(types.Map(types.String, types.String)) 299 }, 300 "pkix.name.extraNames": func(r plugin.Resource) *plugin.DataRes { 301 return (r.(*mqlPkixName).GetExtraNames()).ToDataRes(types.Map(types.String, types.String)) 302 }, 303 "pkix.extension.identifier": func(r plugin.Resource) *plugin.DataRes { 304 return (r.(*mqlPkixExtension).GetIdentifier()).ToDataRes(types.String) 305 }, 306 "pkix.extension.critical": func(r plugin.Resource) *plugin.DataRes { 307 return (r.(*mqlPkixExtension).GetCritical()).ToDataRes(types.Bool) 308 }, 309 "pkix.extension.value": func(r plugin.Resource) *plugin.DataRes { 310 return (r.(*mqlPkixExtension).GetValue()).ToDataRes(types.String) 311 }, 312 "openpgp.entities.content": func(r plugin.Resource) *plugin.DataRes { 313 return (r.(*mqlOpenpgpEntities).GetContent()).ToDataRes(types.String) 314 }, 315 "openpgp.entities.list": func(r plugin.Resource) *plugin.DataRes { 316 return (r.(*mqlOpenpgpEntities).GetList()).ToDataRes(types.Array(types.Resource("openpgp.entity"))) 317 }, 318 "openpgp.entity.primaryPublicKey": func(r plugin.Resource) *plugin.DataRes { 319 return (r.(*mqlOpenpgpEntity).GetPrimaryPublicKey()).ToDataRes(types.Resource("openpgp.publicKey")) 320 }, 321 "openpgp.entity.identities": func(r plugin.Resource) *plugin.DataRes { 322 return (r.(*mqlOpenpgpEntity).GetIdentities()).ToDataRes(types.Array(types.Resource("openpgp.identity"))) 323 }, 324 "openpgp.publicKey.id": func(r plugin.Resource) *plugin.DataRes { 325 return (r.(*mqlOpenpgpPublicKey).GetId()).ToDataRes(types.String) 326 }, 327 "openpgp.publicKey.version": func(r plugin.Resource) *plugin.DataRes { 328 return (r.(*mqlOpenpgpPublicKey).GetVersion()).ToDataRes(types.Int) 329 }, 330 "openpgp.publicKey.fingerprint": func(r plugin.Resource) *plugin.DataRes { 331 return (r.(*mqlOpenpgpPublicKey).GetFingerprint()).ToDataRes(types.String) 332 }, 333 "openpgp.publicKey.keyAlgorithm": func(r plugin.Resource) *plugin.DataRes { 334 return (r.(*mqlOpenpgpPublicKey).GetKeyAlgorithm()).ToDataRes(types.String) 335 }, 336 "openpgp.publicKey.bitLength": func(r plugin.Resource) *plugin.DataRes { 337 return (r.(*mqlOpenpgpPublicKey).GetBitLength()).ToDataRes(types.Int) 338 }, 339 "openpgp.publicKey.creationTime": func(r plugin.Resource) *plugin.DataRes { 340 return (r.(*mqlOpenpgpPublicKey).GetCreationTime()).ToDataRes(types.Time) 341 }, 342 "openpgp.identity.fingerprint": func(r plugin.Resource) *plugin.DataRes { 343 return (r.(*mqlOpenpgpIdentity).GetFingerprint()).ToDataRes(types.String) 344 }, 345 "openpgp.identity.id": func(r plugin.Resource) *plugin.DataRes { 346 return (r.(*mqlOpenpgpIdentity).GetId()).ToDataRes(types.String) 347 }, 348 "openpgp.identity.name": func(r plugin.Resource) *plugin.DataRes { 349 return (r.(*mqlOpenpgpIdentity).GetName()).ToDataRes(types.String) 350 }, 351 "openpgp.identity.email": func(r plugin.Resource) *plugin.DataRes { 352 return (r.(*mqlOpenpgpIdentity).GetEmail()).ToDataRes(types.String) 353 }, 354 "openpgp.identity.comment": func(r plugin.Resource) *plugin.DataRes { 355 return (r.(*mqlOpenpgpIdentity).GetComment()).ToDataRes(types.String) 356 }, 357 "openpgp.identity.signatures": func(r plugin.Resource) *plugin.DataRes { 358 return (r.(*mqlOpenpgpIdentity).GetSignatures()).ToDataRes(types.Array(types.Resource("openpgp.signature"))) 359 }, 360 "openpgp.signature.fingerprint": func(r plugin.Resource) *plugin.DataRes { 361 return (r.(*mqlOpenpgpSignature).GetFingerprint()).ToDataRes(types.String) 362 }, 363 "openpgp.signature.identityName": func(r plugin.Resource) *plugin.DataRes { 364 return (r.(*mqlOpenpgpSignature).GetIdentityName()).ToDataRes(types.String) 365 }, 366 "openpgp.signature.hash": func(r plugin.Resource) *plugin.DataRes { 367 return (r.(*mqlOpenpgpSignature).GetHash()).ToDataRes(types.String) 368 }, 369 "openpgp.signature.version": func(r plugin.Resource) *plugin.DataRes { 370 return (r.(*mqlOpenpgpSignature).GetVersion()).ToDataRes(types.Int) 371 }, 372 "openpgp.signature.signatureType": func(r plugin.Resource) *plugin.DataRes { 373 return (r.(*mqlOpenpgpSignature).GetSignatureType()).ToDataRes(types.String) 374 }, 375 "openpgp.signature.keyAlgorithm": func(r plugin.Resource) *plugin.DataRes { 376 return (r.(*mqlOpenpgpSignature).GetKeyAlgorithm()).ToDataRes(types.String) 377 }, 378 "openpgp.signature.creationTime": func(r plugin.Resource) *plugin.DataRes { 379 return (r.(*mqlOpenpgpSignature).GetCreationTime()).ToDataRes(types.Time) 380 }, 381 "openpgp.signature.lifetimeSecs": func(r plugin.Resource) *plugin.DataRes { 382 return (r.(*mqlOpenpgpSignature).GetLifetimeSecs()).ToDataRes(types.Int) 383 }, 384 "openpgp.signature.expiresIn": func(r plugin.Resource) *plugin.DataRes { 385 return (r.(*mqlOpenpgpSignature).GetExpiresIn()).ToDataRes(types.Time) 386 }, 387 "openpgp.signature.keyLifetimeSecs": func(r plugin.Resource) *plugin.DataRes { 388 return (r.(*mqlOpenpgpSignature).GetKeyLifetimeSecs()).ToDataRes(types.Int) 389 }, 390 "openpgp.signature.keyExpiresIn": func(r plugin.Resource) *plugin.DataRes { 391 return (r.(*mqlOpenpgpSignature).GetKeyExpiresIn()).ToDataRes(types.Time) 392 }, 393 "domainName.fqdn": func(r plugin.Resource) *plugin.DataRes { 394 return (r.(*mqlDomainName).GetFqdn()).ToDataRes(types.String) 395 }, 396 "domainName.effectiveTLDPlusOne": func(r plugin.Resource) *plugin.DataRes { 397 return (r.(*mqlDomainName).GetEffectiveTLDPlusOne()).ToDataRes(types.String) 398 }, 399 "domainName.tld": func(r plugin.Resource) *plugin.DataRes { 400 return (r.(*mqlDomainName).GetTld()).ToDataRes(types.String) 401 }, 402 "domainName.tldIcannManaged": func(r plugin.Resource) *plugin.DataRes { 403 return (r.(*mqlDomainName).GetTldIcannManaged()).ToDataRes(types.Bool) 404 }, 405 "domainName.labels": func(r plugin.Resource) *plugin.DataRes { 406 return (r.(*mqlDomainName).GetLabels()).ToDataRes(types.Array(types.String)) 407 }, 408 "dns.fqdn": func(r plugin.Resource) *plugin.DataRes { 409 return (r.(*mqlDns).GetFqdn()).ToDataRes(types.String) 410 }, 411 "dns.params": func(r plugin.Resource) *plugin.DataRes { 412 return (r.(*mqlDns).GetParams()).ToDataRes(types.Dict) 413 }, 414 "dns.records": func(r plugin.Resource) *plugin.DataRes { 415 return (r.(*mqlDns).GetRecords()).ToDataRes(types.Array(types.Resource("dns.record"))) 416 }, 417 "dns.mx": func(r plugin.Resource) *plugin.DataRes { 418 return (r.(*mqlDns).GetMx()).ToDataRes(types.Array(types.Resource("dns.mxRecord"))) 419 }, 420 "dns.dkim": func(r plugin.Resource) *plugin.DataRes { 421 return (r.(*mqlDns).GetDkim()).ToDataRes(types.Array(types.Resource("dns.dkimRecord"))) 422 }, 423 "dns.record.name": func(r plugin.Resource) *plugin.DataRes { 424 return (r.(*mqlDnsRecord).GetName()).ToDataRes(types.String) 425 }, 426 "dns.record.ttl": func(r plugin.Resource) *plugin.DataRes { 427 return (r.(*mqlDnsRecord).GetTtl()).ToDataRes(types.Int) 428 }, 429 "dns.record.class": func(r plugin.Resource) *plugin.DataRes { 430 return (r.(*mqlDnsRecord).GetClass()).ToDataRes(types.String) 431 }, 432 "dns.record.type": func(r plugin.Resource) *plugin.DataRes { 433 return (r.(*mqlDnsRecord).GetType()).ToDataRes(types.String) 434 }, 435 "dns.record.rdata": func(r plugin.Resource) *plugin.DataRes { 436 return (r.(*mqlDnsRecord).GetRdata()).ToDataRes(types.Array(types.String)) 437 }, 438 "dns.mxRecord.name": func(r plugin.Resource) *plugin.DataRes { 439 return (r.(*mqlDnsMxRecord).GetName()).ToDataRes(types.String) 440 }, 441 "dns.mxRecord.preference": func(r plugin.Resource) *plugin.DataRes { 442 return (r.(*mqlDnsMxRecord).GetPreference()).ToDataRes(types.Int) 443 }, 444 "dns.mxRecord.domainName": func(r plugin.Resource) *plugin.DataRes { 445 return (r.(*mqlDnsMxRecord).GetDomainName()).ToDataRes(types.String) 446 }, 447 "dns.dkimRecord.dnsTxt": func(r plugin.Resource) *plugin.DataRes { 448 return (r.(*mqlDnsDkimRecord).GetDnsTxt()).ToDataRes(types.String) 449 }, 450 "dns.dkimRecord.domain": func(r plugin.Resource) *plugin.DataRes { 451 return (r.(*mqlDnsDkimRecord).GetDomain()).ToDataRes(types.String) 452 }, 453 "dns.dkimRecord.version": func(r plugin.Resource) *plugin.DataRes { 454 return (r.(*mqlDnsDkimRecord).GetVersion()).ToDataRes(types.String) 455 }, 456 "dns.dkimRecord.hashAlgorithms": func(r plugin.Resource) *plugin.DataRes { 457 return (r.(*mqlDnsDkimRecord).GetHashAlgorithms()).ToDataRes(types.Array(types.String)) 458 }, 459 "dns.dkimRecord.keyType": func(r plugin.Resource) *plugin.DataRes { 460 return (r.(*mqlDnsDkimRecord).GetKeyType()).ToDataRes(types.String) 461 }, 462 "dns.dkimRecord.notes": func(r plugin.Resource) *plugin.DataRes { 463 return (r.(*mqlDnsDkimRecord).GetNotes()).ToDataRes(types.String) 464 }, 465 "dns.dkimRecord.publicKeyData": func(r plugin.Resource) *plugin.DataRes { 466 return (r.(*mqlDnsDkimRecord).GetPublicKeyData()).ToDataRes(types.String) 467 }, 468 "dns.dkimRecord.serviceTypes": func(r plugin.Resource) *plugin.DataRes { 469 return (r.(*mqlDnsDkimRecord).GetServiceTypes()).ToDataRes(types.Array(types.String)) 470 }, 471 "dns.dkimRecord.flags": func(r plugin.Resource) *plugin.DataRes { 472 return (r.(*mqlDnsDkimRecord).GetFlags()).ToDataRes(types.Array(types.String)) 473 }, 474 "dns.dkimRecord.valid": func(r plugin.Resource) *plugin.DataRes { 475 return (r.(*mqlDnsDkimRecord).GetValid()).ToDataRes(types.Bool) 476 }, 477 } 478 479 func GetData(resource plugin.Resource, field string, args map[string]*llx.RawData) *plugin.DataRes { 480 f, ok := getDataFields[resource.MqlName()+"."+field] 481 if !ok { 482 return &plugin.DataRes{Error: "cannot find '" + field + "' in resource '" + resource.MqlName() + "'"} 483 } 484 485 return f(resource) 486 } 487 488 var setDataFields = map[string]func(r plugin.Resource, v *llx.RawData) bool { 489 "socket.__id": func(r plugin.Resource, v *llx.RawData) (ok bool) { 490 r.(*mqlSocket).__id, ok = v.Value.(string) 491 return 492 }, 493 "socket.protocol": func(r plugin.Resource, v *llx.RawData) (ok bool) { 494 r.(*mqlSocket).Protocol, ok = plugin.RawToTValue[string](v.Value, v.Error) 495 return 496 }, 497 "socket.port": func(r plugin.Resource, v *llx.RawData) (ok bool) { 498 r.(*mqlSocket).Port, ok = plugin.RawToTValue[int64](v.Value, v.Error) 499 return 500 }, 501 "socket.address": func(r plugin.Resource, v *llx.RawData) (ok bool) { 502 r.(*mqlSocket).Address, ok = plugin.RawToTValue[string](v.Value, v.Error) 503 return 504 }, 505 "tls.__id": func(r plugin.Resource, v *llx.RawData) (ok bool) { 506 r.(*mqlTls).__id, ok = v.Value.(string) 507 return 508 }, 509 "tls.socket": func(r plugin.Resource, v *llx.RawData) (ok bool) { 510 r.(*mqlTls).Socket, ok = plugin.RawToTValue[*mqlSocket](v.Value, v.Error) 511 return 512 }, 513 "tls.domainName": func(r plugin.Resource, v *llx.RawData) (ok bool) { 514 r.(*mqlTls).DomainName, ok = plugin.RawToTValue[string](v.Value, v.Error) 515 return 516 }, 517 "tls.params": func(r plugin.Resource, v *llx.RawData) (ok bool) { 518 r.(*mqlTls).Params, ok = plugin.RawToTValue[interface{}](v.Value, v.Error) 519 return 520 }, 521 "tls.versions": func(r plugin.Resource, v *llx.RawData) (ok bool) { 522 r.(*mqlTls).Versions, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) 523 return 524 }, 525 "tls.ciphers": func(r plugin.Resource, v *llx.RawData) (ok bool) { 526 r.(*mqlTls).Ciphers, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) 527 return 528 }, 529 "tls.extensions": func(r plugin.Resource, v *llx.RawData) (ok bool) { 530 r.(*mqlTls).Extensions, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) 531 return 532 }, 533 "tls.certificates": func(r plugin.Resource, v *llx.RawData) (ok bool) { 534 r.(*mqlTls).Certificates, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) 535 return 536 }, 537 "tls.nonSniCertificates": func(r plugin.Resource, v *llx.RawData) (ok bool) { 538 r.(*mqlTls).NonSniCertificates, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) 539 return 540 }, 541 "certificates.__id": func(r plugin.Resource, v *llx.RawData) (ok bool) { 542 r.(*mqlCertificates).__id, ok = v.Value.(string) 543 return 544 }, 545 "certificates.pem": func(r plugin.Resource, v *llx.RawData) (ok bool) { 546 r.(*mqlCertificates).Pem, ok = plugin.RawToTValue[string](v.Value, v.Error) 547 return 548 }, 549 "certificates.list": func(r plugin.Resource, v *llx.RawData) (ok bool) { 550 r.(*mqlCertificates).List, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) 551 return 552 }, 553 "certificate.__id": func(r plugin.Resource, v *llx.RawData) (ok bool) { 554 r.(*mqlCertificate).__id, ok = v.Value.(string) 555 return 556 }, 557 "certificate.pem": func(r plugin.Resource, v *llx.RawData) (ok bool) { 558 r.(*mqlCertificate).Pem, ok = plugin.RawToTValue[string](v.Value, v.Error) 559 return 560 }, 561 "certificate.fingerprints": func(r plugin.Resource, v *llx.RawData) (ok bool) { 562 r.(*mqlCertificate).Fingerprints, ok = plugin.RawToTValue[map[string]interface{}](v.Value, v.Error) 563 return 564 }, 565 "certificate.serial": func(r plugin.Resource, v *llx.RawData) (ok bool) { 566 r.(*mqlCertificate).Serial, ok = plugin.RawToTValue[string](v.Value, v.Error) 567 return 568 }, 569 "certificate.subjectKeyID": func(r plugin.Resource, v *llx.RawData) (ok bool) { 570 r.(*mqlCertificate).SubjectKeyID, ok = plugin.RawToTValue[string](v.Value, v.Error) 571 return 572 }, 573 "certificate.authorityKeyID": func(r plugin.Resource, v *llx.RawData) (ok bool) { 574 r.(*mqlCertificate).AuthorityKeyID, ok = plugin.RawToTValue[string](v.Value, v.Error) 575 return 576 }, 577 "certificate.subject": func(r plugin.Resource, v *llx.RawData) (ok bool) { 578 r.(*mqlCertificate).Subject, ok = plugin.RawToTValue[*mqlPkixName](v.Value, v.Error) 579 return 580 }, 581 "certificate.issuer": func(r plugin.Resource, v *llx.RawData) (ok bool) { 582 r.(*mqlCertificate).Issuer, ok = plugin.RawToTValue[*mqlPkixName](v.Value, v.Error) 583 return 584 }, 585 "certificate.version": func(r plugin.Resource, v *llx.RawData) (ok bool) { 586 r.(*mqlCertificate).Version, ok = plugin.RawToTValue[int64](v.Value, v.Error) 587 return 588 }, 589 "certificate.notBefore": func(r plugin.Resource, v *llx.RawData) (ok bool) { 590 r.(*mqlCertificate).NotBefore, ok = plugin.RawToTValue[*time.Time](v.Value, v.Error) 591 return 592 }, 593 "certificate.notAfter": func(r plugin.Resource, v *llx.RawData) (ok bool) { 594 r.(*mqlCertificate).NotAfter, ok = plugin.RawToTValue[*time.Time](v.Value, v.Error) 595 return 596 }, 597 "certificate.expiresIn": func(r plugin.Resource, v *llx.RawData) (ok bool) { 598 r.(*mqlCertificate).ExpiresIn, ok = plugin.RawToTValue[*time.Time](v.Value, v.Error) 599 return 600 }, 601 "certificate.signature": func(r plugin.Resource, v *llx.RawData) (ok bool) { 602 r.(*mqlCertificate).Signature, ok = plugin.RawToTValue[string](v.Value, v.Error) 603 return 604 }, 605 "certificate.signingAlgorithm": func(r plugin.Resource, v *llx.RawData) (ok bool) { 606 r.(*mqlCertificate).SigningAlgorithm, ok = plugin.RawToTValue[string](v.Value, v.Error) 607 return 608 }, 609 "certificate.isCA": func(r plugin.Resource, v *llx.RawData) (ok bool) { 610 r.(*mqlCertificate).IsCA, ok = plugin.RawToTValue[bool](v.Value, v.Error) 611 return 612 }, 613 "certificate.keyUsage": func(r plugin.Resource, v *llx.RawData) (ok bool) { 614 r.(*mqlCertificate).KeyUsage, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) 615 return 616 }, 617 "certificate.extendedKeyUsage": func(r plugin.Resource, v *llx.RawData) (ok bool) { 618 r.(*mqlCertificate).ExtendedKeyUsage, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) 619 return 620 }, 621 "certificate.extensions": func(r plugin.Resource, v *llx.RawData) (ok bool) { 622 r.(*mqlCertificate).Extensions, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) 623 return 624 }, 625 "certificate.policyIdentifier": func(r plugin.Resource, v *llx.RawData) (ok bool) { 626 r.(*mqlCertificate).PolicyIdentifier, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) 627 return 628 }, 629 "certificate.crlDistributionPoints": func(r plugin.Resource, v *llx.RawData) (ok bool) { 630 r.(*mqlCertificate).CrlDistributionPoints, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) 631 return 632 }, 633 "certificate.ocspServer": func(r plugin.Resource, v *llx.RawData) (ok bool) { 634 r.(*mqlCertificate).OcspServer, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) 635 return 636 }, 637 "certificate.issuingCertificateUrl": func(r plugin.Resource, v *llx.RawData) (ok bool) { 638 r.(*mqlCertificate).IssuingCertificateUrl, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) 639 return 640 }, 641 "certificate.isRevoked": func(r plugin.Resource, v *llx.RawData) (ok bool) { 642 r.(*mqlCertificate).IsRevoked, ok = plugin.RawToTValue[bool](v.Value, v.Error) 643 return 644 }, 645 "certificate.revokedAt": func(r plugin.Resource, v *llx.RawData) (ok bool) { 646 r.(*mqlCertificate).RevokedAt, ok = plugin.RawToTValue[*time.Time](v.Value, v.Error) 647 return 648 }, 649 "certificate.isVerified": func(r plugin.Resource, v *llx.RawData) (ok bool) { 650 r.(*mqlCertificate).IsVerified, ok = plugin.RawToTValue[bool](v.Value, v.Error) 651 return 652 }, 653 "pkix.name.__id": func(r plugin.Resource, v *llx.RawData) (ok bool) { 654 r.(*mqlPkixName).__id, ok = v.Value.(string) 655 return 656 }, 657 "pkix.name.id": func(r plugin.Resource, v *llx.RawData) (ok bool) { 658 r.(*mqlPkixName).Id, ok = plugin.RawToTValue[string](v.Value, v.Error) 659 return 660 }, 661 "pkix.name.dn": func(r plugin.Resource, v *llx.RawData) (ok bool) { 662 r.(*mqlPkixName).Dn, ok = plugin.RawToTValue[string](v.Value, v.Error) 663 return 664 }, 665 "pkix.name.serialNumber": func(r plugin.Resource, v *llx.RawData) (ok bool) { 666 r.(*mqlPkixName).SerialNumber, ok = plugin.RawToTValue[string](v.Value, v.Error) 667 return 668 }, 669 "pkix.name.commonName": func(r plugin.Resource, v *llx.RawData) (ok bool) { 670 r.(*mqlPkixName).CommonName, ok = plugin.RawToTValue[string](v.Value, v.Error) 671 return 672 }, 673 "pkix.name.country": func(r plugin.Resource, v *llx.RawData) (ok bool) { 674 r.(*mqlPkixName).Country, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) 675 return 676 }, 677 "pkix.name.organization": func(r plugin.Resource, v *llx.RawData) (ok bool) { 678 r.(*mqlPkixName).Organization, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) 679 return 680 }, 681 "pkix.name.organizationalUnit": func(r plugin.Resource, v *llx.RawData) (ok bool) { 682 r.(*mqlPkixName).OrganizationalUnit, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) 683 return 684 }, 685 "pkix.name.locality": func(r plugin.Resource, v *llx.RawData) (ok bool) { 686 r.(*mqlPkixName).Locality, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) 687 return 688 }, 689 "pkix.name.province": func(r plugin.Resource, v *llx.RawData) (ok bool) { 690 r.(*mqlPkixName).Province, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) 691 return 692 }, 693 "pkix.name.streetAddress": func(r plugin.Resource, v *llx.RawData) (ok bool) { 694 r.(*mqlPkixName).StreetAddress, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) 695 return 696 }, 697 "pkix.name.postalCode": func(r plugin.Resource, v *llx.RawData) (ok bool) { 698 r.(*mqlPkixName).PostalCode, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) 699 return 700 }, 701 "pkix.name.names": func(r plugin.Resource, v *llx.RawData) (ok bool) { 702 r.(*mqlPkixName).Names, ok = plugin.RawToTValue[map[string]interface{}](v.Value, v.Error) 703 return 704 }, 705 "pkix.name.extraNames": func(r plugin.Resource, v *llx.RawData) (ok bool) { 706 r.(*mqlPkixName).ExtraNames, ok = plugin.RawToTValue[map[string]interface{}](v.Value, v.Error) 707 return 708 }, 709 "pkix.extension.__id": func(r plugin.Resource, v *llx.RawData) (ok bool) { 710 r.(*mqlPkixExtension).__id, ok = v.Value.(string) 711 return 712 }, 713 "pkix.extension.identifier": func(r plugin.Resource, v *llx.RawData) (ok bool) { 714 r.(*mqlPkixExtension).Identifier, ok = plugin.RawToTValue[string](v.Value, v.Error) 715 return 716 }, 717 "pkix.extension.critical": func(r plugin.Resource, v *llx.RawData) (ok bool) { 718 r.(*mqlPkixExtension).Critical, ok = plugin.RawToTValue[bool](v.Value, v.Error) 719 return 720 }, 721 "pkix.extension.value": func(r plugin.Resource, v *llx.RawData) (ok bool) { 722 r.(*mqlPkixExtension).Value, ok = plugin.RawToTValue[string](v.Value, v.Error) 723 return 724 }, 725 "openpgp.entities.__id": func(r plugin.Resource, v *llx.RawData) (ok bool) { 726 r.(*mqlOpenpgpEntities).__id, ok = v.Value.(string) 727 return 728 }, 729 "openpgp.entities.content": func(r plugin.Resource, v *llx.RawData) (ok bool) { 730 r.(*mqlOpenpgpEntities).Content, ok = plugin.RawToTValue[string](v.Value, v.Error) 731 return 732 }, 733 "openpgp.entities.list": func(r plugin.Resource, v *llx.RawData) (ok bool) { 734 r.(*mqlOpenpgpEntities).List, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) 735 return 736 }, 737 "openpgp.entity.__id": func(r plugin.Resource, v *llx.RawData) (ok bool) { 738 r.(*mqlOpenpgpEntity).__id, ok = v.Value.(string) 739 return 740 }, 741 "openpgp.entity.primaryPublicKey": func(r plugin.Resource, v *llx.RawData) (ok bool) { 742 r.(*mqlOpenpgpEntity).PrimaryPublicKey, ok = plugin.RawToTValue[*mqlOpenpgpPublicKey](v.Value, v.Error) 743 return 744 }, 745 "openpgp.entity.identities": func(r plugin.Resource, v *llx.RawData) (ok bool) { 746 r.(*mqlOpenpgpEntity).Identities, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) 747 return 748 }, 749 "openpgp.publicKey.__id": func(r plugin.Resource, v *llx.RawData) (ok bool) { 750 r.(*mqlOpenpgpPublicKey).__id, ok = v.Value.(string) 751 return 752 }, 753 "openpgp.publicKey.id": func(r plugin.Resource, v *llx.RawData) (ok bool) { 754 r.(*mqlOpenpgpPublicKey).Id, ok = plugin.RawToTValue[string](v.Value, v.Error) 755 return 756 }, 757 "openpgp.publicKey.version": func(r plugin.Resource, v *llx.RawData) (ok bool) { 758 r.(*mqlOpenpgpPublicKey).Version, ok = plugin.RawToTValue[int64](v.Value, v.Error) 759 return 760 }, 761 "openpgp.publicKey.fingerprint": func(r plugin.Resource, v *llx.RawData) (ok bool) { 762 r.(*mqlOpenpgpPublicKey).Fingerprint, ok = plugin.RawToTValue[string](v.Value, v.Error) 763 return 764 }, 765 "openpgp.publicKey.keyAlgorithm": func(r plugin.Resource, v *llx.RawData) (ok bool) { 766 r.(*mqlOpenpgpPublicKey).KeyAlgorithm, ok = plugin.RawToTValue[string](v.Value, v.Error) 767 return 768 }, 769 "openpgp.publicKey.bitLength": func(r plugin.Resource, v *llx.RawData) (ok bool) { 770 r.(*mqlOpenpgpPublicKey).BitLength, ok = plugin.RawToTValue[int64](v.Value, v.Error) 771 return 772 }, 773 "openpgp.publicKey.creationTime": func(r plugin.Resource, v *llx.RawData) (ok bool) { 774 r.(*mqlOpenpgpPublicKey).CreationTime, ok = plugin.RawToTValue[*time.Time](v.Value, v.Error) 775 return 776 }, 777 "openpgp.identity.__id": func(r plugin.Resource, v *llx.RawData) (ok bool) { 778 r.(*mqlOpenpgpIdentity).__id, ok = v.Value.(string) 779 return 780 }, 781 "openpgp.identity.fingerprint": func(r plugin.Resource, v *llx.RawData) (ok bool) { 782 r.(*mqlOpenpgpIdentity).Fingerprint, ok = plugin.RawToTValue[string](v.Value, v.Error) 783 return 784 }, 785 "openpgp.identity.id": func(r plugin.Resource, v *llx.RawData) (ok bool) { 786 r.(*mqlOpenpgpIdentity).Id, ok = plugin.RawToTValue[string](v.Value, v.Error) 787 return 788 }, 789 "openpgp.identity.name": func(r plugin.Resource, v *llx.RawData) (ok bool) { 790 r.(*mqlOpenpgpIdentity).Name, ok = plugin.RawToTValue[string](v.Value, v.Error) 791 return 792 }, 793 "openpgp.identity.email": func(r plugin.Resource, v *llx.RawData) (ok bool) { 794 r.(*mqlOpenpgpIdentity).Email, ok = plugin.RawToTValue[string](v.Value, v.Error) 795 return 796 }, 797 "openpgp.identity.comment": func(r plugin.Resource, v *llx.RawData) (ok bool) { 798 r.(*mqlOpenpgpIdentity).Comment, ok = plugin.RawToTValue[string](v.Value, v.Error) 799 return 800 }, 801 "openpgp.identity.signatures": func(r plugin.Resource, v *llx.RawData) (ok bool) { 802 r.(*mqlOpenpgpIdentity).Signatures, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) 803 return 804 }, 805 "openpgp.signature.__id": func(r plugin.Resource, v *llx.RawData) (ok bool) { 806 r.(*mqlOpenpgpSignature).__id, ok = v.Value.(string) 807 return 808 }, 809 "openpgp.signature.fingerprint": func(r plugin.Resource, v *llx.RawData) (ok bool) { 810 r.(*mqlOpenpgpSignature).Fingerprint, ok = plugin.RawToTValue[string](v.Value, v.Error) 811 return 812 }, 813 "openpgp.signature.identityName": func(r plugin.Resource, v *llx.RawData) (ok bool) { 814 r.(*mqlOpenpgpSignature).IdentityName, ok = plugin.RawToTValue[string](v.Value, v.Error) 815 return 816 }, 817 "openpgp.signature.hash": func(r plugin.Resource, v *llx.RawData) (ok bool) { 818 r.(*mqlOpenpgpSignature).Hash, ok = plugin.RawToTValue[string](v.Value, v.Error) 819 return 820 }, 821 "openpgp.signature.version": func(r plugin.Resource, v *llx.RawData) (ok bool) { 822 r.(*mqlOpenpgpSignature).Version, ok = plugin.RawToTValue[int64](v.Value, v.Error) 823 return 824 }, 825 "openpgp.signature.signatureType": func(r plugin.Resource, v *llx.RawData) (ok bool) { 826 r.(*mqlOpenpgpSignature).SignatureType, ok = plugin.RawToTValue[string](v.Value, v.Error) 827 return 828 }, 829 "openpgp.signature.keyAlgorithm": func(r plugin.Resource, v *llx.RawData) (ok bool) { 830 r.(*mqlOpenpgpSignature).KeyAlgorithm, ok = plugin.RawToTValue[string](v.Value, v.Error) 831 return 832 }, 833 "openpgp.signature.creationTime": func(r plugin.Resource, v *llx.RawData) (ok bool) { 834 r.(*mqlOpenpgpSignature).CreationTime, ok = plugin.RawToTValue[*time.Time](v.Value, v.Error) 835 return 836 }, 837 "openpgp.signature.lifetimeSecs": func(r plugin.Resource, v *llx.RawData) (ok bool) { 838 r.(*mqlOpenpgpSignature).LifetimeSecs, ok = plugin.RawToTValue[int64](v.Value, v.Error) 839 return 840 }, 841 "openpgp.signature.expiresIn": func(r plugin.Resource, v *llx.RawData) (ok bool) { 842 r.(*mqlOpenpgpSignature).ExpiresIn, ok = plugin.RawToTValue[*time.Time](v.Value, v.Error) 843 return 844 }, 845 "openpgp.signature.keyLifetimeSecs": func(r plugin.Resource, v *llx.RawData) (ok bool) { 846 r.(*mqlOpenpgpSignature).KeyLifetimeSecs, ok = plugin.RawToTValue[int64](v.Value, v.Error) 847 return 848 }, 849 "openpgp.signature.keyExpiresIn": func(r plugin.Resource, v *llx.RawData) (ok bool) { 850 r.(*mqlOpenpgpSignature).KeyExpiresIn, ok = plugin.RawToTValue[*time.Time](v.Value, v.Error) 851 return 852 }, 853 "domainName.__id": func(r plugin.Resource, v *llx.RawData) (ok bool) { 854 r.(*mqlDomainName).__id, ok = v.Value.(string) 855 return 856 }, 857 "domainName.fqdn": func(r plugin.Resource, v *llx.RawData) (ok bool) { 858 r.(*mqlDomainName).Fqdn, ok = plugin.RawToTValue[string](v.Value, v.Error) 859 return 860 }, 861 "domainName.effectiveTLDPlusOne": func(r plugin.Resource, v *llx.RawData) (ok bool) { 862 r.(*mqlDomainName).EffectiveTLDPlusOne, ok = plugin.RawToTValue[string](v.Value, v.Error) 863 return 864 }, 865 "domainName.tld": func(r plugin.Resource, v *llx.RawData) (ok bool) { 866 r.(*mqlDomainName).Tld, ok = plugin.RawToTValue[string](v.Value, v.Error) 867 return 868 }, 869 "domainName.tldIcannManaged": func(r plugin.Resource, v *llx.RawData) (ok bool) { 870 r.(*mqlDomainName).TldIcannManaged, ok = plugin.RawToTValue[bool](v.Value, v.Error) 871 return 872 }, 873 "domainName.labels": func(r plugin.Resource, v *llx.RawData) (ok bool) { 874 r.(*mqlDomainName).Labels, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) 875 return 876 }, 877 "dns.__id": func(r plugin.Resource, v *llx.RawData) (ok bool) { 878 r.(*mqlDns).__id, ok = v.Value.(string) 879 return 880 }, 881 "dns.fqdn": func(r plugin.Resource, v *llx.RawData) (ok bool) { 882 r.(*mqlDns).Fqdn, ok = plugin.RawToTValue[string](v.Value, v.Error) 883 return 884 }, 885 "dns.params": func(r plugin.Resource, v *llx.RawData) (ok bool) { 886 r.(*mqlDns).Params, ok = plugin.RawToTValue[interface{}](v.Value, v.Error) 887 return 888 }, 889 "dns.records": func(r plugin.Resource, v *llx.RawData) (ok bool) { 890 r.(*mqlDns).Records, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) 891 return 892 }, 893 "dns.mx": func(r plugin.Resource, v *llx.RawData) (ok bool) { 894 r.(*mqlDns).Mx, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) 895 return 896 }, 897 "dns.dkim": func(r plugin.Resource, v *llx.RawData) (ok bool) { 898 r.(*mqlDns).Dkim, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) 899 return 900 }, 901 "dns.record.__id": func(r plugin.Resource, v *llx.RawData) (ok bool) { 902 r.(*mqlDnsRecord).__id, ok = v.Value.(string) 903 return 904 }, 905 "dns.record.name": func(r plugin.Resource, v *llx.RawData) (ok bool) { 906 r.(*mqlDnsRecord).Name, ok = plugin.RawToTValue[string](v.Value, v.Error) 907 return 908 }, 909 "dns.record.ttl": func(r plugin.Resource, v *llx.RawData) (ok bool) { 910 r.(*mqlDnsRecord).Ttl, ok = plugin.RawToTValue[int64](v.Value, v.Error) 911 return 912 }, 913 "dns.record.class": func(r plugin.Resource, v *llx.RawData) (ok bool) { 914 r.(*mqlDnsRecord).Class, ok = plugin.RawToTValue[string](v.Value, v.Error) 915 return 916 }, 917 "dns.record.type": func(r plugin.Resource, v *llx.RawData) (ok bool) { 918 r.(*mqlDnsRecord).Type, ok = plugin.RawToTValue[string](v.Value, v.Error) 919 return 920 }, 921 "dns.record.rdata": func(r plugin.Resource, v *llx.RawData) (ok bool) { 922 r.(*mqlDnsRecord).Rdata, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) 923 return 924 }, 925 "dns.mxRecord.__id": func(r plugin.Resource, v *llx.RawData) (ok bool) { 926 r.(*mqlDnsMxRecord).__id, ok = v.Value.(string) 927 return 928 }, 929 "dns.mxRecord.name": func(r plugin.Resource, v *llx.RawData) (ok bool) { 930 r.(*mqlDnsMxRecord).Name, ok = plugin.RawToTValue[string](v.Value, v.Error) 931 return 932 }, 933 "dns.mxRecord.preference": func(r plugin.Resource, v *llx.RawData) (ok bool) { 934 r.(*mqlDnsMxRecord).Preference, ok = plugin.RawToTValue[int64](v.Value, v.Error) 935 return 936 }, 937 "dns.mxRecord.domainName": func(r plugin.Resource, v *llx.RawData) (ok bool) { 938 r.(*mqlDnsMxRecord).DomainName, ok = plugin.RawToTValue[string](v.Value, v.Error) 939 return 940 }, 941 "dns.dkimRecord.__id": func(r plugin.Resource, v *llx.RawData) (ok bool) { 942 r.(*mqlDnsDkimRecord).__id, ok = v.Value.(string) 943 return 944 }, 945 "dns.dkimRecord.dnsTxt": func(r plugin.Resource, v *llx.RawData) (ok bool) { 946 r.(*mqlDnsDkimRecord).DnsTxt, ok = plugin.RawToTValue[string](v.Value, v.Error) 947 return 948 }, 949 "dns.dkimRecord.domain": func(r plugin.Resource, v *llx.RawData) (ok bool) { 950 r.(*mqlDnsDkimRecord).Domain, ok = plugin.RawToTValue[string](v.Value, v.Error) 951 return 952 }, 953 "dns.dkimRecord.version": func(r plugin.Resource, v *llx.RawData) (ok bool) { 954 r.(*mqlDnsDkimRecord).Version, ok = plugin.RawToTValue[string](v.Value, v.Error) 955 return 956 }, 957 "dns.dkimRecord.hashAlgorithms": func(r plugin.Resource, v *llx.RawData) (ok bool) { 958 r.(*mqlDnsDkimRecord).HashAlgorithms, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) 959 return 960 }, 961 "dns.dkimRecord.keyType": func(r plugin.Resource, v *llx.RawData) (ok bool) { 962 r.(*mqlDnsDkimRecord).KeyType, ok = plugin.RawToTValue[string](v.Value, v.Error) 963 return 964 }, 965 "dns.dkimRecord.notes": func(r plugin.Resource, v *llx.RawData) (ok bool) { 966 r.(*mqlDnsDkimRecord).Notes, ok = plugin.RawToTValue[string](v.Value, v.Error) 967 return 968 }, 969 "dns.dkimRecord.publicKeyData": func(r plugin.Resource, v *llx.RawData) (ok bool) { 970 r.(*mqlDnsDkimRecord).PublicKeyData, ok = plugin.RawToTValue[string](v.Value, v.Error) 971 return 972 }, 973 "dns.dkimRecord.serviceTypes": func(r plugin.Resource, v *llx.RawData) (ok bool) { 974 r.(*mqlDnsDkimRecord).ServiceTypes, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) 975 return 976 }, 977 "dns.dkimRecord.flags": func(r plugin.Resource, v *llx.RawData) (ok bool) { 978 r.(*mqlDnsDkimRecord).Flags, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) 979 return 980 }, 981 "dns.dkimRecord.valid": func(r plugin.Resource, v *llx.RawData) (ok bool) { 982 r.(*mqlDnsDkimRecord).Valid, ok = plugin.RawToTValue[bool](v.Value, v.Error) 983 return 984 }, 985 } 986 987 func SetData(resource plugin.Resource, field string, val *llx.RawData) error { 988 f, ok := setDataFields[resource.MqlName() + "." + field] 989 if !ok { 990 return errors.New("[network] cannot set '"+field+"' in resource '"+resource.MqlName()+"', field not found") 991 } 992 993 if ok := f(resource, val); !ok { 994 return errors.New("[network] cannot set '"+field+"' in resource '"+resource.MqlName()+"', type does not match") 995 } 996 return nil 997 } 998 999 func SetAllData(resource plugin.Resource, args map[string]*llx.RawData) error { 1000 var err error 1001 for k, v := range args { 1002 if err = SetData(resource, k, v); err != nil { 1003 return err 1004 } 1005 } 1006 return nil 1007 } 1008 1009 // mqlSocket for the socket resource 1010 type mqlSocket struct { 1011 MqlRuntime *plugin.Runtime 1012 __id string 1013 // optional: if you define mqlSocketInternal it will be used here 1014 Protocol plugin.TValue[string] 1015 Port plugin.TValue[int64] 1016 Address plugin.TValue[string] 1017 } 1018 1019 // createSocket creates a new instance of this resource 1020 func createSocket(runtime *plugin.Runtime, args map[string]*llx.RawData) (plugin.Resource, error) { 1021 res := &mqlSocket{ 1022 MqlRuntime: runtime, 1023 } 1024 1025 err := SetAllData(res, args) 1026 if err != nil { 1027 return res, err 1028 } 1029 1030 if res.__id == "" { 1031 res.__id, err = res.id() 1032 if err != nil { 1033 return nil, err 1034 } 1035 } 1036 1037 if runtime.HasRecording { 1038 args, err = runtime.ResourceFromRecording("socket", res.__id) 1039 if err != nil || args == nil { 1040 return res, err 1041 } 1042 return res, SetAllData(res, args) 1043 } 1044 1045 return res, nil 1046 } 1047 1048 func (c *mqlSocket) MqlName() string { 1049 return "socket" 1050 } 1051 1052 func (c *mqlSocket) MqlID() string { 1053 return c.__id 1054 } 1055 1056 func (c *mqlSocket) GetProtocol() *plugin.TValue[string] { 1057 return &c.Protocol 1058 } 1059 1060 func (c *mqlSocket) GetPort() *plugin.TValue[int64] { 1061 return &c.Port 1062 } 1063 1064 func (c *mqlSocket) GetAddress() *plugin.TValue[string] { 1065 return &c.Address 1066 } 1067 1068 // mqlTls for the tls resource 1069 type mqlTls struct { 1070 MqlRuntime *plugin.Runtime 1071 __id string 1072 mqlTlsInternal 1073 Socket plugin.TValue[*mqlSocket] 1074 DomainName plugin.TValue[string] 1075 Params plugin.TValue[interface{}] 1076 Versions plugin.TValue[[]interface{}] 1077 Ciphers plugin.TValue[[]interface{}] 1078 Extensions plugin.TValue[[]interface{}] 1079 Certificates plugin.TValue[[]interface{}] 1080 NonSniCertificates plugin.TValue[[]interface{}] 1081 } 1082 1083 // createTls creates a new instance of this resource 1084 func createTls(runtime *plugin.Runtime, args map[string]*llx.RawData) (plugin.Resource, error) { 1085 res := &mqlTls{ 1086 MqlRuntime: runtime, 1087 } 1088 1089 err := SetAllData(res, args) 1090 if err != nil { 1091 return res, err 1092 } 1093 1094 if res.__id == "" { 1095 res.__id, err = res.id() 1096 if err != nil { 1097 return nil, err 1098 } 1099 } 1100 1101 if runtime.HasRecording { 1102 args, err = runtime.ResourceFromRecording("tls", res.__id) 1103 if err != nil || args == nil { 1104 return res, err 1105 } 1106 return res, SetAllData(res, args) 1107 } 1108 1109 return res, nil 1110 } 1111 1112 func (c *mqlTls) MqlName() string { 1113 return "tls" 1114 } 1115 1116 func (c *mqlTls) MqlID() string { 1117 return c.__id 1118 } 1119 1120 func (c *mqlTls) GetSocket() *plugin.TValue[*mqlSocket] { 1121 return &c.Socket 1122 } 1123 1124 func (c *mqlTls) GetDomainName() *plugin.TValue[string] { 1125 return &c.DomainName 1126 } 1127 1128 func (c *mqlTls) GetParams() *plugin.TValue[interface{}] { 1129 return plugin.GetOrCompute[interface{}](&c.Params, func() (interface{}, error) { 1130 vargSocket := c.GetSocket() 1131 if vargSocket.Error != nil { 1132 return nil, vargSocket.Error 1133 } 1134 1135 vargDomainName := c.GetDomainName() 1136 if vargDomainName.Error != nil { 1137 return nil, vargDomainName.Error 1138 } 1139 1140 return c.params(vargSocket.Data, vargDomainName.Data) 1141 }) 1142 } 1143 1144 func (c *mqlTls) GetVersions() *plugin.TValue[[]interface{}] { 1145 return plugin.GetOrCompute[[]interface{}](&c.Versions, func() ([]interface{}, error) { 1146 vargParams := c.GetParams() 1147 if vargParams.Error != nil { 1148 return nil, vargParams.Error 1149 } 1150 1151 return c.versions(vargParams.Data) 1152 }) 1153 } 1154 1155 func (c *mqlTls) GetCiphers() *plugin.TValue[[]interface{}] { 1156 return plugin.GetOrCompute[[]interface{}](&c.Ciphers, func() ([]interface{}, error) { 1157 vargParams := c.GetParams() 1158 if vargParams.Error != nil { 1159 return nil, vargParams.Error 1160 } 1161 1162 return c.ciphers(vargParams.Data) 1163 }) 1164 } 1165 1166 func (c *mqlTls) GetExtensions() *plugin.TValue[[]interface{}] { 1167 return plugin.GetOrCompute[[]interface{}](&c.Extensions, func() ([]interface{}, error) { 1168 vargParams := c.GetParams() 1169 if vargParams.Error != nil { 1170 return nil, vargParams.Error 1171 } 1172 1173 return c.extensions(vargParams.Data) 1174 }) 1175 } 1176 1177 func (c *mqlTls) GetCertificates() *plugin.TValue[[]interface{}] { 1178 return plugin.GetOrCompute[[]interface{}](&c.Certificates, func() ([]interface{}, error) { 1179 if c.MqlRuntime.HasRecording { 1180 d, err := c.MqlRuntime.FieldResourceFromRecording("tls", c.__id, "certificates") 1181 if err != nil { 1182 return nil, err 1183 } 1184 if d != nil { 1185 return d.Value.([]interface{}), nil 1186 } 1187 } 1188 1189 vargParams := c.GetParams() 1190 if vargParams.Error != nil { 1191 return nil, vargParams.Error 1192 } 1193 1194 return c.certificates(vargParams.Data) 1195 }) 1196 } 1197 1198 func (c *mqlTls) GetNonSniCertificates() *plugin.TValue[[]interface{}] { 1199 return plugin.GetOrCompute[[]interface{}](&c.NonSniCertificates, func() ([]interface{}, error) { 1200 if c.MqlRuntime.HasRecording { 1201 d, err := c.MqlRuntime.FieldResourceFromRecording("tls", c.__id, "nonSniCertificates") 1202 if err != nil { 1203 return nil, err 1204 } 1205 if d != nil { 1206 return d.Value.([]interface{}), nil 1207 } 1208 } 1209 1210 vargParams := c.GetParams() 1211 if vargParams.Error != nil { 1212 return nil, vargParams.Error 1213 } 1214 1215 return c.nonSniCertificates(vargParams.Data) 1216 }) 1217 } 1218 1219 // mqlCertificates for the certificates resource 1220 type mqlCertificates struct { 1221 MqlRuntime *plugin.Runtime 1222 __id string 1223 // optional: if you define mqlCertificatesInternal it will be used here 1224 Pem plugin.TValue[string] 1225 List plugin.TValue[[]interface{}] 1226 } 1227 1228 // createCertificates creates a new instance of this resource 1229 func createCertificates(runtime *plugin.Runtime, args map[string]*llx.RawData) (plugin.Resource, error) { 1230 res := &mqlCertificates{ 1231 MqlRuntime: runtime, 1232 } 1233 1234 err := SetAllData(res, args) 1235 if err != nil { 1236 return res, err 1237 } 1238 1239 if res.__id == "" { 1240 res.__id, err = res.id() 1241 if err != nil { 1242 return nil, err 1243 } 1244 } 1245 1246 if runtime.HasRecording { 1247 args, err = runtime.ResourceFromRecording("certificates", res.__id) 1248 if err != nil || args == nil { 1249 return res, err 1250 } 1251 return res, SetAllData(res, args) 1252 } 1253 1254 return res, nil 1255 } 1256 1257 func (c *mqlCertificates) MqlName() string { 1258 return "certificates" 1259 } 1260 1261 func (c *mqlCertificates) MqlID() string { 1262 return c.__id 1263 } 1264 1265 func (c *mqlCertificates) GetPem() *plugin.TValue[string] { 1266 return &c.Pem 1267 } 1268 1269 func (c *mqlCertificates) GetList() *plugin.TValue[[]interface{}] { 1270 return plugin.GetOrCompute[[]interface{}](&c.List, func() ([]interface{}, error) { 1271 if c.MqlRuntime.HasRecording { 1272 d, err := c.MqlRuntime.FieldResourceFromRecording("certificates", c.__id, "list") 1273 if err != nil { 1274 return nil, err 1275 } 1276 if d != nil { 1277 return d.Value.([]interface{}), nil 1278 } 1279 } 1280 1281 return c.list() 1282 }) 1283 } 1284 1285 // mqlCertificate for the certificate resource 1286 type mqlCertificate struct { 1287 MqlRuntime *plugin.Runtime 1288 __id string 1289 mqlCertificateInternal 1290 Pem plugin.TValue[string] 1291 Fingerprints plugin.TValue[map[string]interface{}] 1292 Serial plugin.TValue[string] 1293 SubjectKeyID plugin.TValue[string] 1294 AuthorityKeyID plugin.TValue[string] 1295 Subject plugin.TValue[*mqlPkixName] 1296 Issuer plugin.TValue[*mqlPkixName] 1297 Version plugin.TValue[int64] 1298 NotBefore plugin.TValue[*time.Time] 1299 NotAfter plugin.TValue[*time.Time] 1300 ExpiresIn plugin.TValue[*time.Time] 1301 Signature plugin.TValue[string] 1302 SigningAlgorithm plugin.TValue[string] 1303 IsCA plugin.TValue[bool] 1304 KeyUsage plugin.TValue[[]interface{}] 1305 ExtendedKeyUsage plugin.TValue[[]interface{}] 1306 Extensions plugin.TValue[[]interface{}] 1307 PolicyIdentifier plugin.TValue[[]interface{}] 1308 CrlDistributionPoints plugin.TValue[[]interface{}] 1309 OcspServer plugin.TValue[[]interface{}] 1310 IssuingCertificateUrl plugin.TValue[[]interface{}] 1311 IsRevoked plugin.TValue[bool] 1312 RevokedAt plugin.TValue[*time.Time] 1313 IsVerified plugin.TValue[bool] 1314 } 1315 1316 // createCertificate creates a new instance of this resource 1317 func createCertificate(runtime *plugin.Runtime, args map[string]*llx.RawData) (plugin.Resource, error) { 1318 res := &mqlCertificate{ 1319 MqlRuntime: runtime, 1320 } 1321 1322 err := SetAllData(res, args) 1323 if err != nil { 1324 return res, err 1325 } 1326 1327 if res.__id == "" { 1328 res.__id, err = res.id() 1329 if err != nil { 1330 return nil, err 1331 } 1332 } 1333 1334 if runtime.HasRecording { 1335 args, err = runtime.ResourceFromRecording("certificate", res.__id) 1336 if err != nil || args == nil { 1337 return res, err 1338 } 1339 return res, SetAllData(res, args) 1340 } 1341 1342 return res, nil 1343 } 1344 1345 func (c *mqlCertificate) MqlName() string { 1346 return "certificate" 1347 } 1348 1349 func (c *mqlCertificate) MqlID() string { 1350 return c.__id 1351 } 1352 1353 func (c *mqlCertificate) GetPem() *plugin.TValue[string] { 1354 return &c.Pem 1355 } 1356 1357 func (c *mqlCertificate) GetFingerprints() *plugin.TValue[map[string]interface{}] { 1358 return plugin.GetOrCompute[map[string]interface{}](&c.Fingerprints, func() (map[string]interface{}, error) { 1359 return c.fingerprints() 1360 }) 1361 } 1362 1363 func (c *mqlCertificate) GetSerial() *plugin.TValue[string] { 1364 return plugin.GetOrCompute[string](&c.Serial, func() (string, error) { 1365 return c.serial() 1366 }) 1367 } 1368 1369 func (c *mqlCertificate) GetSubjectKeyID() *plugin.TValue[string] { 1370 return plugin.GetOrCompute[string](&c.SubjectKeyID, func() (string, error) { 1371 return c.subjectKeyID() 1372 }) 1373 } 1374 1375 func (c *mqlCertificate) GetAuthorityKeyID() *plugin.TValue[string] { 1376 return plugin.GetOrCompute[string](&c.AuthorityKeyID, func() (string, error) { 1377 return c.authorityKeyID() 1378 }) 1379 } 1380 1381 func (c *mqlCertificate) GetSubject() *plugin.TValue[*mqlPkixName] { 1382 return plugin.GetOrCompute[*mqlPkixName](&c.Subject, func() (*mqlPkixName, error) { 1383 if c.MqlRuntime.HasRecording { 1384 d, err := c.MqlRuntime.FieldResourceFromRecording("certificate", c.__id, "subject") 1385 if err != nil { 1386 return nil, err 1387 } 1388 if d != nil { 1389 return d.Value.(*mqlPkixName), nil 1390 } 1391 } 1392 1393 return c.subject() 1394 }) 1395 } 1396 1397 func (c *mqlCertificate) GetIssuer() *plugin.TValue[*mqlPkixName] { 1398 return plugin.GetOrCompute[*mqlPkixName](&c.Issuer, func() (*mqlPkixName, error) { 1399 if c.MqlRuntime.HasRecording { 1400 d, err := c.MqlRuntime.FieldResourceFromRecording("certificate", c.__id, "issuer") 1401 if err != nil { 1402 return nil, err 1403 } 1404 if d != nil { 1405 return d.Value.(*mqlPkixName), nil 1406 } 1407 } 1408 1409 return c.issuer() 1410 }) 1411 } 1412 1413 func (c *mqlCertificate) GetVersion() *plugin.TValue[int64] { 1414 return plugin.GetOrCompute[int64](&c.Version, func() (int64, error) { 1415 return c.version() 1416 }) 1417 } 1418 1419 func (c *mqlCertificate) GetNotBefore() *plugin.TValue[*time.Time] { 1420 return plugin.GetOrCompute[*time.Time](&c.NotBefore, func() (*time.Time, error) { 1421 return c.notBefore() 1422 }) 1423 } 1424 1425 func (c *mqlCertificate) GetNotAfter() *plugin.TValue[*time.Time] { 1426 return plugin.GetOrCompute[*time.Time](&c.NotAfter, func() (*time.Time, error) { 1427 return c.notAfter() 1428 }) 1429 } 1430 1431 func (c *mqlCertificate) GetExpiresIn() *plugin.TValue[*time.Time] { 1432 return plugin.GetOrCompute[*time.Time](&c.ExpiresIn, func() (*time.Time, error) { 1433 return c.expiresIn() 1434 }) 1435 } 1436 1437 func (c *mqlCertificate) GetSignature() *plugin.TValue[string] { 1438 return plugin.GetOrCompute[string](&c.Signature, func() (string, error) { 1439 return c.signature() 1440 }) 1441 } 1442 1443 func (c *mqlCertificate) GetSigningAlgorithm() *plugin.TValue[string] { 1444 return plugin.GetOrCompute[string](&c.SigningAlgorithm, func() (string, error) { 1445 return c.signingAlgorithm() 1446 }) 1447 } 1448 1449 func (c *mqlCertificate) GetIsCA() *plugin.TValue[bool] { 1450 return plugin.GetOrCompute[bool](&c.IsCA, func() (bool, error) { 1451 return c.isCA() 1452 }) 1453 } 1454 1455 func (c *mqlCertificate) GetKeyUsage() *plugin.TValue[[]interface{}] { 1456 return plugin.GetOrCompute[[]interface{}](&c.KeyUsage, func() ([]interface{}, error) { 1457 return c.keyUsage() 1458 }) 1459 } 1460 1461 func (c *mqlCertificate) GetExtendedKeyUsage() *plugin.TValue[[]interface{}] { 1462 return plugin.GetOrCompute[[]interface{}](&c.ExtendedKeyUsage, func() ([]interface{}, error) { 1463 return c.extendedKeyUsage() 1464 }) 1465 } 1466 1467 func (c *mqlCertificate) GetExtensions() *plugin.TValue[[]interface{}] { 1468 return plugin.GetOrCompute[[]interface{}](&c.Extensions, func() ([]interface{}, error) { 1469 if c.MqlRuntime.HasRecording { 1470 d, err := c.MqlRuntime.FieldResourceFromRecording("certificate", c.__id, "extensions") 1471 if err != nil { 1472 return nil, err 1473 } 1474 if d != nil { 1475 return d.Value.([]interface{}), nil 1476 } 1477 } 1478 1479 return c.extensions() 1480 }) 1481 } 1482 1483 func (c *mqlCertificate) GetPolicyIdentifier() *plugin.TValue[[]interface{}] { 1484 return plugin.GetOrCompute[[]interface{}](&c.PolicyIdentifier, func() ([]interface{}, error) { 1485 return c.policyIdentifier() 1486 }) 1487 } 1488 1489 func (c *mqlCertificate) GetCrlDistributionPoints() *plugin.TValue[[]interface{}] { 1490 return plugin.GetOrCompute[[]interface{}](&c.CrlDistributionPoints, func() ([]interface{}, error) { 1491 return c.crlDistributionPoints() 1492 }) 1493 } 1494 1495 func (c *mqlCertificate) GetOcspServer() *plugin.TValue[[]interface{}] { 1496 return plugin.GetOrCompute[[]interface{}](&c.OcspServer, func() ([]interface{}, error) { 1497 return c.ocspServer() 1498 }) 1499 } 1500 1501 func (c *mqlCertificate) GetIssuingCertificateUrl() *plugin.TValue[[]interface{}] { 1502 return plugin.GetOrCompute[[]interface{}](&c.IssuingCertificateUrl, func() ([]interface{}, error) { 1503 return c.issuingCertificateUrl() 1504 }) 1505 } 1506 1507 func (c *mqlCertificate) GetIsRevoked() *plugin.TValue[bool] { 1508 return plugin.GetOrCompute[bool](&c.IsRevoked, func() (bool, error) { 1509 return c.isRevoked() 1510 }) 1511 } 1512 1513 func (c *mqlCertificate) GetRevokedAt() *plugin.TValue[*time.Time] { 1514 return plugin.GetOrCompute[*time.Time](&c.RevokedAt, func() (*time.Time, error) { 1515 return c.revokedAt() 1516 }) 1517 } 1518 1519 func (c *mqlCertificate) GetIsVerified() *plugin.TValue[bool] { 1520 return plugin.GetOrCompute[bool](&c.IsVerified, func() (bool, error) { 1521 return c.isVerified() 1522 }) 1523 } 1524 1525 // mqlPkixName for the pkix.name resource 1526 type mqlPkixName struct { 1527 MqlRuntime *plugin.Runtime 1528 __id string 1529 // optional: if you define mqlPkixNameInternal it will be used here 1530 Id plugin.TValue[string] 1531 Dn plugin.TValue[string] 1532 SerialNumber plugin.TValue[string] 1533 CommonName plugin.TValue[string] 1534 Country plugin.TValue[[]interface{}] 1535 Organization plugin.TValue[[]interface{}] 1536 OrganizationalUnit plugin.TValue[[]interface{}] 1537 Locality plugin.TValue[[]interface{}] 1538 Province plugin.TValue[[]interface{}] 1539 StreetAddress plugin.TValue[[]interface{}] 1540 PostalCode plugin.TValue[[]interface{}] 1541 Names plugin.TValue[map[string]interface{}] 1542 ExtraNames plugin.TValue[map[string]interface{}] 1543 } 1544 1545 // createPkixName creates a new instance of this resource 1546 func createPkixName(runtime *plugin.Runtime, args map[string]*llx.RawData) (plugin.Resource, error) { 1547 res := &mqlPkixName{ 1548 MqlRuntime: runtime, 1549 } 1550 1551 err := SetAllData(res, args) 1552 if err != nil { 1553 return res, err 1554 } 1555 1556 if res.__id == "" { 1557 res.__id, err = res.id() 1558 if err != nil { 1559 return nil, err 1560 } 1561 } 1562 1563 if runtime.HasRecording { 1564 args, err = runtime.ResourceFromRecording("pkix.name", res.__id) 1565 if err != nil || args == nil { 1566 return res, err 1567 } 1568 return res, SetAllData(res, args) 1569 } 1570 1571 return res, nil 1572 } 1573 1574 func (c *mqlPkixName) MqlName() string { 1575 return "pkix.name" 1576 } 1577 1578 func (c *mqlPkixName) MqlID() string { 1579 return c.__id 1580 } 1581 1582 func (c *mqlPkixName) GetId() *plugin.TValue[string] { 1583 return &c.Id 1584 } 1585 1586 func (c *mqlPkixName) GetDn() *plugin.TValue[string] { 1587 return &c.Dn 1588 } 1589 1590 func (c *mqlPkixName) GetSerialNumber() *plugin.TValue[string] { 1591 return &c.SerialNumber 1592 } 1593 1594 func (c *mqlPkixName) GetCommonName() *plugin.TValue[string] { 1595 return &c.CommonName 1596 } 1597 1598 func (c *mqlPkixName) GetCountry() *plugin.TValue[[]interface{}] { 1599 return &c.Country 1600 } 1601 1602 func (c *mqlPkixName) GetOrganization() *plugin.TValue[[]interface{}] { 1603 return &c.Organization 1604 } 1605 1606 func (c *mqlPkixName) GetOrganizationalUnit() *plugin.TValue[[]interface{}] { 1607 return &c.OrganizationalUnit 1608 } 1609 1610 func (c *mqlPkixName) GetLocality() *plugin.TValue[[]interface{}] { 1611 return &c.Locality 1612 } 1613 1614 func (c *mqlPkixName) GetProvince() *plugin.TValue[[]interface{}] { 1615 return &c.Province 1616 } 1617 1618 func (c *mqlPkixName) GetStreetAddress() *plugin.TValue[[]interface{}] { 1619 return &c.StreetAddress 1620 } 1621 1622 func (c *mqlPkixName) GetPostalCode() *plugin.TValue[[]interface{}] { 1623 return &c.PostalCode 1624 } 1625 1626 func (c *mqlPkixName) GetNames() *plugin.TValue[map[string]interface{}] { 1627 return &c.Names 1628 } 1629 1630 func (c *mqlPkixName) GetExtraNames() *plugin.TValue[map[string]interface{}] { 1631 return &c.ExtraNames 1632 } 1633 1634 // mqlPkixExtension for the pkix.extension resource 1635 type mqlPkixExtension struct { 1636 MqlRuntime *plugin.Runtime 1637 __id string 1638 // optional: if you define mqlPkixExtensionInternal it will be used here 1639 Identifier plugin.TValue[string] 1640 Critical plugin.TValue[bool] 1641 Value plugin.TValue[string] 1642 } 1643 1644 // createPkixExtension creates a new instance of this resource 1645 func createPkixExtension(runtime *plugin.Runtime, args map[string]*llx.RawData) (plugin.Resource, error) { 1646 res := &mqlPkixExtension{ 1647 MqlRuntime: runtime, 1648 } 1649 1650 err := SetAllData(res, args) 1651 if err != nil { 1652 return res, err 1653 } 1654 1655 if res.__id == "" { 1656 res.__id, err = res.id() 1657 if err != nil { 1658 return nil, err 1659 } 1660 } 1661 1662 if runtime.HasRecording { 1663 args, err = runtime.ResourceFromRecording("pkix.extension", res.__id) 1664 if err != nil || args == nil { 1665 return res, err 1666 } 1667 return res, SetAllData(res, args) 1668 } 1669 1670 return res, nil 1671 } 1672 1673 func (c *mqlPkixExtension) MqlName() string { 1674 return "pkix.extension" 1675 } 1676 1677 func (c *mqlPkixExtension) MqlID() string { 1678 return c.__id 1679 } 1680 1681 func (c *mqlPkixExtension) GetIdentifier() *plugin.TValue[string] { 1682 return &c.Identifier 1683 } 1684 1685 func (c *mqlPkixExtension) GetCritical() *plugin.TValue[bool] { 1686 return &c.Critical 1687 } 1688 1689 func (c *mqlPkixExtension) GetValue() *plugin.TValue[string] { 1690 return &c.Value 1691 } 1692 1693 // mqlOpenpgpEntities for the openpgp.entities resource 1694 type mqlOpenpgpEntities struct { 1695 MqlRuntime *plugin.Runtime 1696 __id string 1697 // optional: if you define mqlOpenpgpEntitiesInternal it will be used here 1698 Content plugin.TValue[string] 1699 List plugin.TValue[[]interface{}] 1700 } 1701 1702 // createOpenpgpEntities creates a new instance of this resource 1703 func createOpenpgpEntities(runtime *plugin.Runtime, args map[string]*llx.RawData) (plugin.Resource, error) { 1704 res := &mqlOpenpgpEntities{ 1705 MqlRuntime: runtime, 1706 } 1707 1708 err := SetAllData(res, args) 1709 if err != nil { 1710 return res, err 1711 } 1712 1713 // to override __id implement: id() (string, error) 1714 1715 if runtime.HasRecording { 1716 args, err = runtime.ResourceFromRecording("openpgp.entities", res.__id) 1717 if err != nil || args == nil { 1718 return res, err 1719 } 1720 return res, SetAllData(res, args) 1721 } 1722 1723 return res, nil 1724 } 1725 1726 func (c *mqlOpenpgpEntities) MqlName() string { 1727 return "openpgp.entities" 1728 } 1729 1730 func (c *mqlOpenpgpEntities) MqlID() string { 1731 return c.__id 1732 } 1733 1734 func (c *mqlOpenpgpEntities) GetContent() *plugin.TValue[string] { 1735 return &c.Content 1736 } 1737 1738 func (c *mqlOpenpgpEntities) GetList() *plugin.TValue[[]interface{}] { 1739 return plugin.GetOrCompute[[]interface{}](&c.List, func() ([]interface{}, error) { 1740 if c.MqlRuntime.HasRecording { 1741 d, err := c.MqlRuntime.FieldResourceFromRecording("openpgp.entities", c.__id, "list") 1742 if err != nil { 1743 return nil, err 1744 } 1745 if d != nil { 1746 return d.Value.([]interface{}), nil 1747 } 1748 } 1749 1750 vargContent := c.GetContent() 1751 if vargContent.Error != nil { 1752 return nil, vargContent.Error 1753 } 1754 1755 return c.list(vargContent.Data) 1756 }) 1757 } 1758 1759 // mqlOpenpgpEntity for the openpgp.entity resource 1760 type mqlOpenpgpEntity struct { 1761 MqlRuntime *plugin.Runtime 1762 __id string 1763 mqlOpenpgpEntityInternal 1764 PrimaryPublicKey plugin.TValue[*mqlOpenpgpPublicKey] 1765 Identities plugin.TValue[[]interface{}] 1766 } 1767 1768 // createOpenpgpEntity creates a new instance of this resource 1769 func createOpenpgpEntity(runtime *plugin.Runtime, args map[string]*llx.RawData) (plugin.Resource, error) { 1770 res := &mqlOpenpgpEntity{ 1771 MqlRuntime: runtime, 1772 } 1773 1774 err := SetAllData(res, args) 1775 if err != nil { 1776 return res, err 1777 } 1778 1779 if res.__id == "" { 1780 res.__id, err = res.id() 1781 if err != nil { 1782 return nil, err 1783 } 1784 } 1785 1786 if runtime.HasRecording { 1787 args, err = runtime.ResourceFromRecording("openpgp.entity", res.__id) 1788 if err != nil || args == nil { 1789 return res, err 1790 } 1791 return res, SetAllData(res, args) 1792 } 1793 1794 return res, nil 1795 } 1796 1797 func (c *mqlOpenpgpEntity) MqlName() string { 1798 return "openpgp.entity" 1799 } 1800 1801 func (c *mqlOpenpgpEntity) MqlID() string { 1802 return c.__id 1803 } 1804 1805 func (c *mqlOpenpgpEntity) GetPrimaryPublicKey() *plugin.TValue[*mqlOpenpgpPublicKey] { 1806 return &c.PrimaryPublicKey 1807 } 1808 1809 func (c *mqlOpenpgpEntity) GetIdentities() *plugin.TValue[[]interface{}] { 1810 return plugin.GetOrCompute[[]interface{}](&c.Identities, func() ([]interface{}, error) { 1811 if c.MqlRuntime.HasRecording { 1812 d, err := c.MqlRuntime.FieldResourceFromRecording("openpgp.entity", c.__id, "identities") 1813 if err != nil { 1814 return nil, err 1815 } 1816 if d != nil { 1817 return d.Value.([]interface{}), nil 1818 } 1819 } 1820 1821 return c.identities() 1822 }) 1823 } 1824 1825 // mqlOpenpgpPublicKey for the openpgp.publicKey resource 1826 type mqlOpenpgpPublicKey struct { 1827 MqlRuntime *plugin.Runtime 1828 __id string 1829 // optional: if you define mqlOpenpgpPublicKeyInternal it will be used here 1830 Id plugin.TValue[string] 1831 Version plugin.TValue[int64] 1832 Fingerprint plugin.TValue[string] 1833 KeyAlgorithm plugin.TValue[string] 1834 BitLength plugin.TValue[int64] 1835 CreationTime plugin.TValue[*time.Time] 1836 } 1837 1838 // createOpenpgpPublicKey creates a new instance of this resource 1839 func createOpenpgpPublicKey(runtime *plugin.Runtime, args map[string]*llx.RawData) (plugin.Resource, error) { 1840 res := &mqlOpenpgpPublicKey{ 1841 MqlRuntime: runtime, 1842 } 1843 1844 err := SetAllData(res, args) 1845 if err != nil { 1846 return res, err 1847 } 1848 1849 if res.__id == "" { 1850 res.__id, err = res.id() 1851 if err != nil { 1852 return nil, err 1853 } 1854 } 1855 1856 if runtime.HasRecording { 1857 args, err = runtime.ResourceFromRecording("openpgp.publicKey", res.__id) 1858 if err != nil || args == nil { 1859 return res, err 1860 } 1861 return res, SetAllData(res, args) 1862 } 1863 1864 return res, nil 1865 } 1866 1867 func (c *mqlOpenpgpPublicKey) MqlName() string { 1868 return "openpgp.publicKey" 1869 } 1870 1871 func (c *mqlOpenpgpPublicKey) MqlID() string { 1872 return c.__id 1873 } 1874 1875 func (c *mqlOpenpgpPublicKey) GetId() *plugin.TValue[string] { 1876 return &c.Id 1877 } 1878 1879 func (c *mqlOpenpgpPublicKey) GetVersion() *plugin.TValue[int64] { 1880 return &c.Version 1881 } 1882 1883 func (c *mqlOpenpgpPublicKey) GetFingerprint() *plugin.TValue[string] { 1884 return &c.Fingerprint 1885 } 1886 1887 func (c *mqlOpenpgpPublicKey) GetKeyAlgorithm() *plugin.TValue[string] { 1888 return &c.KeyAlgorithm 1889 } 1890 1891 func (c *mqlOpenpgpPublicKey) GetBitLength() *plugin.TValue[int64] { 1892 return &c.BitLength 1893 } 1894 1895 func (c *mqlOpenpgpPublicKey) GetCreationTime() *plugin.TValue[*time.Time] { 1896 return &c.CreationTime 1897 } 1898 1899 // mqlOpenpgpIdentity for the openpgp.identity resource 1900 type mqlOpenpgpIdentity struct { 1901 MqlRuntime *plugin.Runtime 1902 __id string 1903 mqlOpenpgpIdentityInternal 1904 Fingerprint plugin.TValue[string] 1905 Id plugin.TValue[string] 1906 Name plugin.TValue[string] 1907 Email plugin.TValue[string] 1908 Comment plugin.TValue[string] 1909 Signatures plugin.TValue[[]interface{}] 1910 } 1911 1912 // createOpenpgpIdentity creates a new instance of this resource 1913 func createOpenpgpIdentity(runtime *plugin.Runtime, args map[string]*llx.RawData) (plugin.Resource, error) { 1914 res := &mqlOpenpgpIdentity{ 1915 MqlRuntime: runtime, 1916 } 1917 1918 err := SetAllData(res, args) 1919 if err != nil { 1920 return res, err 1921 } 1922 1923 if res.__id == "" { 1924 res.__id, err = res.id() 1925 if err != nil { 1926 return nil, err 1927 } 1928 } 1929 1930 if runtime.HasRecording { 1931 args, err = runtime.ResourceFromRecording("openpgp.identity", res.__id) 1932 if err != nil || args == nil { 1933 return res, err 1934 } 1935 return res, SetAllData(res, args) 1936 } 1937 1938 return res, nil 1939 } 1940 1941 func (c *mqlOpenpgpIdentity) MqlName() string { 1942 return "openpgp.identity" 1943 } 1944 1945 func (c *mqlOpenpgpIdentity) MqlID() string { 1946 return c.__id 1947 } 1948 1949 func (c *mqlOpenpgpIdentity) GetFingerprint() *plugin.TValue[string] { 1950 return &c.Fingerprint 1951 } 1952 1953 func (c *mqlOpenpgpIdentity) GetId() *plugin.TValue[string] { 1954 return &c.Id 1955 } 1956 1957 func (c *mqlOpenpgpIdentity) GetName() *plugin.TValue[string] { 1958 return &c.Name 1959 } 1960 1961 func (c *mqlOpenpgpIdentity) GetEmail() *plugin.TValue[string] { 1962 return &c.Email 1963 } 1964 1965 func (c *mqlOpenpgpIdentity) GetComment() *plugin.TValue[string] { 1966 return &c.Comment 1967 } 1968 1969 func (c *mqlOpenpgpIdentity) GetSignatures() *plugin.TValue[[]interface{}] { 1970 return plugin.GetOrCompute[[]interface{}](&c.Signatures, func() ([]interface{}, error) { 1971 if c.MqlRuntime.HasRecording { 1972 d, err := c.MqlRuntime.FieldResourceFromRecording("openpgp.identity", c.__id, "signatures") 1973 if err != nil { 1974 return nil, err 1975 } 1976 if d != nil { 1977 return d.Value.([]interface{}), nil 1978 } 1979 } 1980 1981 return c.signatures() 1982 }) 1983 } 1984 1985 // mqlOpenpgpSignature for the openpgp.signature resource 1986 type mqlOpenpgpSignature struct { 1987 MqlRuntime *plugin.Runtime 1988 __id string 1989 // optional: if you define mqlOpenpgpSignatureInternal it will be used here 1990 Fingerprint plugin.TValue[string] 1991 IdentityName plugin.TValue[string] 1992 Hash plugin.TValue[string] 1993 Version plugin.TValue[int64] 1994 SignatureType plugin.TValue[string] 1995 KeyAlgorithm plugin.TValue[string] 1996 CreationTime plugin.TValue[*time.Time] 1997 LifetimeSecs plugin.TValue[int64] 1998 ExpiresIn plugin.TValue[*time.Time] 1999 KeyLifetimeSecs plugin.TValue[int64] 2000 KeyExpiresIn plugin.TValue[*time.Time] 2001 } 2002 2003 // createOpenpgpSignature creates a new instance of this resource 2004 func createOpenpgpSignature(runtime *plugin.Runtime, args map[string]*llx.RawData) (plugin.Resource, error) { 2005 res := &mqlOpenpgpSignature{ 2006 MqlRuntime: runtime, 2007 } 2008 2009 err := SetAllData(res, args) 2010 if err != nil { 2011 return res, err 2012 } 2013 2014 if res.__id == "" { 2015 res.__id, err = res.id() 2016 if err != nil { 2017 return nil, err 2018 } 2019 } 2020 2021 if runtime.HasRecording { 2022 args, err = runtime.ResourceFromRecording("openpgp.signature", res.__id) 2023 if err != nil || args == nil { 2024 return res, err 2025 } 2026 return res, SetAllData(res, args) 2027 } 2028 2029 return res, nil 2030 } 2031 2032 func (c *mqlOpenpgpSignature) MqlName() string { 2033 return "openpgp.signature" 2034 } 2035 2036 func (c *mqlOpenpgpSignature) MqlID() string { 2037 return c.__id 2038 } 2039 2040 func (c *mqlOpenpgpSignature) GetFingerprint() *plugin.TValue[string] { 2041 return &c.Fingerprint 2042 } 2043 2044 func (c *mqlOpenpgpSignature) GetIdentityName() *plugin.TValue[string] { 2045 return &c.IdentityName 2046 } 2047 2048 func (c *mqlOpenpgpSignature) GetHash() *plugin.TValue[string] { 2049 return &c.Hash 2050 } 2051 2052 func (c *mqlOpenpgpSignature) GetVersion() *plugin.TValue[int64] { 2053 return &c.Version 2054 } 2055 2056 func (c *mqlOpenpgpSignature) GetSignatureType() *plugin.TValue[string] { 2057 return &c.SignatureType 2058 } 2059 2060 func (c *mqlOpenpgpSignature) GetKeyAlgorithm() *plugin.TValue[string] { 2061 return &c.KeyAlgorithm 2062 } 2063 2064 func (c *mqlOpenpgpSignature) GetCreationTime() *plugin.TValue[*time.Time] { 2065 return &c.CreationTime 2066 } 2067 2068 func (c *mqlOpenpgpSignature) GetLifetimeSecs() *plugin.TValue[int64] { 2069 return &c.LifetimeSecs 2070 } 2071 2072 func (c *mqlOpenpgpSignature) GetExpiresIn() *plugin.TValue[*time.Time] { 2073 return &c.ExpiresIn 2074 } 2075 2076 func (c *mqlOpenpgpSignature) GetKeyLifetimeSecs() *plugin.TValue[int64] { 2077 return &c.KeyLifetimeSecs 2078 } 2079 2080 func (c *mqlOpenpgpSignature) GetKeyExpiresIn() *plugin.TValue[*time.Time] { 2081 return &c.KeyExpiresIn 2082 } 2083 2084 // mqlDomainName for the domainName resource 2085 type mqlDomainName struct { 2086 MqlRuntime *plugin.Runtime 2087 __id string 2088 // optional: if you define mqlDomainNameInternal it will be used here 2089 Fqdn plugin.TValue[string] 2090 EffectiveTLDPlusOne plugin.TValue[string] 2091 Tld plugin.TValue[string] 2092 TldIcannManaged plugin.TValue[bool] 2093 Labels plugin.TValue[[]interface{}] 2094 } 2095 2096 // createDomainName creates a new instance of this resource 2097 func createDomainName(runtime *plugin.Runtime, args map[string]*llx.RawData) (plugin.Resource, error) { 2098 res := &mqlDomainName{ 2099 MqlRuntime: runtime, 2100 } 2101 2102 err := SetAllData(res, args) 2103 if err != nil { 2104 return res, err 2105 } 2106 2107 if res.__id == "" { 2108 res.__id, err = res.id() 2109 if err != nil { 2110 return nil, err 2111 } 2112 } 2113 2114 if runtime.HasRecording { 2115 args, err = runtime.ResourceFromRecording("domainName", res.__id) 2116 if err != nil || args == nil { 2117 return res, err 2118 } 2119 return res, SetAllData(res, args) 2120 } 2121 2122 return res, nil 2123 } 2124 2125 func (c *mqlDomainName) MqlName() string { 2126 return "domainName" 2127 } 2128 2129 func (c *mqlDomainName) MqlID() string { 2130 return c.__id 2131 } 2132 2133 func (c *mqlDomainName) GetFqdn() *plugin.TValue[string] { 2134 return &c.Fqdn 2135 } 2136 2137 func (c *mqlDomainName) GetEffectiveTLDPlusOne() *plugin.TValue[string] { 2138 return &c.EffectiveTLDPlusOne 2139 } 2140 2141 func (c *mqlDomainName) GetTld() *plugin.TValue[string] { 2142 return &c.Tld 2143 } 2144 2145 func (c *mqlDomainName) GetTldIcannManaged() *plugin.TValue[bool] { 2146 return &c.TldIcannManaged 2147 } 2148 2149 func (c *mqlDomainName) GetLabels() *plugin.TValue[[]interface{}] { 2150 return &c.Labels 2151 } 2152 2153 // mqlDns for the dns resource 2154 type mqlDns struct { 2155 MqlRuntime *plugin.Runtime 2156 __id string 2157 // optional: if you define mqlDnsInternal it will be used here 2158 Fqdn plugin.TValue[string] 2159 Params plugin.TValue[interface{}] 2160 Records plugin.TValue[[]interface{}] 2161 Mx plugin.TValue[[]interface{}] 2162 Dkim plugin.TValue[[]interface{}] 2163 } 2164 2165 // createDns creates a new instance of this resource 2166 func createDns(runtime *plugin.Runtime, args map[string]*llx.RawData) (plugin.Resource, error) { 2167 res := &mqlDns{ 2168 MqlRuntime: runtime, 2169 } 2170 2171 err := SetAllData(res, args) 2172 if err != nil { 2173 return res, err 2174 } 2175 2176 if res.__id == "" { 2177 res.__id, err = res.id() 2178 if err != nil { 2179 return nil, err 2180 } 2181 } 2182 2183 if runtime.HasRecording { 2184 args, err = runtime.ResourceFromRecording("dns", res.__id) 2185 if err != nil || args == nil { 2186 return res, err 2187 } 2188 return res, SetAllData(res, args) 2189 } 2190 2191 return res, nil 2192 } 2193 2194 func (c *mqlDns) MqlName() string { 2195 return "dns" 2196 } 2197 2198 func (c *mqlDns) MqlID() string { 2199 return c.__id 2200 } 2201 2202 func (c *mqlDns) GetFqdn() *plugin.TValue[string] { 2203 return &c.Fqdn 2204 } 2205 2206 func (c *mqlDns) GetParams() *plugin.TValue[interface{}] { 2207 return plugin.GetOrCompute[interface{}](&c.Params, func() (interface{}, error) { 2208 vargFqdn := c.GetFqdn() 2209 if vargFqdn.Error != nil { 2210 return nil, vargFqdn.Error 2211 } 2212 2213 return c.params(vargFqdn.Data) 2214 }) 2215 } 2216 2217 func (c *mqlDns) GetRecords() *plugin.TValue[[]interface{}] { 2218 return plugin.GetOrCompute[[]interface{}](&c.Records, func() ([]interface{}, error) { 2219 if c.MqlRuntime.HasRecording { 2220 d, err := c.MqlRuntime.FieldResourceFromRecording("dns", c.__id, "records") 2221 if err != nil { 2222 return nil, err 2223 } 2224 if d != nil { 2225 return d.Value.([]interface{}), nil 2226 } 2227 } 2228 2229 vargParams := c.GetParams() 2230 if vargParams.Error != nil { 2231 return nil, vargParams.Error 2232 } 2233 2234 return c.records(vargParams.Data) 2235 }) 2236 } 2237 2238 func (c *mqlDns) GetMx() *plugin.TValue[[]interface{}] { 2239 return plugin.GetOrCompute[[]interface{}](&c.Mx, func() ([]interface{}, error) { 2240 if c.MqlRuntime.HasRecording { 2241 d, err := c.MqlRuntime.FieldResourceFromRecording("dns", c.__id, "mx") 2242 if err != nil { 2243 return nil, err 2244 } 2245 if d != nil { 2246 return d.Value.([]interface{}), nil 2247 } 2248 } 2249 2250 vargParams := c.GetParams() 2251 if vargParams.Error != nil { 2252 return nil, vargParams.Error 2253 } 2254 2255 return c.mx(vargParams.Data) 2256 }) 2257 } 2258 2259 func (c *mqlDns) GetDkim() *plugin.TValue[[]interface{}] { 2260 return plugin.GetOrCompute[[]interface{}](&c.Dkim, func() ([]interface{}, error) { 2261 if c.MqlRuntime.HasRecording { 2262 d, err := c.MqlRuntime.FieldResourceFromRecording("dns", c.__id, "dkim") 2263 if err != nil { 2264 return nil, err 2265 } 2266 if d != nil { 2267 return d.Value.([]interface{}), nil 2268 } 2269 } 2270 2271 vargParams := c.GetParams() 2272 if vargParams.Error != nil { 2273 return nil, vargParams.Error 2274 } 2275 2276 return c.dkim(vargParams.Data) 2277 }) 2278 } 2279 2280 // mqlDnsRecord for the dns.record resource 2281 type mqlDnsRecord struct { 2282 MqlRuntime *plugin.Runtime 2283 __id string 2284 // optional: if you define mqlDnsRecordInternal it will be used here 2285 Name plugin.TValue[string] 2286 Ttl plugin.TValue[int64] 2287 Class plugin.TValue[string] 2288 Type plugin.TValue[string] 2289 Rdata plugin.TValue[[]interface{}] 2290 } 2291 2292 // createDnsRecord creates a new instance of this resource 2293 func createDnsRecord(runtime *plugin.Runtime, args map[string]*llx.RawData) (plugin.Resource, error) { 2294 res := &mqlDnsRecord{ 2295 MqlRuntime: runtime, 2296 } 2297 2298 err := SetAllData(res, args) 2299 if err != nil { 2300 return res, err 2301 } 2302 2303 if res.__id == "" { 2304 res.__id, err = res.id() 2305 if err != nil { 2306 return nil, err 2307 } 2308 } 2309 2310 if runtime.HasRecording { 2311 args, err = runtime.ResourceFromRecording("dns.record", res.__id) 2312 if err != nil || args == nil { 2313 return res, err 2314 } 2315 return res, SetAllData(res, args) 2316 } 2317 2318 return res, nil 2319 } 2320 2321 func (c *mqlDnsRecord) MqlName() string { 2322 return "dns.record" 2323 } 2324 2325 func (c *mqlDnsRecord) MqlID() string { 2326 return c.__id 2327 } 2328 2329 func (c *mqlDnsRecord) GetName() *plugin.TValue[string] { 2330 return &c.Name 2331 } 2332 2333 func (c *mqlDnsRecord) GetTtl() *plugin.TValue[int64] { 2334 return &c.Ttl 2335 } 2336 2337 func (c *mqlDnsRecord) GetClass() *plugin.TValue[string] { 2338 return &c.Class 2339 } 2340 2341 func (c *mqlDnsRecord) GetType() *plugin.TValue[string] { 2342 return &c.Type 2343 } 2344 2345 func (c *mqlDnsRecord) GetRdata() *plugin.TValue[[]interface{}] { 2346 return &c.Rdata 2347 } 2348 2349 // mqlDnsMxRecord for the dns.mxRecord resource 2350 type mqlDnsMxRecord struct { 2351 MqlRuntime *plugin.Runtime 2352 __id string 2353 // optional: if you define mqlDnsMxRecordInternal it will be used here 2354 Name plugin.TValue[string] 2355 Preference plugin.TValue[int64] 2356 DomainName plugin.TValue[string] 2357 } 2358 2359 // createDnsMxRecord creates a new instance of this resource 2360 func createDnsMxRecord(runtime *plugin.Runtime, args map[string]*llx.RawData) (plugin.Resource, error) { 2361 res := &mqlDnsMxRecord{ 2362 MqlRuntime: runtime, 2363 } 2364 2365 err := SetAllData(res, args) 2366 if err != nil { 2367 return res, err 2368 } 2369 2370 if res.__id == "" { 2371 res.__id, err = res.id() 2372 if err != nil { 2373 return nil, err 2374 } 2375 } 2376 2377 if runtime.HasRecording { 2378 args, err = runtime.ResourceFromRecording("dns.mxRecord", res.__id) 2379 if err != nil || args == nil { 2380 return res, err 2381 } 2382 return res, SetAllData(res, args) 2383 } 2384 2385 return res, nil 2386 } 2387 2388 func (c *mqlDnsMxRecord) MqlName() string { 2389 return "dns.mxRecord" 2390 } 2391 2392 func (c *mqlDnsMxRecord) MqlID() string { 2393 return c.__id 2394 } 2395 2396 func (c *mqlDnsMxRecord) GetName() *plugin.TValue[string] { 2397 return &c.Name 2398 } 2399 2400 func (c *mqlDnsMxRecord) GetPreference() *plugin.TValue[int64] { 2401 return &c.Preference 2402 } 2403 2404 func (c *mqlDnsMxRecord) GetDomainName() *plugin.TValue[string] { 2405 return &c.DomainName 2406 } 2407 2408 // mqlDnsDkimRecord for the dns.dkimRecord resource 2409 type mqlDnsDkimRecord struct { 2410 MqlRuntime *plugin.Runtime 2411 __id string 2412 mqlDnsDkimRecordInternal 2413 DnsTxt plugin.TValue[string] 2414 Domain plugin.TValue[string] 2415 Version plugin.TValue[string] 2416 HashAlgorithms plugin.TValue[[]interface{}] 2417 KeyType plugin.TValue[string] 2418 Notes plugin.TValue[string] 2419 PublicKeyData plugin.TValue[string] 2420 ServiceTypes plugin.TValue[[]interface{}] 2421 Flags plugin.TValue[[]interface{}] 2422 Valid plugin.TValue[bool] 2423 } 2424 2425 // createDnsDkimRecord creates a new instance of this resource 2426 func createDnsDkimRecord(runtime *plugin.Runtime, args map[string]*llx.RawData) (plugin.Resource, error) { 2427 res := &mqlDnsDkimRecord{ 2428 MqlRuntime: runtime, 2429 } 2430 2431 err := SetAllData(res, args) 2432 if err != nil { 2433 return res, err 2434 } 2435 2436 if res.__id == "" { 2437 res.__id, err = res.id() 2438 if err != nil { 2439 return nil, err 2440 } 2441 } 2442 2443 if runtime.HasRecording { 2444 args, err = runtime.ResourceFromRecording("dns.dkimRecord", res.__id) 2445 if err != nil || args == nil { 2446 return res, err 2447 } 2448 return res, SetAllData(res, args) 2449 } 2450 2451 return res, nil 2452 } 2453 2454 func (c *mqlDnsDkimRecord) MqlName() string { 2455 return "dns.dkimRecord" 2456 } 2457 2458 func (c *mqlDnsDkimRecord) MqlID() string { 2459 return c.__id 2460 } 2461 2462 func (c *mqlDnsDkimRecord) GetDnsTxt() *plugin.TValue[string] { 2463 return &c.DnsTxt 2464 } 2465 2466 func (c *mqlDnsDkimRecord) GetDomain() *plugin.TValue[string] { 2467 return &c.Domain 2468 } 2469 2470 func (c *mqlDnsDkimRecord) GetVersion() *plugin.TValue[string] { 2471 return &c.Version 2472 } 2473 2474 func (c *mqlDnsDkimRecord) GetHashAlgorithms() *plugin.TValue[[]interface{}] { 2475 return &c.HashAlgorithms 2476 } 2477 2478 func (c *mqlDnsDkimRecord) GetKeyType() *plugin.TValue[string] { 2479 return &c.KeyType 2480 } 2481 2482 func (c *mqlDnsDkimRecord) GetNotes() *plugin.TValue[string] { 2483 return &c.Notes 2484 } 2485 2486 func (c *mqlDnsDkimRecord) GetPublicKeyData() *plugin.TValue[string] { 2487 return &c.PublicKeyData 2488 } 2489 2490 func (c *mqlDnsDkimRecord) GetServiceTypes() *plugin.TValue[[]interface{}] { 2491 return &c.ServiceTypes 2492 } 2493 2494 func (c *mqlDnsDkimRecord) GetFlags() *plugin.TValue[[]interface{}] { 2495 return &c.Flags 2496 } 2497 2498 func (c *mqlDnsDkimRecord) GetValid() *plugin.TValue[bool] { 2499 return plugin.GetOrCompute[bool](&c.Valid, func() (bool, error) { 2500 return c.valid() 2501 }) 2502 }