From 50a78110781395ffba4b35fc1078104f27aa95db Mon Sep 17 00:00:00 2001 From: Ivan Milchev Date: Mon, 27 Feb 2023 12:17:47 +0100 Subject: [PATCH] use generic func to convert slices of a type to slices of interface Signed-off-by: Ivan Milchev --- resources/packs/azure/azure_cloud_defender.go | 2 +- resources/packs/azure/azure_rm_sql.go | 2 +- resources/packs/core/asset.go | 2 +- resources/packs/core/certificates.go | 20 +++---- resources/packs/core/core.utils.go | 12 ++-- resources/packs/core/dns.go | 8 +-- resources/packs/core/mondoo.go | 2 +- resources/packs/gcp/access_approval.go | 2 +- resources/packs/gcp/bigquery.go | 2 +- resources/packs/gcp/cloudrun.go | 4 +- resources/packs/gcp/compute.go | 60 +++++++++---------- resources/packs/gcp/dataproc.go | 8 +-- resources/packs/gcp/dns.go | 6 +- resources/packs/gcp/essential_contacts.go | 2 +- resources/packs/gcp/gke.go | 10 ++-- resources/packs/gcp/kms.go | 8 +-- resources/packs/gcp/logging.go | 2 +- resources/packs/gcp/monitoring.go | 2 +- resources/packs/gcp/organization.go | 2 +- resources/packs/gcp/project.go | 2 +- resources/packs/gcp/pubsub.go | 2 +- resources/packs/gcp/sql.go | 4 +- resources/packs/gcp/storage.go | 2 +- resources/packs/github/github_org.go | 2 +- resources/packs/github/github_repo.go | 8 +-- .../packs/googleworkspace/connected_apps.go | 18 +----- resources/packs/googleworkspace/group.go | 2 +- resources/packs/googleworkspace/users.go | 4 +- resources/packs/k8s/apiresource.go | 4 +- resources/packs/k8s/container.go | 4 +- resources/packs/ms365/msgraph.go | 8 +-- resources/packs/okta/applications.go | 2 +- resources/packs/os/macos.go | 2 +- resources/packs/os/yum.go | 2 +- resources/packs/terraform/hcl.go | 2 +- resources/packs/terraform/tfplan.go | 2 +- resources/packs/terraform/tfstate.go | 2 +- .../packs/vsphere/resourceclient/esxi.go | 2 +- resources/packs/vsphere/vsphere.go | 8 +-- 39 files changed, 113 insertions(+), 125 deletions(-) diff --git a/resources/packs/azure/azure_cloud_defender.go b/resources/packs/azure/azure_cloud_defender.go index 3ab5d52387..525b252dc8 100644 --- a/resources/packs/azure/azure_cloud_defender.go +++ b/resources/packs/azure/azure_cloud_defender.go @@ -225,7 +225,7 @@ func (a *mqlAzureSubscriptionCloudDefenderService) GetSecurityContacts() (interf mqlSecurityContact, err := a.MotorRuntime.CreateResource("azure.subscription.cloudDefenderService.securityContact", "id", core.ToString(contact.ID), "name", core.ToString(contact.Name), - "emails", core.StrSliceToInterface(strings.Split(mails, ";")), + "emails", core.SliceToInterfaceSlice(strings.Split(mails, ";")), "notificationsByRole", notificationsByRole, "alertNotifications", alertNotifications, ) diff --git a/resources/packs/azure/azure_rm_sql.go b/resources/packs/azure/azure_rm_sql.go index 92b5cfee5d..e3a5494d07 100644 --- a/resources/packs/azure/azure_rm_sql.go +++ b/resources/packs/azure/azure_rm_sql.go @@ -260,7 +260,7 @@ func (a *mqlAzureSubscriptionSqlServiceServer) GetVulnerabilityAssessmentSetting "storageAccountAccessKey", core.ToString(vaSettings.Properties.StorageAccountAccessKey), "storageContainerSasKey", core.ToString(vaSettings.Properties.StorageContainerSasKey), "recurringScanEnabled", core.ToBool(vaSettings.Properties.RecurringScans.IsEnabled), - "recurringScanEmails", core.PtrStrSliceToInterface(vaSettings.Properties.RecurringScans.Emails), + "recurringScanEmails", core.PtrSliceToInterfaceSlice(vaSettings.Properties.RecurringScans.Emails), "mailSubscriptionAdmins", core.ToBool(vaSettings.Properties.RecurringScans.EmailSubscriptionAdmins), ) } diff --git a/resources/packs/core/asset.go b/resources/packs/core/asset.go index 08f67669d6..b8cc5df3d3 100644 --- a/resources/packs/core/asset.go +++ b/resources/packs/core/asset.go @@ -117,5 +117,5 @@ func (a *mqlAsset) GetIds() ([]interface{}, error) { if asset == nil { return nil, errors.New("unimplemented") } - return StrSliceToInterface(asset.PlatformIds), nil + return SliceToInterfaceSlice(asset.PlatformIds), nil } diff --git a/resources/packs/core/certificates.go b/resources/packs/core/certificates.go index 7d5b5e11fd..8eca215cb8 100644 --- a/resources/packs/core/certificates.go +++ b/resources/packs/core/certificates.go @@ -104,13 +104,13 @@ func pkixnameToMql(runtime *resources.Runtime, name pkix.Name, id string) (PkixN "dn", name.String(), "serialNumber", name.SerialNumber, "commonName", name.CommonName, - "country", StrSliceToInterface(name.Country), - "organization", StrSliceToInterface(name.Organization), - "organizationalUnit", StrSliceToInterface(name.OrganizationalUnit), - "locality", StrSliceToInterface(name.Locality), - "province", StrSliceToInterface(name.Province), - "streetAddress", StrSliceToInterface(name.StreetAddress), - "postalCode", StrSliceToInterface(name.PostalCode), + "country", SliceToInterfaceSlice(name.Country), + "organization", SliceToInterfaceSlice(name.Organization), + "organizationalUnit", SliceToInterfaceSlice(name.OrganizationalUnit), + "locality", SliceToInterfaceSlice(name.Locality), + "province", SliceToInterfaceSlice(name.Province), + "streetAddress", SliceToInterfaceSlice(name.StreetAddress), + "postalCode", SliceToInterfaceSlice(name.PostalCode), "names", names, "extraNames", extraNames, ) @@ -383,17 +383,17 @@ func (s *mqlCertificate) GetSignature() (string, error) { func (s *mqlCertificate) GetCrlDistributionPoints() ([]interface{}, error) { cert := s.getGoCert() - return StrSliceToInterface(cert.CRLDistributionPoints), nil + return SliceToInterfaceSlice(cert.CRLDistributionPoints), nil } func (s *mqlCertificate) GetOcspServer() ([]interface{}, error) { cert := s.getGoCert() - return StrSliceToInterface(cert.OCSPServer), nil + return SliceToInterfaceSlice(cert.OCSPServer), nil } func (s *mqlCertificate) GetIssuingCertificateUrl() ([]interface{}, error) { cert := s.getGoCert() - return StrSliceToInterface(cert.IssuingCertificateURL), nil + return SliceToInterfaceSlice(cert.IssuingCertificateURL), nil } func (s *mqlCertificate) GetIsRevoked() (bool, error) { diff --git a/resources/packs/core/core.utils.go b/resources/packs/core/core.utils.go index 7fac08bbb3..4f3b3a6e28 100644 --- a/resources/packs/core/core.utils.go +++ b/resources/packs/core/core.utils.go @@ -35,15 +35,15 @@ func ToBool(b *bool) bool { return *b } -func StrSliceToInterface(value []string) []interface{} { - res := make([]interface{}, len(value)) - for i := range value { - res[i] = value[i] +func SliceToInterfaceSlice[T any](ss []T) []interface{} { + ssI := make([]interface{}, 0, len(ss)) + for _, s := range ss { + ssI = append(ssI, s) } - return res + return ssI } -func PtrStrSliceToInterface(value []*string) []interface{} { +func PtrSliceToInterfaceSlice(value []*string) []interface{} { res := make([]interface{}, len(value)) for i := range value { if value[i] != nil { diff --git a/resources/packs/core/dns.go b/resources/packs/core/dns.go index ea0f1aa755..17452897dc 100644 --- a/resources/packs/core/dns.go +++ b/resources/packs/core/dns.go @@ -37,7 +37,7 @@ func (d *mqlDomainName) init(args *resources.Args) (*resources.Args, DomainName, (*args)["effectiveTLDPlusOne"] = dn.EffectiveTLDPlusOne (*args)["tld"] = dn.TLD (*args)["tldIcannManaged"] = dn.IcannManagedTLD - (*args)["labels"] = StrSliceToInterface(dn.Labels) + (*args)["labels"] = SliceToInterfaceSlice(dn.Labels) return args, nil, nil } @@ -236,12 +236,12 @@ func (d *mqlDns) GetDkim(params interface{}) ([]interface{}, error) { "domain", name, "dnsTxt", entry, "version", dkimRepr.Version, - "hashAlgorithms", StrSliceToInterface(dkimRepr.HashAlgorithms), + "hashAlgorithms", SliceToInterfaceSlice(dkimRepr.HashAlgorithms), "keyType", dkimRepr.KeyType, "notes", dkimRepr.Notes, "publicKeyData", dkimRepr.PublicKeyData, - "serviceTypes", StrSliceToInterface(dkimRepr.ServiceType), - "flags", StrSliceToInterface(dkimRepr.Flags), + "serviceTypes", SliceToInterfaceSlice(dkimRepr.ServiceType), + "flags", SliceToInterfaceSlice(dkimRepr.Flags), ) if err != nil { return nil, err diff --git a/resources/packs/core/mondoo.go b/resources/packs/core/mondoo.go index 5437775340..3b31f6cab1 100644 --- a/resources/packs/core/mondoo.go +++ b/resources/packs/core/mondoo.go @@ -69,5 +69,5 @@ func (m *mqlMondooAsset) GetPlatformIDs() ([]interface{}, error) { if asset == nil { return nil, errors.New("unimplemented") } - return StrSliceToInterface(asset.PlatformIds), nil + return SliceToInterfaceSlice(asset.PlatformIds), nil } diff --git a/resources/packs/gcp/access_approval.go b/resources/packs/gcp/access_approval.go index f609f2a157..98ac72e473 100644 --- a/resources/packs/gcp/access_approval.go +++ b/resources/packs/gcp/access_approval.go @@ -71,7 +71,7 @@ func accessApprovalSettings(motorProvider providers.Instance, runtime *resources return runtime.CreateResource("gcp.accessApprovalSettings", "resourcePath", settings.Name, - "notificationEmails", core.StrSliceToInterface(settings.NotificationEmails), + "notificationEmails", core.SliceToInterfaceSlice(settings.NotificationEmails), "enrolledServices", mqlEnrolledServices, "enrolledAncestor", settings.EnrolledAncestor, "activeKeyVersion", settings.ActiveKeyVersion, diff --git a/resources/packs/gcp/bigquery.go b/resources/packs/gcp/bigquery.go index e520d17464..b31445f484 100644 --- a/resources/packs/gcp/bigquery.go +++ b/resources/packs/gcp/bigquery.go @@ -275,7 +275,7 @@ func (g *mqlGcpProjectBigqueryServiceDataset) GetTables() ([]interface{}, error) var clusteringFields []interface{} if metadata.Clustering != nil { - clusteringFields = core.StrSliceToInterface(metadata.Clustering.Fields) + clusteringFields = core.SliceToInterfaceSlice(metadata.Clustering.Fields) } externalDataConfig, err := core.JsonToDict(metadata.ExternalDataConfig) diff --git a/resources/packs/gcp/cloudrun.go b/resources/packs/gcp/cloudrun.go index b0e3ee7a44..b1a038331a 100644 --- a/resources/packs/gcp/cloudrun.go +++ b/resources/packs/gcp/cloudrun.go @@ -646,8 +646,8 @@ func mqlContainers(runtime *resources.Runtime, containers []*runpb.Container, te "id", containerId, "name", c.Name, "image", c.Image, - "command", core.StrSliceToInterface(c.Command), - "args", core.StrSliceToInterface(c.Args), + "command", core.SliceToInterfaceSlice(c.Command), + "args", core.SliceToInterfaceSlice(c.Args), "env", mqlEnvs, "resources", mqlResources, "ports", mqlPorts, diff --git a/resources/packs/gcp/compute.go b/resources/packs/gcp/compute.go index 30a7e6b12e..d4d7310116 100644 --- a/resources/packs/gcp/compute.go +++ b/resources/packs/gcp/compute.go @@ -346,7 +346,7 @@ func (g *mqlGcpProjectComputeServiceInstance) GetMachineType() (interface{}, err func newMqlServiceAccount(runtime *resources.Runtime, sa *compute.ServiceAccount) (interface{}, error) { return runtime.CreateResource("gcp.project.computeService.serviceaccount", "email", sa.Email, - "scopes", core.StrSliceToInterface(sa.Scopes), + "scopes", core.SliceToInterfaceSlice(sa.Scopes), ) } @@ -366,10 +366,10 @@ func newMqlAttachedDisk(id string, projectId string, runtime *resources.Runtime, "deviceName", attachedDisk.DeviceName, "diskSizeGb", attachedDisk.DiskSizeGb, "forceAttach", attachedDisk.ForceAttach, - "guestOsFeatures", core.StrSliceToInterface(guestOsFeatures), + "guestOsFeatures", core.SliceToInterfaceSlice(guestOsFeatures), "index", attachedDisk.Index, "interface", attachedDisk.Interface, - "licenses", core.StrSliceToInterface(attachedDisk.Licenses), + "licenses", core.SliceToInterfaceSlice(attachedDisk.Licenses), "mode", attachedDisk.Mode, "type", attachedDisk.Type, ) @@ -519,7 +519,7 @@ func newMqlInstance(projectId string, zone GcpProjectComputeServiceZone, runtime "networkInterfaces", networkInterfaces, "privateIpv6GoogleAccess", instance.PrivateIpv6GoogleAccess, "reservationAffinity", reservationAffinity, - "resourcePolicies", core.StrSliceToInterface(instance.ResourcePolicies), + "resourcePolicies", core.SliceToInterfaceSlice(instance.ResourcePolicies), "physicalHostResourceStatus", physicalHost, "scheduling", scheduling, "enableIntegrityMonitoring", enableIntegrityMonitoring, @@ -529,7 +529,7 @@ func newMqlInstance(projectId string, zone GcpProjectComputeServiceZone, runtime "status", instance.Status, "statusMessage", instance.StatusMessage, "sourceMachineImage", instance.SourceMachineImage, - "tags", core.StrSliceToInterface(instance.Tags.Items), + "tags", core.SliceToInterfaceSlice(instance.Tags.Items), "totalEgressBandwidthTier", totalEgressBandwidthTier, "serviceAccounts", mqlServiceAccounts, "disks", attachedDisks, @@ -697,18 +697,18 @@ func (g *mqlGcpProjectComputeService) GetDisks() ([]interface{}, error) { "name", disk.Name, "architecture", disk.Architecture, "description", disk.Description, - "guestOsFeatures", core.StrSliceToInterface(guestOsFeatures), + "guestOsFeatures", core.SliceToInterfaceSlice(guestOsFeatures), "labels", core.StrMapToInterface(disk.Labels), "lastAttachTimestamp", parseTime(disk.LastAttachTimestamp), "lastDetachTimestamp", parseTime(disk.LastDetachTimestamp), "locationHint", disk.LocationHint, - "licenses", core.StrSliceToInterface(disk.Licenses), + "licenses", core.SliceToInterfaceSlice(disk.Licenses), "physicalBlockSizeBytes", disk.PhysicalBlockSizeBytes, "provisionedIops", disk.ProvisionedIops, // TODO: link to resources //"region", disk.Region, - //"replicaZones", core.StrSliceToInterface(disk.ReplicaZones), - //"resourcePolicies", core.StrSliceToInterface(disk.ResourcePolicies), + //"replicaZones", core.SliceToInterfaceSlice(disk.ReplicaZones), + //"resourcePolicies", core.SliceToInterfaceSlice(disk.ResourcePolicies), "sizeGb", disk.SizeGb, // TODO: link to resources //"sourceDiskId", disk.SourceDiskId, @@ -852,11 +852,11 @@ func (g *mqlGcpProjectComputeService) GetFirewalls() ([]interface{}, error) { "priority", firewall.Priority, "disabled", firewall.Disabled, "direction", firewall.Direction, - "sourceRanges", core.StrSliceToInterface(firewall.SourceRanges), - "sourceServiceAccounts", core.StrSliceToInterface(firewall.SourceServiceAccounts), - "sourceTags", core.StrSliceToInterface(firewall.SourceTags), - "destinationRanges", core.StrSliceToInterface(firewall.DestinationRanges), - "targetServiceAccounts", core.StrSliceToInterface(firewall.TargetServiceAccounts), + "sourceRanges", core.SliceToInterfaceSlice(firewall.SourceRanges), + "sourceServiceAccounts", core.SliceToInterfaceSlice(firewall.SourceServiceAccounts), + "sourceTags", core.SliceToInterfaceSlice(firewall.SourceTags), + "destinationRanges", core.SliceToInterfaceSlice(firewall.DestinationRanges), + "targetServiceAccounts", core.SliceToInterfaceSlice(firewall.TargetServiceAccounts), "created", parseTime(firewall.CreationTimestamp), "allowed", allowedDict, "denied", deniedDict, @@ -929,7 +929,7 @@ func (g *mqlGcpProjectComputeService) GetSnapshots() ([]interface{}, error) { "storageBytes", snapshot.StorageBytes, "storageBytesStatus", snapshot.StorageBytesStatus, "snapshotType", snapshot.SnapshotType, - "licenses", core.StrSliceToInterface(snapshot.Licenses), + "licenses", core.SliceToInterfaceSlice(snapshot.Licenses), "labels", core.StrMapToInterface(snapshot.Labels), "status", snapshot.Status, "created", parseTime(snapshot.CreationTimestamp), @@ -1039,7 +1039,7 @@ func (g *mqlGcpProjectComputeService) GetImages() ([]interface{}, error) { "archiveSizeBytes", image.ArchiveSizeBytes, "diskSizeGb", image.DiskSizeGb, "family", image.Family, - "licenses", core.StrSliceToInterface(image.Licenses), + "licenses", core.SliceToInterfaceSlice(image.Licenses), "labels", core.StrMapToInterface(image.Labels), "status", image.Status, "created", parseTime(image.CreationTimestamp), @@ -1189,7 +1189,7 @@ func (g *mqlGcpProjectComputeService) GetNetworks() ([]interface{}, error) { "peerings", peerings, "routingMode", routingMode, "mode", networkMode(network), - "subnetworkUrls", core.StrSliceToInterface(network.Subnetworks), + "subnetworkUrls", core.SliceToInterfaceSlice(network.Subnetworks), ) if err != nil { return err @@ -1346,7 +1346,7 @@ func newMqlSubnetwork(projectId string, runtime *resources.Runtime, subnetwork * "filterExpression", subnetwork.LogConfig.GetFilterExpr(), "flowSampling", float64(subnetwork.LogConfig.GetFlowSampling()), "metadata", subnetwork.LogConfig.GetMetadata(), - "metadataFields", core.StrSliceToInterface(subnetwork.LogConfig.MetadataFields), + "metadataFields", core.SliceToInterfaceSlice(subnetwork.LogConfig.MetadataFields), ) if err != nil { return nil, err @@ -1605,12 +1605,12 @@ func (g *mqlGcpProjectComputeService) GetBackendServices() ([]interface{}, error if b.CdnPolicy.CacheKeyPolicy != nil { mqlCacheKeyPolicy = map[string]interface{}{ "includeHost": b.CdnPolicy.CacheKeyPolicy.IncludeHost, - "includeHttpHeaders": core.StrSliceToInterface(b.CdnPolicy.CacheKeyPolicy.IncludeHttpHeaders), - "includeNamedCookies": core.StrSliceToInterface(b.CdnPolicy.CacheKeyPolicy.IncludeNamedCookies), + "includeHttpHeaders": core.SliceToInterfaceSlice(b.CdnPolicy.CacheKeyPolicy.IncludeHttpHeaders), + "includeNamedCookies": core.SliceToInterfaceSlice(b.CdnPolicy.CacheKeyPolicy.IncludeNamedCookies), "includeProtocol": b.CdnPolicy.CacheKeyPolicy.IncludeProtocol, "includeQueryString": b.CdnPolicy.CacheKeyPolicy.IncludeQueryString, - "queryStringBlacklist": core.StrSliceToInterface(b.CdnPolicy.CacheKeyPolicy.QueryStringBlacklist), - "queryStringWhitelist": core.StrSliceToInterface(b.CdnPolicy.CacheKeyPolicy.QueryStringWhitelist), + "queryStringBlacklist": core.SliceToInterfaceSlice(b.CdnPolicy.CacheKeyPolicy.QueryStringBlacklist), + "queryStringWhitelist": core.SliceToInterfaceSlice(b.CdnPolicy.CacheKeyPolicy.QueryStringWhitelist), } } @@ -1636,7 +1636,7 @@ func (g *mqlGcpProjectComputeService) GetBackendServices() ([]interface{}, error "requestCoalescing", b.CdnPolicy.RequestCoalescing, "serveWhileStale", b.CdnPolicy.ServeWhileStale, "signedUrlCacheMaxAgeSec", b.CdnPolicy.SignedUrlCacheMaxAgeSec, - "signedUrlKeyNames", core.StrSliceToInterface(b.CdnPolicy.SignedUrlKeyNames), + "signedUrlKeyNames", core.SliceToInterfaceSlice(b.CdnPolicy.SignedUrlKeyNames), ) if err != nil { return nil, err @@ -1737,7 +1737,7 @@ func (g *mqlGcpProjectComputeService) GetBackendServices() ([]interface{}, error if b.SecuritySettings != nil { mqlSecuritySettings = map[string]interface{}{ "clientTlsPolicy": b.SecuritySettings.ClientTlsPolicy, - "subjectAltNames": core.StrSliceToInterface(b.SecuritySettings.SubjectAltNames), + "subjectAltNames": core.SliceToInterfaceSlice(b.SecuritySettings.SubjectAltNames), } } @@ -1757,13 +1757,13 @@ func (g *mqlGcpProjectComputeService) GetBackendServices() ([]interface{}, error "connectionTrackingPolicy", mqlConnectionTrackingPolicy, "consistentHash", mqlConsistentHash, "created", parseTime(b.CreationTimestamp), - "customRequestHeaders", core.StrSliceToInterface(b.CustomRequestHeaders), - "customResponseHeaders", core.StrSliceToInterface(b.CustomResponseHeaders), + "customRequestHeaders", core.SliceToInterfaceSlice(b.CustomRequestHeaders), + "customResponseHeaders", core.SliceToInterfaceSlice(b.CustomResponseHeaders), "description", b.Description, "edgeSecurityPolicy", b.EdgeSecurityPolicy, "enableCDN", b.EnableCDN, "failoverPolicy", mqlFailoverPolicy, - "healthChecks", core.StrSliceToInterface(b.HealthChecks), + "healthChecks", core.SliceToInterfaceSlice(b.HealthChecks), "iap", mqlIap, "loadBalancingScheme", b.LoadBalancingScheme, "localityLbPolicies", mqlLocalityLbPolicy, @@ -1777,7 +1777,7 @@ func (g *mqlGcpProjectComputeService) GetBackendServices() ([]interface{}, error "regionUrl", b.Region, "securityPolicyUrl", b.SecurityPolicy, "securitySettings", mqlSecuritySettings, - "serviceBindingUrls", core.StrSliceToInterface(b.ServiceBindings), + "serviceBindingUrls", core.SliceToInterfaceSlice(b.ServiceBindings), "sessionAffinity", b.SessionAffinity, "timeoutSec", b.TimeoutSec, ) @@ -1861,7 +1861,7 @@ func (g *mqlGcpProjectComputeService) GetAddresses() ([]interface{}, error) { "regionUrl", a.Region, "status", a.Status, "subnetworkUrl", a.Subnetwork, - "resourceUrls", core.StrSliceToInterface(a.Users), + "resourceUrls", core.SliceToInterfaceSlice(a.Users), ) if err != nil { return nil, err @@ -1967,7 +1967,7 @@ func (g *mqlGcpProjectComputeService) GetForwardingRules() ([]interface{}, error "networkTier", fwr.GetNetworkTier(), "noAutomateDnsZone", fwr.GetNoAutomateDnsZone(), "portRange", fwr.GetPortRange(), - "ports", core.StrSliceToInterface(fwr.GetPorts()), + "ports", core.SliceToInterfaceSlice(fwr.GetPorts()), "regionUrl", fwr.GetRegion(), "serviceDirectoryRegistrations", serviceDirRegs, "serviceLabel", fwr.GetServiceLabel(), diff --git a/resources/packs/gcp/dataproc.go b/resources/packs/gcp/dataproc.go index b09c8055fe..4a242cbe34 100644 --- a/resources/packs/gcp/dataproc.go +++ b/resources/packs/gcp/dataproc.go @@ -264,7 +264,7 @@ func (g *mqlGcpProjectDataprocService) GetClusters() ([]interface{}, error) { "id", fmt.Sprintf("%s/dataproc/%s/config/gceCluster/reservationAffinity", projectId, c.ClusterName), "consumeReservationType", c.Config.GceClusterConfig.ReservationAffinity.ConsumeReservationType, "key", c.Config.GceClusterConfig.ReservationAffinity.Key, - "values", core.StrSliceToInterface(c.Config.GceClusterConfig.ReservationAffinity.Values), + "values", core.SliceToInterfaceSlice(c.Config.GceClusterConfig.ReservationAffinity.Values), ) if err != nil { log.Error().Err(err).Send() @@ -294,10 +294,10 @@ func (g *mqlGcpProjectDataprocService) GetClusters() ([]interface{}, error) { "privateIpv6GoogleAccess", c.Config.GceClusterConfig.PrivateIpv6GoogleAccess, "reservationAffinity", mqlReservationAffinity, "serviceAccount", c.Config.GceClusterConfig.ServiceAccount, - "serviceAccountScopes", core.StrSliceToInterface(c.Config.GceClusterConfig.ServiceAccountScopes), + "serviceAccountScopes", core.SliceToInterfaceSlice(c.Config.GceClusterConfig.ServiceAccountScopes), "shieldedInstanceConfig", mqlShieldedCfg, "subnetworkUri", c.Config.GceClusterConfig.SubnetworkUri, - "tags", core.StrSliceToInterface(c.Config.GceClusterConfig.Tags), + "tags", core.SliceToInterfaceSlice(c.Config.GceClusterConfig.Tags), "zoneUri", c.Config.GceClusterConfig.ZoneUri, ) if err != nil { @@ -785,7 +785,7 @@ func instaceGroupConfigToMql(runtime *resources.Runtime, igc *dataproc.InstanceG "accelerators", mqlAccs, "diskConfig", mqlDiskCfg, "imageUri", igc.ImageUri, - "instanceNames", core.StrSliceToInterface(igc.InstanceNames), + "instanceNames", core.SliceToInterfaceSlice(igc.InstanceNames), "instanceReferences", mqlInstanceRefs, "isPreemptible", igc.IsPreemptible, "machineTypeUri", igc.MachineTypeUri, diff --git a/resources/packs/gcp/dns.go b/resources/packs/gcp/dns.go index e7b4664a95..a766d89f7b 100644 --- a/resources/packs/gcp/dns.go +++ b/resources/packs/gcp/dns.go @@ -114,7 +114,7 @@ func (g *mqlGcpProjectDnsService) GetManagedZones() ([]interface{}, error) { "dnssecConfig", mqlDnssecCfg, "dnsName", managedZone.DnsName, "nameServerSet", managedZone.NameServerSet, - "nameServers", core.StrSliceToInterface(managedZone.NameServers), + "nameServers", core.SliceToInterfaceSlice(managedZone.NameServers), "visibility", managedZone.Visibility, "created", parseTime(managedZone.CreationTime), ) @@ -288,8 +288,8 @@ func (g *mqlGcpProjectDnsServiceManagedzone) GetRecordSets() ([]interface{}, err mqlDnsPolicy, err := g.MotorRuntime.CreateResource("gcp.project.dnsService.recordset", "projectId", projectId, "name", rSet.Name, - "rrdatas", core.StrSliceToInterface(rSet.Rrdatas), - "signatureRrdatas", core.StrSliceToInterface(rSet.SignatureRrdatas), + "rrdatas", core.SliceToInterfaceSlice(rSet.Rrdatas), + "signatureRrdatas", core.SliceToInterfaceSlice(rSet.SignatureRrdatas), "ttl", rSet.Ttl, "type", rSet.Type, ) diff --git a/resources/packs/gcp/essential_contacts.go b/resources/packs/gcp/essential_contacts.go index ebf79b8995..d7da6f1091 100644 --- a/resources/packs/gcp/essential_contacts.go +++ b/resources/packs/gcp/essential_contacts.go @@ -42,7 +42,7 @@ func (g *mqlGcpProject) GetEssentialContacts() (interface{}, error) { "resourcePath", c.Name, "email", c.Email, "languageTag", c.LanguageTag, - "notificationCategories", core.StrSliceToInterface(c.NotificationCategorySubscriptions), + "notificationCategories", core.SliceToInterfaceSlice(c.NotificationCategorySubscriptions), "validated", parseTime(c.ValidateTime), "validationState", c.ValidationState, ) diff --git a/resources/packs/gcp/gke.go b/resources/packs/gcp/gke.go index cc0d230935..217d041e2b 100644 --- a/resources/packs/gcp/gke.go +++ b/resources/packs/gcp/gke.go @@ -378,7 +378,7 @@ func (g *mqlGcpProjectGkeService) GetClusters() ([]interface{}, error) { "clusterIpv4Cidr", c.ClusterIpv4Cidr, "subnetwork", c.Subnetwork, "nodePools", nodePools, - "locations", core.StrSliceToInterface(c.Locations), + "locations", core.SliceToInterfaceSlice(c.Locations), "enableKubernetesAlpha", c.EnableKubernetesAlpha, "autopilotEnabled", autopilotEnabled, "zone", c.Zone, @@ -438,10 +438,10 @@ func createMqlNodePool(runtime *resources.Runtime, np *containerpb.NodePool, clu "name", np.Name, "config", mqlPoolConfig, "initialNodeCount", int64(np.InitialNodeCount), - "locations", core.StrSliceToInterface(np.Locations), + "locations", core.SliceToInterfaceSlice(np.Locations), "networkConfig", mqlPoolNetworkConfig, "version", np.Version, - "instanceGroupUrls", core.StrSliceToInterface(np.InstanceGroupUrls), + "instanceGroupUrls", core.SliceToInterfaceSlice(np.InstanceGroupUrls), "status", np.Status.String(), "management", management, ) @@ -573,13 +573,13 @@ func createMqlNodePoolConfig(runtime *resources.Runtime, np *containerpb.NodePoo "id", fmt.Sprintf("%s/config", nodePoolId), "machineType", cfg.MachineType, "diskSizeGb", int64(cfg.DiskSizeGb), - "oauthScopes", core.StrSliceToInterface(cfg.OauthScopes), + "oauthScopes", core.SliceToInterfaceSlice(cfg.OauthScopes), "serviceAccount", cfg.ServiceAccount, "metadata", core.StrMapToInterface(cfg.Metadata), "imageType", cfg.ImageType, "labels", core.StrMapToInterface(cfg.Labels), "localSsdCount", int64(cfg.LocalSsdCount), - "tags", core.StrSliceToInterface(cfg.Tags), + "tags", core.SliceToInterfaceSlice(cfg.Tags), "preemptible", cfg.Preemptible, "accelerators", mqlAccelerators, "diskType", cfg.DiskType, diff --git a/resources/packs/gcp/kms.go b/resources/packs/gcp/kms.go index 6d57e8a949..b88c7248a7 100644 --- a/resources/packs/gcp/kms.go +++ b/resources/packs/gcp/kms.go @@ -372,7 +372,7 @@ func (g *mqlGcpProjectKmsServiceKeyringCryptokey) GetIamPolicy() ([]interface{}, mqlBinding, err := g.MotorRuntime.CreateResource("gcp.resourcemanager.binding", "id", cryptokey+"-"+strconv.Itoa(i), "role", b.Role, - "members", core.StrSliceToInterface(b.Members), + "members", core.SliceToInterfaceSlice(b.Members), ) if err != nil { return nil, err @@ -387,9 +387,9 @@ func cryptoKeyVersionToMql(runtime *resources.Runtime, v *kmspb.CryptoKeyVersion if v.Attestation != nil { mqlAttestationCertChains, err := runtime.CreateResource("gcp.project.kmsService.keyring.cryptokey.version.attestation.certificatechains", "cryptoKeyVersionName", v.Name, - "caviumCerts", core.StrSliceToInterface(v.Attestation.CertChains.CaviumCerts), - "googleCardCerts", core.StrSliceToInterface(v.Attestation.CertChains.GoogleCardCerts), - "googlePartitionCerts", core.StrSliceToInterface(v.Attestation.CertChains.GooglePartitionCerts), + "caviumCerts", core.SliceToInterfaceSlice(v.Attestation.CertChains.CaviumCerts), + "googleCardCerts", core.SliceToInterfaceSlice(v.Attestation.CertChains.GoogleCardCerts), + "googlePartitionCerts", core.SliceToInterfaceSlice(v.Attestation.CertChains.GooglePartitionCerts), ) if err != nil { return nil, err diff --git a/resources/packs/gcp/logging.go b/resources/packs/gcp/logging.go index 23a397e021..b0d16492db 100644 --- a/resources/packs/gcp/logging.go +++ b/resources/packs/gcp/logging.go @@ -102,7 +102,7 @@ func (g *mqlGcpProjectLoggingservice) GetBuckets() ([]interface{}, error) { "lifecycleState", bucket.LifecycleState, "locked", bucket.Locked, "name", bucket.Name, - "restrictedFields", core.StrSliceToInterface(bucket.RestrictedFields), + "restrictedFields", core.SliceToInterfaceSlice(bucket.RestrictedFields), "retentionDays", bucket.RetentionDays, "updated", parseTime(bucket.UpdateTime), ) diff --git a/resources/packs/gcp/monitoring.go b/resources/packs/gcp/monitoring.go index cbacbe8c39..faf1f72bcb 100644 --- a/resources/packs/gcp/monitoring.go +++ b/resources/packs/gcp/monitoring.go @@ -177,7 +177,7 @@ func (g *mqlGcpProjectMonitoringService) GetAlertPolicies() ([]interface{}, erro "combiner", p.Combiner.String(), "enabled", p.Enabled.Value, "validity", mqlValidity, - "notificationChannelUrls", core.StrSliceToInterface(p.NotificationChannels), + "notificationChannelUrls", core.SliceToInterfaceSlice(p.NotificationChannels), "created", core.MqlTime(p.CreationRecord.MutateTime.AsTime()), "createdBy", p.CreationRecord.MutatedBy, "updated", core.MqlTime(p.MutationRecord.MutateTime.AsTime()), diff --git a/resources/packs/gcp/organization.go b/resources/packs/gcp/organization.go index 45e7673bc0..b9c97860ad 100644 --- a/resources/packs/gcp/organization.go +++ b/resources/packs/gcp/organization.go @@ -120,7 +120,7 @@ func (g *mqlGcpOrganization) GetIamPolicy() ([]interface{}, error) { mqlServiceaccount, err := g.MotorRuntime.CreateResource("gcp.resourcemanager.binding", "id", name+"-"+strconv.Itoa(i), "role", b.Role, - "members", core.StrSliceToInterface(b.Members), + "members", core.SliceToInterfaceSlice(b.Members), ) if err != nil { return nil, err diff --git a/resources/packs/gcp/project.go b/resources/packs/gcp/project.go index d8eba45728..0514f129de 100644 --- a/resources/packs/gcp/project.go +++ b/resources/packs/gcp/project.go @@ -152,7 +152,7 @@ func (g *mqlGcpProject) GetIamPolicy() ([]interface{}, error) { mqlServiceaccount, err := g.MotorRuntime.CreateResource("gcp.resourcemanager.binding", "id", projectId+"-"+strconv.Itoa(i), "role", b.Role, - "members", core.StrSliceToInterface(b.Members), + "members", core.SliceToInterfaceSlice(b.Members), ) if err != nil { return nil, err diff --git a/resources/packs/gcp/pubsub.go b/resources/packs/gcp/pubsub.go index 83564e610c..b6a18a37a3 100644 --- a/resources/packs/gcp/pubsub.go +++ b/resources/packs/gcp/pubsub.go @@ -209,7 +209,7 @@ func (g *mqlGcpProjectPubsubServiceTopic) GetConfig() (interface{}, error) { messageStoragePolicy, err := g.MotorRuntime.CreateResource("gcp.project.pubsubService.topic.config.messagestoragepolicy", "configId", pubsubConfigId(projectId, t.ID()), - "allowedPersistenceRegions", core.StrSliceToInterface(cfg.MessageStoragePolicy.AllowedPersistenceRegions), + "allowedPersistenceRegions", core.SliceToInterfaceSlice(cfg.MessageStoragePolicy.AllowedPersistenceRegions), ) if err != nil { return nil, err diff --git a/resources/packs/gcp/sql.go b/resources/packs/gcp/sql.go index 35eb398fb9..b6ad639aa0 100644 --- a/resources/packs/gcp/sql.go +++ b/resources/packs/gcp/sql.go @@ -337,7 +337,7 @@ func (g *mqlGcpProjectSqlService) GetInstances() ([]interface{}, error) { mqlInstance, err := g.MotorRuntime.CreateResource("gcp.project.sqlService.instance", "projectId", projectId, - "availableMaintenanceVersions", core.StrSliceToInterface(instance.AvailableMaintenanceVersions), + "availableMaintenanceVersions", core.SliceToInterfaceSlice(instance.AvailableMaintenanceVersions), "backendType", instance.BackendType, "connectionName", instance.ConnectionName, "created", parseTime(instance.CreateTime), @@ -357,7 +357,7 @@ func (g *mqlGcpProjectSqlService) GetInstances() ([]interface{}, error) { // ref project "project", instance.Project, "region", instance.Region, - "replicaNames", core.StrSliceToInterface(instance.ReplicaNames), + "replicaNames", core.SliceToInterfaceSlice(instance.ReplicaNames), "settings", mqlSettings, "serviceAccountEmailAddress", instance.ServiceAccountEmailAddress, "state", instance.State, diff --git a/resources/packs/gcp/storage.go b/resources/packs/gcp/storage.go index 51bec2a297..d0501d5e1e 100644 --- a/resources/packs/gcp/storage.go +++ b/resources/packs/gcp/storage.go @@ -243,7 +243,7 @@ func (g *mqlGcpProjectStorageServiceBucket) GetIamPolicy() ([]interface{}, error mqlServiceaccount, err := g.MotorRuntime.CreateResource("gcp.resourcemanager.binding", "id", bucketName+"-"+strconv.Itoa(i), "role", b.Role, - "members", core.StrSliceToInterface(b.Members), + "members", core.SliceToInterfaceSlice(b.Members), ) if err != nil { return nil, err diff --git a/resources/packs/github/github_org.go b/resources/packs/github/github_org.go index 09cf73cb09..e92c403996 100644 --- a/resources/packs/github/github_org.go +++ b/resources/packs/github/github_org.go @@ -319,7 +319,7 @@ func (g *mqlGithubOrganization) GetWebhooks() ([]interface{}, error) { mqlUser, err := g.MotorRuntime.CreateResource("github.webhook", "id", core.ToInt64(h.ID), "name", core.ToString(h.Name), - "events", core.StrSliceToInterface(h.Events), + "events", core.SliceToInterfaceSlice(h.Events), "config", config, "url", core.ToString(h.URL), "name", core.ToString(h.Name), diff --git a/resources/packs/github/github_repo.go b/resources/packs/github/github_repo.go index f264dfb938..a2be9a1fbe 100644 --- a/resources/packs/github/github_repo.go +++ b/resources/packs/github/github_repo.go @@ -31,7 +31,7 @@ func newMqlGithubRepository(runtime *resources.Runtime, repo *github.Repository) "fullName", core.ToString(repo.FullName), "description", core.ToString(repo.Description), "homepage", core.ToString(repo.Homepage), - "topics", core.StrSliceToInterface(repo.Topics), + "topics", core.SliceToInterfaceSlice(repo.Topics), "language", repo.GetLanguage(), "createdAt", githubTimestamp(repo.CreatedAt), "updatedAt", githubTimestamp(repo.UpdatedAt), @@ -146,7 +146,7 @@ func (g *mqlGithubRepository) init(args *resources.Args) (*resources.Args, Githu (*args)["fullName"] = core.ToString(repo.FullName) (*args)["description"] = core.ToString(repo.Description) (*args)["homepage"] = core.ToString(repo.Homepage) - (*args)["topics"] = core.StrSliceToInterface(repo.Topics) + (*args)["topics"] = core.SliceToInterfaceSlice(repo.Topics) (*args)["language"] = repo.GetLanguage() (*args)["watchersCount"] = int64(repo.GetWatchersCount()) (*args)["forksCount"] = int64(repo.GetForksCount()) @@ -852,7 +852,7 @@ func (g *mqlGithubRepository) GetCollaborators() ([]interface{}, error) { mqlContributor, err := g.MotorRuntime.CreateResource("github.collaborator", "id", core.ToInt64(contributor.ID), "user", mqlUser, - "permissions", core.StrSliceToInterface(permissions), + "permissions", core.SliceToInterfaceSlice(permissions), ) if err != nil { return nil, err @@ -973,7 +973,7 @@ func (g *mqlGithubRepository) GetWebhooks() ([]interface{}, error) { mqlWebhook, err := g.MotorRuntime.CreateResource("github.webhook", "id", core.ToInt64(h.ID), "name", core.ToString(h.Name), - "events", core.StrSliceToInterface(h.Events), + "events", core.SliceToInterfaceSlice(h.Events), "config", config, "url", core.ToString(h.URL), "name", core.ToString(h.Name), diff --git a/resources/packs/googleworkspace/connected_apps.go b/resources/packs/googleworkspace/connected_apps.go index 5d6df85081..da778dd1b7 100644 --- a/resources/packs/googleworkspace/connected_apps.go +++ b/resources/packs/googleworkspace/connected_apps.go @@ -77,25 +77,13 @@ func (g *mqlGoogleworkspace) GetConnectedApps() ([]interface{}, error) { i := 0 for k := range connectedApps { connectedApp := connectedApps[k] - - mqlUsers := make([]interface{}, len(connectedApp.users)) - if connectedApp.users != nil && len(connectedApp.users) > 0 { - for i := range connectedApp.users { - mqlUsers[i] = connectedApp.users[i] - } - } - - mqlTokens := make([]interface{}, len(connectedApp.tokens)) - if connectedApp.tokens != nil && len(connectedApp.tokens) > 0 { - for i := range connectedApp.tokens { - mqlTokens[i] = connectedApp.tokens[i] - } - } + mqlUsers := core.SliceToInterfaceSlice(connectedApp.users) + mqlTokens := core.SliceToInterfaceSlice(connectedApp.tokens) mqlApp, err := runtime.CreateResource("googleworkspace.connectedApp", "clientId", connectedApp.clientID, "name", connectedApp.name, - "scopes", core.StrSliceToInterface(connectedApp.scopes), + "scopes", core.SliceToInterfaceSlice(connectedApp.scopes), "users", mqlUsers, "tokens", mqlTokens, ) diff --git a/resources/packs/googleworkspace/group.go b/resources/packs/googleworkspace/group.go index 90bc067c06..871886b594 100644 --- a/resources/packs/googleworkspace/group.go +++ b/resources/packs/googleworkspace/group.go @@ -53,7 +53,7 @@ func newMqlGoogleWorkspaceGroup(runtime *resources.Runtime, entry *directory.Gro "name", entry.Name, "email", entry.Email, "description", entry.Description, - "aliases", core.StrSliceToInterface(entry.Aliases), + "aliases", core.SliceToInterfaceSlice(entry.Aliases), "directMembersCount", entry.DirectMembersCount, "adminCreated", entry.AdminCreated, ) diff --git a/resources/packs/googleworkspace/users.go b/resources/packs/googleworkspace/users.go index 0a9305974d..b8681951cf 100644 --- a/resources/packs/googleworkspace/users.go +++ b/resources/packs/googleworkspace/users.go @@ -67,7 +67,7 @@ func newMqlGoogleWorkspaceUser(runtime *resources.Runtime, entry *directory.User "recoveryEmail", entry.RecoveryEmail, "recoveryPhone", entry.RecoveryPhone, "agreedToTerms", entry.AgreedToTerms, - "aliases", core.StrSliceToInterface(entry.Aliases), + "aliases", core.SliceToInterfaceSlice(entry.Aliases), "suspended", entry.Suspended, "suspensionReason", entry.SuspensionReason, "archived", entry.Archived, @@ -166,7 +166,7 @@ func newMqlGoogleWorkspaceToken(runtime *resources.Runtime, entry *directory.Tok "clientId", entry.ClientId, "displayText", entry.DisplayText, "nativeApp", entry.NativeApp, - "scopes", core.StrSliceToInterface(entry.Scopes), + "scopes", core.SliceToInterfaceSlice(entry.Scopes), "userKey", entry.UserKey, ) } diff --git a/resources/packs/k8s/apiresource.go b/resources/packs/k8s/apiresource.go index ce32ee3443..a0aca0f7ea 100644 --- a/resources/packs/k8s/apiresource.go +++ b/resources/packs/k8s/apiresource.go @@ -26,8 +26,8 @@ func (k *mqlK8s) GetApiResources() ([]interface{}, error) { "group", entry.Resource.Group, "version", entry.Resource.Version, "kind", entry.Resource.Kind, - "shortNames", core.StrSliceToInterface(entry.Resource.ShortNames), - "categories", core.StrSliceToInterface(entry.Resource.Categories), + "shortNames", core.SliceToInterfaceSlice(entry.Resource.ShortNames), + "categories", core.SliceToInterfaceSlice(entry.Resource.Categories), ) if err != nil { return nil, err diff --git a/resources/packs/k8s/container.go b/resources/packs/k8s/container.go index 354d2f557f..ed6fc2c132 100644 --- a/resources/packs/k8s/container.go +++ b/resources/packs/k8s/container.go @@ -104,8 +104,8 @@ func getContainers( "name", c.Name, "imageName", c.Image, "image", c.Image, // deprecated, will be replaced with the containerImage going forward - "command", core.StrSliceToInterface(c.Command), - "args", core.StrSliceToInterface(c.Args), + "command", core.SliceToInterfaceSlice(c.Command), + "args", core.SliceToInterfaceSlice(c.Args), "volumeMounts", volumeMounts, "volumeDevices", volumeDevices, "imagePullPolicy", string(c.ImagePullPolicy), diff --git a/resources/packs/ms365/msgraph.go b/resources/packs/ms365/msgraph.go index dce441dff5..3857badf23 100644 --- a/resources/packs/ms365/msgraph.go +++ b/resources/packs/ms365/msgraph.go @@ -199,7 +199,7 @@ func (m *mqlMicrosoft) GetUsers() ([]interface{}, error) { "jobTitle", core.ToString(user.GetJobTitle()), "mail", core.ToString(user.GetMail()), "mobilePhone", core.ToString(user.GetMobilePhone()), - "otherMails", core.StrSliceToInterface(user.GetOtherMails()), + "otherMails", core.SliceToInterfaceSlice(user.GetOtherMails()), "officeLocation", core.ToString(user.GetOfficeLocation()), "postalCode", core.ToString(user.GetPostalCode()), "state", core.ToString(user.GetState()), @@ -301,7 +301,7 @@ func (m *mqlMicrosoft) GetDomains() ([]interface{}, error) { "isVerified", core.ToBool(domain.GetIsVerified()), "passwordNotificationWindowInDays", core.ToInt64From32(domain.GetPasswordNotificationWindowInDays()), "passwordValidityPeriodInDays", core.ToInt64From32(domain.GetPasswordValidityPeriodInDays()), - "supportedServices", core.StrSliceToInterface(domain.GetSupportedServices()), + "supportedServices", core.SliceToInterfaceSlice(domain.GetSupportedServices()), ) if err != nil { return nil, err @@ -452,7 +452,7 @@ func (m *mqlMicrosoft) GetApplications() ([]interface{}, error) { "id", core.ToString(app.GetId()), "appId", core.ToString(app.GetAppId()), "createdDateTime", app.GetCreatedDateTime(), - "identifierUris", core.StrSliceToInterface(app.GetIdentifierUris()), + "identifierUris", core.SliceToInterfaceSlice(app.GetIdentifierUris()), "displayName", core.ToString(app.GetDisplayName()), "publisherDomain", core.ToString(app.GetPublisherDomain()), "signInAudience", core.ToString(app.GetSignInAudience()), @@ -537,7 +537,7 @@ func msSecureScoreToMql(runtime *resources.Runtime, score models.SecureScoreable "controlScores", controlScores, "createdDateTime", score.GetCreatedDateTime(), "currentScore", core.ToFloat64(score.GetCurrentScore()), - "enabledServices", core.StrSliceToInterface(score.GetEnabledServices()), + "enabledServices", core.SliceToInterfaceSlice(score.GetEnabledServices()), "licensedUserCount", core.ToInt64From32(score.GetLicensedUserCount()), "maxScore", core.ToFloat64(score.GetMaxScore()), "vendorInformation", vendorInformation, diff --git a/resources/packs/okta/applications.go b/resources/packs/okta/applications.go index 63cae48a57..41071c6ffa 100644 --- a/resources/packs/okta/applications.go +++ b/resources/packs/okta/applications.go @@ -99,7 +99,7 @@ func newMqlOktaApplication(runtime *resources.Runtime, entry *okta.Application) "created", entry.Created, "lastUpdated", entry.LastUpdated, "credentials", credentials, - "features", core.StrSliceToInterface(entry.Features), + "features", core.SliceToInterfaceSlice(entry.Features), "licensing", licensing, "profile", profile, "settings", settings, diff --git a/resources/packs/os/macos.go b/resources/packs/os/macos.go index 7defcbc8cb..f106c15637 100644 --- a/resources/packs/os/macos.go +++ b/resources/packs/os/macos.go @@ -168,7 +168,7 @@ func (m *mqlMacosSystemsetup) GetNetworkTimeServer() (string, error) { func (m *mqlMacosSystemsetup) GetSleep() ([]interface{}, error) { data, err := m.runCmd("systemsetup -getsleep") - return core.StrSliceToInterface(macos.SystemSetupCmdOutput{}.ParseSleep(data)), err + return core.SliceToInterfaceSlice(macos.SystemSetupCmdOutput{}.ParseSleep(data)), err } func (m *mqlMacosSystemsetup) GetDisplaySleep() (string, error) { diff --git a/resources/packs/os/yum.go b/resources/packs/os/yum.go index 8152bf96a0..452121c076 100644 --- a/resources/packs/os/yum.go +++ b/resources/packs/os/yum.go @@ -58,7 +58,7 @@ func (y *mqlYum) GetRepos() ([]interface{}, error) { "id", repo.Id, "name", repo.Name, "status", repo.Status, - "baseurl", core.StrSliceToInterface(repo.Baseurl), + "baseurl", core.SliceToInterfaceSlice(repo.Baseurl), "expire", repo.Expire, "filename", repo.Filename, "file", f, diff --git a/resources/packs/terraform/hcl.go b/resources/packs/terraform/hcl.go index 0e3d868209..d48ecee6f7 100644 --- a/resources/packs/terraform/hcl.go +++ b/resources/packs/terraform/hcl.go @@ -190,7 +190,7 @@ func newMqlHclBlock(runtime *resources.Runtime, block *hcl.Block, file *hcl.File r, err := runtime.CreateResource("terraform.block", "type", block.Type, - "labels", core.StrSliceToInterface(block.Labels), + "labels", core.SliceToInterfaceSlice(block.Labels), "start", start, "end", end, "snippet", snippet, diff --git a/resources/packs/terraform/tfplan.go b/resources/packs/terraform/tfplan.go index 7e0135c06b..019fb5f196 100644 --- a/resources/packs/terraform/tfplan.go +++ b/resources/packs/terraform/tfplan.go @@ -93,7 +93,7 @@ func (t *mqlTerraformPlan) GetResourceChanges() ([]interface{}, error) { lumiChange, err := t.MotorRuntime.CreateResource("terraform.plan.proposedChange", "address", rc.Address, - "actions", core.StrSliceToInterface(rc.Change.Actions), + "actions", core.SliceToInterfaceSlice(rc.Change.Actions), "before", before, "after", after, "afterUnknown", afterUnknown, diff --git a/resources/packs/terraform/tfstate.go b/resources/packs/terraform/tfstate.go index c6f0dd3d53..5e04ef4667 100644 --- a/resources/packs/terraform/tfstate.go +++ b/resources/packs/terraform/tfstate.go @@ -316,7 +316,7 @@ func newMqlResource(runtime *resources.Runtime, resource *terraform.Resource) (r "providerName", resource.ProviderName, "schemaVersion", int64(resource.SchemaVersion), "values", resource.AttributeValues, - "dependsOn", core.StrSliceToInterface(resource.DependsOn), + "dependsOn", core.SliceToInterfaceSlice(resource.DependsOn), "tainted", resource.Tainted, "deposedKey", resource.DeposedKey, ) diff --git a/resources/packs/vsphere/resourceclient/esxi.go b/resources/packs/vsphere/resourceclient/esxi.go index eb606c2720..4da20016d3 100644 --- a/resources/packs/vsphere/resourceclient/esxi.go +++ b/resources/packs/vsphere/resourceclient/esxi.go @@ -47,7 +47,7 @@ func esxiValuesToDict(val esxcli.Values) map[string]interface{} { dict[k] = val[k][0] } else { // convert to []interface - dict[k] = core.StrSliceToInterface(val[k]) + dict[k] = core.SliceToInterfaceSlice(val[k]) } } return dict diff --git a/resources/packs/vsphere/vsphere.go b/resources/packs/vsphere/vsphere.go index bfe3ac9f3c..8c369e1f70 100644 --- a/resources/packs/vsphere/vsphere.go +++ b/resources/packs/vsphere/vsphere.go @@ -473,7 +473,7 @@ func (v *mqlVsphereHost) GetVmknics() ([]interface{}, error) { "properties", entry.Properties, "ipv4", entry.Ipv4, "ipv6", entry.Ipv6, - "tags", core.StrSliceToInterface(entry.Tags), + "tags", core.SliceToInterfaceSlice(entry.Tags), ) if err != nil { return nil, err @@ -621,7 +621,7 @@ func (v *mqlVsphereHost) GetServices() ([]interface{}, error) { "required", s.Required, "uninstallable", s.Uninstallable, "running", s.Running, - "ruleset", core.StrSliceToInterface(s.Ruleset), + "ruleset", core.SliceToInterfaceSlice(s.Ruleset), "policy", s.Policy, // on, off, automatic ) if err != nil { @@ -695,8 +695,8 @@ func (v *mqlVsphereHost) GetNtp() (interface{}, error) { var config []interface{} if datetimeinfo != nil && datetimeinfo.NtpConfig != nil { - server = core.StrSliceToInterface(datetimeinfo.NtpConfig.Server) - config = core.StrSliceToInterface(datetimeinfo.NtpConfig.ConfigFile) + server = core.SliceToInterfaceSlice(datetimeinfo.NtpConfig.Server) + config = core.SliceToInterfaceSlice(datetimeinfo.NtpConfig.ConfigFile) } mqlNtpConfig, err := v.MotorRuntime.CreateResource("esxi.ntpconfig",