diff --git a/plugins/source/azure/client/client.go b/plugins/source/azure/client/client.go index c88b2146346c22..93b3d9436e4404 100644 --- a/plugins/source/azure/client/client.go +++ b/plugins/source/azure/client/client.go @@ -18,10 +18,16 @@ import ( const Namespacemicrosoft_dbformariadb = "microsoft.dbformariadb" const Namespacemicrosoft_keyvault = "microsoft.keyvault" +const Namespacemicrosoft_cache = "microsoft.cache" +const Namespacemicrosoft_search = "microsoft.search" +const Namespacemicrosoft_logic = "microsoft.logic" var otherNamespaces = []string{ Namespacemicrosoft_dbformariadb, Namespacemicrosoft_keyvault, + Namespacemicrosoft_cache, + Namespacemicrosoft_search, + Namespacemicrosoft_logic, } var allNamespaces = append(autoGeneratedNamespaces, otherNamespaces...) diff --git a/plugins/source/azure/codegen2/recipes/logic_e.go b/plugins/source/azure/codegen2/recipes/logic_e.go new file mode 100644 index 00000000000000..b238b3171d7d69 --- /dev/null +++ b/plugins/source/azure/codegen2/recipes/logic_e.go @@ -0,0 +1,20 @@ +package recipes + +import "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/logic/armlogic" + +func init() { + tables := []Table{ + { + Service: "armlogic", + Name: "workflows", + Struct: &armlogic.Workflow{}, + ResponseStruct: &armlogic.WorkflowsClientListBySubscriptionResponse{}, + Client: &armlogic.WorkflowsClient{}, + ListFunc: (&armlogic.WorkflowsClient{}).NewListBySubscriptionPager, + NewFunc: armlogic.NewWorkflowsClient, + URL: "/subscriptions/{subscriptionId}/providers/Microsoft.Logic/workflows", + Multiplex: `client.SubscriptionMultiplexRegisteredNamespace(client.Namespacemicrosoft_logic)`, + }, + } + Tables = append(Tables, tables...) +} diff --git a/plugins/source/azure/codegen2/recipes/monitor_e.go b/plugins/source/azure/codegen2/recipes/monitor_e.go new file mode 100644 index 00000000000000..d2a5b1e8c68365 --- /dev/null +++ b/plugins/source/azure/codegen2/recipes/monitor_e.go @@ -0,0 +1,20 @@ +package recipes + +import "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" + +func init() { + tables := []Table{ + { + Service: "armmonitor", + Name: "tenant_activity_log_alerts", + Struct: &armmonitor.ActivityLogAlertResource{}, + ResponseStruct: &armmonitor.ActivityLogAlertsClientListBySubscriptionIDResponse{}, + Client: &armmonitor.ActivityLogAlertsClient{}, + ListFunc: (&armmonitor.ActivityLogAlertsClient{}).NewListBySubscriptionIDPager, + NewFunc: armmonitor.NewActivityLogAlertsClient, + URL: "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/activityLogAlerts", + Multiplex: `client.SubscriptionMultiplexRegisteredNamespace(client.Namespacemicrosoft_insights)`, + }, + } + Tables = append(Tables, tables...) +} diff --git a/plugins/source/azure/codegen2/recipes/redis_e.go b/plugins/source/azure/codegen2/recipes/redis_e.go new file mode 100644 index 00000000000000..397272735aa487 --- /dev/null +++ b/plugins/source/azure/codegen2/recipes/redis_e.go @@ -0,0 +1,20 @@ +package recipes + +import "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redis/armredis" + +func init() { + tables := []Table{ + { + Service: "armredis", + Name: "caches", + Struct: &armredis.ResourceInfo{}, + ResponseStruct: &armredis.ClientListBySubscriptionResponse{}, + Client: &armredis.Client{}, + ListFunc: (&armredis.Client{}).NewListBySubscriptionPager, + NewFunc: armredis.NewClient, + URL: "/subscriptions/{subscriptionId}/providers/Microsoft.Cache/redis", + Multiplex: `client.SubscriptionMultiplexRegisteredNamespace(client.Namespacemicrosoft_cache)`, + }, + } + Tables = append(Tables, tables...) +} diff --git a/plugins/source/azure/codegen2/recipes/search_e.go b/plugins/source/azure/codegen2/recipes/search_e.go new file mode 100644 index 00000000000000..f295a64e977f40 --- /dev/null +++ b/plugins/source/azure/codegen2/recipes/search_e.go @@ -0,0 +1,21 @@ +package recipes + +import "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch" + +func init() { + tables := []Table{ + { + Service: "armsearch", + Name: "services", + Struct: &armsearch.Service{}, + ResponseStruct: &armsearch.ServicesClientListBySubscriptionResponse{}, + Client: &armsearch.ServicesClient{}, + ListFunc: (&armsearch.ServicesClient{}).NewListBySubscriptionPager, + NewFunc: armsearch.NewServicesClient, + URL: "/subscriptions/{subscriptionId}/providers/Microsoft.Search/searchServices", + Multiplex: `client.SubscriptionMultiplexRegisteredNamespace(client.Namespacemicrosoft_search)`, + SkipFetch: true, + }, + } + Tables = append(Tables, tables...) +} diff --git a/plugins/source/azure/docs/tables/README.md b/plugins/source/azure/docs/tables/README.md index fe234db7cedc7f..f8151aee02e4f4 100644 --- a/plugins/source/azure/docs/tables/README.md +++ b/plugins/source/azure/docs/tables/README.md @@ -107,6 +107,7 @@ - [azure_keyvault_keyvault_keys](azure_keyvault_keyvault_keys.md) - [azure_keyvault_keyvault_secrets](azure_keyvault_keyvault_secrets.md) - [azure_kusto_clusters](azure_kusto_clusters.md) +- [azure_logic_workflows](azure_logic_workflows.md) - [azure_maintenance_configurations](azure_maintenance_configurations.md) - [azure_maintenance_public_maintenance_configurations](azure_maintenance_public_maintenance_configurations.md) - [azure_mariadb_servers](azure_mariadb_servers.md) @@ -115,6 +116,7 @@ - [azure_monitor_log_profiles](azure_monitor_log_profiles.md) - [azure_monitor_private_link_scopes](azure_monitor_private_link_scopes.md) - [azure_monitor_tenant_activity_logs](azure_monitor_tenant_activity_logs.md) +- [azure_monitor_tenant_activity_log_alerts](azure_monitor_tenant_activity_log_alerts.md) - [azure_mysql_servers](azure_mysql_servers.md) - [azure_mysql_server_configurations](azure_mysql_server_configurations.md) - [azure_mysqlflexibleservers_servers](azure_mysqlflexibleservers_servers.md) @@ -180,11 +182,13 @@ - [azure_privatedns_private_zones](azure_privatedns_private_zones.md) - [azure_providerhub_provider_registrations](azure_providerhub_provider_registrations.md) - [azure_redhatopenshift_open_shift_clusters](azure_redhatopenshift_open_shift_clusters.md) +- [azure_redis_caches](azure_redis_caches.md) - [azure_relay_namespaces](azure_relay_namespaces.md) - [azure_reservations_reservation](azure_reservations_reservation.md) - [azure_reservations_reservation_order](azure_reservations_reservation_order.md) - [azure_resources_resources](azure_resources_resources.md) - [azure_saas_resources](azure_saas_resources.md) +- [azure_search_services](azure_search_services.md) - [azure_security_alerts](azure_security_alerts.md) - [azure_security_alerts_suppression_rules](azure_security_alerts_suppression_rules.md) - [azure_security_allowed_connections](azure_security_allowed_connections.md) diff --git a/plugins/source/azure/docs/tables/azure_logic_workflows.md b/plugins/source/azure/docs/tables/azure_logic_workflows.md new file mode 100644 index 00000000000000..5db0a397800260 --- /dev/null +++ b/plugins/source/azure/docs/tables/azure_logic_workflows.md @@ -0,0 +1,19 @@ +# Table: azure_logic_workflows + +The primary key for this table is **id**. + +## Columns + +| Name | Type | +| ------------- | ------------- | +|_cq_source_name|String| +|_cq_sync_time|Timestamp| +|_cq_id|UUID| +|_cq_parent_id|UUID| +|identity|JSON| +|location|String| +|properties|JSON| +|tags|JSON| +|id (PK)|String| +|name|String| +|type|String| \ No newline at end of file diff --git a/plugins/source/azure/docs/tables/azure_monitor_tenant_activity_log_alerts.md b/plugins/source/azure/docs/tables/azure_monitor_tenant_activity_log_alerts.md new file mode 100644 index 00000000000000..e3a2362e1392c3 --- /dev/null +++ b/plugins/source/azure/docs/tables/azure_monitor_tenant_activity_log_alerts.md @@ -0,0 +1,18 @@ +# Table: azure_monitor_tenant_activity_log_alerts + +The primary key for this table is **id**. + +## Columns + +| Name | Type | +| ------------- | ------------- | +|_cq_source_name|String| +|_cq_sync_time|Timestamp| +|_cq_id|UUID| +|_cq_parent_id|UUID| +|location|String| +|properties|JSON| +|tags|JSON| +|id (PK)|String| +|name|String| +|type|String| \ No newline at end of file diff --git a/plugins/source/azure/docs/tables/azure_redis_caches.md b/plugins/source/azure/docs/tables/azure_redis_caches.md new file mode 100644 index 00000000000000..9331096c3bc7e1 --- /dev/null +++ b/plugins/source/azure/docs/tables/azure_redis_caches.md @@ -0,0 +1,20 @@ +# Table: azure_redis_caches + +The primary key for this table is **id**. + +## Columns + +| Name | Type | +| ------------- | ------------- | +|_cq_source_name|String| +|_cq_sync_time|Timestamp| +|_cq_id|UUID| +|_cq_parent_id|UUID| +|location|String| +|properties|JSON| +|identity|JSON| +|tags|JSON| +|zones|StringArray| +|id (PK)|String| +|name|String| +|type|String| \ No newline at end of file diff --git a/plugins/source/azure/docs/tables/azure_search_services.md b/plugins/source/azure/docs/tables/azure_search_services.md new file mode 100644 index 00000000000000..422da235cfe9b8 --- /dev/null +++ b/plugins/source/azure/docs/tables/azure_search_services.md @@ -0,0 +1,20 @@ +# Table: azure_search_services + +The primary key for this table is **id**. + +## Columns + +| Name | Type | +| ------------- | ------------- | +|_cq_source_name|String| +|_cq_sync_time|Timestamp| +|_cq_id|UUID| +|_cq_parent_id|UUID| +|location|String| +|identity|JSON| +|properties|JSON| +|sku|JSON| +|tags|JSON| +|id (PK)|String| +|name|String| +|type|String| \ No newline at end of file diff --git a/plugins/source/azure/go.mod b/plugins/source/azure/go.mod index 518925b3303df6..3be5941a094735 100644 --- a/plugins/source/azure/go.mod +++ b/plugins/source/azure/go.mod @@ -62,6 +62,7 @@ require ( github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault v1.0.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto v1.1.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/labservices/armlabservices v1.0.0 + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/logic/armlogic v1.0.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/machinelearning/armmachinelearning v1.0.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/maintenance/armmaintenance v1.0.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementpartner/armmanagementpartner v0.5.0 @@ -85,12 +86,14 @@ require ( github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/providerhub/armproviderhub v1.0.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/quota/armquota v0.5.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redhatopenshift/armredhatopenshift v1.0.0 + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redis/armredis v1.0.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/relay/armrelay v1.0.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/reservations/armreservations v1.1.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armlocks v1.0.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armpolicy v0.6.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/saas/armsaas v0.5.0 + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch v1.0.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity v0.9.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/servicebus/armservicebus v1.0.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql v1.0.0 diff --git a/plugins/source/azure/go.sum b/plugins/source/azure/go.sum index 292dfa3c689fcb..8d37619356ba14 100644 --- a/plugins/source/azure/go.sum +++ b/plugins/source/azure/go.sum @@ -152,6 +152,8 @@ github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto v1.1.0 h1:0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto v1.1.0/go.mod h1:2+xLw3wnpvSce83gQnAu42MVl3/tiSGcWtEuWe1nhbo= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/labservices/armlabservices v1.0.0 h1:uIjbZwtaWCNPCAu7EVlWKVokAS/+owCbv94sFF1QJyE= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/labservices/armlabservices v1.0.0/go.mod h1:gEopvGKHsDreOE1eiqDJoDIFslSDReh+lTvnlQsFfiE= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/logic/armlogic v1.0.0 h1:zpvUxUvAyKXn3vhE9+huD0FEq1VIE6C5SuCKDQPaCcg= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/logic/armlogic v1.0.0/go.mod h1:wKxEe9OvQk7W+/ZxqjitjvCo33uzbJ99zz3Azzytmu0= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/machinelearning/armmachinelearning v1.0.0 h1:KWvCVjnOTKCZAlqED5KPNoN9AfcK2BhUeveLdiwy33Q= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/machinelearning/armmachinelearning v1.0.0/go.mod h1:qNN4I5AKYbXMLriS9XKebBw8EVIQkX6tJzrdtjOoJ4I= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/maintenance/armmaintenance v1.0.0 h1:dlpFQVi25aChz4Da4z/xqDZW1XaIrr2WdOLQCHKopg0= @@ -198,6 +200,8 @@ github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/quota/armquota v0.5.0 h1:s github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/quota/armquota v0.5.0/go.mod h1:3f1KiBgDekWbbKxDF8gp+w6HSYxPugQzpOorMap4KwQ= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redhatopenshift/armredhatopenshift v1.0.0 h1:mPzD99b57uCHLvvDYRwoNcfC1Gh1vWapQpfxAvtwCDQ= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redhatopenshift/armredhatopenshift v1.0.0/go.mod h1:3TXTu2YxzFYxfjz5h+z+0DcxaFwGlSH84B6kFjcTWQ4= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redis/armredis v1.0.0 h1:nmpTBgRg1HynngFYICRhceC7s5dmbKN9fJ/XQz/UQ2I= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redis/armredis v1.0.0/go.mod h1:3yjiOtnkVociBTlF7UZrwAGfJrGaOCsvtVS4HzNajxQ= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/relay/armrelay v1.0.0 h1:MpzuhAA8DyFfJ2mcVnfBE+OsS7r2oWGnJ0zoCuZ2OYc= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/relay/armrelay v1.0.0/go.mod h1:mcgbqUk0SJX+X93DQdseYYzpbMcgx4yJp2qDeOj9OXA= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/reservations/armreservations v1.1.0 h1:0OO/3K+SKt45gXiOU4gHRILOLeNOUZdqeNO47Mq6iN8= @@ -210,6 +214,8 @@ github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1. github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0/go.mod h1:s1tW/At+xHqjNFvWU4G0c0Qv33KOhvbGNj0RCTQDV8s= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/saas/armsaas v0.5.0 h1:Ago3lJWlCMt1lIuxVaFWIl/AAGFtNECG8uZzEmTlWas= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/saas/armsaas v0.5.0/go.mod h1:vnL/NzlNfo1wQD5OTFGXBmK+7c6AZ9sqP6R126eGMUo= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch v1.0.0 h1:21YCzWMNfJiVsnQYYhO+NEjl32kTnaN/izdHx4KMXwM= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch v1.0.0/go.mod h1:p4K6FOVWhIfLM3cUI+1okdBvNZQ9ypp+W46domhbvSc= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity v0.9.0 h1:leZbYXt1X1+IXOhinVq/eyCu4J/fR/RcgdF6lWeaa5o= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity v0.9.0/go.mod h1:iwDIDV5jIo+eXQf6RA7PwyJnycTQxX4s4MGKSy+m1LA= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/servicebus/armservicebus v1.0.0 h1:6UQQTUHvwuxb0DmRqLUsE7RnvKCxlrsCLpXcNePe64g= diff --git a/plugins/source/azure/resources/plugin/tables.go b/plugins/source/azure/resources/plugin/tables.go index 8de8cb3b325ef2..5695742f340fde 100644 --- a/plugins/source/azure/resources/plugin/tables.go +++ b/plugins/source/azure/resources/plugin/tables.go @@ -52,6 +52,7 @@ import ( "github.com/cloudquery/cloudquery/plugins/source/azure/resources/services/hybriddatamanager" "github.com/cloudquery/cloudquery/plugins/source/azure/resources/services/keyvault" "github.com/cloudquery/cloudquery/plugins/source/azure/resources/services/kusto" + "github.com/cloudquery/cloudquery/plugins/source/azure/resources/services/logic" "github.com/cloudquery/cloudquery/plugins/source/azure/resources/services/maintenance" "github.com/cloudquery/cloudquery/plugins/source/azure/resources/services/mariadb" "github.com/cloudquery/cloudquery/plugins/source/azure/resources/services/marketplace" @@ -73,10 +74,12 @@ import ( "github.com/cloudquery/cloudquery/plugins/source/azure/resources/services/privatedns" "github.com/cloudquery/cloudquery/plugins/source/azure/resources/services/providerhub" "github.com/cloudquery/cloudquery/plugins/source/azure/resources/services/redhatopenshift" + "github.com/cloudquery/cloudquery/plugins/source/azure/resources/services/redis" "github.com/cloudquery/cloudquery/plugins/source/azure/resources/services/relay" "github.com/cloudquery/cloudquery/plugins/source/azure/resources/services/reservations" "github.com/cloudquery/cloudquery/plugins/source/azure/resources/services/resources" "github.com/cloudquery/cloudquery/plugins/source/azure/resources/services/saas" + "github.com/cloudquery/cloudquery/plugins/source/azure/resources/services/search" "github.com/cloudquery/cloudquery/plugins/source/azure/resources/services/security" "github.com/cloudquery/cloudquery/plugins/source/azure/resources/services/servicebus" "github.com/cloudquery/cloudquery/plugins/source/azure/resources/services/sql" @@ -193,6 +196,7 @@ func generatedTables() []*schema.Table { keyvault.KeyvaultManagedHsms(), keyvault.Keyvault(), kusto.Clusters(), + logic.Workflows(), maintenance.Configurations(), maintenance.PublicMaintenanceConfigurations(), mariadb.Servers(), @@ -200,6 +204,7 @@ func generatedTables() []*schema.Table { monitor.LogProfiles(), monitor.PrivateLinkScopes(), monitor.TenantActivityLogs(), + monitor.TenantActivityLogAlerts(), mysql.Servers(), mysqlflexibleservers.Servers(), network.ApplicationGateways(), @@ -264,11 +269,13 @@ func generatedTables() []*schema.Table { privatedns.PrivateZones(), providerhub.ProviderRegistrations(), redhatopenshift.OpenShiftClusters(), + redis.Caches(), relay.Namespaces(), reservations.Reservation(), reservations.ReservationOrder(), resources.Resources(), saas.Resources(), + search.Services(), security.Alerts(), security.AlertsSuppressionRules(), security.AllowedConnections(), diff --git a/plugins/source/azure/resources/services/logic/workflows.go b/plugins/source/azure/resources/services/logic/workflows.go new file mode 100644 index 00000000000000..1c5b37473fcd2f --- /dev/null +++ b/plugins/source/azure/resources/services/logic/workflows.go @@ -0,0 +1,74 @@ +// Code generated by codegen2; DO NOT EDIT. +package logic + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/logic/armlogic" + "github.com/cloudquery/cloudquery/plugins/source/azure/client" + "github.com/cloudquery/plugin-sdk/schema" +) + +func Workflows() *schema.Table { + return &schema.Table{ + Name: "azure_logic_workflows", + Resolver: fetchWorkflows, + Multiplex: client.SubscriptionMultiplexRegisteredNamespace(client.Namespacemicrosoft_logic), + Columns: []schema.Column{ + { + Name: "identity", + Type: schema.TypeJSON, + Resolver: schema.PathResolver("Identity"), + }, + { + Name: "location", + Type: schema.TypeString, + Resolver: schema.PathResolver("Location"), + }, + { + Name: "properties", + Type: schema.TypeJSON, + Resolver: schema.PathResolver("Properties"), + }, + { + Name: "tags", + Type: schema.TypeJSON, + Resolver: schema.PathResolver("Tags"), + }, + { + Name: "id", + Type: schema.TypeString, + Resolver: schema.PathResolver("ID"), + CreationOptions: schema.ColumnCreationOptions{ + PrimaryKey: true, + }, + }, + { + Name: "name", + Type: schema.TypeString, + Resolver: schema.PathResolver("Name"), + }, + { + Name: "type", + Type: schema.TypeString, + Resolver: schema.PathResolver("Type"), + }, + }, + } +} + +func fetchWorkflows(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- any) error { + cl := meta.(*client.Client) + svc, err := armlogic.NewWorkflowsClient(cl.SubscriptionId, cl.Creds, cl.Options) + if err != nil { + return err + } + pager := svc.NewListBySubscriptionPager(nil) + for pager.More() { + p, err := pager.NextPage(ctx) + if err != nil { + return err + } + res <- p.Value + } + return nil +} diff --git a/plugins/source/azure/resources/services/logic/workflows_mock_test.go b/plugins/source/azure/resources/services/logic/workflows_mock_test.go new file mode 100644 index 00000000000000..3ae02bcc58b6d9 --- /dev/null +++ b/plugins/source/azure/resources/services/logic/workflows_mock_test.go @@ -0,0 +1,40 @@ +// Code generated by codegen2; DO NOT EDIT. +package logic + +import ( + "encoding/json" + "github.com/cloudquery/cloudquery/plugins/source/azure/client" + "net/http" + "testing" + + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/logic/armlogic" + "github.com/cloudquery/plugin-sdk/faker" + "github.com/gorilla/mux" +) + +func createWorkflows(router *mux.Router) error { + var item armlogic.WorkflowsClientListBySubscriptionResponse + if err := faker.FakeObject(&item); err != nil { + return err + } + + emptyStr := "" + item.NextLink = &emptyStr + + router.HandleFunc("/subscriptions/{subscriptionId}/providers/Microsoft.Logic/workflows", func(w http.ResponseWriter, r *http.Request) { + b, err := json.Marshal(&item) + if err != nil { + http.Error(w, "unable to marshal request: "+err.Error(), http.StatusBadRequest) + return + } + if _, err := w.Write(b); err != nil { + http.Error(w, "failed to write", http.StatusBadRequest) + return + } + }) + return nil +} + +func TestWorkflows(t *testing.T) { + client.MockTestHelper(t, Workflows(), createWorkflows) +} diff --git a/plugins/source/azure/resources/services/monitor/tenant_activity_log_alerts.go b/plugins/source/azure/resources/services/monitor/tenant_activity_log_alerts.go new file mode 100644 index 00000000000000..37ba95396aa58b --- /dev/null +++ b/plugins/source/azure/resources/services/monitor/tenant_activity_log_alerts.go @@ -0,0 +1,69 @@ +// Code generated by codegen2; DO NOT EDIT. +package monitor + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" + "github.com/cloudquery/cloudquery/plugins/source/azure/client" + "github.com/cloudquery/plugin-sdk/schema" +) + +func TenantActivityLogAlerts() *schema.Table { + return &schema.Table{ + Name: "azure_monitor_tenant_activity_log_alerts", + Resolver: fetchTenantActivityLogAlerts, + Multiplex: client.SubscriptionMultiplexRegisteredNamespace(client.Namespacemicrosoft_insights), + Columns: []schema.Column{ + { + Name: "location", + Type: schema.TypeString, + Resolver: schema.PathResolver("Location"), + }, + { + Name: "properties", + Type: schema.TypeJSON, + Resolver: schema.PathResolver("Properties"), + }, + { + Name: "tags", + Type: schema.TypeJSON, + Resolver: schema.PathResolver("Tags"), + }, + { + Name: "id", + Type: schema.TypeString, + Resolver: schema.PathResolver("ID"), + CreationOptions: schema.ColumnCreationOptions{ + PrimaryKey: true, + }, + }, + { + Name: "name", + Type: schema.TypeString, + Resolver: schema.PathResolver("Name"), + }, + { + Name: "type", + Type: schema.TypeString, + Resolver: schema.PathResolver("Type"), + }, + }, + } +} + +func fetchTenantActivityLogAlerts(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- any) error { + cl := meta.(*client.Client) + svc, err := armmonitor.NewActivityLogAlertsClient(cl.SubscriptionId, cl.Creds, cl.Options) + if err != nil { + return err + } + pager := svc.NewListBySubscriptionIDPager(nil) + for pager.More() { + p, err := pager.NextPage(ctx) + if err != nil { + return err + } + res <- p.Value + } + return nil +} diff --git a/plugins/source/azure/resources/services/monitor/tenant_activity_log_alerts_mock_test.go b/plugins/source/azure/resources/services/monitor/tenant_activity_log_alerts_mock_test.go new file mode 100644 index 00000000000000..0339155b2a8cf7 --- /dev/null +++ b/plugins/source/azure/resources/services/monitor/tenant_activity_log_alerts_mock_test.go @@ -0,0 +1,40 @@ +// Code generated by codegen2; DO NOT EDIT. +package monitor + +import ( + "encoding/json" + "github.com/cloudquery/cloudquery/plugins/source/azure/client" + "net/http" + "testing" + + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" + "github.com/cloudquery/plugin-sdk/faker" + "github.com/gorilla/mux" +) + +func createTenantActivityLogAlerts(router *mux.Router) error { + var item armmonitor.ActivityLogAlertsClientListBySubscriptionIDResponse + if err := faker.FakeObject(&item); err != nil { + return err + } + + emptyStr := "" + item.NextLink = &emptyStr + + router.HandleFunc("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/activityLogAlerts", func(w http.ResponseWriter, r *http.Request) { + b, err := json.Marshal(&item) + if err != nil { + http.Error(w, "unable to marshal request: "+err.Error(), http.StatusBadRequest) + return + } + if _, err := w.Write(b); err != nil { + http.Error(w, "failed to write", http.StatusBadRequest) + return + } + }) + return nil +} + +func TestTenantActivityLogAlerts(t *testing.T) { + client.MockTestHelper(t, TenantActivityLogAlerts(), createTenantActivityLogAlerts) +} diff --git a/plugins/source/azure/resources/services/redis/caches.go b/plugins/source/azure/resources/services/redis/caches.go new file mode 100644 index 00000000000000..52d1eb186a7871 --- /dev/null +++ b/plugins/source/azure/resources/services/redis/caches.go @@ -0,0 +1,79 @@ +// Code generated by codegen2; DO NOT EDIT. +package redis + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redis/armredis" + "github.com/cloudquery/cloudquery/plugins/source/azure/client" + "github.com/cloudquery/plugin-sdk/schema" +) + +func Caches() *schema.Table { + return &schema.Table{ + Name: "azure_redis_caches", + Resolver: fetchCaches, + Multiplex: client.SubscriptionMultiplexRegisteredNamespace(client.Namespacemicrosoft_cache), + Columns: []schema.Column{ + { + Name: "location", + Type: schema.TypeString, + Resolver: schema.PathResolver("Location"), + }, + { + Name: "properties", + Type: schema.TypeJSON, + Resolver: schema.PathResolver("Properties"), + }, + { + Name: "identity", + Type: schema.TypeJSON, + Resolver: schema.PathResolver("Identity"), + }, + { + Name: "tags", + Type: schema.TypeJSON, + Resolver: schema.PathResolver("Tags"), + }, + { + Name: "zones", + Type: schema.TypeStringArray, + Resolver: schema.PathResolver("Zones"), + }, + { + Name: "id", + Type: schema.TypeString, + Resolver: schema.PathResolver("ID"), + CreationOptions: schema.ColumnCreationOptions{ + PrimaryKey: true, + }, + }, + { + Name: "name", + Type: schema.TypeString, + Resolver: schema.PathResolver("Name"), + }, + { + Name: "type", + Type: schema.TypeString, + Resolver: schema.PathResolver("Type"), + }, + }, + } +} + +func fetchCaches(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- any) error { + cl := meta.(*client.Client) + svc, err := armredis.NewClient(cl.SubscriptionId, cl.Creds, cl.Options) + if err != nil { + return err + } + pager := svc.NewListBySubscriptionPager(nil) + for pager.More() { + p, err := pager.NextPage(ctx) + if err != nil { + return err + } + res <- p.Value + } + return nil +} diff --git a/plugins/source/azure/resources/services/redis/caches_mock_test.go b/plugins/source/azure/resources/services/redis/caches_mock_test.go new file mode 100644 index 00000000000000..264ca3a48a5f26 --- /dev/null +++ b/plugins/source/azure/resources/services/redis/caches_mock_test.go @@ -0,0 +1,40 @@ +// Code generated by codegen2; DO NOT EDIT. +package redis + +import ( + "encoding/json" + "github.com/cloudquery/cloudquery/plugins/source/azure/client" + "net/http" + "testing" + + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redis/armredis" + "github.com/cloudquery/plugin-sdk/faker" + "github.com/gorilla/mux" +) + +func createCaches(router *mux.Router) error { + var item armredis.ClientListBySubscriptionResponse + if err := faker.FakeObject(&item); err != nil { + return err + } + + emptyStr := "" + item.NextLink = &emptyStr + + router.HandleFunc("/subscriptions/{subscriptionId}/providers/Microsoft.Cache/redis", func(w http.ResponseWriter, r *http.Request) { + b, err := json.Marshal(&item) + if err != nil { + http.Error(w, "unable to marshal request: "+err.Error(), http.StatusBadRequest) + return + } + if _, err := w.Write(b); err != nil { + http.Error(w, "failed to write", http.StatusBadRequest) + return + } + }) + return nil +} + +func TestCaches(t *testing.T) { + client.MockTestHelper(t, Caches(), createCaches) +} diff --git a/plugins/source/azure/resources/services/search/services.go b/plugins/source/azure/resources/services/search/services.go new file mode 100644 index 00000000000000..901b8e42a3353b --- /dev/null +++ b/plugins/source/azure/resources/services/search/services.go @@ -0,0 +1,60 @@ +// Code generated by codegen2; DO NOT EDIT. +package search + +import ( + "github.com/cloudquery/cloudquery/plugins/source/azure/client" + "github.com/cloudquery/plugin-sdk/schema" +) + +func Services() *schema.Table { + return &schema.Table{ + Name: "azure_search_services", + Resolver: fetchServices, + Multiplex: client.SubscriptionMultiplexRegisteredNamespace(client.Namespacemicrosoft_search), + Columns: []schema.Column{ + { + Name: "location", + Type: schema.TypeString, + Resolver: schema.PathResolver("Location"), + }, + { + Name: "identity", + Type: schema.TypeJSON, + Resolver: schema.PathResolver("Identity"), + }, + { + Name: "properties", + Type: schema.TypeJSON, + Resolver: schema.PathResolver("Properties"), + }, + { + Name: "sku", + Type: schema.TypeJSON, + Resolver: schema.PathResolver("SKU"), + }, + { + Name: "tags", + Type: schema.TypeJSON, + Resolver: schema.PathResolver("Tags"), + }, + { + Name: "id", + Type: schema.TypeString, + Resolver: schema.PathResolver("ID"), + CreationOptions: schema.ColumnCreationOptions{ + PrimaryKey: true, + }, + }, + { + Name: "name", + Type: schema.TypeString, + Resolver: schema.PathResolver("Name"), + }, + { + Name: "type", + Type: schema.TypeString, + Resolver: schema.PathResolver("Type"), + }, + }, + } +} diff --git a/plugins/source/azure/resources/services/search/services_fetch.go b/plugins/source/azure/resources/services/search/services_fetch.go new file mode 100644 index 00000000000000..3fee6c88421086 --- /dev/null +++ b/plugins/source/azure/resources/services/search/services_fetch.go @@ -0,0 +1,26 @@ +package search + +import ( + "context" + + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch" + "github.com/cloudquery/cloudquery/plugins/source/azure/client" + "github.com/cloudquery/plugin-sdk/schema" +) + +func fetchServices(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- any) error { + cl := meta.(*client.Client) + svc, err := armsearch.NewServicesClient(cl.SubscriptionId, cl.Creds, cl.Options) + if err != nil { + return err + } + pager := svc.NewListBySubscriptionPager(nil, nil) + for pager.More() { + p, err := pager.NextPage(ctx) + if err != nil { + return err + } + res <- p.Value + } + return nil +} diff --git a/plugins/source/azure/resources/services/search/services_mock_test.go b/plugins/source/azure/resources/services/search/services_mock_test.go new file mode 100644 index 00000000000000..909923644839e9 --- /dev/null +++ b/plugins/source/azure/resources/services/search/services_mock_test.go @@ -0,0 +1,40 @@ +// Code generated by codegen2; DO NOT EDIT. +package search + +import ( + "encoding/json" + "github.com/cloudquery/cloudquery/plugins/source/azure/client" + "net/http" + "testing" + + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch" + "github.com/cloudquery/plugin-sdk/faker" + "github.com/gorilla/mux" +) + +func createServices(router *mux.Router) error { + var item armsearch.ServicesClientListBySubscriptionResponse + if err := faker.FakeObject(&item); err != nil { + return err + } + + emptyStr := "" + item.NextLink = &emptyStr + + router.HandleFunc("/subscriptions/{subscriptionId}/providers/Microsoft.Search/searchServices", func(w http.ResponseWriter, r *http.Request) { + b, err := json.Marshal(&item) + if err != nil { + http.Error(w, "unable to marshal request: "+err.Error(), http.StatusBadRequest) + return + } + if _, err := w.Write(b); err != nil { + http.Error(w, "failed to write", http.StatusBadRequest) + return + } + }) + return nil +} + +func TestServices(t *testing.T) { + client.MockTestHelper(t, Services(), createServices) +} diff --git a/website/pages/docs/plugins/sources/azure/tables.md b/website/pages/docs/plugins/sources/azure/tables.md index 697c6a32f7223b..402e93bd9f85b2 100644 --- a/website/pages/docs/plugins/sources/azure/tables.md +++ b/website/pages/docs/plugins/sources/azure/tables.md @@ -107,6 +107,7 @@ - [azure_keyvault_keyvault_keys](https://github.com/cloudquery/cloudquery/blob/main/plugins/source/azure/docs/tables/azure_keyvault_keyvault_keys.md) - [azure_keyvault_keyvault_secrets](https://github.com/cloudquery/cloudquery/blob/main/plugins/source/azure/docs/tables/azure_keyvault_keyvault_secrets.md) - [azure_kusto_clusters](https://github.com/cloudquery/cloudquery/blob/main/plugins/source/azure/docs/tables/azure_kusto_clusters.md) +- [azure_logic_workflows](https://github.com/cloudquery/cloudquery/blob/main/plugins/source/azure/docs/tables/azure_logic_workflows.md) - [azure_maintenance_configurations](https://github.com/cloudquery/cloudquery/blob/main/plugins/source/azure/docs/tables/azure_maintenance_configurations.md) - [azure_maintenance_public_maintenance_configurations](https://github.com/cloudquery/cloudquery/blob/main/plugins/source/azure/docs/tables/azure_maintenance_public_maintenance_configurations.md) - [azure_mariadb_servers](https://github.com/cloudquery/cloudquery/blob/main/plugins/source/azure/docs/tables/azure_mariadb_servers.md) @@ -115,6 +116,7 @@ - [azure_monitor_log_profiles](https://github.com/cloudquery/cloudquery/blob/main/plugins/source/azure/docs/tables/azure_monitor_log_profiles.md) - [azure_monitor_private_link_scopes](https://github.com/cloudquery/cloudquery/blob/main/plugins/source/azure/docs/tables/azure_monitor_private_link_scopes.md) - [azure_monitor_tenant_activity_logs](https://github.com/cloudquery/cloudquery/blob/main/plugins/source/azure/docs/tables/azure_monitor_tenant_activity_logs.md) +- [azure_monitor_tenant_activity_log_alerts](https://github.com/cloudquery/cloudquery/blob/main/plugins/source/azure/docs/tables/azure_monitor_tenant_activity_log_alerts.md) - [azure_mysql_servers](https://github.com/cloudquery/cloudquery/blob/main/plugins/source/azure/docs/tables/azure_mysql_servers.md) - [azure_mysql_server_configurations](https://github.com/cloudquery/cloudquery/blob/main/plugins/source/azure/docs/tables/azure_mysql_server_configurations.md) - [azure_mysqlflexibleservers_servers](https://github.com/cloudquery/cloudquery/blob/main/plugins/source/azure/docs/tables/azure_mysqlflexibleservers_servers.md) @@ -180,11 +182,13 @@ - [azure_privatedns_private_zones](https://github.com/cloudquery/cloudquery/blob/main/plugins/source/azure/docs/tables/azure_privatedns_private_zones.md) - [azure_providerhub_provider_registrations](https://github.com/cloudquery/cloudquery/blob/main/plugins/source/azure/docs/tables/azure_providerhub_provider_registrations.md) - [azure_redhatopenshift_open_shift_clusters](https://github.com/cloudquery/cloudquery/blob/main/plugins/source/azure/docs/tables/azure_redhatopenshift_open_shift_clusters.md) +- [azure_redis_caches](https://github.com/cloudquery/cloudquery/blob/main/plugins/source/azure/docs/tables/azure_redis_caches.md) - [azure_relay_namespaces](https://github.com/cloudquery/cloudquery/blob/main/plugins/source/azure/docs/tables/azure_relay_namespaces.md) - [azure_reservations_reservation](https://github.com/cloudquery/cloudquery/blob/main/plugins/source/azure/docs/tables/azure_reservations_reservation.md) - [azure_reservations_reservation_order](https://github.com/cloudquery/cloudquery/blob/main/plugins/source/azure/docs/tables/azure_reservations_reservation_order.md) - [azure_resources_resources](https://github.com/cloudquery/cloudquery/blob/main/plugins/source/azure/docs/tables/azure_resources_resources.md) - [azure_saas_resources](https://github.com/cloudquery/cloudquery/blob/main/plugins/source/azure/docs/tables/azure_saas_resources.md) +- [azure_search_services](https://github.com/cloudquery/cloudquery/blob/main/plugins/source/azure/docs/tables/azure_search_services.md) - [azure_security_alerts](https://github.com/cloudquery/cloudquery/blob/main/plugins/source/azure/docs/tables/azure_security_alerts.md) - [azure_security_alerts_suppression_rules](https://github.com/cloudquery/cloudquery/blob/main/plugins/source/azure/docs/tables/azure_security_alerts_suppression_rules.md) - [azure_security_allowed_connections](https://github.com/cloudquery/cloudquery/blob/main/plugins/source/azure/docs/tables/azure_security_allowed_connections.md)