Skip to content

Commit

Permalink
🧹 Replace llx.StringData and llx.BoolData with llx.StringDataPtr and …
Browse files Browse the repository at this point in the history
…llx.BoolDataPtr in azure.

Signed-off-by: Preslav <[email protected]>
  • Loading branch information
preslavgerchev committed Feb 17, 2024
1 parent ef84431 commit b32b109
Show file tree
Hide file tree
Showing 17 changed files with 371 additions and 371 deletions.
18 changes: 9 additions & 9 deletions providers/azure/resources/aks.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,18 @@ func (a *mqlAzureSubscriptionAksService) clusters() ([]interface{}, error) {

mqlAksCluster, err := CreateResource(a.MqlRuntime, "azure.subscription.aksService.cluster",
map[string]*llx.RawData{
"id": llx.StringData(convert.ToString(entry.ID)),
"name": llx.StringData(convert.ToString(entry.Name)),
"location": llx.StringData(convert.ToString(entry.Location)),
"kubernetesVersion": llx.StringData(convert.ToString(entry.Properties.KubernetesVersion)),
"provisioningState": llx.StringData(convert.ToString(entry.Properties.ProvisioningState)),
"id": llx.StringDataPtr(entry.ID),
"name": llx.StringDataPtr(entry.Name),
"location": llx.StringDataPtr(entry.Location),
"kubernetesVersion": llx.StringDataPtr(entry.Properties.KubernetesVersion),
"provisioningState": llx.StringDataPtr(entry.Properties.ProvisioningState),
"createdAt": llx.TimeDataPtr(createdAt),
"nodeResourceGroup": llx.StringData(convert.ToString(entry.Properties.NodeResourceGroup)),
"nodeResourceGroup": llx.StringDataPtr(entry.Properties.NodeResourceGroup),
"powerState": llx.StringData(convert.ToString((*string)(entry.Properties.PowerState.Code))),
"tags": llx.MapData(convert.PtrMapStrToInterface(entry.Tags), types.String),
"rbacEnabled": llx.BoolData(convert.ToBool(entry.Properties.EnableRBAC)),
"dnsPrefix": llx.StringData(convert.ToString(entry.Properties.DNSPrefix)),
"fqdn": llx.StringData(convert.ToString(entry.Properties.Fqdn)),
"rbacEnabled": llx.BoolDataPtr(entry.Properties.EnableRBAC),
"dnsPrefix": llx.StringDataPtr(entry.Properties.DNSPrefix),
"fqdn": llx.StringDataPtr(entry.Properties.Fqdn),
"agentPoolProfiles": llx.DictData(agentPoolProfiles),
"addonProfiles": llx.DictData(addonProfiles),
"httpProxyConfig": llx.DictData(httpProxyConfig),
Expand Down
6 changes: 3 additions & 3 deletions providers/azure/resources/authorization.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ func (a *mqlAzureSubscriptionAuthorizationService) roleDefinitions() ([]interfac
}
mqlRoleDefinition, err := CreateResource(a.MqlRuntime, "azure.subscription.authorizationService.roleDefinition",
map[string]*llx.RawData{
"id": llx.StringData(convert.ToString(roleDef.ID)),
"name": llx.StringData(convert.ToString(roleDef.Properties.RoleName)),
"description": llx.StringData(convert.ToString(roleDef.Properties.Description)),
"id": llx.StringDataPtr(roleDef.ID),
"name": llx.StringDataPtr(roleDef.Properties.RoleName),
"description": llx.StringDataPtr(roleDef.Properties.Description),
"isCustom": llx.BoolData(isCustom),
"scopes": llx.ArrayData(scopes, types.String),
"permissions": llx.ArrayData(permissions, types.ResourceLike),
Expand Down
4 changes: 2 additions & 2 deletions providers/azure/resources/cloud_defender.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ func (a *mqlAzureSubscriptionCloudDefenderService) securityContacts() ([]interfa
mailsArr := strings.Split(mails, ";")
mqlSecurityContact, err := CreateResource(a.MqlRuntime, "azure.subscription.cloudDefenderService.securityContact",
map[string]*llx.RawData{
"id": llx.StringData(convert.ToString(contact.ID)),
"name": llx.StringData(convert.ToString(contact.Name)),
"id": llx.StringDataPtr(contact.ID),
"name": llx.StringDataPtr(contact.Name),
"emails": llx.ArrayData(convert.SliceAnyToInterface(mailsArr), types.String),
"notificationsByRole": llx.DictData(notificationsByRole),
"alertNotifications": llx.DictData(alertNotifications),
Expand Down
28 changes: 14 additions & 14 deletions providers/azure/resources/compute.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ func (a *mqlAzureSubscriptionComputeService) vms() ([]interface{}, error) {

mqlAzureVm, err := CreateResource(a.MqlRuntime, "azure.subscription.computeService.vm",
map[string]*llx.RawData{
"id": llx.StringData(convert.ToString(vm.ID)),
"name": llx.StringData(convert.ToString(vm.Name)),
"location": llx.StringData(convert.ToString(vm.Location)),
"id": llx.StringDataPtr(vm.ID),
"name": llx.StringDataPtr(vm.Name),
"location": llx.StringDataPtr(vm.Location),
"zones": llx.ArrayData(convert.SliceStrPtrToInterface(vm.Zones), types.String),
"tags": llx.MapData(convert.PtrMapStrToInterface(vm.Tags), types.String),
"type": llx.StringData(convert.ToString(vm.Type)),
"type": llx.StringDataPtr(vm.Type),
"properties": llx.DictData(properties),
})
if err != nil {
Expand Down Expand Up @@ -254,12 +254,12 @@ func diskToMql(runtime *plugin.Runtime, disk compute.Disk) (*mqlAzureSubscriptio

res, err := CreateResource(runtime, "azure.subscription.computeService.disk",
map[string]*llx.RawData{
"id": llx.StringData(convert.ToString(disk.ID)),
"name": llx.StringData(convert.ToString(disk.Name)),
"location": llx.StringData(convert.ToString(disk.Location)),
"id": llx.StringDataPtr(disk.ID),
"name": llx.StringDataPtr(disk.Name),
"location": llx.StringDataPtr(disk.Location),
"tags": llx.MapData(convert.PtrMapStrToInterface(disk.Tags), types.String),
"type": llx.StringData(convert.ToString(disk.Type)),
"managedBy": llx.StringData(convert.ToString(disk.ManagedBy)),
"type": llx.StringDataPtr(disk.Type),
"managedBy": llx.StringDataPtr(disk.ManagedBy),
"managedByExtended": llx.ArrayData(managedByExtended, types.String),
"zones": llx.ArrayData(zones, types.String),
"sku": llx.DictData(sku),
Expand Down Expand Up @@ -462,12 +462,12 @@ func (a *mqlAzureSubscriptionComputeServiceVm) publicIpAddresses() ([]interface{
}
mqlIpAddress, err := CreateResource(a.MqlRuntime, "azure.subscription.networkService.ipAddress",
map[string]*llx.RawData{
"id": llx.StringData(convert.ToString(ipAddress.ID)),
"name": llx.StringData(convert.ToString(ipAddress.Name)),
"location": llx.StringData(convert.ToString(ipAddress.Location)),
"id": llx.StringDataPtr(ipAddress.ID),
"name": llx.StringDataPtr(ipAddress.Name),
"location": llx.StringDataPtr(ipAddress.Location),
"tags": llx.MapData(convert.PtrMapStrToInterface(ipAddress.Tags), types.String),
"ipAddress": llx.StringData(convert.ToString(ipAddress.Properties.IPAddress)),
"type": llx.StringData(convert.ToString(ipAddress.Type)),
"ipAddress": llx.StringDataPtr(ipAddress.Properties.IPAddress),
"type": llx.StringDataPtr(ipAddress.Type),
})
if err != nil {
return nil, err
Expand Down
8 changes: 4 additions & 4 deletions providers/azure/resources/cosmosdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ func (a *mqlAzureSubscriptionCosmosDbService) accounts() ([]interface{}, error)

mqlCosmosDbAccount, err := CreateResource(a.MqlRuntime, "azure.subscription.cosmosDbService.account",
map[string]*llx.RawData{
"id": llx.StringData(convert.ToString(account.ID)),
"name": llx.StringData(convert.ToString(account.Name)),
"id": llx.StringDataPtr(account.ID),
"name": llx.StringDataPtr(account.Name),
"tags": llx.MapData(convert.PtrMapStrToInterface(account.Tags), types.String),
"location": llx.StringData(convert.ToString(account.Location)),
"location": llx.StringDataPtr(account.Location),
"kind": llx.StringData(convert.ToString((*string)(account.Kind))),
"type": llx.StringData(convert.ToString(account.Type)),
"type": llx.StringDataPtr(account.Type),
"properties": llx.DictData(properties),
})
if err != nil {
Expand Down
32 changes: 16 additions & 16 deletions providers/azure/resources/keyvault.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ func (a *mqlAzureSubscriptionKeyVaultService) vaults() ([]interface{}, error) {
for _, entry := range page.Value {
mqlAzure, err := CreateResource(a.MqlRuntime, "azure.subscription.keyVaultService.vault",
map[string]*llx.RawData{
"id": llx.StringData(convert.ToString(entry.ID)),
"vaultName": llx.StringData(convert.ToString(entry.Name)),
"location": llx.StringData(convert.ToString(entry.Location)),
"type": llx.StringData(convert.ToString(entry.Type)),
"id": llx.StringDataPtr(entry.ID),
"vaultName": llx.StringDataPtr(entry.Name),
"location": llx.StringDataPtr(entry.Location),
"type": llx.StringDataPtr(entry.Type),
"tags": llx.MapData(convert.PtrMapStrToInterface(entry.Tags), types.String),
})
if err != nil {
Expand Down Expand Up @@ -189,9 +189,9 @@ func (a *mqlAzureSubscriptionKeyVaultServiceVault) keys() ([]interface{}, error)
mqlAzure, err := CreateResource(a.MqlRuntime, "azure.subscription.keyVaultService.key",
map[string]*llx.RawData{
"kid": llx.StringData(convert.ToString((*string)(entry.KID))),
"managed": llx.BoolData(convert.ToBool(entry.Managed)),
"managed": llx.BoolDataPtr(entry.Managed),
"tags": llx.MapData(convert.PtrMapStrToInterface(entry.Tags), types.String),
"enabled": llx.BoolData(convert.ToBool(entry.Attributes.Enabled)),
"enabled": llx.BoolDataPtr(entry.Attributes.Enabled),
"created": llx.TimeDataPtr(entry.Attributes.Created),
"updated": llx.TimeDataPtr(entry.Attributes.Updated),
"expires": llx.TimeDataPtr(entry.Attributes.Expires),
Expand Down Expand Up @@ -232,9 +232,9 @@ func (a *mqlAzureSubscriptionKeyVaultServiceVault) secrets() ([]interface{}, err
map[string]*llx.RawData{
"id": llx.StringData(convert.ToString((*string)(entry.ID))),
"tags": llx.MapData(convert.PtrMapStrToInterface(entry.Tags), types.String),
"contentType": llx.StringData(convert.ToString(entry.ContentType)),
"managed": llx.BoolData(convert.ToBool(entry.Managed)),
"enabled": llx.BoolData(convert.ToBool(entry.Attributes.Enabled)),
"contentType": llx.StringDataPtr(entry.ContentType),
"managed": llx.BoolDataPtr(entry.Managed),
"enabled": llx.BoolDataPtr(entry.Attributes.Enabled),
"created": llx.TimeDataPtr(entry.Attributes.Created),
"updated": llx.TimeDataPtr(entry.Attributes.Updated),
"expires": llx.TimeDataPtr(entry.Attributes.Expires),
Expand Down Expand Up @@ -274,7 +274,7 @@ func (a *mqlAzureSubscriptionKeyVaultServiceVault) certificates() ([]interface{}
map[string]*llx.RawData{
"id": llx.StringData(convert.ToString((*string)(entry.ID))),
"tags": llx.MapData(convert.PtrMapStrToInterface(entry.Tags), types.String),
"enabled": llx.BoolData(convert.ToBool(entry.Attributes.Enabled)),
"enabled": llx.BoolDataPtr(entry.Attributes.Enabled),
"created": llx.TimeDataPtr(entry.Attributes.Created),
"updated": llx.TimeDataPtr(entry.Attributes.Updated),
"expires": llx.TimeDataPtr(entry.Attributes.Expires),
Expand Down Expand Up @@ -351,9 +351,9 @@ func (a *mqlAzureSubscriptionKeyVaultServiceKey) versions() ([]interface{}, erro
mqlAzure, err := CreateResource(a.MqlRuntime, "azure.subscription.keyVaultService.key",
map[string]*llx.RawData{
"kid": llx.StringData(convert.ToString((*string)(entry.KID))),
"managed": llx.BoolData(convert.ToBool(entry.Managed)),
"managed": llx.BoolDataPtr(entry.Managed),
"tags": llx.MapData(convert.PtrMapStrToInterface(entry.Tags), types.String),
"enabled": llx.BoolData(convert.ToBool(entry.Attributes.Enabled)),
"enabled": llx.BoolDataPtr(entry.Attributes.Enabled),
"created": llx.TimeDataPtr(entry.Attributes.Created),
"updated": llx.TimeDataPtr(entry.Attributes.Updated),
"expires": llx.TimeDataPtr(entry.Attributes.Expires),
Expand Down Expand Up @@ -426,7 +426,7 @@ func (a *mqlAzureSubscriptionKeyVaultServiceCertificate) versions() ([]interface
map[string]*llx.RawData{
"id": llx.StringData(convert.ToString((*string)(entry.ID))),
"tags": llx.MapData(convert.PtrMapStrToInterface(entry.Tags), types.String),
"enabled": llx.BoolData(convert.ToBool(entry.Attributes.Enabled)),
"enabled": llx.BoolDataPtr(entry.Attributes.Enabled),
"created": llx.TimeDataPtr(entry.Attributes.Created),
"updated": llx.TimeDataPtr(entry.Attributes.Updated),
"expires": llx.TimeDataPtr(entry.Attributes.Expires),
Expand Down Expand Up @@ -502,9 +502,9 @@ func (a *mqlAzureSubscriptionKeyVaultServiceSecret) versions() ([]interface{}, e
map[string]*llx.RawData{
"id": llx.StringData(convert.ToString((*string)(entry.ID))),
"tags": llx.MapData(convert.PtrMapStrToInterface(entry.Tags), types.String),
"contentType": llx.StringData(convert.ToString(entry.ContentType)),
"managed": llx.BoolData(convert.ToBool(entry.Managed)),
"enabled": llx.BoolData(convert.ToBool(entry.Attributes.Enabled)),
"contentType": llx.StringDataPtr(entry.ContentType),
"managed": llx.BoolDataPtr(entry.Managed),
"enabled": llx.BoolDataPtr(entry.Attributes.Enabled),
"created": llx.TimeDataPtr(entry.Attributes.Created),
"updated": llx.TimeDataPtr(entry.Attributes.Updated),
"expires": llx.TimeDataPtr(entry.Attributes.Expires),
Expand Down
46 changes: 23 additions & 23 deletions providers/azure/resources/mariadb.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ func (a *mqlAzureSubscriptionMariaDbService) servers() ([]interface{}, error) {

mqlAzureDbServer, err := CreateResource(a.MqlRuntime, "azure.subscription.mariaDbService.server",
map[string]*llx.RawData{
"id": llx.StringData(convert.ToString(dbServer.ID)),
"name": llx.StringData(convert.ToString(dbServer.Name)),
"location": llx.StringData(convert.ToString(dbServer.Location)),
"id": llx.StringDataPtr(dbServer.ID),
"name": llx.StringDataPtr(dbServer.Name),
"location": llx.StringDataPtr(dbServer.Location),
"tags": llx.MapData(convert.PtrMapStrToInterface(dbServer.Tags), types.String),
"type": llx.StringData(convert.ToString(dbServer.Type)),
"type": llx.StringDataPtr(dbServer.Type),
"properties": llx.DictData(properties),
})
if err != nil {
Expand Down Expand Up @@ -113,11 +113,11 @@ func (a *mqlAzureSubscriptionMariaDbServiceServer) databases() ([]interface{}, e
for _, entry := range page.Value {
mqlAzureDatabase, err := CreateResource(a.MqlRuntime, "azure.subscription.mariaDbService.database",
map[string]*llx.RawData{
"id": llx.StringData(convert.ToString(entry.ID)),
"name": llx.StringData(convert.ToString(entry.Name)),
"type": llx.StringData(convert.ToString(entry.Type)),
"charset": llx.StringData(convert.ToString(entry.Properties.Charset)),
"collation": llx.StringData(convert.ToString(entry.Properties.Collation)),
"id": llx.StringDataPtr(entry.ID),
"name": llx.StringDataPtr(entry.Name),
"type": llx.StringDataPtr(entry.Type),
"charset": llx.StringDataPtr(entry.Properties.Charset),
"collation": llx.StringDataPtr(entry.Properties.Collation),
})
if err != nil {
return nil, err
Expand Down Expand Up @@ -161,11 +161,11 @@ func (a *mqlAzureSubscriptionMariaDbServiceServer) firewallRules() ([]interface{
for _, entry := range page.Value {
mqlFireWallRule, err := CreateResource(a.MqlRuntime, "azure.subscription.sqlService.firewallrule",
map[string]*llx.RawData{
"id": llx.StringData(convert.ToString(entry.ID)),
"name": llx.StringData(convert.ToString(entry.Name)),
"type": llx.StringData(convert.ToString(entry.Type)),
"startIpAddress": llx.StringData(convert.ToString(entry.Properties.StartIPAddress)),
"endIpAddress": llx.StringData(convert.ToString(entry.Properties.EndIPAddress)),
"id": llx.StringDataPtr(entry.ID),
"name": llx.StringDataPtr(entry.Name),
"type": llx.StringDataPtr(entry.Type),
"startIpAddress": llx.StringDataPtr(entry.Properties.StartIPAddress),
"endIpAddress": llx.StringDataPtr(entry.Properties.EndIPAddress),
})
if err != nil {
return nil, err
Expand Down Expand Up @@ -208,15 +208,15 @@ func (a *mqlAzureSubscriptionMariaDbServiceServer) configuration() ([]interface{
for _, entry := range page.Value {
mqlAzureConfiguration, err := CreateResource(a.MqlRuntime, "azure.subscription.sqlService.configuration",
map[string]*llx.RawData{
"id": llx.StringData(convert.ToString(entry.ID)),
"name": llx.StringData(convert.ToString(entry.Name)),
"type": llx.StringData(convert.ToString(entry.Type)),
"value": llx.StringData(convert.ToString(entry.Properties.Value)),
"description": llx.StringData(convert.ToString(entry.Properties.Description)),
"defaultValue": llx.StringData(convert.ToString(entry.Properties.DefaultValue)),
"dataType": llx.StringData(convert.ToString(entry.Properties.DataType)),
"allowedValues": llx.StringData(convert.ToString(entry.Properties.AllowedValues)),
"source": llx.StringData(convert.ToString(entry.Properties.Source)),
"id": llx.StringDataPtr(entry.ID),
"name": llx.StringDataPtr(entry.Name),
"type": llx.StringDataPtr(entry.Type),
"value": llx.StringDataPtr(entry.Properties.Value),
"description": llx.StringDataPtr(entry.Properties.Description),
"defaultValue": llx.StringDataPtr(entry.Properties.DefaultValue),
"dataType": llx.StringDataPtr(entry.Properties.DataType),
"allowedValues": llx.StringDataPtr(entry.Properties.AllowedValues),
"source": llx.StringDataPtr(entry.Properties.Source),
})
if err != nil {
return nil, err
Expand Down
Loading

0 comments on commit b32b109

Please sign in to comment.