├── .piglet-meta.json ├── CHANGELOG.md ├── test └── config.yaml ├── main.go ├── resources ├── access │ ├── access.go │ ├── organizationmanager_organizations.go │ ├── resourcemanager_clouds.go │ ├── resourcemanager_folders.go │ ├── ydb_databases.go │ ├── kms_symmetric_keys.go │ ├── datasphere_projects.go │ ├── serverless_functions.go │ ├── datasphere_communities.go │ ├── serverless_containers.go │ ├── containerregistry_registries.go │ ├── kms_asymmetric_keys.go │ ├── containerregistry_repositories.go │ ├── iam_service_accounts.go │ └── lockbox_secrets_access_bindings.go ├── mdb │ ├── mdb.go │ ├── mysql_hosts.go │ ├── kafka_users.go │ ├── mysql_users.go │ ├── mongodb_users.go │ ├── redis_hosts.go │ ├── mongodb_hosts.go │ ├── mysql_databases.go │ ├── clickhouse_users.go │ ├── postgresql_users.go │ ├── mongodb_databases.go │ ├── clickhouse_hosts.go │ ├── opensearch_hosts.go │ ├── postgresql_backups.go │ ├── postgresql_hosts.go │ ├── kafka_topics.go │ ├── redis_clusters.go │ ├── kafka_clusters.go │ ├── clickhouse_databases.go │ ├── postgresql_databases.go │ ├── mysql_clusters.go │ ├── greenplum_clusters.go │ ├── opensearch_clusters.go │ ├── mongodb_clusters.go │ ├── clickhouse_clusters.go │ ├── postgresql_clusters.go │ ├── opensearch_auth_settings.go │ └── greenplum_hosts.go ├── vpc │ ├── subnets.go │ ├── gateways.go │ ├── networks.go │ ├── addresses.go │ ├── route_tables.go │ ├── security_groups.go │ └── privatelink │ │ └── private_endpoints.go ├── resourcemanager │ ├── clouds.go │ └── folders.go ├── compute │ ├── images.go │ ├── disks.go │ ├── instances.go │ └── disks_images.go ├── kubernetes │ ├── node_groups.go │ ├── clusters.go │ └── nodes.go ├── cdn │ └── resources.go ├── dns │ ├── zones.go │ └── record_sets.go ├── audittrails │ └── trails.go ├── datatransfer │ ├── endpoints.go │ └── transfers.go ├── organizationmanager │ ├── organizations.go │ ├── federations.go │ ├── oslogin_settings.go │ └── users.go ├── kms │ ├── symmetric_keys.go │ └── asymmetric_keys.go ├── iam │ ├── keys.go │ ├── api_keys.go │ ├── service_accounts.go │ └── access_keys.go ├── nlb │ ├── target_groups.go │ └── balancers.go ├── alb │ └── balancers.go ├── ydb │ └── databases.go ├── lockbox │ └── secrets.go ├── datasphere │ ├── communities.go │ └── projects.go ├── serverless │ ├── functions.go │ ├── containers.go │ └── api_gateways.go ├── containerregistry │ ├── registries.go │ └── repositories.go ├── quotamanager │ └── services.go └── storage │ └── buckets.go ├── plugin ├── plugin.go └── client.go ├── AUTHORS ├── .gitignore ├── docs ├── tables │ ├── yc_access_bindings_organizationmanager_organizations.md │ ├── yc_vpc_gateways.md │ ├── yc_access_bindings_ydb_databases.md │ ├── yc_datatransfer_endpoints.md │ ├── yc_resourcemanager_clouds.md │ ├── yc_access_bindings_resourcemanager_clouds.md │ ├── yc_access_bindings_datasphere_projects.md │ ├── yc_access_bindings_resourcemanager_folders.md │ ├── yc_resourcemanager_folders.md │ ├── yc_vpc_networks.md │ ├── yc_access_bindings_datasphere_communities.md │ ├── yc_access_bindings_kms_symmetric_keys.md │ ├── yc_access_bindings_kms_asymmetric_keys.md │ ├── yc_organizationmanager_organizations.md │ ├── yc_access_bindings_serverless_functions.md │ ├── yc_access_bindings_serverless_containers.md │ ├── yc_mdb_mysql_databases.md │ ├── yc_mdb_kafka_users.md │ ├── yc_vpc_route_tables.md │ ├── yc_mdb_mongodb_databases.md │ ├── yc_organizationmanager_oslogin_settings.md │ ├── yc_access_bindings_containerregistry_registries.md │ ├── yc_mdb_mongodb_users.md │ ├── yc_access_bindings_containerregistry_repositories.md │ ├── yc_dns_record_sets.md │ ├── yc_kubernetes_nodes.md │ ├── yc_access_bindings_lockbox_secrets.md │ ├── yc_access_iam_service_accounts.md │ ├── yc_serverless_apigateway_openapi_specs.md │ ├── yc_mdb_clickhouse_databases.md │ ├── yc_nlb_target_groups.md │ ├── yc_vpc_security_groups.md │ ├── yc_iam_keys.md │ ├── yc_mdb_kafka_topics.md │ ├── yc_iam_access_keys.md │ ├── yc_vpc_addresses.md │ ├── yc_mdb_clickhouse_users.md │ ├── yc_mdb_postgresql_backups.md │ ├── yc_quotamanager_quota_services.md │ ├── yc_quotamanager_quota_limits.md │ ├── yc_vpc_subnets.md │ ├── yc_datatransfer_transfers.md │ ├── yc_mdb_greenplum_hosts.md │ ├── yc_mdb_mysql_hosts.md │ ├── yc_serverless_functions_functions.md │ ├── yc_vpc_privatelink_private_endpoints.md │ ├── yc_mdb_mysql_users.md │ ├── yc_iam_api_keys.md │ ├── yc_audittrails_trails.md │ ├── yc_compute_images.md │ ├── yc_dns_zones.md │ ├── yc_mdb_postgresql_databases.md │ ├── yc_mdb_clickhouse_hosts.md │ ├── yc_mdb_redis_hosts.md │ ├── yc_storage_buckets.md │ ├── yc_mdb_mongodb_hosts.md │ ├── yc_cdn_resources.md │ ├── yc_mdb_opensearch_hosts.md │ ├── yc_containerregistry_repositories.md │ ├── yc_organizationmanager_federations.md │ ├── yc_mdb_postgresql_users.md │ ├── yc_datasphere_communities.md │ ├── yc_kms_symmetric_keys.md │ ├── yc_nlb_balancers.md │ ├── yc_lockbox_secrets.md │ ├── yc_serverless_containers_containers.md │ ├── yc_kms_asymmetric_keys.md │ ├── yc_mdb_postgresql_hosts.md │ ├── yc_alb_balancers.md │ ├── yc_containerregistry_registries.md │ ├── yc_datasphere_projects.md │ ├── yc_mdb_opensearch_auth_settings.md │ ├── yc_iam_service_accounts.md │ ├── yc_kubernetes_clusters.md │ ├── yc_organizationmanager_users.md │ ├── yc_kubernetes_node_groups.md │ ├── yc_compute_disks.md │ ├── yc_compute_disks_images.md │ ├── yc_serverless_apigateway_gateways.md │ ├── yc_mdb_kafka_clusters.md │ ├── yc_mdb_redis_clusters.md │ ├── yc_mdb_opensearch_clusters.md │ ├── yc_mdb_mongodb_clusters.md │ ├── yc_mdb_mysql_clusters.md │ ├── yc_compute_instances.md │ ├── yc_mdb_clickhouse_clusters.md │ ├── yc_mdb_postgresql_clusters.md │ ├── yc_ydb_databases.md │ └── yc_mdb_greenplum_clusters.md ├── _authentication.md ├── overview.md └── configuration.md ├── internal └── util │ ├── http.go │ └── util.go ├── .github └── workflows │ ├── lint.yml │ └── test.yml ├── Makefile ├── .goreleaser.yaml ├── client ├── sdk.go ├── spec.go ├── multiplexer.go └── resourcehierarchy_test.go ├── README.md └── CONTRIBUTING.md /.piglet-meta.json: -------------------------------------------------------------------------------- 1 | { 2 | "project":"cq-source-yc", 3 | "repository":"arcadia" 4 | } -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [1.0.0](https://github.com/yandex-cloud/cq-source-yc/compare/v1.0.0...v0.3.4) 4 | 5 | ### Features 6 | 7 | * migrate to plugin-sdk v4 8 | -------------------------------------------------------------------------------- /test/config.yaml: -------------------------------------------------------------------------------- 1 | kind: source 2 | spec: 3 | name: yc 4 | version: v1.0.0 5 | destinations: [test] 6 | path: ./yc 7 | registry: local 8 | tables: ["*"] 9 | spec: 10 | --- 11 | kind: destination 12 | spec: 13 | name: test 14 | path: cloudquery/test 15 | version: "v2.2.3" 16 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "context" 5 | "log" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/serve" 8 | "github.com/yandex-cloud/cq-source-yc/plugin" 9 | ) 10 | 11 | func main() { 12 | p := serve.Plugin(plugin.Plugin()) 13 | 14 | err := p.Serve(context.Background()) 15 | if err != nil { 16 | log.Fatal(err) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /resources/access/access.go: -------------------------------------------------------------------------------- 1 | package access 2 | 3 | import ( 4 | "github.com/cloudquery/plugin-sdk/v4/transformers" 5 | "github.com/yandex-cloud/cq-source-yc/client" 6 | "github.com/yandex-cloud/go-genproto/yandex/cloud/access" 7 | ) 8 | 9 | var ( 10 | Transform = client.TransformWithStruct(&access.AccessBinding{}, transformers.WithPrimaryKeys("Subject", "RoleId")) 11 | ) 12 | -------------------------------------------------------------------------------- /plugin/plugin.go: -------------------------------------------------------------------------------- 1 | package plugin 2 | 3 | import ( 4 | "github.com/cloudquery/plugin-sdk/v4/plugin" 5 | ) 6 | 7 | var ( 8 | Name = "yc" 9 | Kind = "source" 10 | Team = "yandex-cloud" 11 | Version = "development" 12 | ) 13 | 14 | func Plugin() *plugin.Plugin { 15 | return plugin.NewPlugin( 16 | Name, 17 | Version, 18 | NewClient, 19 | plugin.WithKind(Kind), 20 | plugin.WithTeam(Team), 21 | ) 22 | } 23 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | The following authors have created the source code of "cq-source-yc" published and distributed by YANDEX LLC as the owner. 2 | 3 | This list is incomplete and will be expanded and revised in the future. 4 | 5 | In alphabetical order: 6 | Alex Shcherbakov 7 | Alexandre Le Madec 8 | Daniil Ushkov 9 | Danil Beltyukov 10 | Gennady Lipenkov 11 | Roman Mingazeev 12 | Valentin Kiel 13 | Yevgeny Pats 14 | 15 | More contributors available here: https://github.com/yandex-cloud/cq-source-yc/graphs/contributors -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | 8 | # Test binary, built with `go test -c` 9 | *.test 10 | 11 | # Output of the go coverage tool, specifically when used with LiteIDE 12 | *.out 13 | 14 | # Dependency directories (remove the comment below to include it) 15 | # vendor/ 16 | 17 | # IDE & OS 18 | .DS_Store 19 | .vscode 20 | .idea 21 | 22 | # Cloudquery specific 23 | .cq 24 | cq-source-yc 25 | integration 26 | *.log 27 | dist 28 | db.sql 29 | logs 30 | yc -------------------------------------------------------------------------------- /docs/tables/yc_access_bindings_organizationmanager_organizations.md: -------------------------------------------------------------------------------- 1 | # Table: yc_access_bindings_organizationmanager_organizations 2 | 3 | This table shows data for YC Access Bindings Cloud Organization Organizations. 4 | 5 | The composite primary key for this table is (**id**, **role_id**, **subject**). 6 | 7 | ## Columns 8 | 9 | | Name | Type | 10 | | ------------- | ------------- | 11 | |_cq_id|`uuid`| 12 | |_cq_parent_id|`uuid`| 13 | |id (PK)|`utf8`| 14 | |role_id (PK)|`utf8`| 15 | |subject (PK)|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_vpc_gateways.md: -------------------------------------------------------------------------------- 1 | # Table: yc_vpc_gateways 2 | 3 | This table shows data for YC VPC Gateways. 4 | 5 | https://cloud.yandex.ru/docs/vpc/api-ref/grpc/gateway_service#Gateway1 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Columns 10 | 11 | | Name | Type | 12 | | ------------- | ------------- | 13 | |_cq_id|`uuid`| 14 | |_cq_parent_id|`uuid`| 15 | |cloud_id|`utf8`| 16 | |id (PK)|`utf8`| 17 | |folder_id|`utf8`| 18 | |created_at|`timestamp[us, tz=UTC]`| 19 | |name|`utf8`| 20 | |description|`utf8`| 21 | |labels|`json`| 22 | |gateway|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_access_bindings_ydb_databases.md: -------------------------------------------------------------------------------- 1 | # Table: yc_access_bindings_ydb_databases 2 | 3 | This table shows data for YC Access Bindings Managed Service for YDB Databases. 4 | 5 | The composite primary key for this table is (**id**, **role_id**, **subject**). 6 | 7 | ## Relations 8 | 9 | This table depends on [yc_ydb_databases](yc_ydb_databases.md). 10 | 11 | ## Columns 12 | 13 | | Name | Type | 14 | | ------------- | ------------- | 15 | |_cq_id|`uuid`| 16 | |_cq_parent_id|`uuid`| 17 | |id (PK)|`utf8`| 18 | |role_id (PK)|`utf8`| 19 | |subject (PK)|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_datatransfer_endpoints.md: -------------------------------------------------------------------------------- 1 | # Table: yc_datatransfer_endpoints 2 | 3 | This table shows data for YC Data Transfer Endpoints. 4 | 5 | https://yandex.cloud/ru/docs/data-transfer/api-ref/grpc/endpoint_service#Endpoint1 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Columns 10 | 11 | | Name | Type | 12 | | ------------- | ------------- | 13 | |_cq_id|`uuid`| 14 | |_cq_parent_id|`uuid`| 15 | |cloud_id|`utf8`| 16 | |id (PK)|`utf8`| 17 | |folder_id|`utf8`| 18 | |name|`utf8`| 19 | |description|`utf8`| 20 | |labels|`json`| 21 | |settings|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_resourcemanager_clouds.md: -------------------------------------------------------------------------------- 1 | # Table: yc_resourcemanager_clouds 2 | 3 | This table shows data for YC Resource Manager Clouds. 4 | 5 | https://cloud.yandex.ru/docs/resource-manager/api-ref/grpc/cloud_service#Cloud1 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Columns 10 | 11 | | Name | Type | 12 | | ------------- | ------------- | 13 | |_cq_id|`uuid`| 14 | |_cq_parent_id|`uuid`| 15 | |id (PK)|`utf8`| 16 | |created_at|`timestamp[us, tz=UTC]`| 17 | |name|`utf8`| 18 | |description|`utf8`| 19 | |organization_id|`utf8`| 20 | |labels|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_access_bindings_resourcemanager_clouds.md: -------------------------------------------------------------------------------- 1 | # Table: yc_access_bindings_resourcemanager_clouds 2 | 3 | This table shows data for YC Access Bindings Resource Manager Clouds. 4 | 5 | https://cloud.yandex.ru/docs/resource-manager/api-ref/grpc/cloud_service#AccessBinding 6 | 7 | The composite primary key for this table is (**id**, **role_id**, **subject**). 8 | 9 | ## Columns 10 | 11 | | Name | Type | 12 | | ------------- | ------------- | 13 | |_cq_id|`uuid`| 14 | |_cq_parent_id|`uuid`| 15 | |id (PK)|`utf8`| 16 | |role_id (PK)|`utf8`| 17 | |subject (PK)|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_access_bindings_datasphere_projects.md: -------------------------------------------------------------------------------- 1 | # Table: yc_access_bindings_datasphere_projects 2 | 3 | This table shows data for YC Access Bindings DataSphere Projects. 4 | 5 | The composite primary key for this table is (**id**, **role_id**, **subject**). 6 | 7 | ## Relations 8 | 9 | This table depends on [yc_datasphere_projects](yc_datasphere_projects.md). 10 | 11 | ## Columns 12 | 13 | | Name | Type | 14 | | ------------- | ------------- | 15 | |_cq_id|`uuid`| 16 | |_cq_parent_id|`uuid`| 17 | |id (PK)|`utf8`| 18 | |role_id (PK)|`utf8`| 19 | |subject (PK)|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_access_bindings_resourcemanager_folders.md: -------------------------------------------------------------------------------- 1 | # Table: yc_access_bindings_resourcemanager_folders 2 | 3 | This table shows data for YC Access Bindings Resource Manager Folders. 4 | 5 | https://cloud.yandex.ru/docs/resource-manager/api-ref/grpc/folder_service#AccessBinding 6 | 7 | The composite primary key for this table is (**id**, **role_id**, **subject**). 8 | 9 | ## Columns 10 | 11 | | Name | Type | 12 | | ------------- | ------------- | 13 | |_cq_id|`uuid`| 14 | |_cq_parent_id|`uuid`| 15 | |id (PK)|`utf8`| 16 | |role_id (PK)|`utf8`| 17 | |subject (PK)|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_resourcemanager_folders.md: -------------------------------------------------------------------------------- 1 | # Table: yc_resourcemanager_folders 2 | 3 | This table shows data for YC Resource Manager Folders. 4 | 5 | https://cloud.yandex.ru/docs/resource-manager/api-ref/grpc/folder_service#Folder1 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Columns 10 | 11 | | Name | Type | 12 | | ------------- | ------------- | 13 | |_cq_id|`uuid`| 14 | |_cq_parent_id|`uuid`| 15 | |id (PK)|`utf8`| 16 | |cloud_id|`utf8`| 17 | |created_at|`timestamp[us, tz=UTC]`| 18 | |name|`utf8`| 19 | |description|`utf8`| 20 | |labels|`json`| 21 | |status|`utf8`| -------------------------------------------------------------------------------- /docs/tables/yc_vpc_networks.md: -------------------------------------------------------------------------------- 1 | # Table: yc_vpc_networks 2 | 3 | This table shows data for YC VPC Networks. 4 | 5 | https://cloud.yandex.ru/docs/vpc/api-ref/grpc/network_service#Network1 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Columns 10 | 11 | | Name | Type | 12 | | ------------- | ------------- | 13 | |_cq_id|`uuid`| 14 | |_cq_parent_id|`uuid`| 15 | |cloud_id|`utf8`| 16 | |id (PK)|`utf8`| 17 | |folder_id|`utf8`| 18 | |created_at|`timestamp[us, tz=UTC]`| 19 | |name|`utf8`| 20 | |description|`utf8`| 21 | |labels|`json`| 22 | |default_security_group_id|`utf8`| -------------------------------------------------------------------------------- /docs/tables/yc_access_bindings_datasphere_communities.md: -------------------------------------------------------------------------------- 1 | # Table: yc_access_bindings_datasphere_communities 2 | 3 | This table shows data for YC Access Bindings DataSphere Communities. 4 | 5 | The composite primary key for this table is (**id**, **role_id**, **subject**). 6 | 7 | ## Relations 8 | 9 | This table depends on [yc_datasphere_communities](yc_datasphere_communities.md). 10 | 11 | ## Columns 12 | 13 | | Name | Type | 14 | | ------------- | ------------- | 15 | |_cq_id|`uuid`| 16 | |_cq_parent_id|`uuid`| 17 | |id (PK)|`utf8`| 18 | |role_id (PK)|`utf8`| 19 | |subject (PK)|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_access_bindings_kms_symmetric_keys.md: -------------------------------------------------------------------------------- 1 | # Table: yc_access_bindings_kms_symmetric_keys 2 | 3 | This table shows data for YC Access Bindings Key Management Service Symmetric Keys. 4 | 5 | The composite primary key for this table is (**id**, **role_id**, **subject**). 6 | 7 | ## Relations 8 | 9 | This table depends on [yc_kms_symmetric_keys](yc_kms_symmetric_keys.md). 10 | 11 | ## Columns 12 | 13 | | Name | Type | 14 | | ------------- | ------------- | 15 | |_cq_id|`uuid`| 16 | |_cq_parent_id|`uuid`| 17 | |id (PK)|`utf8`| 18 | |role_id (PK)|`utf8`| 19 | |subject (PK)|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_access_bindings_kms_asymmetric_keys.md: -------------------------------------------------------------------------------- 1 | # Table: yc_access_bindings_kms_asymmetric_keys 2 | 3 | This table shows data for YC Access Bindings Key Management Service Asymmetric Keys. 4 | 5 | The composite primary key for this table is (**id**, **role_id**, **subject**). 6 | 7 | ## Relations 8 | 9 | This table depends on [yc_kms_asymmetric_keys](yc_kms_asymmetric_keys.md). 10 | 11 | ## Columns 12 | 13 | | Name | Type | 14 | | ------------- | ------------- | 15 | |_cq_id|`uuid`| 16 | |_cq_parent_id|`uuid`| 17 | |id (PK)|`utf8`| 18 | |role_id (PK)|`utf8`| 19 | |subject (PK)|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_organizationmanager_organizations.md: -------------------------------------------------------------------------------- 1 | # Table: yc_organizationmanager_organizations 2 | 3 | This table shows data for YC Cloud Organization Organizations. 4 | 5 | https://cloud.yandex.ru/docs/organization/api-ref/grpc/organization_service#Organization1 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Columns 10 | 11 | | Name | Type | 12 | | ------------- | ------------- | 13 | |_cq_id|`uuid`| 14 | |_cq_parent_id|`uuid`| 15 | |id (PK)|`utf8`| 16 | |created_at|`timestamp[us, tz=UTC]`| 17 | |name|`utf8`| 18 | |description|`utf8`| 19 | |title|`utf8`| 20 | |labels|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_access_bindings_serverless_functions.md: -------------------------------------------------------------------------------- 1 | # Table: yc_access_bindings_serverless_functions 2 | 3 | This table shows data for YC Access Bindings Serverless Functions. 4 | 5 | The composite primary key for this table is (**id**, **role_id**, **subject**). 6 | 7 | ## Relations 8 | 9 | This table depends on [yc_serverless_functions_functions](yc_serverless_functions_functions.md). 10 | 11 | ## Columns 12 | 13 | | Name | Type | 14 | | ------------- | ------------- | 15 | |_cq_id|`uuid`| 16 | |_cq_parent_id|`uuid`| 17 | |id (PK)|`utf8`| 18 | |role_id (PK)|`utf8`| 19 | |subject (PK)|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_access_bindings_serverless_containers.md: -------------------------------------------------------------------------------- 1 | # Table: yc_access_bindings_serverless_containers 2 | 3 | This table shows data for YC Access Bindings Serverless Containers. 4 | 5 | The composite primary key for this table is (**id**, **role_id**, **subject**). 6 | 7 | ## Relations 8 | 9 | This table depends on [yc_serverless_containers_containers](yc_serverless_containers_containers.md). 10 | 11 | ## Columns 12 | 13 | | Name | Type | 14 | | ------------- | ------------- | 15 | |_cq_id|`uuid`| 16 | |_cq_parent_id|`uuid`| 17 | |id (PK)|`utf8`| 18 | |role_id (PK)|`utf8`| 19 | |subject (PK)|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_mdb_mysql_databases.md: -------------------------------------------------------------------------------- 1 | # Table: yc_mdb_mysql_databases 2 | 3 | This table shows data for YC Managed Service for Mysql Databases. 4 | 5 | https://cloud.yandex.ru/docs/managed-mysql/api-ref/grpc/database_service#Database1 6 | 7 | The composite primary key for this table is (**name**, **cluster_id**). 8 | 9 | ## Relations 10 | 11 | This table depends on [yc_mdb_mysql_clusters](yc_mdb_mysql_clusters.md). 12 | 13 | ## Columns 14 | 15 | | Name | Type | 16 | | ------------- | ------------- | 17 | |_cq_id|`uuid`| 18 | |_cq_parent_id|`uuid`| 19 | |name (PK)|`utf8`| 20 | |cluster_id (PK)|`utf8`| -------------------------------------------------------------------------------- /internal/util/http.go: -------------------------------------------------------------------------------- 1 | package util 2 | 3 | import "net/http" 4 | 5 | type InterceptFunc func(*http.Request) error 6 | 7 | type InterceptTransport struct { 8 | T http.RoundTripper 9 | f InterceptFunc 10 | } 11 | 12 | func (it *InterceptTransport) RoundTrip(req *http.Request) (*http.Response, error) { 13 | err := it.f(req) 14 | if err != nil { 15 | return nil, err 16 | } 17 | return it.T.RoundTrip(req) 18 | } 19 | 20 | func NewInterceptTransport(t http.RoundTripper, f InterceptFunc) *InterceptTransport { 21 | if t == nil { 22 | t = http.DefaultTransport 23 | } 24 | return &InterceptTransport{t, f} 25 | } 26 | -------------------------------------------------------------------------------- /docs/tables/yc_mdb_kafka_users.md: -------------------------------------------------------------------------------- 1 | # Table: yc_mdb_kafka_users 2 | 3 | This table shows data for YC Managed Service for Kafka Users. 4 | 5 | https://cloud.yandex.ru/docs/managed-kafka/api-ref/grpc/user_service#User1 6 | 7 | The composite primary key for this table is (**name**, **cluster_id**). 8 | 9 | ## Relations 10 | 11 | This table depends on [yc_mdb_kafka_clusters](yc_mdb_kafka_clusters.md). 12 | 13 | ## Columns 14 | 15 | | Name | Type | 16 | | ------------- | ------------- | 17 | |_cq_id|`uuid`| 18 | |_cq_parent_id|`uuid`| 19 | |name (PK)|`utf8`| 20 | |cluster_id (PK)|`utf8`| 21 | |permissions|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_vpc_route_tables.md: -------------------------------------------------------------------------------- 1 | # Table: yc_vpc_route_tables 2 | 3 | This table shows data for YC VPC Route Tables. 4 | 5 | https://cloud.yandex.ru/docs/vpc/api-ref/grpc/route_table_service#RouteTable1 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Columns 10 | 11 | | Name | Type | 12 | | ------------- | ------------- | 13 | |_cq_id|`uuid`| 14 | |_cq_parent_id|`uuid`| 15 | |cloud_id|`utf8`| 16 | |id (PK)|`utf8`| 17 | |folder_id|`utf8`| 18 | |created_at|`timestamp[us, tz=UTC]`| 19 | |name|`utf8`| 20 | |description|`utf8`| 21 | |labels|`json`| 22 | |network_id|`utf8`| 23 | |static_routes|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_mdb_mongodb_databases.md: -------------------------------------------------------------------------------- 1 | # Table: yc_mdb_mongodb_databases 2 | 3 | This table shows data for YC Managed Service for Mongodb Databases. 4 | 5 | https://cloud.yandex.ru/docs/managed-mongodb/api-ref/grpc/database_service#Database1 6 | 7 | The composite primary key for this table is (**name**, **cluster_id**). 8 | 9 | ## Relations 10 | 11 | This table depends on [yc_mdb_mongodb_clusters](yc_mdb_mongodb_clusters.md). 12 | 13 | ## Columns 14 | 15 | | Name | Type | 16 | | ------------- | ------------- | 17 | |_cq_id|`uuid`| 18 | |_cq_parent_id|`uuid`| 19 | |name (PK)|`utf8`| 20 | |cluster_id (PK)|`utf8`| -------------------------------------------------------------------------------- /docs/tables/yc_organizationmanager_oslogin_settings.md: -------------------------------------------------------------------------------- 1 | # Table: yc_organizationmanager_oslogin_settings 2 | 3 | This table shows data for YC Cloud Organization Oslogin Settings. 4 | 5 | https://yandex.cloud/ru/docs/organization/api-ref/grpc/OsLogin/getSettings#yandex.cloud.organizationmanager.v1.OsLoginSettings 6 | 7 | The primary key for this table is **organization_id**. 8 | 9 | ## Columns 10 | 11 | | Name | Type | 12 | | ------------- | ------------- | 13 | |_cq_id|`uuid`| 14 | |_cq_parent_id|`uuid`| 15 | |organization_id (PK)|`utf8`| 16 | |user_ssh_key_settings|`json`| 17 | |ssh_certificate_settings|`json`| -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | name: Lint 2 | 3 | permissions: 4 | contents: read 5 | 6 | on: 7 | push: 8 | branches: 9 | - main 10 | pull_request: 11 | branches: 12 | - main 13 | 14 | jobs: 15 | golangci: 16 | name: Lint with GolangCI 17 | timeout-minutes: 10 18 | runs-on: ubuntu-latest 19 | steps: 20 | - uses: actions/checkout@v4 21 | - uses: actions/setup-go@v5 22 | with: 23 | go-version-file: go.mod 24 | - name: golangci-lint 25 | uses: golangci/golangci-lint-action@v6 26 | with: 27 | version: v1.63.4 28 | args: --timeout=10m -------------------------------------------------------------------------------- /docs/tables/yc_access_bindings_containerregistry_registries.md: -------------------------------------------------------------------------------- 1 | # Table: yc_access_bindings_containerregistry_registries 2 | 3 | This table shows data for YC Access Bindings Container Registry Registries. 4 | 5 | The composite primary key for this table is (**id**, **role_id**, **subject**). 6 | 7 | ## Relations 8 | 9 | This table depends on [yc_containerregistry_registries](yc_containerregistry_registries.md). 10 | 11 | ## Columns 12 | 13 | | Name | Type | 14 | | ------------- | ------------- | 15 | |_cq_id|`uuid`| 16 | |_cq_parent_id|`uuid`| 17 | |id (PK)|`utf8`| 18 | |role_id (PK)|`utf8`| 19 | |subject (PK)|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_mdb_mongodb_users.md: -------------------------------------------------------------------------------- 1 | # Table: yc_mdb_mongodb_users 2 | 3 | This table shows data for YC Managed Service for Mongodb Users. 4 | 5 | https://cloud.yandex.ru/docs/managed-mongodb/api-ref/grpc/user_service#User1 6 | 7 | The composite primary key for this table is (**name**, **cluster_id**). 8 | 9 | ## Relations 10 | 11 | This table depends on [yc_mdb_mongodb_clusters](yc_mdb_mongodb_clusters.md). 12 | 13 | ## Columns 14 | 15 | | Name | Type | 16 | | ------------- | ------------- | 17 | |_cq_id|`uuid`| 18 | |_cq_parent_id|`uuid`| 19 | |name (PK)|`utf8`| 20 | |cluster_id (PK)|`utf8`| 21 | |permissions|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_access_bindings_containerregistry_repositories.md: -------------------------------------------------------------------------------- 1 | # Table: yc_access_bindings_containerregistry_repositories 2 | 3 | This table shows data for YC Access Bindings Container Registry Repositories. 4 | 5 | The composite primary key for this table is (**id**, **role_id**, **subject**). 6 | 7 | ## Relations 8 | 9 | This table depends on [yc_containerregistry_repositories](yc_containerregistry_repositories.md). 10 | 11 | ## Columns 12 | 13 | | Name | Type | 14 | | ------------- | ------------- | 15 | |_cq_id|`uuid`| 16 | |_cq_parent_id|`uuid`| 17 | |id (PK)|`utf8`| 18 | |role_id (PK)|`utf8`| 19 | |subject (PK)|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_dns_record_sets.md: -------------------------------------------------------------------------------- 1 | # Table: yc_dns_record_sets 2 | 3 | This table shows data for YC DNS Record Sets. 4 | 5 | https://cloud.yandex.ru/docs/dns/api-ref/grpc/dns_zone_service#RecordSet1 6 | 7 | The composite primary key for this table is (**zone_id**, **name**, **type**). 8 | 9 | ## Relations 10 | 11 | This table depends on [yc_dns_zones](yc_dns_zones.md). 12 | 13 | ## Columns 14 | 15 | | Name | Type | 16 | | ------------- | ------------- | 17 | |_cq_id|`uuid`| 18 | |_cq_parent_id|`uuid`| 19 | |zone_id (PK)|`utf8`| 20 | |name (PK)|`utf8`| 21 | |type (PK)|`utf8`| 22 | |ttl|`int64`| 23 | |data|`list`| -------------------------------------------------------------------------------- /docs/tables/yc_kubernetes_nodes.md: -------------------------------------------------------------------------------- 1 | # Table: yc_kubernetes_nodes 2 | 3 | This table shows data for YC Kubernetes Nodes. 4 | 5 | The primary key for this table is **cloud_status_id**. 6 | 7 | ## Relations 8 | 9 | This table depends on [yc_kubernetes_node_groups](yc_kubernetes_node_groups.md). 10 | 11 | ## Columns 12 | 13 | | Name | Type | 14 | | ------------- | ------------- | 15 | |_cq_id|`uuid`| 16 | |_cq_parent_id|`uuid`| 17 | |node_group_id|`utf8`| 18 | |status|`utf8`| 19 | |spec|`json`| 20 | |cloud_status_id (PK)|`utf8`| 21 | |cloud_status_status|`utf8`| 22 | |cloud_status_status_message|`utf8`| 23 | |kubernetes_status|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_access_bindings_lockbox_secrets.md: -------------------------------------------------------------------------------- 1 | # Table: yc_access_bindings_lockbox_secrets 2 | 3 | This table shows data for YC Access Bindings Lockbox Secrets. 4 | 5 | https://cloud.yandex.ru/docs/lockbox/api-ref/grpc/secret_service#AccessBinding 6 | 7 | The composite primary key for this table is (**id**, **role_id**, **subject**). 8 | 9 | ## Relations 10 | 11 | This table depends on [yc_lockbox_secrets](yc_lockbox_secrets.md). 12 | 13 | ## Columns 14 | 15 | | Name | Type | 16 | | ------------- | ------------- | 17 | |_cq_id|`uuid`| 18 | |_cq_parent_id|`uuid`| 19 | |id (PK)|`utf8`| 20 | |role_id (PK)|`utf8`| 21 | |subject (PK)|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_access_iam_service_accounts.md: -------------------------------------------------------------------------------- 1 | # Table: yc_access_iam_service_accounts 2 | 3 | This table shows data for YC Access IAM Service Accounts. 4 | 5 | https://cloud.yandex.ru/docs/iam/api-ref/grpc/service_account_service#AccessBinding 6 | 7 | The composite primary key for this table is (**id**, **role_id**, **subject**). 8 | 9 | ## Relations 10 | 11 | This table depends on [yc_iam_service_accounts](yc_iam_service_accounts.md). 12 | 13 | ## Columns 14 | 15 | | Name | Type | 16 | | ------------- | ------------- | 17 | |_cq_id|`uuid`| 18 | |_cq_parent_id|`uuid`| 19 | |id (PK)|`utf8`| 20 | |role_id (PK)|`utf8`| 21 | |subject (PK)|`json`| -------------------------------------------------------------------------------- /internal/util/util.go: -------------------------------------------------------------------------------- 1 | package util 2 | 3 | func SliceToSet[T comparable](src []T) map[T]bool { 4 | result := make(map[T]bool) 5 | for _, elem := range src { 6 | result[elem] = true 7 | } 8 | return result 9 | } 10 | 11 | func SetToSlice[T comparable](src map[T]bool) []T { 12 | result := make([]T, 0) 13 | for key := range src { 14 | result = append(result, key) 15 | } 16 | return result 17 | } 18 | 19 | func Filter[T comparable](arr []T, predicate func(T) bool) []T { 20 | filtered := make([]T, 0) 21 | for _, elem := range arr { 22 | if predicate(elem) { 23 | filtered = append(filtered, elem) 24 | } 25 | } 26 | return filtered 27 | } 28 | -------------------------------------------------------------------------------- /docs/tables/yc_serverless_apigateway_openapi_specs.md: -------------------------------------------------------------------------------- 1 | # Table: yc_serverless_apigateway_openapi_specs 2 | 3 | This table shows data for YC Serverless API Gateway Openapi Specs. 4 | 5 | https://cloud.yandex.ru/docs/api-gateway/apigateway/api-ref/grpc/apigateway_service#GetOpenapiSpecResponse 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Relations 10 | 11 | This table depends on [yc_serverless_apigateway_gateways](yc_serverless_apigateway_gateways.md). 12 | 13 | ## Columns 14 | 15 | | Name | Type | 16 | | ------------- | ------------- | 17 | |_cq_id|`uuid`| 18 | |_cq_parent_id|`uuid`| 19 | |id (PK)|`utf8`| 20 | |openapi_spec|`utf8`| -------------------------------------------------------------------------------- /docs/tables/yc_mdb_clickhouse_databases.md: -------------------------------------------------------------------------------- 1 | # Table: yc_mdb_clickhouse_databases 2 | 3 | This table shows data for YC Managed Service for Clickhouse Databases. 4 | 5 | https://cloud.yandex.ru/docs/managed-clickhouse/api-ref/grpc/database_service#Database1 6 | 7 | The composite primary key for this table is (**name**, **cluster_id**). 8 | 9 | ## Relations 10 | 11 | This table depends on [yc_mdb_clickhouse_clusters](yc_mdb_clickhouse_clusters.md). 12 | 13 | ## Columns 14 | 15 | | Name | Type | 16 | | ------------- | ------------- | 17 | |_cq_id|`uuid`| 18 | |_cq_parent_id|`uuid`| 19 | |name (PK)|`utf8`| 20 | |cluster_id (PK)|`utf8`| 21 | |engine|`utf8`| -------------------------------------------------------------------------------- /docs/tables/yc_nlb_target_groups.md: -------------------------------------------------------------------------------- 1 | # Table: yc_nlb_target_groups 2 | 3 | This table shows data for YC Network Load Balancer Target Groups. 4 | 5 | https://yandex.cloud/ru/docs/network-load-balancer/api-ref/grpc/TargetGroup/list#yandex.cloud.loadbalancer.v1.TargetGroup 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Columns 10 | 11 | | Name | Type | 12 | | ------------- | ------------- | 13 | |_cq_id|`uuid`| 14 | |_cq_parent_id|`uuid`| 15 | |cloud_id|`utf8`| 16 | |id (PK)|`utf8`| 17 | |folder_id|`utf8`| 18 | |created_at|`timestamp[us, tz=UTC]`| 19 | |name|`utf8`| 20 | |description|`utf8`| 21 | |labels|`json`| 22 | |region_id|`utf8`| 23 | |targets|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_vpc_security_groups.md: -------------------------------------------------------------------------------- 1 | # Table: yc_vpc_security_groups 2 | 3 | This table shows data for YC VPC Security Groups. 4 | 5 | https://cloud.yandex.ru/docs/vpc/api-ref/grpc/security_group_service#SecurityGroup1 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Columns 10 | 11 | | Name | Type | 12 | | ------------- | ------------- | 13 | |_cq_id|`uuid`| 14 | |_cq_parent_id|`uuid`| 15 | |cloud_id|`utf8`| 16 | |id (PK)|`utf8`| 17 | |folder_id|`utf8`| 18 | |created_at|`timestamp[us, tz=UTC]`| 19 | |name|`utf8`| 20 | |description|`utf8`| 21 | |labels|`json`| 22 | |network_id|`utf8`| 23 | |status|`utf8`| 24 | |rules|`json`| 25 | |default_for_network|`bool`| -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: "Unit tests" 2 | 3 | permissions: 4 | contents: read 5 | 6 | on: 7 | push: 8 | branches: 9 | - main 10 | pull_request: 11 | branches: 12 | - main 13 | 14 | jobs: 15 | unitests: 16 | name: Unit tests 17 | timeout-minutes: 15 18 | runs-on: ubuntu-latest 19 | steps: 20 | - name: Check out code into the Go module directory 21 | uses: actions/checkout@v4 22 | - name: Set up Go 1.x 23 | uses: actions/setup-go@v5 24 | with: 25 | go-version-file: go.mod 26 | - run: go mod download 27 | - run: go build ./... 28 | - name: Run tests 29 | run: go test -race ./... -------------------------------------------------------------------------------- /docs/tables/yc_iam_keys.md: -------------------------------------------------------------------------------- 1 | # Table: yc_iam_keys 2 | 3 | This table shows data for YC IAM Keys. 4 | 5 | https://cloud.yandex.ru/docs/iam/api-ref/grpc/key_service#Key1 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Relations 10 | 11 | This table depends on [yc_iam_service_accounts](yc_iam_service_accounts.md). 12 | 13 | ## Columns 14 | 15 | | Name | Type | 16 | | ------------- | ------------- | 17 | |_cq_id|`uuid`| 18 | |_cq_parent_id|`uuid`| 19 | |cloud_id|`utf8`| 20 | |id (PK)|`utf8`| 21 | |subject|`json`| 22 | |created_at|`timestamp[us, tz=UTC]`| 23 | |description|`utf8`| 24 | |key_algorithm|`utf8`| 25 | |public_key|`utf8`| 26 | |last_used_at|`timestamp[us, tz=UTC]`| -------------------------------------------------------------------------------- /docs/tables/yc_mdb_kafka_topics.md: -------------------------------------------------------------------------------- 1 | # Table: yc_mdb_kafka_topics 2 | 3 | This table shows data for YC Managed Service for Kafka Topics. 4 | 5 | https://cloud.yandex.ru/docs/managed-kafka/api-ref/grpc/topic_service#Topic1 6 | 7 | The composite primary key for this table is (**name**, **cluster_id**). 8 | 9 | ## Relations 10 | 11 | This table depends on [yc_mdb_kafka_clusters](yc_mdb_kafka_clusters.md). 12 | 13 | ## Columns 14 | 15 | | Name | Type | 16 | | ------------- | ------------- | 17 | |_cq_id|`uuid`| 18 | |_cq_parent_id|`uuid`| 19 | |cloud_id|`utf8`| 20 | |name (PK)|`utf8`| 21 | |cluster_id (PK)|`utf8`| 22 | |partitions|`json`| 23 | |replication_factor|`json`| 24 | |topic_config|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_iam_access_keys.md: -------------------------------------------------------------------------------- 1 | # Table: yc_iam_access_keys 2 | 3 | This table shows data for YC IAM Access Keys. 4 | 5 | https://cloud.yandex.ru/docs/iam/api-ref/grpc/access_key_service#AccessKey 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Relations 10 | 11 | This table depends on [yc_iam_service_accounts](yc_iam_service_accounts.md). 12 | 13 | ## Columns 14 | 15 | | Name | Type | 16 | | ------------- | ------------- | 17 | |_cq_id|`uuid`| 18 | |_cq_parent_id|`uuid`| 19 | |cloud_id|`utf8`| 20 | |id (PK)|`utf8`| 21 | |service_account_id|`utf8`| 22 | |created_at|`timestamp[us, tz=UTC]`| 23 | |description|`utf8`| 24 | |key_id|`utf8`| 25 | |last_used_at|`timestamp[us, tz=UTC]`| -------------------------------------------------------------------------------- /docs/tables/yc_vpc_addresses.md: -------------------------------------------------------------------------------- 1 | # Table: yc_vpc_addresses 2 | 3 | This table shows data for YC VPC Addresses. 4 | 5 | https://cloud.yandex.ru/docs/vpc/api-ref/grpc/address_service#Address2 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Columns 10 | 11 | | Name | Type | 12 | | ------------- | ------------- | 13 | |_cq_id|`uuid`| 14 | |_cq_parent_id|`uuid`| 15 | |cloud_id|`utf8`| 16 | |id (PK)|`utf8`| 17 | |folder_id|`utf8`| 18 | |created_at|`timestamp[us, tz=UTC]`| 19 | |name|`utf8`| 20 | |description|`utf8`| 21 | |labels|`json`| 22 | |address|`json`| 23 | |reserved|`bool`| 24 | |used|`bool`| 25 | |type|`utf8`| 26 | |ip_version|`utf8`| 27 | |deletion_protection|`bool`| 28 | |dns_records|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_mdb_clickhouse_users.md: -------------------------------------------------------------------------------- 1 | # Table: yc_mdb_clickhouse_users 2 | 3 | This table shows data for YC Managed Service for Clickhouse Users. 4 | 5 | https://cloud.yandex.ru/docs/managed-clickhouse/api-ref/grpc/user_service#User1 6 | 7 | The composite primary key for this table is (**name**, **cluster_id**). 8 | 9 | ## Relations 10 | 11 | This table depends on [yc_mdb_clickhouse_clusters](yc_mdb_clickhouse_clusters.md). 12 | 13 | ## Columns 14 | 15 | | Name | Type | 16 | | ------------- | ------------- | 17 | |_cq_id|`uuid`| 18 | |_cq_parent_id|`uuid`| 19 | |name (PK)|`utf8`| 20 | |cluster_id (PK)|`utf8`| 21 | |permissions|`json`| 22 | |settings|`json`| 23 | |quotas|`json`| 24 | |connection_manager|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_mdb_postgresql_backups.md: -------------------------------------------------------------------------------- 1 | # Table: yc_mdb_postgresql_backups 2 | 3 | This table shows data for YC Managed Service for Postgresql Backups. 4 | 5 | https://yandex.cloud/ru/docs/managed-postgresql/api-ref/grpc/backup_service#Backup 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Columns 10 | 11 | | Name | Type | 12 | | ------------- | ------------- | 13 | |_cq_id|`uuid`| 14 | |_cq_parent_id|`uuid`| 15 | |cloud_id|`utf8`| 16 | |id (PK)|`utf8`| 17 | |folder_id|`utf8`| 18 | |created_at|`timestamp[us, tz=UTC]`| 19 | |source_cluster_id|`utf8`| 20 | |started_at|`timestamp[us, tz=UTC]`| 21 | |size|`int64`| 22 | |type|`utf8`| 23 | |method|`utf8`| 24 | |journal_size|`int64`| 25 | |status|`utf8`| -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: test 2 | test: 3 | go test -timeout 3m ./... 4 | 5 | .PHONY: build 6 | build: 7 | go build -o yc main.go 8 | 9 | .PHONY: gen-docs 10 | gen-docs: build 11 | @command -v cloudquery >/dev/null 2>&1 || { \ 12 | echo "Error: 'cloudquery' command not found. Please install it before running gen-docs."; \ 13 | echo "You can install it by following the instructions at: https://cli-docs.cloudquery.io/docs/quickstart"; \ 14 | exit 1; \ 15 | } 16 | rm -rf docs/tables 17 | cloudquery --no-log-file tables --format markdown --output-dir docs test/config.yaml 18 | mv docs/yc docs/tables 19 | 20 | .PHONY: lint 21 | lint: 22 | @golangci-lint run --timeout 10m 23 | 24 | # All gen targets 25 | .PHONY: gen 26 | gen: gen-docs 27 | -------------------------------------------------------------------------------- /docs/tables/yc_quotamanager_quota_services.md: -------------------------------------------------------------------------------- 1 | # Table: yc_quotamanager_quota_services 2 | 3 | This table shows data for YC Quota Manager Quota Services. 4 | 5 | https://yandex.cloud/ru/docs/quota-manager/api-ref/grpc/QuotaLimit/listServices#yandex.cloud.quotamanager.v1.Service 6 | 7 | The composite primary key for this table is (**id**, **resource_type**). 8 | 9 | ## Relations 10 | 11 | The following tables depend on yc_quotamanager_quota_services: 12 | - [yc_quotamanager_quota_limits](yc_quotamanager_quota_limits.md) 13 | 14 | ## Columns 15 | 16 | | Name | Type | 17 | | ------------- | ------------- | 18 | |_cq_id|`uuid`| 19 | |_cq_parent_id|`uuid`| 20 | |id (PK)|`utf8`| 21 | |name|`utf8`| 22 | |resource_type (PK)|`utf8`| 23 | -------------------------------------------------------------------------------- /docs/tables/yc_quotamanager_quota_limits.md: -------------------------------------------------------------------------------- 1 | # Table: yc_quotamanager_quota_limits 2 | 3 | This table shows data for YC Quota Manager Quota Limits. 4 | 5 | https://yandex.cloud/ru/docs/quota-manager/api-ref/grpc/QuotaLimit/list#yandex.cloud.quotamanager.v1.QuotaLimit 6 | 7 | The composite primary key for this table is (**resource_id**, **quota_id**). 8 | 9 | ## Relations 10 | 11 | This table depends on [yc_quotamanager_quota_services](yc_quotamanager_quota_services.md). 12 | 13 | ## Columns 14 | 15 | | Name | Type | 16 | | ------------- | ------------- | 17 | |_cq_id|`uuid`| 18 | |_cq_parent_id|`uuid`| 19 | |resource_id (PK)|`utf8`| 20 | |resource_type|`utf8`| 21 | |quota_id (PK)|`utf8`| 22 | |limit|`json`| 23 | |usage|`json`| 24 | -------------------------------------------------------------------------------- /docs/tables/yc_vpc_subnets.md: -------------------------------------------------------------------------------- 1 | # Table: yc_vpc_subnets 2 | 3 | This table shows data for YC VPC Subnets. 4 | 5 | https://cloud.yandex.ru/docs/vpc/api-ref/grpc/subnet_service#Subnet1 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Columns 10 | 11 | | Name | Type | 12 | | ------------- | ------------- | 13 | |_cq_id|`uuid`| 14 | |_cq_parent_id|`uuid`| 15 | |cloud_id|`utf8`| 16 | |id (PK)|`utf8`| 17 | |folder_id|`utf8`| 18 | |created_at|`timestamp[us, tz=UTC]`| 19 | |name|`utf8`| 20 | |description|`utf8`| 21 | |labels|`json`| 22 | |network_id|`utf8`| 23 | |zone_id|`utf8`| 24 | |v4_cidr_blocks|`list`| 25 | |v6_cidr_blocks|`list`| 26 | |route_table_id|`utf8`| 27 | |dhcp_options|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_datatransfer_transfers.md: -------------------------------------------------------------------------------- 1 | # Table: yc_datatransfer_transfers 2 | 3 | This table shows data for YC Data Transfer Transfers. 4 | 5 | https://yandex.cloud/ru/docs/data-transfer/api-ref/grpc/transfer_service#Transfer 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Columns 10 | 11 | | Name | Type | 12 | | ------------- | ------------- | 13 | |_cq_id|`uuid`| 14 | |_cq_parent_id|`uuid`| 15 | |cloud_id|`utf8`| 16 | |id (PK)|`utf8`| 17 | |folder_id|`utf8`| 18 | |name|`utf8`| 19 | |description|`utf8`| 20 | |labels|`json`| 21 | |source|`json`| 22 | |target|`json`| 23 | |runtime|`json`| 24 | |status|`utf8`| 25 | |type|`utf8`| 26 | |warning|`utf8`| 27 | |transformation|`json`| 28 | |data_objects|`json`| 29 | |prestable|`bool`| -------------------------------------------------------------------------------- /docs/tables/yc_mdb_greenplum_hosts.md: -------------------------------------------------------------------------------- 1 | # Table: yc_mdb_greenplum_hosts 2 | 3 | This table shows data for YC Managed Service for Greenplum Hosts. 4 | 5 | https://cloud.yandex.ru/docs/managed-greenplum/api-ref/grpc/cluster_service#Host 6 | 7 | The composite primary key for this table is (**name**, **cluster_id**). 8 | 9 | ## Relations 10 | 11 | This table depends on [yc_mdb_greenplum_clusters](yc_mdb_greenplum_clusters.md). 12 | 13 | ## Columns 14 | 15 | | Name | Type | 16 | | ------------- | ------------- | 17 | |_cq_id|`uuid`| 18 | |_cq_parent_id|`uuid`| 19 | |name (PK)|`utf8`| 20 | |cluster_id (PK)|`utf8`| 21 | |zone_id|`utf8`| 22 | |type|`utf8`| 23 | |resources|`json`| 24 | |health|`utf8`| 25 | |subnet_id|`utf8`| 26 | |assign_public_ip|`bool`| -------------------------------------------------------------------------------- /docs/tables/yc_mdb_mysql_hosts.md: -------------------------------------------------------------------------------- 1 | # Table: yc_mdb_mysql_hosts 2 | 3 | This table shows data for YC Managed Service for Mysql Hosts. 4 | 5 | The composite primary key for this table is (**name**, **cluster_id**). 6 | 7 | ## Relations 8 | 9 | This table depends on [yc_mdb_mysql_clusters](yc_mdb_mysql_clusters.md). 10 | 11 | ## Columns 12 | 13 | | Name | Type | 14 | | ------------- | ------------- | 15 | |_cq_id|`uuid`| 16 | |_cq_parent_id|`uuid`| 17 | |name (PK)|`utf8`| 18 | |cluster_id (PK)|`utf8`| 19 | |zone_id|`utf8`| 20 | |resources|`json`| 21 | |role|`utf8`| 22 | |health|`utf8`| 23 | |services|`json`| 24 | |subnet_id|`utf8`| 25 | |assign_public_ip|`bool`| 26 | |replication_source|`utf8`| 27 | |backup_priority|`int64`| 28 | |priority|`int64`| -------------------------------------------------------------------------------- /docs/tables/yc_serverless_functions_functions.md: -------------------------------------------------------------------------------- 1 | # Table: yc_serverless_functions_functions 2 | 3 | This table shows data for YC Serverless Functions Functions. 4 | 5 | The primary key for this table is **id**. 6 | 7 | ## Relations 8 | 9 | The following tables depend on yc_serverless_functions_functions: 10 | - [yc_access_bindings_serverless_functions](yc_access_bindings_serverless_functions.md) 11 | 12 | ## Columns 13 | 14 | | Name | Type | 15 | | ------------- | ------------- | 16 | |_cq_id|`uuid`| 17 | |_cq_parent_id|`uuid`| 18 | |cloud_id|`utf8`| 19 | |id (PK)|`utf8`| 20 | |folder_id|`utf8`| 21 | |created_at|`timestamp[us, tz=UTC]`| 22 | |name|`utf8`| 23 | |description|`utf8`| 24 | |labels|`json`| 25 | |http_invoke_url|`utf8`| 26 | |status|`utf8`| -------------------------------------------------------------------------------- /docs/tables/yc_vpc_privatelink_private_endpoints.md: -------------------------------------------------------------------------------- 1 | # Table: yc_vpc_privatelink_private_endpoints 2 | 3 | This table shows data for VPC Private Endpoints. 4 | 5 | https://yandex.cloud/ru/docs/vpc/privatelink/api-ref/grpc/PrivateEndpoint/list#yandex.cloud.vpc.v1.privatelink.PrivateEndpoint 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Columns 10 | 11 | | Name | Type | 12 | | ------------- | ------------- | 13 | |_cq_id|`uuid`| 14 | |_cq_parent_id|`uuid`| 15 | |cloud_id|`utf8`| 16 | |id (PK)|`utf8`| 17 | |folder_id|`utf8`| 18 | |created_at|`timestamp[us, tz=UTC]`| 19 | |name|`utf8`| 20 | |description|`utf8`| 21 | |labels|`json`| 22 | |network_id|`utf8`| 23 | |status|`utf8`| 24 | |address|`json`| 25 | |dns_options|`json`| 26 | |service|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_mdb_mysql_users.md: -------------------------------------------------------------------------------- 1 | # Table: yc_mdb_mysql_users 2 | 3 | This table shows data for YC Managed Service for Mysql Users. 4 | 5 | https://cloud.yandex.ru/docs/managed-mysql/api-ref/grpc/user_service#User1 6 | 7 | The composite primary key for this table is (**name**, **cluster_id**). 8 | 9 | ## Relations 10 | 11 | This table depends on [yc_mdb_mysql_clusters](yc_mdb_mysql_clusters.md). 12 | 13 | ## Columns 14 | 15 | | Name | Type | 16 | | ------------- | ------------- | 17 | |_cq_id|`uuid`| 18 | |_cq_parent_id|`uuid`| 19 | |name (PK)|`utf8`| 20 | |cluster_id (PK)|`utf8`| 21 | |permissions|`json`| 22 | |global_permissions|`list`| 23 | |connection_limits|`json`| 24 | |authentication_plugin|`utf8`| 25 | |connection_manager|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_iam_api_keys.md: -------------------------------------------------------------------------------- 1 | # Table: yc_iam_api_keys 2 | 3 | This table shows data for YC IAM API Keys. 4 | 5 | https://cloud.yandex.ru/docs/iam/api-ref/grpc/api_key_service#ApiKey 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Relations 10 | 11 | This table depends on [yc_iam_service_accounts](yc_iam_service_accounts.md). 12 | 13 | ## Columns 14 | 15 | | Name | Type | 16 | | ------------- | ------------- | 17 | |_cq_id|`uuid`| 18 | |_cq_parent_id|`uuid`| 19 | |cloud_id|`utf8`| 20 | |id (PK)|`utf8`| 21 | |service_account_id|`utf8`| 22 | |created_at|`timestamp[us, tz=UTC]`| 23 | |description|`utf8`| 24 | |last_used_at|`timestamp[us, tz=UTC]`| 25 | |scope|`utf8`| 26 | |scopes|`list`| 27 | |expires_at|`timestamp[us, tz=UTC]`| -------------------------------------------------------------------------------- /docs/tables/yc_audittrails_trails.md: -------------------------------------------------------------------------------- 1 | # Table: yc_audittrails_trails 2 | 3 | This table shows data for YC Audit Trails Trails. 4 | 5 | https://yandex.cloud/ru/docs/audit-trails/api-ref/grpc/trail_service#Trail1 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Columns 10 | 11 | | Name | Type | 12 | | ------------- | ------------- | 13 | |_cq_id|`uuid`| 14 | |_cq_parent_id|`uuid`| 15 | |cloud_id|`utf8`| 16 | |id (PK)|`utf8`| 17 | |folder_id|`utf8`| 18 | |created_at|`timestamp[us, tz=UTC]`| 19 | |updated_at|`timestamp[us, tz=UTC]`| 20 | |name|`utf8`| 21 | |description|`utf8`| 22 | |labels|`json`| 23 | |destination|`json`| 24 | |service_account_id|`utf8`| 25 | |status|`utf8`| 26 | |filter|`json`| 27 | |status_error_message|`utf8`| 28 | |filtering_policy|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_compute_images.md: -------------------------------------------------------------------------------- 1 | # Table: yc_compute_images 2 | 3 | This table shows data for YC Compute Images. 4 | 5 | https://cloud.yandex.ru/docs/compute/api-ref/grpc/image_service#Image2 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Columns 10 | 11 | | Name | Type | 12 | | ------------- | ------------- | 13 | |_cq_id|`uuid`| 14 | |_cq_parent_id|`uuid`| 15 | |cloud_id|`utf8`| 16 | |id (PK)|`utf8`| 17 | |folder_id|`utf8`| 18 | |created_at|`timestamp[us, tz=UTC]`| 19 | |name|`utf8`| 20 | |description|`utf8`| 21 | |labels|`json`| 22 | |family|`utf8`| 23 | |storage_size|`int64`| 24 | |min_disk_size|`int64`| 25 | |product_ids|`list`| 26 | |status|`utf8`| 27 | |os|`json`| 28 | |pooled|`bool`| 29 | |hardware_generation|`json`| 30 | |kms_key|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_dns_zones.md: -------------------------------------------------------------------------------- 1 | # Table: yc_dns_zones 2 | 3 | This table shows data for YC DNS Zones. 4 | 5 | https://cloud.yandex.ru/docs/dns/api-ref/grpc/dns_zone_service#DnsZone1 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Relations 10 | 11 | The following tables depend on yc_dns_zones: 12 | - [yc_dns_record_sets](yc_dns_record_sets.md) 13 | 14 | ## Columns 15 | 16 | | Name | Type | 17 | | ------------- | ------------- | 18 | |_cq_id|`uuid`| 19 | |_cq_parent_id|`uuid`| 20 | |cloud_id|`utf8`| 21 | |id (PK)|`utf8`| 22 | |folder_id|`utf8`| 23 | |created_at|`timestamp[us, tz=UTC]`| 24 | |name|`utf8`| 25 | |description|`utf8`| 26 | |labels|`json`| 27 | |zone|`utf8`| 28 | |private_visibility|`json`| 29 | |public_visibility|`json`| 30 | |deletion_protection|`bool`| -------------------------------------------------------------------------------- /docs/tables/yc_mdb_postgresql_databases.md: -------------------------------------------------------------------------------- 1 | # Table: yc_mdb_postgresql_databases 2 | 3 | This table shows data for YC Managed Service for Postgresql Databases. 4 | 5 | https://cloud.yandex.ru/docs/managed-postgresql/api-ref/grpc/database_service#Database1 6 | 7 | The composite primary key for this table is (**name**, **cluster_id**). 8 | 9 | ## Relations 10 | 11 | This table depends on [yc_mdb_postgresql_clusters](yc_mdb_postgresql_clusters.md). 12 | 13 | ## Columns 14 | 15 | | Name | Type | 16 | | ------------- | ------------- | 17 | |_cq_id|`uuid`| 18 | |_cq_parent_id|`uuid`| 19 | |name (PK)|`utf8`| 20 | |cluster_id (PK)|`utf8`| 21 | |owner|`utf8`| 22 | |lc_collate|`utf8`| 23 | |lc_ctype|`utf8`| 24 | |extensions|`json`| 25 | |template_db|`utf8`| 26 | |deletion_protection|`json`| -------------------------------------------------------------------------------- /resources/mdb/mdb.go: -------------------------------------------------------------------------------- 1 | package mdb 2 | 3 | import ( 4 | "github.com/apache/arrow-go/v18/arrow" 5 | "github.com/cloudquery/plugin-sdk/v4/schema" 6 | "github.com/cloudquery/plugin-sdk/v4/transformers" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | ) 9 | 10 | var ( 11 | primaryKeyNameClusterIdTransformer = transformers.WithPrimaryKeys("Name", "ClusterId") 12 | clusterIdResolver = schema.ParentColumnResolver("Id") 13 | clusterIdColumn = schema.Column{ 14 | Name: "cluster_id", 15 | Type: arrow.BinaryTypes.String, 16 | Resolver: clusterIdResolver, 17 | PrimaryKey: true, 18 | } 19 | ) 20 | 21 | func structNameClusterIdTransformer(t any) schema.Transform { 22 | return client.TransformWithStruct(t, primaryKeyNameClusterIdTransformer) 23 | } 24 | -------------------------------------------------------------------------------- /.goreleaser.yaml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | before: 4 | hooks: 5 | - "go mod download" 6 | 7 | builds: 8 | - flags: 9 | - -buildmode=exe 10 | env: 11 | - CGO_ENANLED=0 12 | - GO111MODULE=on 13 | ldflags: 14 | - -s -w -X github.com/yandex-cloud/cq-source-yc/plugin.Version={{.Version}} 15 | goos: 16 | - windows 17 | - linux 18 | - darwin 19 | goarch: 20 | - amd64 21 | - arm64 22 | ignore: 23 | - goos: windows 24 | goarch: arm64 25 | 26 | sboms: 27 | - artifacts: archive 28 | 29 | archives: 30 | - formats: ["zip"] 31 | 32 | checksum: 33 | name_template: "checksums.txt" 34 | 35 | changelog: 36 | sort: asc 37 | filters: 38 | exclude: 39 | - "^docs:" 40 | - "^test:" 41 | 42 | release: 43 | prerelease: auto -------------------------------------------------------------------------------- /docs/tables/yc_mdb_clickhouse_hosts.md: -------------------------------------------------------------------------------- 1 | # Table: yc_mdb_clickhouse_hosts 2 | 3 | This table shows data for YC Managed Service for Clickhouse Hosts. 4 | 5 | https://cloud.yandex.ru/docs/managed-clickhouse/api-ref/grpc/cluster_service#Host 6 | 7 | The composite primary key for this table is (**name**, **cluster_id**). 8 | 9 | ## Relations 10 | 11 | This table depends on [yc_mdb_clickhouse_clusters](yc_mdb_clickhouse_clusters.md). 12 | 13 | ## Columns 14 | 15 | | Name | Type | 16 | | ------------- | ------------- | 17 | |_cq_id|`uuid`| 18 | |_cq_parent_id|`uuid`| 19 | |name (PK)|`utf8`| 20 | |cluster_id (PK)|`utf8`| 21 | |zone_id|`utf8`| 22 | |type|`utf8`| 23 | |resources|`json`| 24 | |health|`utf8`| 25 | |services|`json`| 26 | |subnet_id|`utf8`| 27 | |assign_public_ip|`bool`| 28 | |shard_name|`utf8`| -------------------------------------------------------------------------------- /docs/tables/yc_mdb_redis_hosts.md: -------------------------------------------------------------------------------- 1 | # Table: yc_mdb_redis_hosts 2 | 3 | This table shows data for YC Managed Service for Redis Hosts. 4 | 5 | https://cloud.yandex.ru/docs/managed-redis/api-ref/grpc/cluster_service#Host 6 | 7 | The composite primary key for this table is (**name**, **cluster_id**). 8 | 9 | ## Relations 10 | 11 | This table depends on [yc_mdb_redis_clusters](yc_mdb_redis_clusters.md). 12 | 13 | ## Columns 14 | 15 | | Name | Type | 16 | | ------------- | ------------- | 17 | |_cq_id|`uuid`| 18 | |_cq_parent_id|`uuid`| 19 | |name (PK)|`utf8`| 20 | |cluster_id (PK)|`utf8`| 21 | |zone_id|`utf8`| 22 | |subnet_id|`utf8`| 23 | |resources|`json`| 24 | |role|`utf8`| 25 | |health|`utf8`| 26 | |services|`json`| 27 | |shard_name|`utf8`| 28 | |replica_priority|`json`| 29 | |assign_public_ip|`bool`| -------------------------------------------------------------------------------- /docs/tables/yc_storage_buckets.md: -------------------------------------------------------------------------------- 1 | # Table: yc_storage_buckets 2 | 3 | This table shows data for YC Object Storage Buckets. 4 | 5 | The composite primary key for this table is (**name**, **folder_id**). 6 | 7 | ## Columns 8 | 9 | | Name | Type | 10 | | ------------- | ------------- | 11 | |_cq_id|`uuid`| 12 | |_cq_parent_id|`uuid`| 13 | |cloud_id|`utf8`| 14 | |name (PK)|`utf8`| 15 | |folder_id (PK)|`utf8`| 16 | |anonymous_access_flags|`json`| 17 | |default_storage_class|`utf8`| 18 | |versioning|`utf8`| 19 | |max_size|`int64`| 20 | |policy|`json`| 21 | |acl|`json`| 22 | |created_at|`timestamp[us, tz=UTC]`| 23 | |cors|`json`| 24 | |website_settings|`json`| 25 | |lifecycle_rules|`json`| 26 | |tags|`json`| 27 | |object_lock|`json`| 28 | |encryption|`json`| 29 | |allowed_private_endpoints|`json`| 30 | |resource_id|`utf8`| -------------------------------------------------------------------------------- /docs/tables/yc_mdb_mongodb_hosts.md: -------------------------------------------------------------------------------- 1 | # Table: yc_mdb_mongodb_hosts 2 | 3 | This table shows data for YC Managed Service for Mongodb Hosts. 4 | 5 | https://cloud.yandex.ru/docs/managed-mongodb/api-ref/grpc/cluster_service#Host 6 | 7 | The composite primary key for this table is (**name**, **cluster_id**). 8 | 9 | ## Relations 10 | 11 | This table depends on [yc_mdb_mongodb_clusters](yc_mdb_mongodb_clusters.md). 12 | 13 | ## Columns 14 | 15 | | Name | Type | 16 | | ------------- | ------------- | 17 | |_cq_id|`uuid`| 18 | |_cq_parent_id|`uuid`| 19 | |name (PK)|`utf8`| 20 | |cluster_id (PK)|`utf8`| 21 | |zone_id|`utf8`| 22 | |resources|`json`| 23 | |role|`utf8`| 24 | |health|`utf8`| 25 | |services|`json`| 26 | |subnet_id|`utf8`| 27 | |assign_public_ip|`bool`| 28 | |shard_name|`utf8`| 29 | |type|`utf8`| 30 | |host_parameters|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_cdn_resources.md: -------------------------------------------------------------------------------- 1 | # Table: yc_cdn_resources 2 | 3 | This table shows data for YC CDN Resources. 4 | 5 | https://cloud.yandex.ru/docs/cdn/api-ref/grpc/resource_service#Resource1 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Columns 10 | 11 | | Name | Type | 12 | | ------------- | ------------- | 13 | |_cq_id|`uuid`| 14 | |_cq_parent_id|`uuid`| 15 | |cloud_id|`utf8`| 16 | |id (PK)|`utf8`| 17 | |folder_id|`utf8`| 18 | |cname|`utf8`| 19 | |created_at|`timestamp[us, tz=UTC]`| 20 | |updated_at|`timestamp[us, tz=UTC]`| 21 | |active|`bool`| 22 | |options|`json`| 23 | |secondary_hostnames|`list`| 24 | |origin_group_id|`int64`| 25 | |origin_group_name|`utf8`| 26 | |origin_protocol|`utf8`| 27 | |ssl_certificate|`json`| 28 | |labels|`json`| 29 | |provider_type|`utf8`| 30 | |provider_cname|`utf8`| 31 | -------------------------------------------------------------------------------- /docs/tables/yc_mdb_opensearch_hosts.md: -------------------------------------------------------------------------------- 1 | # Table: yc_mdb_opensearch_hosts 2 | 3 | This table shows data for YC Managed Service for Opensearch Hosts. 4 | 5 | https://cloud.yandex.ru/docs/managed-opensearch/api-ref/grpc/cluster_service#Host 6 | 7 | The composite primary key for this table is (**name**, **cluster_id**). 8 | 9 | ## Relations 10 | 11 | This table depends on [yc_mdb_opensearch_clusters](yc_mdb_opensearch_clusters.md). 12 | 13 | ## Columns 14 | 15 | | Name | Type | 16 | | ------------- | ------------- | 17 | |_cq_id|`uuid`| 18 | |_cq_parent_id|`uuid`| 19 | |name (PK)|`utf8`| 20 | |cluster_id (PK)|`utf8`| 21 | |zone_id|`utf8`| 22 | |resources|`json`| 23 | |type|`utf8`| 24 | |health|`utf8`| 25 | |subnet_id|`utf8`| 26 | |assign_public_ip|`bool`| 27 | |system|`json`| 28 | |node_group|`utf8`| 29 | |roles|`list`| -------------------------------------------------------------------------------- /docs/tables/yc_containerregistry_repositories.md: -------------------------------------------------------------------------------- 1 | # Table: yc_containerregistry_repositories 2 | 3 | This table shows data for YC Container Registry Repositories. 4 | 5 | https://cloud.yandex.ru/docs/container-registry/api-ref/grpc/repository_service#Repository2 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Relations 10 | 11 | This table depends on [yc_containerregistry_registries](yc_containerregistry_registries.md). 12 | 13 | The following tables depend on yc_containerregistry_repositories: 14 | - [yc_access_bindings_containerregistry_repositories](yc_access_bindings_containerregistry_repositories.md) 15 | 16 | ## Columns 17 | 18 | | Name | Type | 19 | | ------------- | ------------- | 20 | |_cq_id|`uuid`| 21 | |_cq_parent_id|`uuid`| 22 | |cloud_id|`utf8`| 23 | |registry_id|`utf8`| 24 | |name|`utf8`| 25 | |id (PK)|`utf8`| -------------------------------------------------------------------------------- /docs/tables/yc_organizationmanager_federations.md: -------------------------------------------------------------------------------- 1 | # Table: yc_organizationmanager_federations 2 | 3 | This table shows data for YC Cloud Organization Federations. 4 | 5 | https://yandex.cloud/ru/docs/organization/saml/api-ref/grpc/Federation/list#yandex.cloud.organizationmanager.v1.saml.Federation 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Columns 10 | 11 | | Name | Type | 12 | | ------------- | ------------- | 13 | |_cq_id|`uuid`| 14 | |_cq_parent_id|`uuid`| 15 | |id (PK)|`utf8`| 16 | |organization_id|`utf8`| 17 | |name|`utf8`| 18 | |description|`utf8`| 19 | |created_at|`timestamp[us, tz=UTC]`| 20 | |cookie_max_age|`json`| 21 | |auto_create_account_on_login|`bool`| 22 | |issuer|`utf8`| 23 | |sso_binding|`utf8`| 24 | |sso_url|`utf8`| 25 | |security_settings|`json`| 26 | |case_insensitive_name_ids|`bool`| 27 | |labels|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_mdb_postgresql_users.md: -------------------------------------------------------------------------------- 1 | # Table: yc_mdb_postgresql_users 2 | 3 | This table shows data for YC Managed Service for Postgresql Users. 4 | 5 | https://cloud.yandex.ru/docs/managed-postgresql/api-ref/grpc/user_service#User1 6 | 7 | The composite primary key for this table is (**name**, **cluster_id**). 8 | 9 | ## Relations 10 | 11 | This table depends on [yc_mdb_postgresql_clusters](yc_mdb_postgresql_clusters.md). 12 | 13 | ## Columns 14 | 15 | | Name | Type | 16 | | ------------- | ------------- | 17 | |_cq_id|`uuid`| 18 | |_cq_parent_id|`uuid`| 19 | |name (PK)|`utf8`| 20 | |cluster_id (PK)|`utf8`| 21 | |permissions|`json`| 22 | |conn_limit|`int64`| 23 | |settings|`json`| 24 | |login|`json`| 25 | |grants|`list`| 26 | |deletion_protection|`json`| 27 | |user_password_encryption|`utf8`| 28 | |connection_manager|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_datasphere_communities.md: -------------------------------------------------------------------------------- 1 | # Table: yc_datasphere_communities 2 | 3 | This table shows data for YC DataSphere Communities. 4 | 5 | https://cloud.yandex.ru/docs/datasphere/api-ref/grpc/community_service#Community3 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Relations 10 | 11 | The following tables depend on yc_datasphere_communities: 12 | - [yc_access_bindings_datasphere_communities](yc_access_bindings_datasphere_communities.md) 13 | - [yc_datasphere_projects](yc_datasphere_projects.md) 14 | 15 | ## Columns 16 | 17 | | Name | Type | 18 | | ------------- | ------------- | 19 | |_cq_id|`uuid`| 20 | |_cq_parent_id|`uuid`| 21 | |id (PK)|`utf8`| 22 | |created_at|`timestamp[us, tz=UTC]`| 23 | |name|`utf8`| 24 | |description|`utf8`| 25 | |labels|`json`| 26 | |created_by_id|`utf8`| 27 | |organization_id|`utf8`| 28 | |zone_id|`utf8`| -------------------------------------------------------------------------------- /docs/tables/yc_kms_symmetric_keys.md: -------------------------------------------------------------------------------- 1 | # Table: yc_kms_symmetric_keys 2 | 3 | This table shows data for YC Key Management Service Symmetric Keys. 4 | 5 | The primary key for this table is **id**. 6 | 7 | ## Relations 8 | 9 | The following tables depend on yc_kms_symmetric_keys: 10 | - [yc_access_bindings_kms_symmetric_keys](yc_access_bindings_kms_symmetric_keys.md) 11 | 12 | ## Columns 13 | 14 | | Name | Type | 15 | | ------------- | ------------- | 16 | |_cq_id|`uuid`| 17 | |_cq_parent_id|`uuid`| 18 | |cloud_id|`utf8`| 19 | |id (PK)|`utf8`| 20 | |folder_id|`utf8`| 21 | |created_at|`timestamp[us, tz=UTC]`| 22 | |name|`utf8`| 23 | |description|`utf8`| 24 | |labels|`json`| 25 | |status|`utf8`| 26 | |primary_version|`json`| 27 | |default_algorithm|`utf8`| 28 | |rotated_at|`timestamp[us, tz=UTC]`| 29 | |rotation_period|`json`| 30 | |deletion_protection|`bool`| -------------------------------------------------------------------------------- /docs/tables/yc_nlb_balancers.md: -------------------------------------------------------------------------------- 1 | # Table: yc_nlb_balancers 2 | 3 | This table shows data for YC Network Load Balancer Balancers. 4 | 5 | https://cloud.yandex.ru/docs/network-load-balancer/api-ref/grpc/network_load_balancer_service#NetworkLoadBalancer1 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Columns 10 | 11 | | Name | Type | 12 | | ------------- | ------------- | 13 | |_cq_id|`uuid`| 14 | |_cq_parent_id|`uuid`| 15 | |cloud_id|`utf8`| 16 | |id (PK)|`utf8`| 17 | |folder_id|`utf8`| 18 | |created_at|`timestamp[us, tz=UTC]`| 19 | |name|`utf8`| 20 | |description|`utf8`| 21 | |labels|`json`| 22 | |region_id|`utf8`| 23 | |status|`utf8`| 24 | |type|`utf8`| 25 | |session_affinity|`utf8`| 26 | |listeners|`json`| 27 | |attached_target_groups|`json`| 28 | |deletion_protection|`bool`| 29 | |allow_zonal_shift|`bool`| 30 | |disable_zone_statuses|`json`| -------------------------------------------------------------------------------- /docs/_authentication.md: -------------------------------------------------------------------------------- 1 | Authentication is done via IAM tokens/keys. You can read more about it [here](https://cloud.yandex.com/en/docs/iam/concepts/authorization/iam-token) 2 | 3 | It is recommended to grant read-only permissions/roles: 4 | 5 | - `auditor` role – primitive role which gives access to all configurations, but not the data. 6 | - `*.viewer` roles – per-sevice roles to read resource. Sometimes it is necessary to grant this role, if the service doesn't support `auditor` role. 7 | 8 | You can read more about roles [here](https://cloud.yandex.com/en/docs/iam/concepts/access-control/roles) 9 | 10 | The plugin will get the following environment variables: 11 | 12 | - `YC_SERVICE_ACCOUNT_KEY` – Service Account key (in json format) 13 | - `YC_TOKEN` – IAM or OAuth token 14 | 15 | If none of the variables are set, plugin will try to use Compute Metadata API to get IAM token. -------------------------------------------------------------------------------- /docs/tables/yc_lockbox_secrets.md: -------------------------------------------------------------------------------- 1 | # Table: yc_lockbox_secrets 2 | 3 | This table shows data for YC Lockbox Secrets. 4 | 5 | https://cloud.yandex.ru/docs/lockbox/api-ref/grpc/secret_service#Secret1 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Relations 10 | 11 | The following tables depend on yc_lockbox_secrets: 12 | - [yc_access_bindings_lockbox_secrets](yc_access_bindings_lockbox_secrets.md) 13 | 14 | ## Columns 15 | 16 | | Name | Type | 17 | | ------------- | ------------- | 18 | |_cq_id|`uuid`| 19 | |_cq_parent_id|`uuid`| 20 | |cloud_id|`utf8`| 21 | |id (PK)|`utf8`| 22 | |folder_id|`utf8`| 23 | |created_at|`timestamp[us, tz=UTC]`| 24 | |name|`utf8`| 25 | |description|`utf8`| 26 | |labels|`json`| 27 | |kms_key_id|`utf8`| 28 | |status|`utf8`| 29 | |current_version|`json`| 30 | |deletion_protection|`bool`| 31 | |payload_specification|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_serverless_containers_containers.md: -------------------------------------------------------------------------------- 1 | # Table: yc_serverless_containers_containers 2 | 3 | This table shows data for YC Serverless Containers Containers. 4 | 5 | https://cloud.yandex.ru/docs/serverless-containers/containers/api-ref/grpc/container_service#Container1 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Relations 10 | 11 | The following tables depend on yc_serverless_containers_containers: 12 | - [yc_access_bindings_serverless_containers](yc_access_bindings_serverless_containers.md) 13 | 14 | ## Columns 15 | 16 | | Name | Type | 17 | | ------------- | ------------- | 18 | |_cq_id|`uuid`| 19 | |_cq_parent_id|`uuid`| 20 | |cloud_id|`utf8`| 21 | |id (PK)|`utf8`| 22 | |folder_id|`utf8`| 23 | |created_at|`timestamp[us, tz=UTC]`| 24 | |name|`utf8`| 25 | |description|`utf8`| 26 | |labels|`json`| 27 | |url|`utf8`| 28 | |status|`utf8`| -------------------------------------------------------------------------------- /docs/tables/yc_kms_asymmetric_keys.md: -------------------------------------------------------------------------------- 1 | # Table: yc_kms_asymmetric_keys 2 | 3 | This table shows data for YC Key Management Service Asymmetric Keys. 4 | 5 | https://yandex.cloud/ru/docs/kms/api-ref/grpc/asymmetric_encryption_key_service#AsymmetricEncryptionKey2 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Relations 10 | 11 | The following tables depend on yc_kms_asymmetric_keys: 12 | - [yc_access_bindings_kms_asymmetric_keys](yc_access_bindings_kms_asymmetric_keys.md) 13 | 14 | ## Columns 15 | 16 | | Name | Type | 17 | | ------------- | ------------- | 18 | |_cq_id|`uuid`| 19 | |_cq_parent_id|`uuid`| 20 | |cloud_id|`utf8`| 21 | |id (PK)|`utf8`| 22 | |folder_id|`utf8`| 23 | |created_at|`timestamp[us, tz=UTC]`| 24 | |name|`utf8`| 25 | |description|`utf8`| 26 | |labels|`json`| 27 | |status|`utf8`| 28 | |encryption_algorithm|`utf8`| 29 | |deletion_protection|`bool`| -------------------------------------------------------------------------------- /docs/tables/yc_mdb_postgresql_hosts.md: -------------------------------------------------------------------------------- 1 | # Table: yc_mdb_postgresql_hosts 2 | 3 | This table shows data for YC Managed Service for Postgresql Hosts. 4 | 5 | https://cloud.yandex.ru/docs/managed-postgresql/api-ref/grpc/cluster_service#Host 6 | 7 | The composite primary key for this table is (**name**, **cluster_id**). 8 | 9 | ## Relations 10 | 11 | This table depends on [yc_mdb_postgresql_clusters](yc_mdb_postgresql_clusters.md). 12 | 13 | ## Columns 14 | 15 | | Name | Type | 16 | | ------------- | ------------- | 17 | |_cq_id|`uuid`| 18 | |_cq_parent_id|`uuid`| 19 | |name (PK)|`utf8`| 20 | |cluster_id (PK)|`utf8`| 21 | |zone_id|`utf8`| 22 | |resources|`json`| 23 | |role|`utf8`| 24 | |health|`utf8`| 25 | |services|`json`| 26 | |subnet_id|`utf8`| 27 | |replication_source|`utf8`| 28 | |priority|`json`| 29 | |config|`json`| 30 | |assign_public_ip|`bool`| 31 | |replica_type|`utf8`| -------------------------------------------------------------------------------- /docs/tables/yc_alb_balancers.md: -------------------------------------------------------------------------------- 1 | # Table: yc_alb_balancers 2 | 3 | This table shows data for YC Application Load Balancer Balancers. 4 | 5 | https://cloud.yandex.ru/docs/application-load-balancer/api-ref/grpc/load_balancer_service#LoadBalancer1 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Columns 10 | 11 | | Name | Type | 12 | | ------------- | ------------- | 13 | |_cq_id|`uuid`| 14 | |_cq_parent_id|`uuid`| 15 | |cloud_id|`utf8`| 16 | |id (PK)|`utf8`| 17 | |name|`utf8`| 18 | |description|`utf8`| 19 | |folder_id|`utf8`| 20 | |labels|`json`| 21 | |status|`utf8`| 22 | |region_id|`utf8`| 23 | |network_id|`utf8`| 24 | |listeners|`json`| 25 | |allocation_policy|`json`| 26 | |log_group_id|`utf8`| 27 | |security_group_ids|`list`| 28 | |created_at|`timestamp[us, tz=UTC]`| 29 | |auto_scale_policy|`json`| 30 | |log_options|`json`| 31 | |allow_zonal_shift|`bool`| -------------------------------------------------------------------------------- /docs/tables/yc_containerregistry_registries.md: -------------------------------------------------------------------------------- 1 | # Table: yc_containerregistry_registries 2 | 3 | This table shows data for YC Container Registry Registries. 4 | 5 | https://cloud.yandex.ru/docs/container-registry/api-ref/grpc/registry_service#Registry1 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Relations 10 | 11 | The following tables depend on yc_containerregistry_registries: 12 | - [yc_access_bindings_containerregistry_registries](yc_access_bindings_containerregistry_registries.md) 13 | - [yc_containerregistry_repositories](yc_containerregistry_repositories.md) 14 | 15 | ## Columns 16 | 17 | | Name | Type | 18 | | ------------- | ------------- | 19 | |_cq_id|`uuid`| 20 | |_cq_parent_id|`uuid`| 21 | |cloud_id|`utf8`| 22 | |id (PK)|`utf8`| 23 | |folder_id|`utf8`| 24 | |name|`utf8`| 25 | |status|`utf8`| 26 | |created_at|`timestamp[us, tz=UTC]`| 27 | |labels|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_datasphere_projects.md: -------------------------------------------------------------------------------- 1 | # Table: yc_datasphere_projects 2 | 3 | This table shows data for YC DataSphere Projects. 4 | 5 | https://cloud.yandex.ru/docs/datasphere/api-ref/grpc/project_service#Project3 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Relations 10 | 11 | This table depends on [yc_datasphere_communities](yc_datasphere_communities.md). 12 | 13 | The following tables depend on yc_datasphere_projects: 14 | - [yc_access_bindings_datasphere_projects](yc_access_bindings_datasphere_projects.md) 15 | 16 | ## Columns 17 | 18 | | Name | Type | 19 | | ------------- | ------------- | 20 | |_cq_id|`uuid`| 21 | |_cq_parent_id|`uuid`| 22 | |id (PK)|`utf8`| 23 | |created_at|`timestamp[us, tz=UTC]`| 24 | |name|`utf8`| 25 | |description|`utf8`| 26 | |labels|`json`| 27 | |created_by_id|`utf8`| 28 | |settings|`json`| 29 | |limits|`json`| 30 | |community_id|`utf8`| -------------------------------------------------------------------------------- /docs/tables/yc_mdb_opensearch_auth_settings.md: -------------------------------------------------------------------------------- 1 | # Table: yc_mdb_opensearch_auth_settings 2 | 3 | This table shows data for YC Managed Service for Opensearch Auth Settings. 4 | 5 | https://cloud.yandex.ru/docs/managed-opensearch/api-ref/grpc/cluster_service#AuthSettings 6 | 7 | The primary key for this table is **cluster_id**. 8 | 9 | ## Relations 10 | 11 | This table depends on [yc_mdb_opensearch_clusters](yc_mdb_opensearch_clusters.md). 12 | 13 | ## Columns 14 | 15 | | Name | Type | 16 | | ------------- | ------------- | 17 | |_cq_id|`uuid`| 18 | |_cq_parent_id|`uuid`| 19 | |cloud_id|`utf8`| 20 | |cluster_id (PK)|`utf8`| 21 | |saml_enabled|`bool`| 22 | |saml_idp_entity_id|`utf8`| 23 | |saml_idp_metadata_file|`binary`| 24 | |saml_sp_entity_id|`utf8`| 25 | |saml_dashboards_url|`utf8`| 26 | |saml_roles_key|`utf8`| 27 | |saml_subject_key|`utf8`| 28 | |saml_jwt_default_expiration_timeout|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_iam_service_accounts.md: -------------------------------------------------------------------------------- 1 | # Table: yc_iam_service_accounts 2 | 3 | This table shows data for YC IAM Service Accounts. 4 | 5 | https://cloud.yandex.ru/docs/iam/api-ref/grpc/service_account_service#ServiceAccount1 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Relations 10 | 11 | The following tables depend on yc_iam_service_accounts: 12 | - [yc_access_iam_service_accounts](yc_access_iam_service_accounts.md) 13 | - [yc_iam_access_keys](yc_iam_access_keys.md) 14 | - [yc_iam_api_keys](yc_iam_api_keys.md) 15 | - [yc_iam_keys](yc_iam_keys.md) 16 | 17 | ## Columns 18 | 19 | | Name | Type | 20 | | ------------- | ------------- | 21 | |_cq_id|`uuid`| 22 | |_cq_parent_id|`uuid`| 23 | |cloud_id|`utf8`| 24 | |id (PK)|`utf8`| 25 | |folder_id|`utf8`| 26 | |created_at|`timestamp[us, tz=UTC]`| 27 | |name|`utf8`| 28 | |description|`utf8`| 29 | |labels|`json`| 30 | |last_authenticated_at|`timestamp[us, tz=UTC]`| -------------------------------------------------------------------------------- /docs/tables/yc_kubernetes_clusters.md: -------------------------------------------------------------------------------- 1 | # Table: yc_kubernetes_clusters 2 | 3 | This table shows data for YC Kubernetes Clusters. 4 | 5 | https://cloud.yandex.ru/docs/managed-kubernetes/api-ref/grpc/cluster_service#Cluster1 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Columns 10 | 11 | | Name | Type | 12 | | ------------- | ------------- | 13 | |_cq_id|`uuid`| 14 | |_cq_parent_id|`uuid`| 15 | |cloud_id|`utf8`| 16 | |id (PK)|`utf8`| 17 | |folder_id|`utf8`| 18 | |created_at|`timestamp[us, tz=UTC]`| 19 | |name|`utf8`| 20 | |description|`utf8`| 21 | |labels|`json`| 22 | |status|`utf8`| 23 | |health|`utf8`| 24 | |network_id|`utf8`| 25 | |master|`json`| 26 | |ip_allocation_policy|`json`| 27 | |internet_gateway|`json`| 28 | |service_account_id|`utf8`| 29 | |node_service_account_id|`utf8`| 30 | |release_channel|`utf8`| 31 | |network_policy|`json`| 32 | |kms_provider|`json`| 33 | |log_group_id|`utf8`| 34 | |network_implementation|`json`| 35 | |scheduled_maintenance|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_organizationmanager_users.md: -------------------------------------------------------------------------------- 1 | # Table: yc_organizationmanager_users 2 | 3 | This table shows data for YC Cloud Organization Users. 4 | 5 | https://cloud.yandex.ru/docs/organization/api-ref/grpc/user_service#OrganizationUser 6 | 7 | The primary key for this table is **subject_claims_sub**. 8 | 9 | ## Columns 10 | 11 | | Name | Type | 12 | | ------------- | ------------- | 13 | |_cq_id|`uuid`| 14 | |_cq_parent_id|`uuid`| 15 | |organization_id|`utf8`| 16 | |subject_claims_sub (PK)|`utf8`| 17 | |subject_claims_name|`utf8`| 18 | |subject_claims_given_name|`utf8`| 19 | |subject_claims_family_name|`utf8`| 20 | |subject_claims_preferred_username|`utf8`| 21 | |subject_claims_picture|`utf8`| 22 | |subject_claims_email|`utf8`| 23 | |subject_claims_zoneinfo|`utf8`| 24 | |subject_claims_locale|`utf8`| 25 | |subject_claims_phone_number|`utf8`| 26 | |subject_claims_sub_type|`utf8`| 27 | |subject_claims_federation|`json`| 28 | |subject_claims_last_authenticated_at|`timestamp[us, tz=UTC]`| -------------------------------------------------------------------------------- /docs/tables/yc_kubernetes_node_groups.md: -------------------------------------------------------------------------------- 1 | # Table: yc_kubernetes_node_groups 2 | 3 | This table shows data for YC Kubernetes Node Groups. 4 | 5 | The primary key for this table is **id**. 6 | 7 | ## Relations 8 | 9 | The following tables depend on yc_kubernetes_node_groups: 10 | - [yc_kubernetes_nodes](yc_kubernetes_nodes.md) 11 | 12 | ## Columns 13 | 14 | | Name | Type | 15 | | ------------- | ------------- | 16 | |_cq_id|`uuid`| 17 | |_cq_parent_id|`uuid`| 18 | |cloud_id|`utf8`| 19 | |id (PK)|`utf8`| 20 | |cluster_id|`utf8`| 21 | |created_at|`timestamp[us, tz=UTC]`| 22 | |name|`utf8`| 23 | |description|`utf8`| 24 | |labels|`json`| 25 | |status|`utf8`| 26 | |node_template|`json`| 27 | |scale_policy|`json`| 28 | |allocation_policy|`json`| 29 | |deploy_policy|`json`| 30 | |instance_group_id|`utf8`| 31 | |node_version|`utf8`| 32 | |version_info|`json`| 33 | |maintenance_policy|`json`| 34 | |allowed_unsafe_sysctls|`list`| 35 | |node_taints|`json`| 36 | |node_labels|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_compute_disks.md: -------------------------------------------------------------------------------- 1 | # Table: yc_compute_disks 2 | 3 | This table shows data for YC Compute Disks. 4 | 5 | https://cloud.yandex.ru/docs/compute/api-ref/grpc/disk_service#Disk1 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Relations 10 | 11 | The following tables depend on yc_compute_disks: 12 | - [yc_compute_disks_images](yc_compute_disks_images.md) 13 | 14 | ## Columns 15 | 16 | | Name | Type | 17 | | ------------- | ------------- | 18 | |_cq_id|`uuid`| 19 | |_cq_parent_id|`uuid`| 20 | |cloud_id|`utf8`| 21 | |id (PK)|`utf8`| 22 | |folder_id|`utf8`| 23 | |created_at|`timestamp[us, tz=UTC]`| 24 | |name|`utf8`| 25 | |description|`utf8`| 26 | |labels|`json`| 27 | |type_id|`utf8`| 28 | |zone_id|`utf8`| 29 | |size|`int64`| 30 | |block_size|`int64`| 31 | |product_ids|`list`| 32 | |status|`utf8`| 33 | |source|`json`| 34 | |instance_ids|`list`| 35 | |disk_placement_policy|`json`| 36 | |hardware_generation|`json`| 37 | |kms_key|`json`| -------------------------------------------------------------------------------- /client/sdk.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | "os" 7 | "strings" 8 | 9 | ycsdk "github.com/yandex-cloud/go-sdk" 10 | "github.com/yandex-cloud/go-sdk/iamkey" 11 | ) 12 | 13 | func iamKeyFromJSONContent(content string) (*iamkey.Key, error) { 14 | key := &iamkey.Key{} 15 | err := json.Unmarshal([]byte(content), key) 16 | if err != nil { 17 | return nil, fmt.Errorf("key unmarshal: %s", err) 18 | } 19 | return key, nil 20 | } 21 | 22 | func getCredentials() (ycsdk.Credentials, error) { 23 | if val := os.Getenv("YC_SERVICE_ACCOUNT_KEY"); val != "" { 24 | key, err := iamKeyFromJSONContent(val) 25 | if err != nil { 26 | return nil, err 27 | } 28 | return ycsdk.ServiceAccountKey(key) 29 | } 30 | 31 | if val := os.Getenv("YC_TOKEN"); val != "" { 32 | if strings.HasPrefix(val, "t1.") && strings.Count(val, ".") == 2 { 33 | return ycsdk.NewIAMTokenCredentials(val), nil 34 | } 35 | return ycsdk.OAuthToken(val), nil 36 | } 37 | 38 | return ycsdk.InstanceServiceAccount(), nil 39 | } 40 | -------------------------------------------------------------------------------- /resources/mdb/mysql_hosts.go: -------------------------------------------------------------------------------- 1 | package mdb 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/mdb/mysql/v1" 10 | ) 11 | 12 | func MySQLHosts() *schema.Table { 13 | return &schema.Table{ 14 | Name: "yc_mdb_mysql_hosts", 15 | Description: ``, 16 | Resolver: fetchMySQLHosts, 17 | Transform: structNameClusterIdTransformer(&mysql.Host{}), 18 | } 19 | } 20 | 21 | func fetchMySQLHosts(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 22 | c := meta.(*client.Client) 23 | cluster, ok := parent.Item.(*mysql.Cluster) 24 | if !ok { 25 | return fmt.Errorf("parent is not type of *mysql.Cluster: %+v", cluster) 26 | } 27 | 28 | it := c.SDK.MDB().MySQL().Cluster().ClusterHostsIterator(ctx, &mysql.ListClusterHostsRequest{ClusterId: cluster.Id}) 29 | for it.Next() { 30 | res <- it.Value() 31 | } 32 | 33 | return it.Error() 34 | } 35 | -------------------------------------------------------------------------------- /resources/vpc/subnets.go: -------------------------------------------------------------------------------- 1 | package vpc 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/vpc/v1" 9 | ) 10 | 11 | func Subnets() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_vpc_subnets", 14 | Description: `https://cloud.yandex.ru/docs/vpc/api-ref/grpc/subnet_service#Subnet1`, 15 | Multiplex: client.FolderMultiplex, 16 | Resolver: fetchSubnets, 17 | Transform: client.TransformWithStruct(&vpc.Subnet{}, client.PrimaryKeyIdTransformer), 18 | Columns: schema.ColumnList{ 19 | client.CloudIdColumn, 20 | }, 21 | } 22 | } 23 | 24 | func fetchSubnets(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 25 | c := meta.(*client.Client) 26 | 27 | it := c.SDK.VPC().Subnet().SubnetIterator(ctx, &vpc.ListSubnetsRequest{FolderId: c.FolderId}) 28 | for it.Next() { 29 | res <- it.Value() 30 | } 31 | 32 | return it.Error() 33 | } 34 | -------------------------------------------------------------------------------- /docs/tables/yc_compute_disks_images.md: -------------------------------------------------------------------------------- 1 | # Table: yc_compute_disks_images 2 | 3 | This table shows data for YC Compute Disks Images. 4 | 5 | This table is exact copy of [yc_compute_images](yc_compute_images.md), but contains images used in [yc_compute_disks](yc_compute_disks.md) 6 | https://cloud.yandex.ru/docs/compute/api-ref/grpc/image_service#Image2 7 | 8 | The primary key for this table is **id**. 9 | 10 | ## Relations 11 | 12 | This table depends on [yc_compute_disks](yc_compute_disks.md). 13 | 14 | ## Columns 15 | 16 | | Name | Type | 17 | | ------------- | ------------- | 18 | |_cq_id|`uuid`| 19 | |_cq_parent_id|`uuid`| 20 | |cloud_id|`utf8`| 21 | |id (PK)|`utf8`| 22 | |folder_id|`utf8`| 23 | |created_at|`timestamp[us, tz=UTC]`| 24 | |name|`utf8`| 25 | |description|`utf8`| 26 | |labels|`json`| 27 | |family|`utf8`| 28 | |storage_size|`int64`| 29 | |min_disk_size|`int64`| 30 | |product_ids|`list`| 31 | |status|`utf8`| 32 | |os|`json`| 33 | |pooled|`bool`| 34 | |hardware_generation|`json`| 35 | |kms_key|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_serverless_apigateway_gateways.md: -------------------------------------------------------------------------------- 1 | # Table: yc_serverless_apigateway_gateways 2 | 3 | This table shows data for YC Serverless API Gateway Gateways. 4 | 5 | https://cloud.yandex.ru/docs/api-gateway/apigateway/api-ref/grpc/apigateway_service#ApiGateway1 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Relations 10 | 11 | The following tables depend on yc_serverless_apigateway_gateways: 12 | - [yc_serverless_apigateway_openapi_specs](yc_serverless_apigateway_openapi_specs.md) 13 | 14 | ## Columns 15 | 16 | | Name | Type | 17 | | ------------- | ------------- | 18 | |_cq_id|`uuid`| 19 | |_cq_parent_id|`uuid`| 20 | |cloud_id|`utf8`| 21 | |id (PK)|`utf8`| 22 | |folder_id|`utf8`| 23 | |created_at|`timestamp[us, tz=UTC]`| 24 | |name|`utf8`| 25 | |description|`utf8`| 26 | |labels|`json`| 27 | |status|`utf8`| 28 | |domain|`utf8`| 29 | |log_group_id|`utf8`| 30 | |attached_domains|`json`| 31 | |connectivity|`json`| 32 | |log_options|`json`| 33 | |variables|`json`| 34 | |canary|`json`| 35 | |execution_timeout|`json`| -------------------------------------------------------------------------------- /resources/resourcemanager/clouds.go: -------------------------------------------------------------------------------- 1 | package resourcemanager 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/resourcemanager/v1" 9 | ) 10 | 11 | func Clouds() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_resourcemanager_clouds", 14 | Description: `https://cloud.yandex.ru/docs/resource-manager/api-ref/grpc/cloud_service#Cloud1`, 15 | Multiplex: client.CloudMultiplex, 16 | Resolver: fetchClouds, 17 | Transform: client.TransformWithStruct(&resourcemanager.Cloud{}, client.PrimaryKeyIdTransformer), 18 | } 19 | } 20 | 21 | func fetchClouds(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 22 | c := meta.(*client.Client) 23 | 24 | cloud, err := c.SDK.ResourceManager().Cloud().Get(ctx, &resourcemanager.GetCloudRequest{CloudId: c.CloudId}) 25 | if err != nil { 26 | return err 27 | } 28 | res <- cloud 29 | 30 | return nil 31 | } 32 | -------------------------------------------------------------------------------- /resources/vpc/gateways.go: -------------------------------------------------------------------------------- 1 | package vpc 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/vpc/v1" 9 | ) 10 | 11 | func Gateways() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_vpc_gateways", 14 | Description: `https://cloud.yandex.ru/docs/vpc/api-ref/grpc/gateway_service#Gateway1`, 15 | Multiplex: client.FolderMultiplex, 16 | Resolver: fetchGateways, 17 | Transform: client.TransformWithStruct(&vpc.Gateway{}, client.PrimaryKeyIdTransformer), 18 | Columns: schema.ColumnList{ 19 | client.CloudIdColumn, 20 | }, 21 | } 22 | } 23 | 24 | func fetchGateways(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 25 | c := meta.(*client.Client) 26 | 27 | it := c.SDK.VPC().Gateway().GatewayIterator(ctx, &vpc.ListGatewaysRequest{FolderId: c.FolderId}) 28 | for it.Next() { 29 | res <- it.Value() 30 | } 31 | 32 | return it.Error() 33 | } 34 | -------------------------------------------------------------------------------- /resources/vpc/networks.go: -------------------------------------------------------------------------------- 1 | package vpc 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/vpc/v1" 9 | ) 10 | 11 | func Networks() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_vpc_networks", 14 | Description: `https://cloud.yandex.ru/docs/vpc/api-ref/grpc/network_service#Network1`, 15 | Multiplex: client.FolderMultiplex, 16 | Resolver: fetchNetworks, 17 | Transform: client.TransformWithStruct(&vpc.Network{}, client.PrimaryKeyIdTransformer), 18 | Columns: schema.ColumnList{ 19 | client.CloudIdColumn, 20 | }, 21 | } 22 | } 23 | 24 | func fetchNetworks(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 25 | c := meta.(*client.Client) 26 | 27 | it := c.SDK.VPC().Network().NetworkIterator(ctx, &vpc.ListNetworksRequest{FolderId: c.FolderId}) 28 | for it.Next() { 29 | res <- it.Value() 30 | } 31 | 32 | return it.Error() 33 | } 34 | -------------------------------------------------------------------------------- /resources/vpc/addresses.go: -------------------------------------------------------------------------------- 1 | package vpc 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/vpc/v1" 9 | ) 10 | 11 | func Addresses() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_vpc_addresses", 14 | Description: `https://cloud.yandex.ru/docs/vpc/api-ref/grpc/address_service#Address2`, 15 | Multiplex: client.FolderMultiplex, 16 | Resolver: fetchAddresses, 17 | Transform: client.TransformWithStruct(&vpc.Address{}, client.PrimaryKeyIdTransformer), 18 | Columns: schema.ColumnList{ 19 | client.CloudIdColumn, 20 | }, 21 | } 22 | } 23 | 24 | func fetchAddresses(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 25 | c := meta.(*client.Client) 26 | 27 | it := c.SDK.VPC().Address().AddressIterator(ctx, &vpc.ListAddressesRequest{FolderId: c.FolderId}) 28 | for it.Next() { 29 | res <- it.Value() 30 | } 31 | 32 | return it.Error() 33 | } 34 | -------------------------------------------------------------------------------- /resources/resourcemanager/folders.go: -------------------------------------------------------------------------------- 1 | package resourcemanager 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/resourcemanager/v1" 9 | ) 10 | 11 | func Folders() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_resourcemanager_folders", 14 | Description: `https://cloud.yandex.ru/docs/resource-manager/api-ref/grpc/folder_service#Folder1`, 15 | Resolver: fetchFolders, 16 | Multiplex: client.FolderMultiplex, 17 | Transform: client.TransformWithStruct(&resourcemanager.Folder{}, client.PrimaryKeyIdTransformer), 18 | } 19 | } 20 | 21 | func fetchFolders(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 22 | c := meta.(*client.Client) 23 | 24 | folder, err := c.SDK.ResourceManager().Folder().Get(ctx, &resourcemanager.GetFolderRequest{FolderId: c.FolderId}) 25 | if err != nil { 26 | return err 27 | } 28 | res <- folder 29 | 30 | return nil 31 | } 32 | -------------------------------------------------------------------------------- /resources/compute/images.go: -------------------------------------------------------------------------------- 1 | package compute 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/compute/v1" 9 | ) 10 | 11 | func Images() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_compute_images", 14 | Description: `https://cloud.yandex.ru/docs/compute/api-ref/grpc/image_service#Image2`, 15 | Multiplex: client.FolderMultiplex, 16 | Resolver: fetchImages, 17 | Transform: client.TransformWithStruct(&compute.Image{}, client.PrimaryKeyIdTransformer), 18 | Columns: schema.ColumnList{ 19 | client.CloudIdColumn, 20 | }, 21 | } 22 | } 23 | 24 | func fetchImages(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 25 | c := meta.(*client.Client) 26 | 27 | it := c.SDK.Compute().Image().ImageIterator(ctx, &compute.ListImagesRequest{FolderId: c.FolderId}) 28 | for it.Next() { 29 | res <- it.Value() 30 | } 31 | 32 | return it.Error() 33 | } 34 | -------------------------------------------------------------------------------- /resources/kubernetes/node_groups.go: -------------------------------------------------------------------------------- 1 | package kubernetes 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/k8s/v1" 9 | ) 10 | 11 | func NodeGroups() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_kubernetes_node_groups", 14 | Description: ``, 15 | Multiplex: client.FolderMultiplex, 16 | Resolver: fetchNodeGroups, 17 | Transform: client.TransformWithStruct(&k8s.NodeGroup{}, client.PrimaryKeyIdTransformer), 18 | Columns: schema.ColumnList{ 19 | client.CloudIdColumn, 20 | }, 21 | Relations: schema.Tables{Nodes()}, 22 | } 23 | } 24 | 25 | func fetchNodeGroups(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 26 | c := meta.(*client.Client) 27 | 28 | it := c.SDK.Kubernetes().NodeGroup().NodeGroupIterator(ctx, &k8s.ListNodeGroupsRequest{FolderId: c.FolderId}) 29 | for it.Next() { 30 | res <- it.Value() 31 | } 32 | 33 | return it.Error() 34 | } 35 | -------------------------------------------------------------------------------- /resources/cdn/resources.go: -------------------------------------------------------------------------------- 1 | package cdn 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/cdn/v1" 9 | ) 10 | 11 | func Resources() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_cdn_resources", 14 | Description: `https://cloud.yandex.ru/docs/cdn/api-ref/grpc/resource_service#Resource1`, 15 | Multiplex: client.FolderMultiplex, 16 | Resolver: fetchResources, 17 | Transform: client.TransformWithStruct(&cdn.Resource{}, client.PrimaryKeyIdTransformer), 18 | Columns: schema.ColumnList{ 19 | client.CloudIdColumn, 20 | }, 21 | } 22 | } 23 | 24 | func fetchResources(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 25 | c := meta.(*client.Client) 26 | 27 | it := c.SDK.CDN().Resource().ResourceIterator(ctx, &cdn.ListResourcesRequest{FolderId: c.FolderId}) 28 | for it.Next() { 29 | value := it.Value() 30 | res <- value 31 | } 32 | 33 | return it.Error() 34 | } 35 | -------------------------------------------------------------------------------- /resources/dns/zones.go: -------------------------------------------------------------------------------- 1 | package dns 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/dns/v1" 9 | ) 10 | 11 | func Zones() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_dns_zones", 14 | Description: `https://cloud.yandex.ru/docs/dns/api-ref/grpc/dns_zone_service#DnsZone1`, 15 | Multiplex: client.FolderMultiplex, 16 | Resolver: fetchZones, 17 | Transform: client.TransformWithStruct(&dns.DnsZone{}, client.PrimaryKeyIdTransformer), 18 | Columns: schema.ColumnList{ 19 | client.CloudIdColumn, 20 | }, 21 | Relations: schema.Tables{RecordSets()}, 22 | } 23 | } 24 | 25 | func fetchZones(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 26 | c := meta.(*client.Client) 27 | 28 | it := c.SDK.DNS().DnsZone().DnsZoneIterator(ctx, &dns.ListDnsZonesRequest{FolderId: c.FolderId}) 29 | for it.Next() { 30 | res <- it.Value() 31 | } 32 | 33 | return it.Error() 34 | } 35 | -------------------------------------------------------------------------------- /resources/vpc/route_tables.go: -------------------------------------------------------------------------------- 1 | package vpc 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/vpc/v1" 9 | ) 10 | 11 | func RouteTables() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_vpc_route_tables", 14 | Description: `https://cloud.yandex.ru/docs/vpc/api-ref/grpc/route_table_service#RouteTable1`, 15 | Multiplex: client.FolderMultiplex, 16 | Resolver: fetchRouteTables, 17 | Transform: client.TransformWithStruct(&vpc.RouteTable{}, client.PrimaryKeyIdTransformer), 18 | Columns: schema.ColumnList{ 19 | client.CloudIdColumn, 20 | }, 21 | } 22 | } 23 | 24 | func fetchRouteTables(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 25 | c := meta.(*client.Client) 26 | 27 | it := c.SDK.VPC().RouteTable().RouteTableIterator(ctx, &vpc.ListRouteTablesRequest{FolderId: c.FolderId}) 28 | for it.Next() { 29 | res <- it.Value() 30 | } 31 | 32 | return it.Error() 33 | } 34 | -------------------------------------------------------------------------------- /resources/audittrails/trails.go: -------------------------------------------------------------------------------- 1 | package audittrails 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/audittrails/v1" 9 | ) 10 | 11 | func Trails() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_audittrails_trails", 14 | Description: `https://yandex.cloud/ru/docs/audit-trails/api-ref/grpc/trail_service#Trail1`, 15 | Multiplex: client.FolderMultiplex, 16 | Resolver: fetchTrails, 17 | Transform: client.TransformWithStruct(&audittrails.Trail{}, client.PrimaryKeyIdTransformer), 18 | Columns: schema.ColumnList{ 19 | client.CloudIdColumn, 20 | }, 21 | } 22 | } 23 | 24 | func fetchTrails(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 25 | c := meta.(*client.Client) 26 | 27 | it := c.SDK.AuditTrails().Trail().TrailIterator(ctx, &audittrails.ListTrailsRequest{FolderId: c.FolderId}) 28 | for it.Next() { 29 | res <- it.Value() 30 | } 31 | 32 | return it.Error() 33 | } 34 | -------------------------------------------------------------------------------- /resources/kubernetes/clusters.go: -------------------------------------------------------------------------------- 1 | package kubernetes 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/k8s/v1" 9 | ) 10 | 11 | func Clusters() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_kubernetes_clusters", 14 | Description: `https://cloud.yandex.ru/docs/managed-kubernetes/api-ref/grpc/cluster_service#Cluster1`, 15 | Multiplex: client.FolderMultiplex, 16 | Resolver: fetchClusters, 17 | Transform: client.TransformWithStruct(&k8s.Cluster{}, client.PrimaryKeyIdTransformer), 18 | Columns: schema.ColumnList{ 19 | client.CloudIdColumn, 20 | }, 21 | } 22 | } 23 | 24 | func fetchClusters(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 25 | c := meta.(*client.Client) 26 | 27 | it := c.SDK.Kubernetes().Cluster().ClusterIterator(ctx, &k8s.ListClustersRequest{FolderId: c.FolderId}) 28 | for it.Next() { 29 | res <- it.Value() 30 | } 31 | 32 | return it.Error() 33 | } 34 | -------------------------------------------------------------------------------- /resources/compute/disks.go: -------------------------------------------------------------------------------- 1 | package compute 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/compute/v1" 9 | ) 10 | 11 | func Disks() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_compute_disks", 14 | Description: `https://cloud.yandex.ru/docs/compute/api-ref/grpc/disk_service#Disk1`, 15 | Multiplex: client.FolderMultiplex, 16 | Resolver: fetchDisks, 17 | Transform: client.TransformWithStruct(&compute.Disk{}, client.PrimaryKeyIdTransformer), 18 | Columns: schema.ColumnList{ 19 | client.CloudIdColumn, 20 | }, 21 | Relations: schema.Tables{DisksImages()}, 22 | } 23 | } 24 | 25 | func fetchDisks(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 26 | c := meta.(*client.Client) 27 | 28 | it := c.SDK.Compute().Disk().DiskIterator(ctx, &compute.ListDisksRequest{FolderId: c.FolderId}) 29 | for it.Next() { 30 | res <- it.Value() 31 | } 32 | 33 | return it.Error() 34 | } 35 | -------------------------------------------------------------------------------- /resources/mdb/kafka_users.go: -------------------------------------------------------------------------------- 1 | package mdb 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/mdb/kafka/v1" 10 | ) 11 | 12 | func KafkaUsers() *schema.Table { 13 | return &schema.Table{ 14 | Name: "yc_mdb_kafka_users", 15 | Description: `https://cloud.yandex.ru/docs/managed-kafka/api-ref/grpc/user_service#User1`, 16 | Resolver: fetchKafkaUsers, 17 | Transform: structNameClusterIdTransformer(&kafka.User{}), 18 | } 19 | } 20 | 21 | func fetchKafkaUsers(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 22 | c := meta.(*client.Client) 23 | cluster, ok := parent.Item.(*kafka.Cluster) 24 | if !ok { 25 | return fmt.Errorf("parent is not type of *kafka.Cluster: %+v", cluster) 26 | } 27 | 28 | it := c.SDK.MDB().Kafka().User().UserIterator(ctx, &kafka.ListUsersRequest{ClusterId: cluster.Id}) 29 | for it.Next() { 30 | res <- it.Value() 31 | } 32 | 33 | return it.Error() 34 | } 35 | -------------------------------------------------------------------------------- /resources/mdb/mysql_users.go: -------------------------------------------------------------------------------- 1 | package mdb 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/mdb/mysql/v1" 10 | ) 11 | 12 | func MySQLUsers() *schema.Table { 13 | return &schema.Table{ 14 | Name: "yc_mdb_mysql_users", 15 | Description: `https://cloud.yandex.ru/docs/managed-mysql/api-ref/grpc/user_service#User1`, 16 | Resolver: fetchMySQLUsers, 17 | Transform: structNameClusterIdTransformer(&mysql.User{}), 18 | } 19 | } 20 | 21 | func fetchMySQLUsers(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 22 | c := meta.(*client.Client) 23 | cluster, ok := parent.Item.(*mysql.Cluster) 24 | if !ok { 25 | return fmt.Errorf("parent is not type of *mysql.Cluster: %+v", cluster) 26 | } 27 | 28 | it := c.SDK.MDB().MySQL().User().UserIterator(ctx, &mysql.ListUsersRequest{ClusterId: cluster.Id}) 29 | for it.Next() { 30 | res <- it.Value() 31 | } 32 | 33 | return it.Error() 34 | } 35 | -------------------------------------------------------------------------------- /resources/access/organizationmanager_organizations.go: -------------------------------------------------------------------------------- 1 | package access 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/access" 9 | ) 10 | 11 | func OrganizationsAccessBindings() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_access_bindings_organizationmanager_organizations", 14 | Resolver: fetchOrganizationsAccessBindings, 15 | Multiplex: client.OrganizationMultiplex, 16 | Transform: Transform, 17 | Columns: schema.ColumnList{ 18 | client.MultiplexedResourceIdColumn, 19 | }, 20 | } 21 | } 22 | 23 | func fetchOrganizationsAccessBindings(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 24 | c := meta.(*client.Client) 25 | orgId := c.OrganizationId 26 | 27 | it := c.SDK.OrganizationManager().Organization().OrganizationAccessBindingsIterator(ctx, &access.ListAccessBindingsRequest{ResourceId: orgId}) 28 | for it.Next() { 29 | res <- it.Value() 30 | } 31 | 32 | return it.Error() 33 | } 34 | -------------------------------------------------------------------------------- /resources/mdb/mongodb_users.go: -------------------------------------------------------------------------------- 1 | package mdb 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/mdb/mongodb/v1" 10 | ) 11 | 12 | func MongoDBUsers() *schema.Table { 13 | return &schema.Table{ 14 | Name: "yc_mdb_mongodb_users", 15 | Description: `https://cloud.yandex.ru/docs/managed-mongodb/api-ref/grpc/user_service#User1`, 16 | Resolver: fetchMongoDBUsers, 17 | Transform: structNameClusterIdTransformer(&mongodb.User{}), 18 | } 19 | } 20 | 21 | func fetchMongoDBUsers(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 22 | c := meta.(*client.Client) 23 | cluster, ok := parent.Item.(*mongodb.Cluster) 24 | if !ok { 25 | return fmt.Errorf("parent is not type of *mongodb.Cluster: %+v", cluster) 26 | } 27 | 28 | it := c.SDK.MDB().MongoDB().User().UserIterator(ctx, &mongodb.ListUsersRequest{ClusterId: cluster.Id}) 29 | for it.Next() { 30 | res <- it.Value() 31 | } 32 | 33 | return it.Error() 34 | } 35 | -------------------------------------------------------------------------------- /resources/mdb/redis_hosts.go: -------------------------------------------------------------------------------- 1 | package mdb 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/mdb/redis/v1" 10 | ) 11 | 12 | func RedisHosts() *schema.Table { 13 | return &schema.Table{ 14 | Name: "yc_mdb_redis_hosts", 15 | Description: `https://cloud.yandex.ru/docs/managed-redis/api-ref/grpc/cluster_service#Host`, 16 | Resolver: fetchRedisHosts, 17 | Transform: structNameClusterIdTransformer(&redis.Host{}), 18 | } 19 | } 20 | 21 | func fetchRedisHosts(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 22 | c := meta.(*client.Client) 23 | cluster, ok := parent.Item.(*redis.Cluster) 24 | if !ok { 25 | return fmt.Errorf("parent is not type of *redis.Cluster: %+v", cluster) 26 | } 27 | 28 | it := c.SDK.MDB().Redis().Cluster().ClusterHostsIterator(ctx, &redis.ListClusterHostsRequest{ClusterId: cluster.Id}) 29 | for it.Next() { 30 | res <- it.Value() 31 | } 32 | 33 | return it.Error() 34 | } 35 | -------------------------------------------------------------------------------- /resources/vpc/security_groups.go: -------------------------------------------------------------------------------- 1 | package vpc 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/vpc/v1" 9 | ) 10 | 11 | func SecurityGroups() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_vpc_security_groups", 14 | Description: `https://cloud.yandex.ru/docs/vpc/api-ref/grpc/security_group_service#SecurityGroup1`, 15 | Multiplex: client.FolderMultiplex, 16 | Resolver: fetchSecurityGroups, 17 | Transform: client.TransformWithStruct(&vpc.SecurityGroup{}, client.PrimaryKeyIdTransformer), 18 | Columns: schema.ColumnList{ 19 | client.CloudIdColumn, 20 | }, 21 | } 22 | } 23 | 24 | func fetchSecurityGroups(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 25 | c := meta.(*client.Client) 26 | 27 | it := c.SDK.VPC().SecurityGroup().SecurityGroupIterator(ctx, &vpc.ListSecurityGroupsRequest{FolderId: c.FolderId}) 28 | 29 | for it.Next() { 30 | res <- it.Value() 31 | } 32 | 33 | return it.Error() 34 | } 35 | -------------------------------------------------------------------------------- /resources/datatransfer/endpoints.go: -------------------------------------------------------------------------------- 1 | package datatransfer 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/datatransfer/v1" 9 | ) 10 | 11 | func Endpoints() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_datatransfer_endpoints", 14 | Description: `https://yandex.cloud/ru/docs/data-transfer/api-ref/grpc/endpoint_service#Endpoint1`, 15 | Multiplex: client.FolderMultiplex, 16 | Resolver: fetchEndpoints, 17 | Transform: client.TransformWithStruct(&datatransfer.Endpoint{}, client.PrimaryKeyIdTransformer), 18 | Columns: schema.ColumnList{ 19 | client.CloudIdColumn, 20 | }, 21 | } 22 | } 23 | 24 | func fetchEndpoints(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 25 | c := meta.(*client.Client) 26 | 27 | it := c.SDK.DataTransfer().Endpoint().EndpointIterator(ctx, &datatransfer.ListEndpointsRequest{FolderId: c.FolderId}) 28 | for it.Next() { 29 | res <- it.Value() 30 | } 31 | 32 | return it.Error() 33 | } 34 | -------------------------------------------------------------------------------- /resources/datatransfer/transfers.go: -------------------------------------------------------------------------------- 1 | package datatransfer 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/datatransfer/v1" 9 | ) 10 | 11 | func Transfers() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_datatransfer_transfers", 14 | Description: `https://yandex.cloud/ru/docs/data-transfer/api-ref/grpc/transfer_service#Transfer`, 15 | Multiplex: client.FolderMultiplex, 16 | Resolver: fetchTransfers, 17 | Transform: client.TransformWithStruct(&datatransfer.Transfer{}, client.PrimaryKeyIdTransformer), 18 | Columns: schema.ColumnList{ 19 | client.CloudIdColumn, 20 | }, 21 | } 22 | } 23 | 24 | func fetchTransfers(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 25 | c := meta.(*client.Client) 26 | 27 | it := c.SDK.DataTransfer().Transfer().TransferIterator(ctx, &datatransfer.ListTransfersRequest{FolderId: c.FolderId}) 28 | for it.Next() { 29 | res <- it.Value() 30 | } 31 | 32 | return it.Error() 33 | } 34 | -------------------------------------------------------------------------------- /resources/mdb/mongodb_hosts.go: -------------------------------------------------------------------------------- 1 | package mdb 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/mdb/mongodb/v1" 10 | ) 11 | 12 | func MongoDBHosts() *schema.Table { 13 | return &schema.Table{ 14 | Name: "yc_mdb_mongodb_hosts", 15 | Description: `https://cloud.yandex.ru/docs/managed-mongodb/api-ref/grpc/cluster_service#Host`, 16 | Resolver: fetchMongoDBHosts, 17 | Transform: structNameClusterIdTransformer(&mongodb.Host{}), 18 | } 19 | } 20 | 21 | func fetchMongoDBHosts(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 22 | c := meta.(*client.Client) 23 | cluster, ok := parent.Item.(*mongodb.Cluster) 24 | if !ok { 25 | return fmt.Errorf("parent is not type of *mongodb.Cluster: %+v", cluster) 26 | } 27 | 28 | it := c.SDK.MDB().MongoDB().Cluster().ClusterHostsIterator(ctx, &mongodb.ListClusterHostsRequest{ClusterId: cluster.Id}) 29 | for it.Next() { 30 | res <- it.Value() 31 | } 32 | 33 | return it.Error() 34 | } 35 | -------------------------------------------------------------------------------- /resources/mdb/mysql_databases.go: -------------------------------------------------------------------------------- 1 | package mdb 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/mdb/mysql/v1" 10 | ) 11 | 12 | func MySQLDatabases() *schema.Table { 13 | return &schema.Table{ 14 | Name: "yc_mdb_mysql_databases", 15 | Description: `https://cloud.yandex.ru/docs/managed-mysql/api-ref/grpc/database_service#Database1`, 16 | Resolver: fetchMySQLDatabases, 17 | Transform: structNameClusterIdTransformer(&mysql.Database{}), 18 | } 19 | } 20 | 21 | func fetchMySQLDatabases(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 22 | c := meta.(*client.Client) 23 | cluster, ok := parent.Item.(*mysql.Cluster) 24 | if !ok { 25 | return fmt.Errorf("parent is not type of *mysql.Cluster: %+v", cluster) 26 | } 27 | 28 | it := c.SDK.MDB().MySQL().Database().DatabaseIterator(ctx, &mysql.ListDatabasesRequest{ClusterId: cluster.Id}) 29 | for it.Next() { 30 | res <- it.Value() 31 | } 32 | 33 | return it.Error() 34 | } 35 | -------------------------------------------------------------------------------- /docs/tables/yc_mdb_kafka_clusters.md: -------------------------------------------------------------------------------- 1 | # Table: yc_mdb_kafka_clusters 2 | 3 | This table shows data for YC Managed Service for Kafka Clusters. 4 | 5 | https://cloud.yandex.ru/docs/managed-kafka/api-ref/grpc/cluster_service#Cluster1 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Relations 10 | 11 | The following tables depend on yc_mdb_kafka_clusters: 12 | - [yc_mdb_kafka_topics](yc_mdb_kafka_topics.md) 13 | - [yc_mdb_kafka_users](yc_mdb_kafka_users.md) 14 | 15 | ## Columns 16 | 17 | | Name | Type | 18 | | ------------- | ------------- | 19 | |_cq_id|`uuid`| 20 | |_cq_parent_id|`uuid`| 21 | |cloud_id|`utf8`| 22 | |id (PK)|`utf8`| 23 | |folder_id|`utf8`| 24 | |created_at|`timestamp[us, tz=UTC]`| 25 | |name|`utf8`| 26 | |description|`utf8`| 27 | |labels|`json`| 28 | |environment|`utf8`| 29 | |monitoring|`json`| 30 | |config|`json`| 31 | |network_id|`utf8`| 32 | |health|`utf8`| 33 | |status|`utf8`| 34 | |security_group_ids|`list`| 35 | |host_group_ids|`list`| 36 | |deletion_protection|`bool`| 37 | |maintenance_window|`json`| 38 | |planned_operation|`json`| 39 | |kafka_ui|`json`| -------------------------------------------------------------------------------- /resources/mdb/clickhouse_users.go: -------------------------------------------------------------------------------- 1 | package mdb 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/mdb/clickhouse/v1" 10 | ) 11 | 12 | func ClickhouseUsers() *schema.Table { 13 | return &schema.Table{ 14 | Name: "yc_mdb_clickhouse_users", 15 | Description: `https://cloud.yandex.ru/docs/managed-clickhouse/api-ref/grpc/user_service#User1`, 16 | Resolver: fetchClickhouseUsers, 17 | Transform: structNameClusterIdTransformer(&clickhouse.User{}), 18 | } 19 | } 20 | 21 | func fetchClickhouseUsers(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 22 | c := meta.(*client.Client) 23 | cluster, ok := parent.Item.(*clickhouse.Cluster) 24 | if !ok { 25 | return fmt.Errorf("parent is not type of *clickhouse.Cluster: %+v", cluster) 26 | } 27 | 28 | it := c.SDK.MDB().Clickhouse().User().UserIterator(ctx, &clickhouse.ListUsersRequest{ClusterId: cluster.Id}) 29 | for it.Next() { 30 | res <- it.Value() 31 | } 32 | 33 | return it.Error() 34 | } 35 | -------------------------------------------------------------------------------- /resources/mdb/postgresql_users.go: -------------------------------------------------------------------------------- 1 | package mdb 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/mdb/postgresql/v1" 10 | ) 11 | 12 | func PostgreSQLUsers() *schema.Table { 13 | return &schema.Table{ 14 | Name: "yc_mdb_postgresql_users", 15 | Description: `https://cloud.yandex.ru/docs/managed-postgresql/api-ref/grpc/user_service#User1`, 16 | Resolver: fetchPostgreSQLUsers, 17 | Transform: structNameClusterIdTransformer(&postgresql.User{}), 18 | } 19 | } 20 | 21 | func fetchPostgreSQLUsers(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 22 | c := meta.(*client.Client) 23 | cluster, ok := parent.Item.(*postgresql.Cluster) 24 | if !ok { 25 | return fmt.Errorf("parent is not type of *postgresql.Cluster: %+v", cluster) 26 | } 27 | 28 | it := c.SDK.MDB().PostgreSQL().User().UserIterator(ctx, &postgresql.ListUsersRequest{ClusterId: cluster.Id}) 29 | for it.Next() { 30 | res <- it.Value() 31 | } 32 | 33 | return it.Error() 34 | } 35 | -------------------------------------------------------------------------------- /resources/organizationmanager/organizations.go: -------------------------------------------------------------------------------- 1 | package organizationmanager 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/organizationmanager/v1" 9 | ) 10 | 11 | func Organizations() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_organizationmanager_organizations", 14 | Description: `https://cloud.yandex.ru/docs/organization/api-ref/grpc/organization_service#Organization1`, 15 | Resolver: fetchOrganizations, 16 | Multiplex: client.OrganizationMultiplex, 17 | Transform: client.TransformWithStruct(&organizationmanager.Organization{}, client.PrimaryKeyIdTransformer), 18 | } 19 | } 20 | 21 | func fetchOrganizations(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 22 | c := meta.(*client.Client) 23 | 24 | org, err := c.SDK.OrganizationManager().Organization().Get(ctx, &organizationmanager.GetOrganizationRequest{OrganizationId: c.OrganizationId}) 25 | if err != nil { 26 | return err 27 | } 28 | res <- org 29 | 30 | return nil 31 | } 32 | -------------------------------------------------------------------------------- /resources/mdb/mongodb_databases.go: -------------------------------------------------------------------------------- 1 | package mdb 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/mdb/mongodb/v1" 10 | ) 11 | 12 | func MongoDBDatabases() *schema.Table { 13 | return &schema.Table{ 14 | Name: "yc_mdb_mongodb_databases", 15 | Description: `https://cloud.yandex.ru/docs/managed-mongodb/api-ref/grpc/database_service#Database1`, 16 | Resolver: fetchMongoDBDatabases, 17 | Transform: structNameClusterIdTransformer(&mongodb.Database{}), 18 | } 19 | } 20 | 21 | func fetchMongoDBDatabases(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 22 | c := meta.(*client.Client) 23 | cluster, ok := parent.Item.(*mongodb.Cluster) 24 | if !ok { 25 | return fmt.Errorf("parent is not type of *mongodb.Cluster: %+v", cluster) 26 | } 27 | 28 | it := c.SDK.MDB().MongoDB().Database().DatabaseIterator(ctx, &mongodb.ListDatabasesRequest{ClusterId: cluster.Id}) 29 | for it.Next() { 30 | res <- it.Value() 31 | } 32 | 33 | return it.Error() 34 | } 35 | -------------------------------------------------------------------------------- /resources/kms/symmetric_keys.go: -------------------------------------------------------------------------------- 1 | package kms 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | caccess "github.com/yandex-cloud/cq-source-yc/resources/access" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/kms/v1" 10 | ) 11 | 12 | func SymmetricKeys() *schema.Table { 13 | return &schema.Table{ 14 | Name: "yc_kms_symmetric_keys", 15 | Description: ``, 16 | Multiplex: client.FolderMultiplex, 17 | Resolver: fetchSymmetricKeys, 18 | Transform: client.TransformWithStruct(&kms.SymmetricKey{}, client.PrimaryKeyIdTransformer), 19 | Relations: schema.Tables{caccess.SymmetricKeysAccessBindings()}, 20 | Columns: schema.ColumnList{ 21 | client.CloudIdColumn, 22 | }, 23 | } 24 | } 25 | 26 | func fetchSymmetricKeys(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 27 | c := meta.(*client.Client) 28 | 29 | it := c.SDK.KMS().SymmetricKey().SymmetricKeyIterator(ctx, &kms.ListSymmetricKeysRequest{FolderId: c.FolderId}) 30 | for it.Next() { 31 | res <- it.Value() 32 | } 33 | 34 | return it.Error() 35 | } 36 | -------------------------------------------------------------------------------- /resources/access/resourcemanager_clouds.go: -------------------------------------------------------------------------------- 1 | package access 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/access" 9 | ) 10 | 11 | func CloudsAccessBindings() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_access_bindings_resourcemanager_clouds", 14 | Description: `https://cloud.yandex.ru/docs/resource-manager/api-ref/grpc/cloud_service#AccessBinding`, 15 | Multiplex: client.CloudMultiplex, 16 | Resolver: fetchCloudsAccessBindings, 17 | Transform: Transform, 18 | Columns: schema.ColumnList{ 19 | client.MultiplexedResourceIdColumn, 20 | }, 21 | } 22 | } 23 | 24 | func fetchCloudsAccessBindings(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 25 | c := meta.(*client.Client) 26 | cloudId := c.CloudId 27 | 28 | it := c.SDK.ResourceManager().Cloud().CloudAccessBindingsIterator(ctx, &access.ListAccessBindingsRequest{ResourceId: cloudId}) 29 | for it.Next() { 30 | value := it.Value() 31 | res <- value 32 | } 33 | 34 | return it.Error() 35 | } 36 | -------------------------------------------------------------------------------- /resources/iam/keys.go: -------------------------------------------------------------------------------- 1 | package iam 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/iam/v1" 10 | ) 11 | 12 | func Keys() *schema.Table { 13 | return &schema.Table{ 14 | Name: "yc_iam_keys", 15 | Description: `https://cloud.yandex.ru/docs/iam/api-ref/grpc/key_service#Key1`, 16 | Multiplex: client.FolderMultiplex, 17 | Resolver: fetchKeys, 18 | Transform: client.TransformWithStruct(&iam.Key{}, client.PrimaryKeyIdTransformer), 19 | Columns: schema.ColumnList{ 20 | client.CloudIdColumn, 21 | }, 22 | } 23 | } 24 | 25 | func fetchKeys(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 26 | c := meta.(*client.Client) 27 | sa, ok := parent.Item.(*iam.ServiceAccount) 28 | if !ok { 29 | return fmt.Errorf("parent is not type of *iam.ServiceAccount: %+v", sa) 30 | } 31 | 32 | it := c.SDK.IAM().Key().KeyIterator(ctx, &iam.ListKeysRequest{ServiceAccountId: sa.Id}) 33 | for it.Next() { 34 | res <- it.Value() 35 | } 36 | 37 | return it.Error() 38 | } 39 | -------------------------------------------------------------------------------- /resources/mdb/clickhouse_hosts.go: -------------------------------------------------------------------------------- 1 | package mdb 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/mdb/clickhouse/v1" 10 | ) 11 | 12 | func ClickhouseHosts() *schema.Table { 13 | return &schema.Table{ 14 | Name: "yc_mdb_clickhouse_hosts", 15 | Description: `https://cloud.yandex.ru/docs/managed-clickhouse/api-ref/grpc/cluster_service#Host`, 16 | Resolver: fetchClickhouseHosts, 17 | Transform: structNameClusterIdTransformer(&clickhouse.Host{}), 18 | } 19 | } 20 | 21 | func fetchClickhouseHosts(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 22 | c := meta.(*client.Client) 23 | cluster, ok := parent.Item.(*clickhouse.Cluster) 24 | if !ok { 25 | return fmt.Errorf("parent is not type of *clickhouse.Cluster: %+v", cluster) 26 | } 27 | 28 | it := c.SDK.MDB().Clickhouse().Cluster().ClusterHostsIterator(ctx, &clickhouse.ListClusterHostsRequest{ClusterId: cluster.Id}) 29 | for it.Next() { 30 | res <- it.Value() 31 | } 32 | 33 | return it.Error() 34 | } 35 | -------------------------------------------------------------------------------- /resources/mdb/opensearch_hosts.go: -------------------------------------------------------------------------------- 1 | package mdb 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/mdb/opensearch/v1" 10 | ) 11 | 12 | func OpensearchHosts() *schema.Table { 13 | return &schema.Table{ 14 | Name: "yc_mdb_opensearch_hosts", 15 | Description: `https://cloud.yandex.ru/docs/managed-opensearch/api-ref/grpc/cluster_service#Host`, 16 | Resolver: fetchOpensearchHosts, 17 | Transform: structNameClusterIdTransformer(&opensearch.Host{}), 18 | } 19 | } 20 | 21 | func fetchOpensearchHosts(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 22 | c := meta.(*client.Client) 23 | cluster, ok := parent.Item.(*opensearch.Cluster) 24 | if !ok { 25 | return fmt.Errorf("parent is not type of *opensearch.Cluster: %+v", cluster) 26 | } 27 | 28 | it := c.SDK.MDB().OpenSearch().Cluster().ClusterHostsIterator(ctx, &opensearch.ListClusterHostsRequest{ClusterId: cluster.Id}) 29 | for it.Next() { 30 | res <- it.Value() 31 | } 32 | 33 | return it.Error() 34 | } 35 | -------------------------------------------------------------------------------- /resources/mdb/postgresql_backups.go: -------------------------------------------------------------------------------- 1 | package mdb 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/mdb/postgresql/v1" 9 | ) 10 | 11 | func PostgreSQLBackups() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_mdb_postgresql_backups", 14 | Description: `https://yandex.cloud/ru/docs/managed-postgresql/api-ref/grpc/backup_service#Backup`, 15 | Multiplex: client.FolderMultiplex, 16 | Resolver: fetchPostgreSQLBackups, 17 | Transform: client.TransformWithStruct(&postgresql.Backup{}, client.PrimaryKeyIdTransformer), 18 | Columns: schema.ColumnList{ 19 | client.CloudIdColumn, 20 | }, 21 | } 22 | } 23 | 24 | func fetchPostgreSQLBackups(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 25 | c := meta.(*client.Client) 26 | folderId := c.FolderId 27 | 28 | it := c.SDK.MDB().PostgreSQL().Backup().BackupIterator(ctx, &postgresql.ListBackupsRequest{FolderId: folderId}) 29 | for it.Next() { 30 | res <- it.Value() 31 | } 32 | 33 | return it.Error() 34 | } 35 | -------------------------------------------------------------------------------- /resources/mdb/postgresql_hosts.go: -------------------------------------------------------------------------------- 1 | package mdb 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/mdb/postgresql/v1" 10 | ) 11 | 12 | func PostgreSQLHosts() *schema.Table { 13 | return &schema.Table{ 14 | Name: "yc_mdb_postgresql_hosts", 15 | Description: `https://cloud.yandex.ru/docs/managed-postgresql/api-ref/grpc/cluster_service#Host`, 16 | Resolver: fetchPostgreSQLHosts, 17 | Transform: structNameClusterIdTransformer(&postgresql.Host{}), 18 | } 19 | } 20 | 21 | func fetchPostgreSQLHosts(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 22 | c := meta.(*client.Client) 23 | cluster, ok := parent.Item.(*postgresql.Cluster) 24 | if !ok { 25 | return fmt.Errorf("parent is not type of *postgresql.Cluster: %+v", cluster) 26 | } 27 | 28 | it := c.SDK.MDB().PostgreSQL().Cluster().ClusterHostsIterator(ctx, &postgresql.ListClusterHostsRequest{ClusterId: cluster.Id}) 29 | for it.Next() { 30 | res <- it.Value() 31 | } 32 | 33 | return it.Error() 34 | } 35 | -------------------------------------------------------------------------------- /resources/nlb/target_groups.go: -------------------------------------------------------------------------------- 1 | package nlb 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/loadbalancer/v1" 9 | ) 10 | 11 | func TargetGroups() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_nlb_target_groups", 14 | Description: `https://yandex.cloud/ru/docs/network-load-balancer/api-ref/grpc/TargetGroup/list#yandex.cloud.loadbalancer.v1.TargetGroup`, 15 | Multiplex: client.FolderMultiplex, 16 | Resolver: fetchTargetGroups, 17 | Transform: client.TransformWithStruct(&loadbalancer.TargetGroup{}, client.PrimaryKeyIdTransformer), 18 | Columns: schema.ColumnList{ 19 | client.CloudIdColumn, 20 | }, 21 | } 22 | } 23 | 24 | func fetchTargetGroups(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 25 | c := meta.(*client.Client) 26 | 27 | it := c.SDK.LoadBalancer().TargetGroup().TargetGroupIterator(ctx, &loadbalancer.ListTargetGroupsRequest{FolderId: c.FolderId}) 28 | for it.Next() { 29 | res <- it.Value() 30 | } 31 | 32 | return it.Error() 33 | } 34 | -------------------------------------------------------------------------------- /resources/mdb/kafka_topics.go: -------------------------------------------------------------------------------- 1 | package mdb 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/mdb/kafka/v1" 10 | ) 11 | 12 | func KafkaTopics() *schema.Table { 13 | return &schema.Table{ 14 | Name: "yc_mdb_kafka_topics", 15 | Description: `https://cloud.yandex.ru/docs/managed-kafka/api-ref/grpc/topic_service#Topic1`, 16 | Resolver: fetchKafkaTopics, 17 | Transform: structNameClusterIdTransformer(&kafka.Topic{}), 18 | Columns: schema.ColumnList{ 19 | client.CloudIdColumn, 20 | }, 21 | } 22 | } 23 | 24 | func fetchKafkaTopics(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 25 | c := meta.(*client.Client) 26 | cluster, ok := parent.Item.(*kafka.Cluster) 27 | if !ok { 28 | return fmt.Errorf("parent is not type of *kafka.Cluster: %+v", cluster) 29 | } 30 | 31 | it := c.SDK.MDB().Kafka().Topic().TopicIterator(ctx, &kafka.ListTopicsRequest{ClusterId: cluster.Id}) 32 | for it.Next() { 33 | res <- it.Value() 34 | } 35 | 36 | return it.Error() 37 | } 38 | -------------------------------------------------------------------------------- /resources/mdb/redis_clusters.go: -------------------------------------------------------------------------------- 1 | package mdb 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/mdb/redis/v1" 9 | ) 10 | 11 | func RedisClusters() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_mdb_redis_clusters", 14 | Description: `https://cloud.yandex.ru/docs/managed-mongodb/api-ref/grpc/cluster_service#Cluster1`, 15 | Multiplex: client.FolderMultiplex, 16 | Resolver: fetchRedisClusters, 17 | Transform: client.TransformWithStruct(&redis.Cluster{}, client.PrimaryKeyIdTransformer), 18 | Columns: schema.ColumnList{ 19 | client.CloudIdColumn, 20 | }, 21 | Relations: schema.Tables{RedisHosts()}, 22 | } 23 | } 24 | 25 | func fetchRedisClusters(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 26 | c := meta.(*client.Client) 27 | folderId := c.FolderId 28 | 29 | it := c.SDK.MDB().Redis().Cluster().ClusterIterator(ctx, &redis.ListClustersRequest{FolderId: folderId}) 30 | for it.Next() { 31 | res <- it.Value() 32 | } 33 | 34 | return it.Error() 35 | } 36 | -------------------------------------------------------------------------------- /resources/access/resourcemanager_folders.go: -------------------------------------------------------------------------------- 1 | package access 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/access" 9 | ) 10 | 11 | func FoldersAccessBindings() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_access_bindings_resourcemanager_folders", 14 | Description: `https://cloud.yandex.ru/docs/resource-manager/api-ref/grpc/folder_service#AccessBinding`, 15 | Multiplex: client.FolderMultiplex, 16 | Resolver: fetchFoldersAccessBindings, 17 | Transform: Transform, 18 | Columns: schema.ColumnList{ 19 | client.MultiplexedResourceIdColumn, 20 | }, 21 | } 22 | } 23 | 24 | func fetchFoldersAccessBindings(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 25 | c := meta.(*client.Client) 26 | folderId := c.FolderId 27 | 28 | it := c.SDK.ResourceManager().Folder().FolderAccessBindingsIterator(ctx, &access.ListAccessBindingsRequest{ResourceId: folderId}) 29 | for it.Next() { 30 | value := it.Value() 31 | res <- value 32 | } 33 | 34 | return it.Error() 35 | } 36 | -------------------------------------------------------------------------------- /resources/compute/instances.go: -------------------------------------------------------------------------------- 1 | package compute 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/compute/v1" 9 | ) 10 | 11 | func Instances() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_compute_instances", 14 | Description: `https://cloud.yandex.ru/docs/compute/api-ref/grpc/instance_service#Instance`, 15 | Resolver: fetchInstances, 16 | Transform: client.TransformWithStruct(&compute.Instance{}, client.PrimaryKeyIdTransformer), 17 | Multiplex: client.FolderMultiplex, 18 | Columns: schema.ColumnList{ 19 | client.CloudIdColumn, 20 | }, 21 | SensitiveColumns: []string{"metadata"}, 22 | } 23 | } 24 | 25 | func fetchInstances(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 26 | c := meta.(*client.Client) 27 | folderId := c.FolderId 28 | 29 | it := c.SDK.Compute().Instance().InstanceIterator(ctx, &compute.ListInstancesRequest{FolderId: folderId}) 30 | for it.Next() { 31 | value := it.Value() 32 | res <- value 33 | } 34 | 35 | return it.Error() 36 | } 37 | -------------------------------------------------------------------------------- /resources/organizationmanager/federations.go: -------------------------------------------------------------------------------- 1 | package organizationmanager 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/organizationmanager/v1/saml" 9 | ) 10 | 11 | func Federations() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_organizationmanager_federations", 14 | Description: `https://yandex.cloud/ru/docs/organization/saml/api-ref/grpc/Federation/list#yandex.cloud.organizationmanager.v1.saml.Federation`, 15 | Multiplex: client.OrganizationMultiplex, 16 | Resolver: fetchFederations, 17 | Transform: client.TransformWithStruct(&saml.Federation{}, client.PrimaryKeyIdTransformer), 18 | } 19 | } 20 | 21 | func fetchFederations(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 22 | c := meta.(*client.Client) 23 | orgId := c.OrganizationId 24 | 25 | it := c.SDK.OrganizationManagerSAML().Federation().FederationIterator(ctx, &saml.ListFederationsRequest{OrganizationId: orgId}) 26 | for it.Next() { 27 | res <- it.Value() 28 | } 29 | 30 | return it.Error() 31 | } 32 | -------------------------------------------------------------------------------- /resources/alb/balancers.go: -------------------------------------------------------------------------------- 1 | package alb 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/apploadbalancer/v1" 9 | ) 10 | 11 | func Balancers() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_alb_balancers", 14 | Description: `https://cloud.yandex.ru/docs/application-load-balancer/api-ref/grpc/load_balancer_service#LoadBalancer1`, 15 | Multiplex: client.FolderMultiplex, 16 | Resolver: fetchBalancers, 17 | Transform: client.TransformWithStruct(&apploadbalancer.LoadBalancer{}, client.PrimaryKeyIdTransformer), 18 | Columns: schema.ColumnList{ 19 | client.CloudIdColumn, 20 | }, 21 | } 22 | } 23 | 24 | func fetchBalancers(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 25 | c := meta.(*client.Client) 26 | folderId := c.FolderId 27 | 28 | it := c.SDK.ApplicationLoadBalancer().LoadBalancer().LoadBalancerIterator(ctx, &apploadbalancer.ListLoadBalancersRequest{FolderId: folderId}) 29 | for it.Next() { 30 | res <- it.Value() 31 | } 32 | 33 | return it.Error() 34 | } 35 | -------------------------------------------------------------------------------- /resources/mdb/kafka_clusters.go: -------------------------------------------------------------------------------- 1 | package mdb 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/mdb/kafka/v1" 9 | ) 10 | 11 | func KafkaClusters() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_mdb_kafka_clusters", 14 | Description: `https://cloud.yandex.ru/docs/managed-kafka/api-ref/grpc/cluster_service#Cluster1`, 15 | Multiplex: client.FolderMultiplex, 16 | Resolver: fetchKafkaClusters, 17 | Transform: client.TransformWithStruct(&kafka.Cluster{}, client.PrimaryKeyIdTransformer), 18 | Columns: schema.ColumnList{ 19 | client.CloudIdColumn, 20 | }, 21 | Relations: schema.Tables{KafkaTopics(), KafkaUsers()}, 22 | } 23 | } 24 | 25 | func fetchKafkaClusters(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 26 | c := meta.(*client.Client) 27 | folderId := c.FolderId 28 | 29 | it := c.SDK.MDB().Kafka().Cluster().ClusterIterator(ctx, &kafka.ListClustersRequest{FolderId: folderId}) 30 | for it.Next() { 31 | res <- it.Value() 32 | } 33 | 34 | return it.Error() 35 | } 36 | -------------------------------------------------------------------------------- /resources/ydb/databases.go: -------------------------------------------------------------------------------- 1 | package ydb 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/cq-source-yc/resources/access" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/ydb/v1" 10 | ) 11 | 12 | func Databases() *schema.Table { 13 | return &schema.Table{ 14 | Name: "yc_ydb_databases", 15 | Description: `https://cloud.yandex.ru/docs/ydb/api-ref/grpc/database_service#Database1`, 16 | Multiplex: client.FolderMultiplex, 17 | Resolver: fetchDatabases, 18 | Transform: client.TransformWithStruct(&ydb.Database{}, client.PrimaryKeyIdTransformer), 19 | Columns: schema.ColumnList{ 20 | client.CloudIdColumn, 21 | }, 22 | Relations: schema.Tables{access.YDBDatabasesAccessBindings()}, 23 | } 24 | } 25 | 26 | func fetchDatabases(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 27 | c := meta.(*client.Client) 28 | 29 | it := c.SDK.YDB().Database().DatabaseIterator(ctx, &ydb.ListDatabasesRequest{FolderId: c.FolderId}) 30 | for it.Next() { 31 | res <- it.Value() 32 | } 33 | 34 | return it.Error() 35 | } 36 | -------------------------------------------------------------------------------- /docs/tables/yc_mdb_redis_clusters.md: -------------------------------------------------------------------------------- 1 | # Table: yc_mdb_redis_clusters 2 | 3 | This table shows data for YC Managed Service for Redis Clusters. 4 | 5 | https://cloud.yandex.ru/docs/managed-mongodb/api-ref/grpc/cluster_service#Cluster1 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Relations 10 | 11 | The following tables depend on yc_mdb_redis_clusters: 12 | - [yc_mdb_redis_hosts](yc_mdb_redis_hosts.md) 13 | 14 | ## Columns 15 | 16 | | Name | Type | 17 | | ------------- | ------------- | 18 | |_cq_id|`uuid`| 19 | |_cq_parent_id|`uuid`| 20 | |cloud_id|`utf8`| 21 | |id (PK)|`utf8`| 22 | |folder_id|`utf8`| 23 | |created_at|`timestamp[us, tz=UTC]`| 24 | |name|`utf8`| 25 | |description|`utf8`| 26 | |labels|`json`| 27 | |environment|`utf8`| 28 | |monitoring|`json`| 29 | |config|`json`| 30 | |network_id|`utf8`| 31 | |health|`utf8`| 32 | |status|`utf8`| 33 | |sharded|`bool`| 34 | |maintenance_window|`json`| 35 | |planned_operation|`json`| 36 | |security_group_ids|`list`| 37 | |tls_enabled|`bool`| 38 | |deletion_protection|`bool`| 39 | |persistence_mode|`utf8`| 40 | |announce_hostnames|`bool`| 41 | |auth_sentinel|`bool`| 42 | |disk_encryption_key_id|`json`| -------------------------------------------------------------------------------- /resources/mdb/clickhouse_databases.go: -------------------------------------------------------------------------------- 1 | package mdb 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/mdb/clickhouse/v1" 10 | ) 11 | 12 | func ClickhouseDatabases() *schema.Table { 13 | return &schema.Table{ 14 | Name: "yc_mdb_clickhouse_databases", 15 | Description: `https://cloud.yandex.ru/docs/managed-clickhouse/api-ref/grpc/database_service#Database1`, 16 | Resolver: fetchClickhouseDatabases, 17 | Transform: structNameClusterIdTransformer(&clickhouse.Database{}), 18 | } 19 | } 20 | 21 | func fetchClickhouseDatabases(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 22 | c := meta.(*client.Client) 23 | cluster, ok := parent.Item.(*clickhouse.Cluster) 24 | if !ok { 25 | return fmt.Errorf("parent is not type of *clickhouse.Cluster: %+v", cluster) 26 | } 27 | 28 | it := c.SDK.MDB().Clickhouse().Database().DatabaseIterator(ctx, &clickhouse.ListDatabasesRequest{ClusterId: cluster.Id}) 29 | for it.Next() { 30 | res <- it.Value() 31 | } 32 | 33 | return it.Error() 34 | } 35 | -------------------------------------------------------------------------------- /resources/mdb/postgresql_databases.go: -------------------------------------------------------------------------------- 1 | package mdb 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/mdb/postgresql/v1" 10 | ) 11 | 12 | func PostgreSQLDatabases() *schema.Table { 13 | return &schema.Table{ 14 | Name: "yc_mdb_postgresql_databases", 15 | Description: `https://cloud.yandex.ru/docs/managed-postgresql/api-ref/grpc/database_service#Database1`, 16 | Resolver: fetchPostgreSQLDatabases, 17 | Transform: structNameClusterIdTransformer(&postgresql.Database{}), 18 | } 19 | } 20 | 21 | func fetchPostgreSQLDatabases(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 22 | c := meta.(*client.Client) 23 | cluster, ok := parent.Item.(*postgresql.Cluster) 24 | if !ok { 25 | return fmt.Errorf("parent is not type of *postgresql.Cluster: %+v", cluster) 26 | } 27 | 28 | it := c.SDK.MDB().PostgreSQL().Database().DatabaseIterator(ctx, &postgresql.ListDatabasesRequest{ClusterId: cluster.Id}) 29 | for it.Next() { 30 | res <- it.Value() 31 | } 32 | 33 | return it.Error() 34 | } 35 | -------------------------------------------------------------------------------- /docs/tables/yc_mdb_opensearch_clusters.md: -------------------------------------------------------------------------------- 1 | # Table: yc_mdb_opensearch_clusters 2 | 3 | This table shows data for YC Managed Service for Opensearch Clusters. 4 | 5 | https://cloud.yandex.ru/docs/managed-opensearch/api-ref/grpc/cluster_service#Cluster1 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Relations 10 | 11 | The following tables depend on yc_mdb_opensearch_clusters: 12 | - [yc_mdb_opensearch_auth_settings](yc_mdb_opensearch_auth_settings.md) 13 | - [yc_mdb_opensearch_hosts](yc_mdb_opensearch_hosts.md) 14 | 15 | ## Columns 16 | 17 | | Name | Type | 18 | | ------------- | ------------- | 19 | |_cq_id|`uuid`| 20 | |_cq_parent_id|`uuid`| 21 | |cloud_id|`utf8`| 22 | |id (PK)|`utf8`| 23 | |folder_id|`utf8`| 24 | |created_at|`timestamp[us, tz=UTC]`| 25 | |name|`utf8`| 26 | |description|`utf8`| 27 | |labels|`json`| 28 | |environment|`utf8`| 29 | |monitoring|`json`| 30 | |config|`json`| 31 | |network_id|`utf8`| 32 | |health|`utf8`| 33 | |status|`utf8`| 34 | |security_group_ids|`list`| 35 | |service_account_id|`utf8`| 36 | |deletion_protection|`bool`| 37 | |maintenance_window|`json`| 38 | |planned_operation|`json`| 39 | |disk_encryption_key_id|`json`| -------------------------------------------------------------------------------- /resources/access/ydb_databases.go: -------------------------------------------------------------------------------- 1 | package access 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/access" 10 | "github.com/yandex-cloud/go-genproto/yandex/cloud/ydb/v1" 11 | ) 12 | 13 | func YDBDatabasesAccessBindings() *schema.Table { 14 | return &schema.Table{ 15 | Name: "yc_access_bindings_ydb_databases", 16 | Resolver: fetchYDBDatabasesAccessBindings, 17 | Transform: Transform, 18 | Columns: schema.ColumnList{ 19 | client.ParentIdColumn, 20 | }, 21 | } 22 | } 23 | 24 | func fetchYDBDatabasesAccessBindings(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 25 | c := meta.(*client.Client) 26 | database, ok := parent.Item.(*ydb.Database) 27 | if !ok { 28 | return fmt.Errorf("parent is not type of *ydb.Database: %+v", database) 29 | } 30 | 31 | it := c.SDK.YDB().Database().DatabaseAccessBindingsIterator(ctx, &access.ListAccessBindingsRequest{ 32 | ResourceId: database.Id, 33 | }) 34 | for it.Next() { 35 | res <- it.Value() 36 | } 37 | 38 | return it.Error() 39 | } 40 | -------------------------------------------------------------------------------- /resources/lockbox/secrets.go: -------------------------------------------------------------------------------- 1 | package lockbox 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/cq-source-yc/resources/access" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/lockbox/v1" 10 | ) 11 | 12 | func Secrets() *schema.Table { 13 | return &schema.Table{ 14 | Name: "yc_lockbox_secrets", 15 | Description: `https://cloud.yandex.ru/docs/lockbox/api-ref/grpc/secret_service#Secret1`, 16 | Multiplex: client.FolderMultiplex, 17 | Resolver: fetchSecrets, 18 | Transform: client.TransformWithStruct(&lockbox.Secret{}, client.PrimaryKeyIdTransformer), 19 | Relations: schema.Tables{access.SecretsAccessBindings()}, 20 | Columns: schema.ColumnList{ 21 | client.CloudIdColumn, 22 | }, 23 | } 24 | } 25 | 26 | func fetchSecrets(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 27 | c := meta.(*client.Client) 28 | 29 | it := c.SDK.LockboxSecret().Secret().SecretIterator(ctx, &lockbox.ListSecretsRequest{FolderId: c.FolderId}) 30 | for it.Next() { 31 | res <- it.Value() 32 | } 33 | 34 | return it.Error() 35 | } 36 | -------------------------------------------------------------------------------- /docs/tables/yc_mdb_mongodb_clusters.md: -------------------------------------------------------------------------------- 1 | # Table: yc_mdb_mongodb_clusters 2 | 3 | This table shows data for YC Managed Service for Mongodb Clusters. 4 | 5 | https://cloud.yandex.ru/docs/managed-mongodb/api-ref/grpc/cluster_service#Cluster1 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Relations 10 | 11 | The following tables depend on yc_mdb_mongodb_clusters: 12 | - [yc_mdb_mongodb_databases](yc_mdb_mongodb_databases.md) 13 | - [yc_mdb_mongodb_hosts](yc_mdb_mongodb_hosts.md) 14 | - [yc_mdb_mongodb_users](yc_mdb_mongodb_users.md) 15 | 16 | ## Columns 17 | 18 | | Name | Type | 19 | | ------------- | ------------- | 20 | |_cq_id|`uuid`| 21 | |_cq_parent_id|`uuid`| 22 | |cloud_id|`utf8`| 23 | |id (PK)|`utf8`| 24 | |folder_id|`utf8`| 25 | |created_at|`timestamp[us, tz=UTC]`| 26 | |name|`utf8`| 27 | |description|`utf8`| 28 | |labels|`json`| 29 | |environment|`utf8`| 30 | |monitoring|`json`| 31 | |config|`json`| 32 | |network_id|`utf8`| 33 | |health|`utf8`| 34 | |status|`utf8`| 35 | |sharded|`bool`| 36 | |maintenance_window|`json`| 37 | |planned_operation|`json`| 38 | |security_group_ids|`list`| 39 | |deletion_protection|`bool`| 40 | |disk_encryption_key_id|`json`| -------------------------------------------------------------------------------- /resources/iam/api_keys.go: -------------------------------------------------------------------------------- 1 | package iam 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/iam/v1" 10 | ) 11 | 12 | func ApiKeys() *schema.Table { 13 | return &schema.Table{ 14 | Name: "yc_iam_api_keys", 15 | Description: `https://cloud.yandex.ru/docs/iam/api-ref/grpc/api_key_service#ApiKey`, 16 | Multiplex: client.FolderMultiplex, 17 | Resolver: fetchApiKeys, 18 | Transform: client.TransformWithStruct(&iam.ApiKey{}, client.PrimaryKeyIdTransformer), 19 | Columns: schema.ColumnList{ 20 | client.CloudIdColumn, 21 | }, 22 | } 23 | } 24 | 25 | func fetchApiKeys(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 26 | c := meta.(*client.Client) 27 | sa, ok := parent.Item.(*iam.ServiceAccount) 28 | if !ok { 29 | return fmt.Errorf("parent is not type of *iam.ServiceAccount: %+v", sa) 30 | } 31 | 32 | it := c.SDK.IAM().ApiKey().ApiKeyIterator(ctx, &iam.ListApiKeysRequest{ServiceAccountId: sa.Id}) 33 | for it.Next() { 34 | res <- it.Value() 35 | } 36 | 37 | return it.Error() 38 | } 39 | -------------------------------------------------------------------------------- /resources/nlb/balancers.go: -------------------------------------------------------------------------------- 1 | package nlb 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/loadbalancer/v1" 9 | ) 10 | 11 | func Balancers() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_nlb_balancers", 14 | Description: `https://cloud.yandex.ru/docs/network-load-balancer/api-ref/grpc/network_load_balancer_service#NetworkLoadBalancer1`, 15 | Multiplex: client.FolderMultiplex, 16 | Resolver: fetchBalancers, 17 | Transform: client.TransformWithStruct(&loadbalancer.NetworkLoadBalancer{}, client.PrimaryKeyIdTransformer), 18 | Columns: schema.ColumnList{ 19 | client.CloudIdColumn, 20 | }, 21 | } 22 | } 23 | 24 | func fetchBalancers(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 25 | c := meta.(*client.Client) 26 | folderId := c.FolderId 27 | 28 | it := c.SDK.LoadBalancer().NetworkLoadBalancer().NetworkLoadBalancerIterator(ctx, &loadbalancer.ListNetworkLoadBalancersRequest{FolderId: folderId}) 29 | for it.Next() { 30 | res <- it.Value() 31 | } 32 | 33 | return it.Error() 34 | } 35 | -------------------------------------------------------------------------------- /docs/tables/yc_mdb_mysql_clusters.md: -------------------------------------------------------------------------------- 1 | # Table: yc_mdb_mysql_clusters 2 | 3 | This table shows data for YC Managed Service for Mysql Clusters. 4 | 5 | https://cloud.yandex.ru/docs/managed-mysql/api-ref/grpc/cluster_service#Cluster1 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Relations 10 | 11 | The following tables depend on yc_mdb_mysql_clusters: 12 | - [yc_mdb_mysql_databases](yc_mdb_mysql_databases.md) 13 | - [yc_mdb_mysql_hosts](yc_mdb_mysql_hosts.md) 14 | - [yc_mdb_mysql_users](yc_mdb_mysql_users.md) 15 | 16 | ## Columns 17 | 18 | | Name | Type | 19 | | ------------- | ------------- | 20 | |_cq_id|`uuid`| 21 | |_cq_parent_id|`uuid`| 22 | |cloud_id|`utf8`| 23 | |id (PK)|`utf8`| 24 | |folder_id|`utf8`| 25 | |created_at|`timestamp[us, tz=UTC]`| 26 | |name|`utf8`| 27 | |description|`utf8`| 28 | |labels|`json`| 29 | |environment|`utf8`| 30 | |monitoring|`json`| 31 | |config|`json`| 32 | |network_id|`utf8`| 33 | |health|`utf8`| 34 | |status|`utf8`| 35 | |maintenance_window|`json`| 36 | |planned_operation|`json`| 37 | |security_group_ids|`list`| 38 | |deletion_protection|`bool`| 39 | |host_group_ids|`list`| 40 | |disk_encryption_key_id|`json`| -------------------------------------------------------------------------------- /resources/mdb/mysql_clusters.go: -------------------------------------------------------------------------------- 1 | package mdb 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/mdb/mysql/v1" 9 | ) 10 | 11 | func MySQLClusters() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_mdb_mysql_clusters", 14 | Description: `https://cloud.yandex.ru/docs/managed-mysql/api-ref/grpc/cluster_service#Cluster1`, 15 | Multiplex: client.FolderMultiplex, 16 | Resolver: fetchMySQLClusters, 17 | Transform: client.TransformWithStruct(&mysql.Cluster{}, client.PrimaryKeyIdTransformer), 18 | Columns: schema.ColumnList{ 19 | client.CloudIdColumn, 20 | }, 21 | Relations: schema.Tables{ 22 | MySQLDatabases(), 23 | MySQLHosts(), 24 | MySQLUsers(), 25 | }, 26 | } 27 | } 28 | 29 | func fetchMySQLClusters(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 30 | c := meta.(*client.Client) 31 | 32 | it := c.SDK.MDB().MySQL().Cluster().ClusterIterator(ctx, &mysql.ListClustersRequest{FolderId: c.FolderId}) 33 | for it.Next() { 34 | res <- it.Value() 35 | } 36 | 37 | return it.Error() 38 | } 39 | -------------------------------------------------------------------------------- /resources/mdb/greenplum_clusters.go: -------------------------------------------------------------------------------- 1 | package mdb 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/mdb/greenplum/v1" 9 | ) 10 | 11 | func GreenplumClusters() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_mdb_greenplum_clusters", 14 | Description: `https://cloud.yandex.ru/docs/managed-greenplum/api-ref/grpc/cluster_service#Cluster1`, 15 | Multiplex: client.FolderMultiplex, 16 | Resolver: fetchGreenplumClusters, 17 | Transform: client.TransformWithStruct(&greenplum.Cluster{}, client.PrimaryKeyIdTransformer), 18 | Columns: schema.ColumnList{ 19 | client.CloudIdColumn, 20 | }, 21 | Relations: schema.Tables{GreenplumHosts()}, 22 | } 23 | } 24 | 25 | func fetchGreenplumClusters(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 26 | c := meta.(*client.Client) 27 | folderId := c.FolderId 28 | 29 | it := c.SDK.MDB().Greenplum().Cluster().ClusterIterator(ctx, &greenplum.ListClustersRequest{FolderId: folderId}) 30 | for it.Next() { 31 | res <- it.Value() 32 | } 33 | 34 | return it.Error() 35 | } 36 | -------------------------------------------------------------------------------- /resources/access/kms_symmetric_keys.go: -------------------------------------------------------------------------------- 1 | package access 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/access" 10 | "github.com/yandex-cloud/go-genproto/yandex/cloud/kms/v1" 11 | ) 12 | 13 | func SymmetricKeysAccessBindings() *schema.Table { 14 | return &schema.Table{ 15 | Name: "yc_access_bindings_kms_symmetric_keys", 16 | Description: ``, 17 | Resolver: fetchSymmetricKeysAccessBindings, 18 | Transform: Transform, 19 | Columns: schema.ColumnList{ 20 | client.ParentIdColumn, 21 | }, 22 | } 23 | } 24 | 25 | func fetchSymmetricKeysAccessBindings(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 26 | c := meta.(*client.Client) 27 | key, ok := parent.Item.(*kms.SymmetricKey) 28 | if !ok { 29 | return fmt.Errorf("parent is not type of *kms.SymmetricKey: %+v", key) 30 | } 31 | 32 | it := c.SDK.KMS().SymmetricKey().SymmetricKeyAccessBindingsIterator(ctx, &access.ListAccessBindingsRequest{ResourceId: key.Id}) 33 | for it.Next() { 34 | res <- it.Value() 35 | } 36 | 37 | return it.Error() 38 | } 39 | -------------------------------------------------------------------------------- /resources/datasphere/communities.go: -------------------------------------------------------------------------------- 1 | package datasphere 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/cq-source-yc/resources/access" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/datasphere/v2" 10 | ) 11 | 12 | func Communities() *schema.Table { 13 | return &schema.Table{ 14 | Name: "yc_datasphere_communities", 15 | Description: `https://cloud.yandex.ru/docs/datasphere/api-ref/grpc/community_service#Community3`, 16 | Multiplex: client.OrganizationMultiplex, 17 | Resolver: fetchCommunities, 18 | Transform: client.TransformWithStruct(&datasphere.Community{}, client.PrimaryKeyIdTransformer), 19 | Relations: schema.Tables{Projects(), access.DatasphereCommunitiesBindings()}, 20 | } 21 | } 22 | 23 | func fetchCommunities(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 24 | c := meta.(*client.Client) 25 | 26 | it := c.SDK.Datasphere().Community().CommunityIterator(ctx, &datasphere.ListCommunitiesRequest{OrganizationId: c.OrganizationId}) 27 | for it.Next() { 28 | res <- it.Value() 29 | } 30 | 31 | return it.Error() 32 | } 33 | -------------------------------------------------------------------------------- /resources/mdb/opensearch_clusters.go: -------------------------------------------------------------------------------- 1 | package mdb 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/mdb/opensearch/v1" 9 | ) 10 | 11 | func OpenSearchClusters() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_mdb_opensearch_clusters", 14 | Description: `https://cloud.yandex.ru/docs/managed-opensearch/api-ref/grpc/cluster_service#Cluster1`, 15 | Multiplex: client.FolderMultiplex, 16 | Resolver: fetchOpenSearchClusters, 17 | Transform: client.TransformWithStruct(&opensearch.Cluster{}, client.PrimaryKeyIdTransformer), 18 | Columns: schema.ColumnList{ 19 | client.CloudIdColumn, 20 | }, 21 | Relations: schema.Tables{OpensearchHosts(), OpenSearchAuthSettings()}, 22 | } 23 | } 24 | 25 | func fetchOpenSearchClusters(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 26 | c := meta.(*client.Client) 27 | 28 | it := c.SDK.MDB().OpenSearch().Cluster().ClusterIterator(ctx, &opensearch.ListClustersRequest{FolderId: c.FolderId}) 29 | for it.Next() { 30 | res <- it.Value() 31 | } 32 | 33 | return it.Error() 34 | } 35 | -------------------------------------------------------------------------------- /docs/tables/yc_compute_instances.md: -------------------------------------------------------------------------------- 1 | # Table: yc_compute_instances 2 | 3 | This table shows data for YC Compute Instances. 4 | 5 | https://cloud.yandex.ru/docs/compute/api-ref/grpc/instance_service#Instance 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Columns 10 | 11 | | Name | Type | 12 | | ------------- | ------------- | 13 | |_cq_id|`uuid`| 14 | |_cq_parent_id|`uuid`| 15 | |cloud_id|`utf8`| 16 | |id (PK)|`utf8`| 17 | |folder_id|`utf8`| 18 | |created_at|`timestamp[us, tz=UTC]`| 19 | |name|`utf8`| 20 | |description|`utf8`| 21 | |labels|`json`| 22 | |zone_id|`utf8`| 23 | |platform_id|`utf8`| 24 | |resources|`json`| 25 | |status|`utf8`| 26 | |metadata|`json`| 27 | |metadata_options|`json`| 28 | |boot_disk|`json`| 29 | |secondary_disks|`json`| 30 | |local_disks|`json`| 31 | |filesystems|`json`| 32 | |network_interfaces|`json`| 33 | |serial_port_settings|`json`| 34 | |gpu_settings|`json`| 35 | |fqdn|`utf8`| 36 | |scheduling_policy|`json`| 37 | |service_account_id|`utf8`| 38 | |network_settings|`json`| 39 | |placement_policy|`json`| 40 | |host_group_id|`utf8`| 41 | |host_id|`utf8`| 42 | |maintenance_policy|`utf8`| 43 | |maintenance_grace_period|`json`| 44 | |hardware_generation|`json`| 45 | |reserved_instance_pool_id|`utf8`| -------------------------------------------------------------------------------- /resources/access/datasphere_projects.go: -------------------------------------------------------------------------------- 1 | package access 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/access" 10 | "github.com/yandex-cloud/go-genproto/yandex/cloud/datasphere/v2" 11 | ) 12 | 13 | func DatasphereProjectsBindings() *schema.Table { 14 | return &schema.Table{ 15 | Name: "yc_access_bindings_datasphere_projects", 16 | Description: ``, 17 | Resolver: fetchDatasphereProjectsBindings, 18 | Transform: Transform, 19 | Columns: schema.ColumnList{ 20 | client.ParentIdColumn, 21 | }, 22 | } 23 | } 24 | 25 | func fetchDatasphereProjectsBindings(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 26 | c := meta.(*client.Client) 27 | project, ok := parent.Item.(*datasphere.Project) 28 | if !ok { 29 | return fmt.Errorf("parent is not type of *datasphere.Project: %+v", project) 30 | } 31 | 32 | it := c.SDK.Datasphere().Project().ProjectAccessBindingsIterator(ctx, &access.ListAccessBindingsRequest{ResourceId: project.Id}) 33 | for it.Next() { 34 | res <- it.Value() 35 | } 36 | 37 | return it.Error() 38 | } 39 | -------------------------------------------------------------------------------- /docs/tables/yc_mdb_clickhouse_clusters.md: -------------------------------------------------------------------------------- 1 | # Table: yc_mdb_clickhouse_clusters 2 | 3 | This table shows data for YC Managed Service for Clickhouse Clusters. 4 | 5 | https://cloud.yandex.ru/docs/managed-clickhouse/api-ref/grpc/cluster_service#Cluster1 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Relations 10 | 11 | The following tables depend on yc_mdb_clickhouse_clusters: 12 | - [yc_mdb_clickhouse_databases](yc_mdb_clickhouse_databases.md) 13 | - [yc_mdb_clickhouse_hosts](yc_mdb_clickhouse_hosts.md) 14 | - [yc_mdb_clickhouse_users](yc_mdb_clickhouse_users.md) 15 | 16 | ## Columns 17 | 18 | | Name | Type | 19 | | ------------- | ------------- | 20 | |_cq_id|`uuid`| 21 | |_cq_parent_id|`uuid`| 22 | |cloud_id|`utf8`| 23 | |id (PK)|`utf8`| 24 | |folder_id|`utf8`| 25 | |created_at|`timestamp[us, tz=UTC]`| 26 | |name|`utf8`| 27 | |description|`utf8`| 28 | |labels|`json`| 29 | |environment|`utf8`| 30 | |monitoring|`json`| 31 | |config|`json`| 32 | |network_id|`utf8`| 33 | |health|`utf8`| 34 | |status|`utf8`| 35 | |service_account_id|`utf8`| 36 | |maintenance_window|`json`| 37 | |planned_operation|`json`| 38 | |security_group_ids|`list`| 39 | |deletion_protection|`bool`| 40 | |disk_encryption_key_id|`json`| -------------------------------------------------------------------------------- /resources/serverless/functions.go: -------------------------------------------------------------------------------- 1 | package serverless 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/cq-source-yc/resources/access" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/serverless/functions/v1" 10 | ) 11 | 12 | func FunctionsFunctions() *schema.Table { 13 | return &schema.Table{ 14 | Name: "yc_serverless_functions_functions", 15 | Description: ``, 16 | Multiplex: client.FolderMultiplex, 17 | Resolver: fetchFunctionsFunctions, 18 | Transform: client.TransformWithStruct(&functions.Function{}, client.PrimaryKeyIdTransformer), 19 | Relations: schema.Tables{access.ServerlessFunctionsAccessBindings()}, 20 | Columns: schema.ColumnList{ 21 | client.CloudIdColumn, 22 | }, 23 | } 24 | } 25 | func fetchFunctionsFunctions(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 26 | c := meta.(*client.Client) 27 | folderId := c.FolderId 28 | 29 | it := c.SDK.Serverless().Functions().Function().FunctionIterator(ctx, &functions.ListFunctionsRequest{FolderId: folderId}) 30 | for it.Next() { 31 | res <- it.Value() 32 | } 33 | 34 | return it.Error() 35 | } 36 | -------------------------------------------------------------------------------- /resources/access/serverless_functions.go: -------------------------------------------------------------------------------- 1 | package access 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/access" 10 | "github.com/yandex-cloud/go-genproto/yandex/cloud/serverless/functions/v1" 11 | ) 12 | 13 | func ServerlessFunctionsAccessBindings() *schema.Table { 14 | return &schema.Table{ 15 | Name: "yc_access_bindings_serverless_functions", 16 | Resolver: fetchServerlessFunctionsAccessBindings, 17 | Transform: Transform, 18 | Columns: schema.ColumnList{ 19 | client.ParentIdColumn, 20 | }, 21 | } 22 | } 23 | 24 | func fetchServerlessFunctionsAccessBindings(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 25 | c := meta.(*client.Client) 26 | function, ok := parent.Item.(*functions.Function) 27 | if !ok { 28 | return fmt.Errorf("parent is not type of *functions.Function: %+v", function) 29 | } 30 | 31 | it := c.SDK.Serverless().Functions().Function().FunctionAccessBindingsIterator(ctx, &access.ListAccessBindingsRequest{ResourceId: function.Id}) 32 | for it.Next() { 33 | res <- it.Value() 34 | } 35 | 36 | return it.Error() 37 | } 38 | -------------------------------------------------------------------------------- /docs/tables/yc_mdb_postgresql_clusters.md: -------------------------------------------------------------------------------- 1 | # Table: yc_mdb_postgresql_clusters 2 | 3 | This table shows data for YC Managed Service for Postgresql Clusters. 4 | 5 | https://cloud.yandex.ru/docs/managed-postgresql/api-ref/grpc/cluster_service#Cluster1 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Relations 10 | 11 | The following tables depend on yc_mdb_postgresql_clusters: 12 | - [yc_mdb_postgresql_databases](yc_mdb_postgresql_databases.md) 13 | - [yc_mdb_postgresql_hosts](yc_mdb_postgresql_hosts.md) 14 | - [yc_mdb_postgresql_users](yc_mdb_postgresql_users.md) 15 | 16 | ## Columns 17 | 18 | | Name | Type | 19 | | ------------- | ------------- | 20 | |_cq_id|`uuid`| 21 | |_cq_parent_id|`uuid`| 22 | |cloud_id|`utf8`| 23 | |id (PK)|`utf8`| 24 | |folder_id|`utf8`| 25 | |created_at|`timestamp[us, tz=UTC]`| 26 | |name|`utf8`| 27 | |description|`utf8`| 28 | |labels|`json`| 29 | |environment|`utf8`| 30 | |monitoring|`json`| 31 | |config|`json`| 32 | |network_id|`utf8`| 33 | |health|`utf8`| 34 | |status|`utf8`| 35 | |maintenance_window|`json`| 36 | |planned_operation|`json`| 37 | |security_group_ids|`list`| 38 | |deletion_protection|`bool`| 39 | |host_group_ids|`list`| 40 | |disk_encryption_key_id|`json`| -------------------------------------------------------------------------------- /docs/tables/yc_ydb_databases.md: -------------------------------------------------------------------------------- 1 | # Table: yc_ydb_databases 2 | 3 | This table shows data for YC Managed Service for YDB Databases. 4 | 5 | https://cloud.yandex.ru/docs/ydb/api-ref/grpc/database_service#Database1 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Relations 10 | 11 | The following tables depend on yc_ydb_databases: 12 | - [yc_access_bindings_ydb_databases](yc_access_bindings_ydb_databases.md) 13 | 14 | ## Columns 15 | 16 | | Name | Type | 17 | | ------------- | ------------- | 18 | |_cq_id|`uuid`| 19 | |_cq_parent_id|`uuid`| 20 | |cloud_id|`utf8`| 21 | |id (PK)|`utf8`| 22 | |folder_id|`utf8`| 23 | |created_at|`timestamp[us, tz=UTC]`| 24 | |name|`utf8`| 25 | |description|`utf8`| 26 | |status|`utf8`| 27 | |endpoint|`utf8`| 28 | |resource_preset_id|`utf8`| 29 | |storage_config|`json`| 30 | |scale_policy|`json`| 31 | |network_id|`utf8`| 32 | |subnet_ids|`list`| 33 | |database_type|`json`| 34 | |assign_public_ips|`bool`| 35 | |location_id|`utf8`| 36 | |labels|`json`| 37 | |backup_config|`json`| 38 | |document_api_endpoint|`utf8`| 39 | |kinesis_api_endpoint|`utf8`| 40 | |kafka_api_endpoint|`utf8`| 41 | |monitoring_config|`json`| 42 | |deletion_protection|`bool`| 43 | |security_group_ids|`list`| -------------------------------------------------------------------------------- /resources/mdb/mongodb_clusters.go: -------------------------------------------------------------------------------- 1 | package mdb 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/mdb/mongodb/v1" 9 | ) 10 | 11 | func MongoDBClusters() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_mdb_mongodb_clusters", 14 | Description: `https://cloud.yandex.ru/docs/managed-mongodb/api-ref/grpc/cluster_service#Cluster1`, 15 | Multiplex: client.FolderMultiplex, 16 | Resolver: fetchMongoDBClusters, 17 | Transform: client.TransformWithStruct(&mongodb.Cluster{}, client.PrimaryKeyIdTransformer), 18 | Relations: schema.Tables{ 19 | MongoDBDatabases(), 20 | MongoDBHosts(), 21 | MongoDBUsers(), 22 | }, 23 | Columns: schema.ColumnList{ 24 | client.CloudIdColumn, 25 | }, 26 | } 27 | } 28 | 29 | func fetchMongoDBClusters(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 30 | c := meta.(*client.Client) 31 | folderId := c.FolderId 32 | 33 | it := c.SDK.MDB().MongoDB().Cluster().ClusterIterator(ctx, &mongodb.ListClustersRequest{FolderId: folderId}) 34 | for it.Next() { 35 | res <- it.Value() 36 | } 37 | 38 | return it.Error() 39 | } 40 | -------------------------------------------------------------------------------- /resources/access/datasphere_communities.go: -------------------------------------------------------------------------------- 1 | package access 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/access" 10 | "github.com/yandex-cloud/go-genproto/yandex/cloud/datasphere/v2" 11 | ) 12 | 13 | func DatasphereCommunitiesBindings() *schema.Table { 14 | return &schema.Table{ 15 | Name: "yc_access_bindings_datasphere_communities", 16 | Description: ``, 17 | Resolver: fetchDatasphereCommunitiesBindings, 18 | Transform: Transform, 19 | Columns: schema.ColumnList{ 20 | client.ParentIdColumn, 21 | }, 22 | } 23 | } 24 | 25 | func fetchDatasphereCommunitiesBindings(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 26 | c := meta.(*client.Client) 27 | community, ok := parent.Item.(*datasphere.Community) 28 | if !ok { 29 | return fmt.Errorf("parent is not type of *datasphere.Community: %+v", community) 30 | } 31 | 32 | it := c.SDK.Datasphere().Community().CommunityAccessBindingsIterator(ctx, &access.ListAccessBindingsRequest{ResourceId: community.Id}) 33 | for it.Next() { 34 | res <- it.Value() 35 | } 36 | 37 | return it.Error() 38 | } 39 | -------------------------------------------------------------------------------- /resources/mdb/clickhouse_clusters.go: -------------------------------------------------------------------------------- 1 | package mdb 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/mdb/clickhouse/v1" 9 | ) 10 | 11 | func ClickhouseClusters() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_mdb_clickhouse_clusters", 14 | Description: `https://cloud.yandex.ru/docs/managed-clickhouse/api-ref/grpc/cluster_service#Cluster1`, 15 | Multiplex: client.FolderMultiplex, 16 | Resolver: fetchClickhouseClusters, 17 | Transform: client.TransformWithStruct(&clickhouse.Cluster{}, client.PrimaryKeyIdTransformer), 18 | Relations: schema.Tables{ClickhouseDatabases(), ClickhouseUsers(), ClickhouseHosts()}, 19 | Columns: schema.ColumnList{ 20 | client.CloudIdColumn, 21 | }, 22 | } 23 | } 24 | 25 | func fetchClickhouseClusters(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 26 | c := meta.(*client.Client) 27 | folderId := c.FolderId 28 | 29 | it := c.SDK.MDB().Clickhouse().Cluster().ClusterIterator(ctx, &clickhouse.ListClustersRequest{FolderId: folderId}) 30 | for it.Next() { 31 | res <- it.Value() 32 | } 33 | 34 | return it.Error() 35 | } 36 | -------------------------------------------------------------------------------- /resources/mdb/postgresql_clusters.go: -------------------------------------------------------------------------------- 1 | package mdb 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/mdb/postgresql/v1" 9 | ) 10 | 11 | func PostgreSQLClusters() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_mdb_postgresql_clusters", 14 | Description: `https://cloud.yandex.ru/docs/managed-postgresql/api-ref/grpc/cluster_service#Cluster1`, 15 | Multiplex: client.FolderMultiplex, 16 | Resolver: fetchPostgreSQLClusters, 17 | Transform: client.TransformWithStruct(&postgresql.Cluster{}, client.PrimaryKeyIdTransformer), 18 | Relations: schema.Tables{PostgreSQLDatabases(), PostgreSQLUsers(), PostgreSQLHosts()}, 19 | Columns: schema.ColumnList{ 20 | client.CloudIdColumn, 21 | }, 22 | } 23 | } 24 | 25 | func fetchPostgreSQLClusters(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 26 | c := meta.(*client.Client) 27 | folderId := c.FolderId 28 | 29 | it := c.SDK.MDB().PostgreSQL().Cluster().ClusterIterator(ctx, &postgresql.ListClustersRequest{FolderId: folderId}) 30 | for it.Next() { 31 | res <- it.Value() 32 | } 33 | 34 | return it.Error() 35 | } 36 | -------------------------------------------------------------------------------- /resources/access/serverless_containers.go: -------------------------------------------------------------------------------- 1 | package access 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/access" 10 | "github.com/yandex-cloud/go-genproto/yandex/cloud/serverless/containers/v1" 11 | ) 12 | 13 | func ServerlessContainersAccessBindings() *schema.Table { 14 | return &schema.Table{ 15 | Name: "yc_access_bindings_serverless_containers", 16 | Resolver: fetchServerlessContainersAccessBindings, 17 | Transform: Transform, 18 | Columns: schema.ColumnList{ 19 | client.ParentIdColumn, 20 | }, 21 | } 22 | } 23 | 24 | func fetchServerlessContainersAccessBindings(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 25 | c := meta.(*client.Client) 26 | container, ok := parent.Item.(*containers.Container) 27 | if !ok { 28 | return fmt.Errorf("parent is not type of *containers.Container: %+v", container) 29 | } 30 | 31 | it := c.SDK.Serverless().Containers().Container().ContainerAccessBindingsIterator(ctx, &access.ListAccessBindingsRequest{ResourceId: container.Id}) 32 | for it.Next() { 33 | res <- it.Value() 34 | } 35 | 36 | return it.Error() 37 | } 38 | -------------------------------------------------------------------------------- /resources/access/containerregistry_registries.go: -------------------------------------------------------------------------------- 1 | package access 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/access" 10 | "github.com/yandex-cloud/go-genproto/yandex/cloud/containerregistry/v1" 11 | ) 12 | 13 | func RegistriesAccessBindings() *schema.Table { 14 | return &schema.Table{ 15 | Name: "yc_access_bindings_containerregistry_registries", 16 | Description: ``, 17 | Resolver: fetchRegistriesAccessBindings, 18 | Transform: Transform, 19 | Columns: schema.ColumnList{ 20 | client.ParentIdColumn, 21 | }, 22 | } 23 | } 24 | 25 | func fetchRegistriesAccessBindings(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 26 | c := meta.(*client.Client) 27 | registry, ok := parent.Item.(*containerregistry.Registry) 28 | if !ok { 29 | return fmt.Errorf("parent is not type of *containerregistry.Registry: %+v", registry) 30 | } 31 | 32 | it := c.SDK.ContainerRegistry().Registry().RegistryAccessBindingsIterator(ctx, &access.ListAccessBindingsRequest{ResourceId: registry.Id}) 33 | for it.Next() { 34 | res <- it.Value() 35 | } 36 | 37 | return it.Error() 38 | } 39 | -------------------------------------------------------------------------------- /resources/access/kms_asymmetric_keys.go: -------------------------------------------------------------------------------- 1 | package access 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/access" 10 | kms "github.com/yandex-cloud/go-genproto/yandex/cloud/kms/v1/asymmetricencryption" 11 | ) 12 | 13 | func AsymmetricKeysAccessBindings() *schema.Table { 14 | return &schema.Table{ 15 | Name: "yc_access_bindings_kms_asymmetric_keys", 16 | Description: ``, 17 | Resolver: fetchAsymmetricKeysAccessBindings, 18 | Transform: Transform, 19 | Columns: schema.ColumnList{ 20 | client.ParentIdColumn, 21 | }, 22 | } 23 | } 24 | 25 | func fetchAsymmetricKeysAccessBindings(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 26 | c := meta.(*client.Client) 27 | key, ok := parent.Item.(*kms.AsymmetricEncryptionKey) 28 | if !ok { 29 | return fmt.Errorf("parent is not type of *kms.SymmetricKey: %+v", key) 30 | } 31 | 32 | it := c.SDK.KMSAsymmetricEncryption().AsymmetricEncryptionKey().AsymmetricEncryptionKeyAccessBindingsIterator(ctx, &access.ListAccessBindingsRequest{ResourceId: key.Id}) 33 | for it.Next() { 34 | res <- it.Value() 35 | } 36 | 37 | return it.Error() 38 | } 39 | -------------------------------------------------------------------------------- /resources/access/containerregistry_repositories.go: -------------------------------------------------------------------------------- 1 | package access 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/access" 10 | "github.com/yandex-cloud/go-genproto/yandex/cloud/containerregistry/v1" 11 | ) 12 | 13 | func RepositoriesAccessBindings() *schema.Table { 14 | return &schema.Table{ 15 | Name: "yc_access_bindings_containerregistry_repositories", 16 | Description: ``, 17 | Resolver: fetchRepositoriesAccessBindings, 18 | Transform: Transform, 19 | Columns: schema.ColumnList{ 20 | client.ParentIdColumn, 21 | }, 22 | } 23 | } 24 | 25 | func fetchRepositoriesAccessBindings(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 26 | c := meta.(*client.Client) 27 | repository, ok := parent.Item.(*containerregistry.Repository) 28 | if !ok { 29 | return fmt.Errorf("parent is not type of *containerregistry.Repository: %+v", repository) 30 | } 31 | 32 | it := c.SDK.ContainerRegistry().Repository().RepositoryAccessBindingsIterator(ctx, &access.ListAccessBindingsRequest{ResourceId: repository.Id}) 33 | for it.Next() { 34 | res <- it.Value() 35 | } 36 | 37 | return it.Error() 38 | } 39 | -------------------------------------------------------------------------------- /resources/access/iam_service_accounts.go: -------------------------------------------------------------------------------- 1 | package access 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/access" 10 | "github.com/yandex-cloud/go-genproto/yandex/cloud/iam/v1" 11 | ) 12 | 13 | func ServiceAccountsAccessBindings() *schema.Table { 14 | return &schema.Table{ 15 | Name: "yc_access_iam_service_accounts", 16 | Description: `https://cloud.yandex.ru/docs/iam/api-ref/grpc/service_account_service#AccessBinding`, 17 | Resolver: fetchServiceAccountsAccessBindings, 18 | Transform: Transform, 19 | Columns: schema.ColumnList{ 20 | client.ParentIdColumn, 21 | }, 22 | } 23 | } 24 | 25 | func fetchServiceAccountsAccessBindings(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 26 | c := meta.(*client.Client) 27 | sa, ok := parent.Item.(*iam.ServiceAccount) 28 | if !ok { 29 | return fmt.Errorf("parent is not type of *iam.ServiceAccount: %+v", sa) 30 | } 31 | 32 | it := c.SDK.IAM().ServiceAccount().ServiceAccountAccessBindingsIterator(ctx, &access.ListAccessBindingsRequest{ResourceId: sa.Id}) 33 | for it.Next() { 34 | res <- it.Value() 35 | } 36 | 37 | return it.Error() 38 | } 39 | -------------------------------------------------------------------------------- /resources/access/lockbox_secrets_access_bindings.go: -------------------------------------------------------------------------------- 1 | package access 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/access" 10 | "github.com/yandex-cloud/go-genproto/yandex/cloud/lockbox/v1" 11 | ) 12 | 13 | func SecretsAccessBindings() *schema.Table { 14 | return &schema.Table{ 15 | Name: "yc_access_bindings_lockbox_secrets", 16 | Description: `https://cloud.yandex.ru/docs/lockbox/api-ref/grpc/secret_service#AccessBinding`, 17 | Resolver: fetchSecretsAccessBindings, 18 | Transform: Transform, 19 | Columns: schema.ColumnList{ 20 | client.ParentIdColumn, 21 | }, 22 | } 23 | } 24 | 25 | func fetchSecretsAccessBindings(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 26 | c := meta.(*client.Client) 27 | secret, ok := parent.Item.(*lockbox.Secret) 28 | if !ok { 29 | return fmt.Errorf("parent is not type of *lockbox.Secret: %+v", secret) 30 | } 31 | 32 | it := c.SDK.LockboxSecret().Secret().SecretAccessBindingsIterator(ctx, &access.ListAccessBindingsRequest{ResourceId: secret.Id}) 33 | for it.Next() { 34 | value := it.Value() 35 | res <- value 36 | } 37 | 38 | return it.Error() 39 | } 40 | -------------------------------------------------------------------------------- /resources/containerregistry/registries.go: -------------------------------------------------------------------------------- 1 | package containerregistry 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/cq-source-yc/resources/access" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/containerregistry/v1" 10 | ) 11 | 12 | func Registries() *schema.Table { 13 | return &schema.Table{ 14 | Name: "yc_containerregistry_registries", 15 | Description: `https://cloud.yandex.ru/docs/container-registry/api-ref/grpc/registry_service#Registry1`, 16 | Multiplex: client.FolderMultiplex, 17 | Resolver: fetchRegistries, 18 | Transform: client.TransformWithStruct(&containerregistry.Registry{}, client.PrimaryKeyIdTransformer), 19 | Columns: schema.ColumnList{ 20 | client.CloudIdColumn, 21 | }, 22 | Relations: schema.Tables{Repositories(), access.RegistriesAccessBindings()}, 23 | } 24 | } 25 | 26 | func fetchRegistries(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 27 | c := meta.(*client.Client) 28 | 29 | it := c.SDK.ContainerRegistry().Registry().RegistryIterator(ctx, &containerregistry.ListRegistriesRequest{FolderId: c.FolderId}) 30 | for it.Next() { 31 | res <- it.Value() 32 | } 33 | 34 | return it.Error() 35 | } 36 | -------------------------------------------------------------------------------- /resources/organizationmanager/oslogin_settings.go: -------------------------------------------------------------------------------- 1 | package organizationmanager 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/organizationmanager/v1" 9 | ) 10 | 11 | func OsloginSettings() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_organizationmanager_oslogin_settings", 14 | Description: `https://yandex.cloud/ru/docs/organization/api-ref/grpc/OsLogin/getSettings#yandex.cloud.organizationmanager.v1.OsLoginSettings`, 15 | Multiplex: client.OrganizationMultiplex, 16 | Resolver: fetchOsloginSettings, 17 | Transform: client.TransformWithStruct(&organizationmanager.OsLoginSettings{}), 18 | Columns: schema.ColumnList{ 19 | client.TransformColumnPrimaryKey(client.OrganiztionIdColumn), 20 | }, 21 | } 22 | } 23 | 24 | func fetchOsloginSettings(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 25 | c := meta.(*client.Client) 26 | orgId := c.OrganizationId 27 | 28 | settings, err := c.SDK.OrganizationManager().OsLogin().GetSettings(ctx, &organizationmanager.GetOsLoginSettingsRequest{OrganizationId: orgId}) 29 | if err != nil { 30 | return err 31 | } 32 | res <- settings 33 | 34 | return nil 35 | } 36 | -------------------------------------------------------------------------------- /resources/datasphere/projects.go: -------------------------------------------------------------------------------- 1 | package datasphere 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/cq-source-yc/resources/access" 10 | "github.com/yandex-cloud/go-genproto/yandex/cloud/datasphere/v2" 11 | ) 12 | 13 | func Projects() *schema.Table { 14 | return &schema.Table{ 15 | Name: "yc_datasphere_projects", 16 | Description: `https://cloud.yandex.ru/docs/datasphere/api-ref/grpc/project_service#Project3`, 17 | Multiplex: nil, 18 | Resolver: fetchProjects, 19 | Transform: client.TransformWithStruct(&datasphere.Project{}, client.PrimaryKeyIdTransformer), 20 | Relations: schema.Tables{access.DatasphereProjectsBindings()}, 21 | } 22 | } 23 | 24 | func fetchProjects(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 25 | c := meta.(*client.Client) 26 | community, ok := parent.Item.(*datasphere.Community) 27 | if !ok { 28 | return fmt.Errorf("parent is not type of *datasphere.Community: %+v", community) 29 | } 30 | 31 | it := c.SDK.Datasphere().Project().ProjectIterator(ctx, &datasphere.ListProjectsRequest{CommunityId: community.Id}) 32 | for it.Next() { 33 | res <- it.Value() 34 | } 35 | 36 | return it.Error() 37 | } 38 | -------------------------------------------------------------------------------- /resources/serverless/containers.go: -------------------------------------------------------------------------------- 1 | package serverless 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/cq-source-yc/resources/access" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/serverless/containers/v1" 10 | ) 11 | 12 | func ContainersContainers() *schema.Table { 13 | return &schema.Table{ 14 | Name: "yc_serverless_containers_containers", 15 | Description: `https://cloud.yandex.ru/docs/serverless-containers/containers/api-ref/grpc/container_service#Container1`, 16 | Multiplex: client.FolderMultiplex, 17 | Resolver: fetchContainersContainers, 18 | Transform: client.TransformWithStruct(&containers.Container{}, client.PrimaryKeyIdTransformer), 19 | Relations: schema.Tables{access.ServerlessContainersAccessBindings()}, 20 | Columns: schema.ColumnList{ 21 | client.CloudIdColumn, 22 | }, 23 | } 24 | } 25 | 26 | func fetchContainersContainers(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 27 | c := meta.(*client.Client) 28 | 29 | it := c.SDK.Serverless().Containers().Container().ContainerIterator(ctx, &containers.ListContainersRequest{FolderId: c.FolderId}) 30 | for it.Next() { 31 | res <- it.Value() 32 | } 33 | 34 | return it.Error() 35 | } 36 | -------------------------------------------------------------------------------- /resources/iam/service_accounts.go: -------------------------------------------------------------------------------- 1 | package iam 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/cq-source-yc/resources/access" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/iam/v1" 10 | ) 11 | 12 | func ServiceAccounts() *schema.Table { 13 | return &schema.Table{ 14 | Name: "yc_iam_service_accounts", 15 | Description: `https://cloud.yandex.ru/docs/iam/api-ref/grpc/service_account_service#ServiceAccount1`, 16 | Multiplex: client.FolderMultiplex, 17 | Resolver: fetchServiceAccounts, 18 | Transform: client.TransformWithStruct(&iam.ServiceAccount{}, client.PrimaryKeyIdTransformer), 19 | Columns: schema.ColumnList{ 20 | client.CloudIdColumn, 21 | }, 22 | Relations: schema.Tables{ 23 | AccessKeys(), 24 | ApiKeys(), 25 | Keys(), 26 | access.ServiceAccountsAccessBindings(), 27 | }, 28 | } 29 | } 30 | 31 | func fetchServiceAccounts(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 32 | c := meta.(*client.Client) 33 | 34 | it := c.SDK.IAM().ServiceAccount().ServiceAccountIterator(ctx, &iam.ListServiceAccountsRequest{FolderId: c.FolderId}) 35 | for it.Next() { 36 | value := it.Value() 37 | res <- value 38 | } 39 | 40 | return it.Error() 41 | } 42 | -------------------------------------------------------------------------------- /resources/organizationmanager/users.go: -------------------------------------------------------------------------------- 1 | package organizationmanager 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/cloudquery/plugin-sdk/v4/transformers" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/organizationmanager/v1" 10 | ) 11 | 12 | func Users() *schema.Table { 13 | return &schema.Table{ 14 | Name: "yc_organizationmanager_users", 15 | Description: `https://cloud.yandex.ru/docs/organization/api-ref/grpc/user_service#OrganizationUser`, 16 | Multiplex: client.OrganizationMultiplex, 17 | Resolver: fetchUsers, 18 | Transform: client.TransformWithStruct(&organizationmanager.ListMembersResponse_OrganizationUser{}, transformers.WithUnwrapStructFields("SubjectClaims"), transformers.WithPrimaryKeys("SubjectClaims.Sub")), 19 | Columns: schema.ColumnList{ 20 | client.OrganiztionIdColumn, 21 | }, 22 | } 23 | } 24 | 25 | func fetchUsers(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 26 | c := meta.(*client.Client) 27 | orgId := c.OrganizationId 28 | 29 | it := c.SDK.OrganizationManager().User().UserMembersIterator(ctx, &organizationmanager.ListMembersRequest{OrganizationId: orgId}) 30 | for it.Next() { 31 | res <- it.Value() 32 | } 33 | 34 | return it.Error() 35 | } 36 | -------------------------------------------------------------------------------- /resources/iam/access_keys.go: -------------------------------------------------------------------------------- 1 | package iam 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/iam/v1" 10 | "github.com/yandex-cloud/go-genproto/yandex/cloud/iam/v1/awscompatibility" 11 | ) 12 | 13 | func AccessKeys() *schema.Table { 14 | return &schema.Table{ 15 | Name: "yc_iam_access_keys", 16 | Description: `https://cloud.yandex.ru/docs/iam/api-ref/grpc/access_key_service#AccessKey`, 17 | Multiplex: client.FolderMultiplex, 18 | Resolver: fetchAccessKeys, 19 | Transform: client.TransformWithStruct(&awscompatibility.AccessKey{}, client.PrimaryKeyIdTransformer), 20 | Columns: schema.ColumnList{ 21 | client.CloudIdColumn, 22 | }, 23 | } 24 | } 25 | 26 | func fetchAccessKeys(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 27 | c := meta.(*client.Client) 28 | sa, ok := parent.Item.(*iam.ServiceAccount) 29 | if !ok { 30 | return fmt.Errorf("parent is not type of *iam.ServiceAccount: %+v", sa) 31 | } 32 | 33 | it := c.SDK.IAM().AWSCompatibility().AccessKey().AccessKeyIterator(ctx, &awscompatibility.ListAccessKeysRequest{ServiceAccountId: sa.Id}) 34 | for it.Next() { 35 | res <- it.Value() 36 | } 37 | 38 | return it.Error() 39 | } 40 | -------------------------------------------------------------------------------- /resources/kms/asymmetric_keys.go: -------------------------------------------------------------------------------- 1 | package kms 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | caccess "github.com/yandex-cloud/cq-source-yc/resources/access" 9 | kms "github.com/yandex-cloud/go-genproto/yandex/cloud/kms/v1/asymmetricencryption" 10 | ) 11 | 12 | func AsymmetricKeys() *schema.Table { 13 | return &schema.Table{ 14 | Name: "yc_kms_asymmetric_keys", 15 | Description: `https://yandex.cloud/ru/docs/kms/api-ref/grpc/asymmetric_encryption_key_service#AsymmetricEncryptionKey2`, 16 | Multiplex: client.FolderMultiplex, 17 | Resolver: fetchAsymmetricKeys, 18 | Transform: client.TransformWithStruct(&kms.AsymmetricEncryptionKey{}, client.PrimaryKeyIdTransformer), 19 | Relations: schema.Tables{caccess.AsymmetricKeysAccessBindings()}, 20 | Columns: schema.ColumnList{ 21 | client.CloudIdColumn, 22 | }, 23 | } 24 | } 25 | 26 | func fetchAsymmetricKeys(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 27 | c := meta.(*client.Client) 28 | 29 | it := c.SDK.KMSAsymmetricEncryption().AsymmetricEncryptionKey().AsymmetricEncryptionKeyIterator(ctx, &kms.ListAsymmetricEncryptionKeysRequest{FolderId: c.FolderId}) 30 | for it.Next() { 31 | res <- it.Value() 32 | } 33 | 34 | return it.Error() 35 | } 36 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Yandex Cloud Source Plugin 2 | 3 | The Yandex Cloud Source Plugin extracts information from [Yandex Cloud API](https://cloud.yandex.ru/ru/docs/api-design-guide/) 4 | 5 | > Previous version is available [here](https://github.com/yandex-cloud/cq-source-yandex/tree/v0.3.8) 6 | 7 | --- 8 | 9 | ## Configuration 10 | 11 | Example configuration: 12 | 13 | ```yaml 14 | kind: source 15 | spec: 16 | name: "yc" 17 | registry: github 18 | path: yandex-cloud/cq-source-yc 19 | version: "v1.0.0" 20 | destinations: ["postgresql"] 21 | tables: 22 | ["*"] 23 | spec: 24 | organization_ids: # sync these organizations only 25 | - bpf... 26 | cloud_ids: # sync these clouds only 27 | - b1g... 28 | folder_ids: # sync these folders only 29 | - b1g... 30 | --- 31 | kind: destination 32 | spec: 33 | name: "postgresql" 34 | path: "cloudquery/postgresql" 35 | registry: "cloudquery" 36 | version: "v7.1.2" 37 | spec: 38 | connection_string: "${PG_CONNECTION_STRING}" 39 | ``` 40 | 41 | ## Authentication 42 | 43 | Authentication is done via IAM tokens/keys. 44 | 45 | You can set following environment variables: 46 | 47 | - `YC_SERVICE_ACCOUNT_KEY` – Service Account key (in json format) 48 | - `YC_TOKEN` – IAM or OAuth token 49 | 50 | If none of the variables are set, plugin will try to use Compute Metadata API to get IAM token. 51 | -------------------------------------------------------------------------------- /resources/vpc/privatelink/private_endpoints.go: -------------------------------------------------------------------------------- 1 | package privatelink 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/yandex-cloud/cq-source-yc/client" 8 | "github.com/yandex-cloud/go-genproto/yandex/cloud/vpc/v1/privatelink" 9 | ) 10 | 11 | func PrivateEndpoints() *schema.Table { 12 | return &schema.Table{ 13 | Name: "yc_vpc_privatelink_private_endpoints", 14 | Title: "VPC Private Endpoints", 15 | Description: `https://yandex.cloud/ru/docs/vpc/privatelink/api-ref/grpc/PrivateEndpoint/list#yandex.cloud.vpc.v1.privatelink.PrivateEndpoint`, 16 | Multiplex: client.FolderMultiplex, 17 | Resolver: fetchPrivateEndpoints, 18 | Transform: client.TransformWithStruct(&privatelink.PrivateEndpoint{}, client.PrimaryKeyIdTransformer), 19 | Columns: schema.ColumnList{ 20 | client.CloudIdColumn, 21 | }, 22 | } 23 | } 24 | 25 | func fetchPrivateEndpoints(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 26 | c := meta.(*client.Client) 27 | 28 | it := c.SDK.VPCPrivateLink().PrivateEndpoint().PrivateEndpointIterator(ctx, &privatelink.ListPrivateEndpointsRequest{ 29 | Container: &privatelink.ListPrivateEndpointsRequest_FolderId{ 30 | FolderId: c.FolderId, 31 | }, 32 | }) 33 | for it.Next() { 34 | res <- it.Value() 35 | } 36 | 37 | return it.Error() 38 | } 39 | -------------------------------------------------------------------------------- /resources/mdb/opensearch_auth_settings.go: -------------------------------------------------------------------------------- 1 | package mdb 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/cloudquery/plugin-sdk/v4/transformers" 9 | "github.com/yandex-cloud/cq-source-yc/client" 10 | "github.com/yandex-cloud/go-genproto/yandex/cloud/mdb/opensearch/v1" 11 | ) 12 | 13 | func OpenSearchAuthSettings() *schema.Table { 14 | return &schema.Table{ 15 | Name: "yc_mdb_opensearch_auth_settings", 16 | Description: `https://cloud.yandex.ru/docs/managed-opensearch/api-ref/grpc/cluster_service#AuthSettings`, 17 | Resolver: fetchOpenSearchAuthSettings, 18 | Transform: client.TransformWithStruct(&opensearch.AuthSettings{}, transformers.WithUnwrapStructFields("Saml")), 19 | Columns: schema.ColumnList{ 20 | client.CloudIdColumn, 21 | clusterIdColumn, 22 | }, 23 | } 24 | } 25 | 26 | func fetchOpenSearchAuthSettings(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 27 | c := meta.(*client.Client) 28 | cluster, ok := parent.Item.(*opensearch.Cluster) 29 | if !ok { 30 | return fmt.Errorf("parent is not type of *opensearch.Cluster: %+v", cluster) 31 | } 32 | 33 | resp, err := c.SDK.MDB().OpenSearch().Cluster().GetAuthSettings(ctx, &opensearch.GetAuthSettingsRequest{ClusterId: cluster.Id}) 34 | if err != nil { 35 | return err 36 | } 37 | res <- resp 38 | 39 | return nil 40 | } 41 | -------------------------------------------------------------------------------- /resources/compute/disks_images.go: -------------------------------------------------------------------------------- 1 | package compute 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/compute/v1" 10 | ) 11 | 12 | func DisksImages() *schema.Table { 13 | return &schema.Table{ 14 | Name: "yc_compute_disks_images", 15 | Description: `This table is exact copy of [yc_compute_images](yc_compute_images.md), but contains images used in [yc_compute_disks](yc_compute_disks.md) 16 | https://cloud.yandex.ru/docs/compute/api-ref/grpc/image_service#Image2`, 17 | Resolver: fetchDisksImages, 18 | Transform: client.TransformWithStruct(&compute.Image{}, client.PrimaryKeyIdTransformer), 19 | Columns: schema.ColumnList{ 20 | client.CloudIdColumn, 21 | }, 22 | } 23 | } 24 | 25 | func fetchDisksImages(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 26 | c := meta.(*client.Client) 27 | disk, ok := parent.Item.(*compute.Disk) 28 | if !ok { 29 | return fmt.Errorf("parent is not type of *compute.Disk") 30 | } 31 | 32 | imageId := disk.GetSourceImageId() 33 | if imageId == "" { 34 | return nil // Disk source is not Image, but rather Snapshot 35 | } 36 | 37 | image, err := c.SDK.Compute().Image().Get(ctx, &compute.GetImageRequest{ImageId: imageId}) 38 | if err != nil { 39 | return err 40 | } 41 | 42 | res <- image 43 | return nil 44 | } 45 | -------------------------------------------------------------------------------- /resources/kubernetes/nodes.go: -------------------------------------------------------------------------------- 1 | package kubernetes 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/apache/arrow-go/v18/arrow" 8 | "github.com/cloudquery/plugin-sdk/v4/schema" 9 | "github.com/cloudquery/plugin-sdk/v4/transformers" 10 | "github.com/yandex-cloud/cq-source-yc/client" 11 | "github.com/yandex-cloud/go-genproto/yandex/cloud/k8s/v1" 12 | ) 13 | 14 | func Nodes() *schema.Table { 15 | return &schema.Table{ 16 | Name: "yc_kubernetes_nodes", 17 | Description: ``, 18 | Multiplex: client.FolderMultiplex, 19 | Resolver: fetchNodes, 20 | Transform: client.TransformWithStruct(&k8s.Node{}, transformers.WithUnwrapStructFields("CloudStatus"), transformers.WithPrimaryKeys("CloudStatus.Id")), 21 | Columns: schema.ColumnList{ 22 | { 23 | Name: "node_group_id", 24 | Type: arrow.BinaryTypes.String, 25 | Resolver: schema.ParentColumnResolver("id"), 26 | }, 27 | }, 28 | } 29 | } 30 | 31 | func fetchNodes(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 32 | c := meta.(*client.Client) 33 | nodeGroup, ok := parent.Item.(*k8s.NodeGroup) 34 | if !ok { 35 | return fmt.Errorf("parent is not type of *k8s.NodeGroup: %+v", nodeGroup) 36 | } 37 | 38 | it := c.SDK.Kubernetes().NodeGroup().NodeGroupNodesIterator(ctx, &k8s.ListNodeGroupNodesRequest{NodeGroupId: nodeGroup.Id}) 39 | for it.Next() { 40 | res <- it.Value() 41 | } 42 | 43 | return it.Error() 44 | } 45 | -------------------------------------------------------------------------------- /resources/mdb/greenplum_hosts.go: -------------------------------------------------------------------------------- 1 | package mdb 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/mdb/greenplum/v1" 10 | ) 11 | 12 | func GreenplumHosts() *schema.Table { 13 | return &schema.Table{ 14 | Name: "yc_mdb_greenplum_hosts", 15 | Description: `https://cloud.yandex.ru/docs/managed-greenplum/api-ref/grpc/cluster_service#Host`, 16 | Resolver: fetchGreenplumHosts, 17 | Transform: structNameClusterIdTransformer(&greenplum.Host{}), 18 | } 19 | } 20 | 21 | func fetchGreenplumHosts(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 22 | c := meta.(*client.Client) 23 | cluster, ok := parent.Item.(*greenplum.Cluster) 24 | if !ok { 25 | return fmt.Errorf("parent is not type of *greenplum.Cluster: %+v", cluster) 26 | } 27 | 28 | itMaster := c.SDK.MDB().Greenplum().Cluster().ClusterMasterHostsIterator(ctx, &greenplum.ListClusterHostsRequest{ClusterId: cluster.Id}) 29 | for itMaster.Next() { 30 | res <- itMaster.Value() 31 | } 32 | if itMaster.Error() != nil { 33 | return itMaster.Error() 34 | } 35 | 36 | itSegment := c.SDK.MDB().Greenplum().Cluster().ClusterSegmentHostsIterator(ctx, &greenplum.ListClusterHostsRequest{ClusterId: cluster.Id}) 37 | for itSegment.Next() { 38 | res <- itSegment.Value() 39 | } 40 | return itSegment.Error() 41 | } 42 | -------------------------------------------------------------------------------- /docs/tables/yc_mdb_greenplum_clusters.md: -------------------------------------------------------------------------------- 1 | # Table: yc_mdb_greenplum_clusters 2 | 3 | This table shows data for YC Managed Service for Greenplum Clusters. 4 | 5 | https://cloud.yandex.ru/docs/managed-greenplum/api-ref/grpc/cluster_service#Cluster1 6 | 7 | The primary key for this table is **id**. 8 | 9 | ## Relations 10 | 11 | The following tables depend on yc_mdb_greenplum_clusters: 12 | - [yc_mdb_greenplum_hosts](yc_mdb_greenplum_hosts.md) 13 | 14 | ## Columns 15 | 16 | | Name | Type | 17 | | ------------- | ------------- | 18 | |_cq_id|`uuid`| 19 | |_cq_parent_id|`uuid`| 20 | |cloud_id|`utf8`| 21 | |id (PK)|`utf8`| 22 | |folder_id|`utf8`| 23 | |created_at|`timestamp[us, tz=UTC]`| 24 | |name|`utf8`| 25 | |config|`json`| 26 | |description|`utf8`| 27 | |labels|`json`| 28 | |environment|`utf8`| 29 | |monitoring|`json`| 30 | |master_config|`json`| 31 | |segment_config|`json`| 32 | |master_host_count|`int64`| 33 | |segment_host_count|`int64`| 34 | |segment_in_host|`int64`| 35 | |network_id|`utf8`| 36 | |health|`utf8`| 37 | |status|`utf8`| 38 | |maintenance_window|`json`| 39 | |planned_operation|`json`| 40 | |security_group_ids|`list`| 41 | |user_name|`utf8`| 42 | |deletion_protection|`bool`| 43 | |host_group_ids|`list`| 44 | |cluster_config|`json`| 45 | |cloud_storage|`json`| 46 | |master_host_group_ids|`list`| 47 | |segment_host_group_ids|`list`| 48 | |service_account_id|`utf8`| 49 | |logging|`json`| -------------------------------------------------------------------------------- /resources/dns/record_sets.go: -------------------------------------------------------------------------------- 1 | package dns 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/apache/arrow-go/v18/arrow" 8 | "github.com/cloudquery/plugin-sdk/v4/schema" 9 | "github.com/cloudquery/plugin-sdk/v4/transformers" 10 | "github.com/yandex-cloud/cq-source-yc/client" 11 | "github.com/yandex-cloud/go-genproto/yandex/cloud/dns/v1" 12 | ) 13 | 14 | func RecordSets() *schema.Table { 15 | return &schema.Table{ 16 | Name: "yc_dns_record_sets", 17 | Description: `https://cloud.yandex.ru/docs/dns/api-ref/grpc/dns_zone_service#RecordSet1`, 18 | Multiplex: client.FolderMultiplex, 19 | Resolver: fetchRecordSets, 20 | Transform: client.TransformWithStruct(&dns.RecordSet{}, transformers.WithPrimaryKeys("Name", "Type")), 21 | Columns: schema.ColumnList{ 22 | { 23 | Name: "zone_id", 24 | Type: arrow.BinaryTypes.String, 25 | Resolver: schema.ParentColumnResolver("id"), 26 | PrimaryKey: true, 27 | }, 28 | }, 29 | } 30 | } 31 | 32 | func fetchRecordSets(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 33 | c := meta.(*client.Client) 34 | zone, ok := parent.Item.(*dns.DnsZone) 35 | if !ok { 36 | return fmt.Errorf("parent is not type of *dns.DnsZone: %+v", zone) 37 | } 38 | 39 | it := c.SDK.DNS().DnsZone().DnsZoneRecordSetsIterator(ctx, &dns.ListDnsZoneRecordSetsRequest{DnsZoneId: zone.Id}) 40 | for it.Next() { 41 | res <- it.Value() 42 | } 43 | 44 | return it.Error() 45 | } 46 | -------------------------------------------------------------------------------- /client/spec.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import "github.com/cloudquery/plugin-sdk/v4/scheduler" 4 | 5 | const defaultEndpoint = "api.cloud.yandex.net:443" 6 | 7 | type Spec struct { 8 | // List of all organiztions ids to fetch information from 9 | OrganizationIDs []string `json:"organization_ids"` 10 | 11 | // List of all clouds ids to fetch information from 12 | CloudIDs []string `json:"cloud_ids"` 13 | 14 | // List of all folder ids to fetch information from 15 | FolderIDs []string `json:"folder_ids"` 16 | 17 | // If `true`, will log all GRPC calls (currently YC SDK only) 18 | DebugGRPC bool `json:"debug_grpc"` 19 | 20 | // Defines the maximum number of times an API request will be retried. 21 | MaxRetries int `json:"max_retries,omitempty" jsonschema:"default=3"` 22 | 23 | // The base URL endpoint the SDK will use 24 | Endpoint string `json:"endpoint"` 25 | 26 | // The best effort maximum number of Go routines to use. Lower this number to reduce memory usage. 27 | Concurrency int `json:"concurrency" jsonschema:"minimum=1,default=50000"` 28 | 29 | // The scheduler to use when determining the priority of resources to sync. By default it is set to `shuffle`. 30 | // 31 | // Available options: `dfs`, `round-robin`, `shuffle` 32 | Scheduler scheduler.Strategy `json:"scheduler,omitempty"` 33 | } 34 | 35 | func NewDefaultSpec() *Spec { 36 | return &Spec{ 37 | MaxRetries: 3, 38 | Endpoint: defaultEndpoint, 39 | Concurrency: scheduler.DefaultConcurrency, 40 | Scheduler: scheduler.StrategyShuffle, 41 | } 42 | } 43 | 44 | func (spec *Spec) Validate() error { 45 | return nil 46 | } 47 | -------------------------------------------------------------------------------- /resources/containerregistry/repositories.go: -------------------------------------------------------------------------------- 1 | package containerregistry 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/apache/arrow-go/v18/arrow" 8 | "github.com/cloudquery/plugin-sdk/v4/schema" 9 | "github.com/yandex-cloud/cq-source-yc/client" 10 | "github.com/yandex-cloud/cq-source-yc/resources/access" 11 | "github.com/yandex-cloud/go-genproto/yandex/cloud/containerregistry/v1" 12 | ) 13 | 14 | func Repositories() *schema.Table { 15 | return &schema.Table{ 16 | Name: "yc_containerregistry_repositories", 17 | Description: `https://cloud.yandex.ru/docs/container-registry/api-ref/grpc/repository_service#Repository2`, 18 | Resolver: fetchRepositories, 19 | Transform: client.TransformWithStruct(&containerregistry.Repository{}, client.PrimaryKeyIdTransformer), 20 | Columns: schema.ColumnList{ 21 | client.CloudIdColumn, 22 | schema.Column{ 23 | Name: "registry_id", 24 | Type: arrow.BinaryTypes.String, 25 | Resolver: schema.ParentColumnResolver("id"), 26 | }, 27 | }, 28 | Relations: schema.Tables{access.RepositoriesAccessBindings()}, 29 | } 30 | } 31 | 32 | func fetchRepositories(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 33 | c := meta.(*client.Client) 34 | registry, ok := parent.Item.(*containerregistry.Registry) 35 | if !ok { 36 | return fmt.Errorf("parent is not type of *containerregistry.Registry: %+v", registry) 37 | } 38 | 39 | it := c.SDK.ContainerRegistry().Repository().RepositoryIterator(ctx, &containerregistry.ListRepositoriesRequest{RegistryId: registry.Id}) 40 | for it.Next() { 41 | res <- it.Value() 42 | } 43 | 44 | return it.Error() 45 | } 46 | -------------------------------------------------------------------------------- /resources/quotamanager/services.go: -------------------------------------------------------------------------------- 1 | // Provides a dictionary table of quota-enabled services per resource container. 2 | package quotamanager 3 | 4 | import ( 5 | "context" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/cloudquery/plugin-sdk/v4/transformers" 9 | "github.com/yandex-cloud/cq-source-yc/client" 10 | "github.com/yandex-cloud/go-genproto/yandex/cloud/quotamanager/v1" 11 | ) 12 | 13 | type Service struct { 14 | quotamanager.Service 15 | ResourceType string 16 | } 17 | 18 | func QuotaServices() *schema.Table { 19 | return &schema.Table{ 20 | Name: "yc_quotamanager_quota_services", 21 | Description: `https://yandex.cloud/ru/docs/quota-manager/api-ref/grpc/QuotaLimit/listServices#yandex.cloud.quotamanager.v1.Service`, 22 | Resolver: fetchQuotaServices, 23 | Transform: client.TransformWithStruct(&Service{}, transformers.WithUnwrapAllEmbeddedStructs(), transformers.WithPrimaryKeys("Id", "ResourceType")), 24 | } 25 | } 26 | 27 | // NOTE: no API to get this list, so hardcode 28 | var quotaEnabledResourceTypes = []client.ResourceType{client.ResourceTypeOrganization, client.ResourceTypeCloud} 29 | 30 | func fetchQuotaServices(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 31 | c := meta.(*client.Client) 32 | 33 | for _, rt := range quotaEnabledResourceTypes { 34 | rt := string(rt) 35 | it := c.SDK.QuotaManager().QuotaLimit().QuotaLimitServicesIterator(ctx, "amanager.ListServicesRequest{ 36 | ResourceType: rt, 37 | }) 38 | for it.Next() { 39 | res <- &Service{ 40 | Service: *it.Value(), 41 | ResourceType: rt, 42 | } 43 | } 44 | 45 | if err := it.Error(); err != nil { 46 | return err 47 | } 48 | } 49 | 50 | return nil 51 | } 52 | -------------------------------------------------------------------------------- /docs/overview.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Yandex Cloud 3 | stage: Preview 4 | title: Yandex Cloud Source Plugin 5 | description: CloudQuery Yandex Cloud Plugin documentation 6 | --- 7 | 8 | # Yandex Cloud Source Plugin 9 | 10 | :badge 11 | 12 | The CloudQuery Yandex Cloud plugin pulls configuration out of Yandex Cloud resources and loads it into any supported CloudQuery destination (e.g. PostgreSQL, BigQuery, Snowflake, and [more](/docs/plugins/destinations/overview)). 13 | 14 | ## Authentication 15 | 16 | :authentication 17 | 18 | ## Query Examples 19 | 20 | ### Find all compute instances having public IPv4 address 21 | 22 | ```sql copy 23 | with instances as (select yci.*, 24 | iface #>> '{primary_v4_address, one_to_one_nat, address}' address 25 | from (select id, 26 | folder_id, 27 | name, 28 | labels, 29 | fqdn, 30 | jsonb_array_elements(network_interfaces) as iface 31 | from yc_compute_instances) yci) 32 | select * 33 | from instances 34 | where address is not null 35 | ``` 36 | 37 | ### Find all public object storage buckets (access flags only) 38 | 39 | ```sql copy 40 | with buckets as (select *, 41 | (anonymous_access_flags #> '{list, value}')::bool as flags_list, 42 | (anonymous_access_flags #> '{read, value}')::bool as flags_read, 43 | (anonymous_access_flags #> '{config_read, value}')::bool as flags_config_read 44 | from yc_storage_buckets) 45 | select * 46 | from buckets 47 | where flags_list 48 | or flags_read 49 | or flags_config_read 50 | ``` 51 | -------------------------------------------------------------------------------- /docs/configuration.md: -------------------------------------------------------------------------------- 1 | # Yandex Cloud Source Plugin Configuration Reference 2 | 3 | ## Example 4 | 5 | ```yaml copy 6 | kind: source 7 | spec: 8 | name: "yc" 9 | registry: cloudquery 10 | path: yandex-cloud/yc 11 | version: "v1.0.0" 12 | destinations: ["postgresql"] 13 | tables: 14 | ["*"] 15 | spec: 16 | organization_ids: # sync these organizations only 17 | - bpf... 18 | cloud_ids: # sync these clouds only 19 | - b1g... 20 | folder_ids: # sync these folders only 21 | - b1g... 22 | --- 23 | kind: destination 24 | spec: 25 | name: "postgresql" 26 | path: "cloudquery/postgresql" 27 | registry: "cloudquery" 28 | version: "v7.1.2" 29 | spec: 30 | connection_string: "${PG_CONNECTION_STRING}" 31 | ``` 32 | 33 | ## YC Spec 34 | 35 | - `organization_ids` (`[]string`, optional, default: empty): 36 | List of Organization IDs to target. If empty, all available Organization will be targeted. 37 | 38 | - `cloud_ids` (`[]string`, optional, default: empty): 39 | List of Cloud IDs to target. If empty, all available Clouds will be targeted. 40 | 41 | - `folder_ids` (`[]string`, optional, default: empty): 42 | List of Folder IDs to target. If empty, all available Folders will be targeted. 43 | 44 | - `debug_grpc` (`bool`, default `false`): 45 | If true, will log all GRPC calls 46 | 47 | - `max_retries` (`int`, default `3`): 48 | Maxiumum number of retries for YC Client 49 | 50 | - `endpoint` (`string`, default `api.cloud.yandex.net:443`): 51 | Yandex Cloud endpoint 52 | 53 | - `concurrency` (`int`, optional, default: `10000`): 54 | A best effort maximum number of Go routines to use. Lower this number to reduce memory usage. 55 | 56 | - `scheduler` (`string`, default: `shuffle`): 57 | The scheduler to use when determining the priority of resources to sync. Currently, the only supported values are dfs (depth-first search), round-robin and shuffle. 58 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Notice to external contributors 2 | 3 | ## General info 4 | 5 | Hello! In order for us (YANDEX LLC) to accept patches and other contributions from you, you will have to adopt our Yandex Contributor License Agreement (the **CLA**). The current version of the CLA can be found here: 6 | 1) https://yandex.ru/legal/cla/?lang=en (in English) and 7 | 2) https://yandex.ru/legal/cla/?lang=ru (in Russian). 8 | 9 | By adopting the CLA, you state the following: 10 | 11 | * You obviously wish and are willingly licensing your contributions to us for our open source projects under the terms of the CLA, 12 | * You have read the terms and conditions of the CLA and agree with them in full, 13 | * You are legally able to provide and license your contributions as stated, 14 | * We may use your contributions for our open source projects and for any other our project too, 15 | * We rely on your assurances concerning the rights of third parties in relation to your contributions. 16 | 17 | If you agree with these principles, please read and adopt our CLA. By providing us your contributions, you hereby declare that you have already read and adopt our CLA, and we may freely merge your contributions with our corresponding open source project and use it in further in accordance with terms and conditions of the CLA. 18 | 19 | ## Provide contributions 20 | 21 | If you have already adopted terms and conditions of the CLA, you are able to provide your contributions. When you submit your pull request, please add the following information into it (in a separate comment): 22 | 23 | ``` 24 | I hereby agree to the terms of the CLA available at: [link]. 25 | ``` 26 | 27 | Replace the bracketed text as follows: 28 | 29 | * [link] is the link to the current version of the CLA: https://yandex.ru/legal/cla/?lang=en (in English) or https://yandex.ru/legal/cla/?lang=ru (in Russian). 30 | 31 | It is enough to provide us such notification once. 32 | -------------------------------------------------------------------------------- /resources/storage/buckets.go: -------------------------------------------------------------------------------- 1 | package storage 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/cloudquery/plugin-sdk/v4/schema" 7 | "github.com/cloudquery/plugin-sdk/v4/transformers" 8 | "github.com/yandex-cloud/cq-source-yc/client" 9 | "github.com/yandex-cloud/go-genproto/yandex/cloud/storage/v1" 10 | "google.golang.org/grpc/codes" 11 | "google.golang.org/grpc/status" 12 | ) 13 | 14 | func Buckets() *schema.Table { 15 | return &schema.Table{ 16 | Name: "yc_storage_buckets", 17 | Transform: client.TransformWithStruct( 18 | &storage.Bucket{}, 19 | transformers.WithUnwrapStructFields("Bucket"), 20 | // Id is always empty ¯\_(ツ)_/¯ 21 | transformers.WithSkipFields("Id"), 22 | transformers.WithPrimaryKeys("FolderId", "Name"), 23 | ), 24 | Resolver: fetchBuckets, 25 | Multiplex: client.FolderMultiplex, 26 | Columns: schema.ColumnList{ 27 | client.CloudIdColumn, 28 | }, 29 | } 30 | } 31 | 32 | func fetchBuckets(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- any) error { 33 | c := meta.(*client.Client) 34 | folderId := c.FolderId 35 | 36 | it := c.SDK.StorageAPI().Bucket().BucketIterator(ctx, &storage.ListBucketsRequest{FolderId: folderId}) 37 | for it.Next() { 38 | value := it.Value() 39 | // List doesn't return full info, so we need an additional fetch 40 | b, err := c.SDK.StorageAPI().Bucket().Get(ctx, &storage.GetBucketRequest{ 41 | Name: value.Name, 42 | View: storage.GetBucketRequest_VIEW_FULL, 43 | }) 44 | if err != nil { 45 | st, ok := status.FromError(err) 46 | if !ok { 47 | return err 48 | } 49 | 50 | if st.Code() == codes.PermissionDenied { 51 | // Can't fail here because then we wouldn't get all other buckets 52 | c.Logger.Warn().Str("bucket", b.Name).Msg("PermissionDenied while fetching bucket") 53 | continue 54 | } 55 | 56 | return err 57 | } 58 | 59 | res <- b 60 | } 61 | 62 | return it.Error() 63 | } 64 | -------------------------------------------------------------------------------- /client/multiplexer.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "github.com/cloudquery/plugin-sdk/v4/schema" 5 | ) 6 | 7 | func OrganizationMultiplex(meta schema.ClientMeta) []schema.ClientMeta { 8 | client := meta.(*Client) 9 | hierarchyItems := client.hierarchy.OrganizationRows() 10 | 11 | var l = make([]schema.ClientMeta, len(hierarchyItems)) 12 | for i, item := range hierarchyItems { 13 | l[i] = client.WithOrganization(item.Organization).WithMultiplexedResourceId(item.Organization) 14 | } 15 | return l 16 | } 17 | 18 | func CloudMultiplex(meta schema.ClientMeta) []schema.ClientMeta { 19 | client := meta.(*Client) 20 | hierarchyItems := client.hierarchy.CloudRows() 21 | 22 | var l = make([]schema.ClientMeta, len(hierarchyItems)) 23 | for i, item := range hierarchyItems { 24 | l[i] = client.WithOrganization(item.Organization).WithCloud(item.Cloud).WithMultiplexedResourceId(item.Cloud) 25 | } 26 | return l 27 | } 28 | 29 | func FolderMultiplex(meta schema.ClientMeta) []schema.ClientMeta { 30 | client := meta.(*Client) 31 | hierarchyItems := client.hierarchy.FolderRows() 32 | 33 | var l = make([]schema.ClientMeta, len(hierarchyItems)) 34 | for i, item := range hierarchyItems { 35 | l[i] = client.WithOrganization(item.Organization).WithCloud(item.Cloud).WithFolder(item.Folder).WithMultiplexedResourceId(item.Folder) 36 | } 37 | return l 38 | } 39 | 40 | func PrependEmptyMultiplex(multiplexer schema.Multiplexer) schema.Multiplexer { 41 | return func(meta schema.ClientMeta) []schema.ClientMeta { 42 | client := meta.(*Client) 43 | return append([]schema.ClientMeta{client}, multiplexer(meta)...) 44 | } 45 | } 46 | 47 | func CombineMultiplex(multiplexers ...schema.Multiplexer) schema.Multiplexer { 48 | return func(meta schema.ClientMeta) []schema.ClientMeta { 49 | clients := []schema.ClientMeta{} 50 | for _, m := range multiplexers { 51 | clients = append(clients, m(meta)...) 52 | } 53 | return clients 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /resources/serverless/api_gateways.go: -------------------------------------------------------------------------------- 1 | package serverless 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cloudquery/plugin-sdk/v4/schema" 8 | "github.com/cloudquery/plugin-sdk/v4/transformers" 9 | "github.com/yandex-cloud/cq-source-yc/client" 10 | "github.com/yandex-cloud/go-genproto/yandex/cloud/serverless/apigateway/v1" 11 | ) 12 | 13 | func APIGatewayGateways() *schema.Table { 14 | return &schema.Table{ 15 | Name: "yc_serverless_apigateway_gateways", 16 | Description: `https://cloud.yandex.ru/docs/api-gateway/apigateway/api-ref/grpc/apigateway_service#ApiGateway1`, 17 | Multiplex: client.FolderMultiplex, 18 | Resolver: fetchAPIGateways, 19 | Transform: client.TransformWithStruct(&apigateway.ApiGateway{}, client.PrimaryKeyIdTransformer), 20 | Relations: schema.Tables{APIGatewayOpenapiSpecs()}, 21 | Columns: schema.ColumnList{ 22 | client.CloudIdColumn, 23 | }, 24 | } 25 | } 26 | 27 | func fetchAPIGateways(ctx context.Context, meta schema.ClientMeta, _ *schema.Resource, res chan<- interface{}) error { 28 | c := meta.(*client.Client) 29 | folderId := c.FolderId 30 | 31 | it := c.SDK.Serverless().APIGateway().ApiGateway().ApiGatewayIterator(ctx, &apigateway.ListApiGatewayRequest{FolderId: folderId}) 32 | for it.Next() { 33 | res <- it.Value() 34 | } 35 | 36 | return it.Error() 37 | } 38 | 39 | func APIGatewayOpenapiSpecs() *schema.Table { 40 | return &schema.Table{ 41 | Name: "yc_serverless_apigateway_openapi_specs", 42 | Description: `https://cloud.yandex.ru/docs/api-gateway/apigateway/api-ref/grpc/apigateway_service#GetOpenapiSpecResponse`, 43 | Resolver: fetchAPIGatewayOpenapiSpecs, 44 | Transform: client.TransformWithStruct(&apigateway.GetOpenapiSpecResponse{}, transformers.WithSkipFields("ApiGatewayId")), 45 | Columns: schema.ColumnList{client.ParentIdColumn}, 46 | } 47 | } 48 | 49 | func fetchAPIGatewayOpenapiSpecs(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { 50 | c := meta.(*client.Client) 51 | apigw, ok := parent.Item.(*apigateway.ApiGateway) 52 | if !ok { 53 | return fmt.Errorf("parent is not type of *apigateway.ApiGateway: %+v", apigw) 54 | } 55 | 56 | resp, err := c.SDK.Serverless().APIGateway().ApiGateway().GetOpenapiSpec(ctx, &apigateway.GetOpenapiSpecRequest{ApiGatewayId: apigw.Id}) 57 | if err != nil { 58 | return err 59 | } 60 | res <- resp 61 | 62 | return nil 63 | } 64 | -------------------------------------------------------------------------------- /client/resourcehierarchy_test.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "context" 5 | "os" 6 | "testing" 7 | 8 | "github.com/rs/zerolog" 9 | ycsdk "github.com/yandex-cloud/go-sdk" 10 | ) 11 | 12 | func TestResourceHierarchy(t *testing.T) { 13 | t.Skip("test not mocked") 14 | ctx := context.Background() 15 | credentials, err := getCredentials() 16 | if err != nil { 17 | t.Error(err) 18 | } 19 | sdk, err := ycsdk.Build(ctx, ycsdk.Config{ 20 | Credentials: credentials, 21 | }) 22 | if err != nil { 23 | t.Error(err) 24 | } 25 | logger := zerolog.New(os.Stdout) 26 | 27 | // Validate that we indeed have hierarchy and don't have dangling resources 28 | // TODO: mock it 29 | t.Run("empty_filters", func(t *testing.T) { 30 | hierarchy, err := NewResourceHierarchy(ctx, logger, sdk, []string{}, []string{}, []string{}) 31 | if err != nil { 32 | t.Error(err) 33 | } 34 | items := hierarchy.All() 35 | for _, item := range items { 36 | algebra := []bool{ 37 | item.Organization != "", 38 | item.Cloud != "", 39 | item.Folder != "", 40 | } 41 | t.Log(item) 42 | seenOne := false 43 | seenZeroAfterOne := false 44 | for _, i := range algebra { 45 | if i == true { 46 | if seenZeroAfterOne { 47 | t.Fatalf("zeros can't be followed by ones: %+v -> %+v", algebra, item) 48 | } 49 | seenOne = true 50 | } else { 51 | if seenOne { 52 | seenZeroAfterOne = true 53 | } 54 | } 55 | } 56 | } 57 | 58 | t.Run("OrganizationRows", func(t *testing.T) { 59 | rows := hierarchy.OrganizationRows() 60 | for _, item := range rows { 61 | if item.Cloud != "" { 62 | t.Fatalf("OrganizationRows have item with not-null Cloud: %+v", item) 63 | } 64 | if item.Folder != "" { 65 | t.Fatalf("OrganizationRows have item with not-null Folder: %+v", item) 66 | } 67 | } 68 | }) 69 | 70 | t.Run("CloudRows", func(t *testing.T) { 71 | rows := hierarchy.CloudRows() 72 | for _, item := range rows { 73 | if item.Organization == "" { 74 | t.Fatalf("CloudRows have item with null Organization: %+v", item) 75 | } 76 | if item.Folder != "" { 77 | t.Fatalf("CloudRows have item with not-null Folder: %+v", item) 78 | } 79 | } 80 | }) 81 | 82 | t.Run("FolderRows", func(t *testing.T) { 83 | rows := hierarchy.FolderRows() 84 | for _, item := range rows { 85 | if item.Folder == "" { 86 | t.Fatalf("FolderRows have item with null Folder: %+v", item) 87 | } 88 | } 89 | }) 90 | }) 91 | 92 | } 93 | -------------------------------------------------------------------------------- /plugin/client.go: -------------------------------------------------------------------------------- 1 | package plugin 2 | 3 | import ( 4 | "context" 5 | "encoding/json" 6 | "fmt" 7 | 8 | "github.com/cloudquery/plugin-sdk/v4/message" 9 | "github.com/cloudquery/plugin-sdk/v4/plugin" 10 | "github.com/cloudquery/plugin-sdk/v4/scheduler" 11 | "github.com/cloudquery/plugin-sdk/v4/schema" 12 | "github.com/cloudquery/plugin-sdk/v4/state" 13 | "github.com/rs/zerolog" 14 | "github.com/yandex-cloud/cq-source-yc/client" 15 | "google.golang.org/grpc" 16 | "google.golang.org/grpc/credentials/insecure" 17 | ) 18 | 19 | const maxMsgSize = 100 * 1024 * 1024 // 100 MiB 20 | 21 | type Client struct { 22 | plugin.UnimplementedDestination 23 | scheduler *scheduler.Scheduler 24 | syncClient *client.Client 25 | options plugin.NewClientOptions 26 | allTables schema.Tables 27 | } 28 | 29 | func NewClient(ctx context.Context, logger zerolog.Logger, specBytes []byte, options plugin.NewClientOptions) (plugin.Client, error) { 30 | c := &Client{ 31 | options: options, 32 | allTables: PluginAutoGeneratedTables(), 33 | } 34 | if options.NoConnection { 35 | return c, nil 36 | } 37 | 38 | spec := client.NewDefaultSpec() 39 | 40 | if err := json.Unmarshal(specBytes, spec); err != nil { 41 | return nil, err 42 | } 43 | err := spec.Validate() 44 | if err != nil { 45 | return nil, err 46 | } 47 | 48 | c.syncClient, err = client.New(ctx, logger, spec) 49 | if err != nil { 50 | return nil, err 51 | } 52 | 53 | c.scheduler = scheduler.NewScheduler( 54 | scheduler.WithLogger(logger), 55 | scheduler.WithConcurrency(spec.Concurrency), 56 | scheduler.WithStrategy(spec.Scheduler), 57 | ) 58 | return c, nil 59 | } 60 | 61 | func (*Client) Close(_ context.Context) error { 62 | return nil 63 | } 64 | 65 | func (c *Client) Tables(_ context.Context, options plugin.TableOptions) (schema.Tables, error) { 66 | tt, err := c.allTables.FilterDfs(options.Tables, options.SkipTables, options.SkipDependentTables) 67 | if err != nil { 68 | return nil, err 69 | } 70 | return tt, nil 71 | } 72 | 73 | func (c *Client) Sync(ctx context.Context, options plugin.SyncOptions, res chan<- message.SyncMessage) error { 74 | if c.options.NoConnection { 75 | return fmt.Errorf("Client.NoConnection is not supported") 76 | } 77 | tables, err := c.allTables.FilterDfs(options.Tables, options.SkipTables, options.SkipDependentTables) 78 | if err != nil { 79 | return err 80 | } 81 | 82 | stateClient := state.Client(&state.NoOpClient{}) 83 | if options.BackendOptions != nil { 84 | conn, err := grpc.NewClient(options.BackendOptions.Connection, grpc.WithTransportCredentials(insecure.NewCredentials()), 85 | grpc.WithDefaultCallOptions( 86 | grpc.MaxCallRecvMsgSize(maxMsgSize), 87 | grpc.MaxCallSendMsgSize(maxMsgSize), 88 | )) 89 | if err != nil { 90 | return fmt.Errorf("dial grpc source plugin at %s: %w", options.BackendOptions.Connection, err) 91 | } 92 | stateClient, err = state.NewClient(ctx, conn, options.BackendOptions.TableName) 93 | if err != nil { 94 | return fmt.Errorf("create state client: %w", err) 95 | } 96 | } 97 | err = c.scheduler.Sync(ctx, c.syncClient.WithBackend(stateClient), tables, res, scheduler.WithSyncDeterministicCQID(options.DeterministicCQID)) 98 | if err != nil { 99 | return err 100 | } 101 | return stateClient.Flush(ctx) 102 | } 103 | --------------------------------------------------------------------------------