From c06c92c4ab2d90390271b4a75c43ad5338f16782 Mon Sep 17 00:00:00 2001 From: ISMAIL KABOUBI Date: Wed, 3 Jan 2024 19:45:58 +0100 Subject: [PATCH] feat(apis): adding databases apis --- apis/zz_register.go | 2 ++ config/databases/config.go | 56 +++++++++++++++++++++++++++++++++ config/external_name.go | 15 +++++++++ config/provider.go | 3 ++ internal/controller/zz_setup.go | 30 ++++++++++++++++++ 5 files changed, 106 insertions(+) create mode 100644 config/databases/config.go diff --git a/apis/zz_register.go b/apis/zz_register.go index f9505fc..71abb48 100755 --- a/apis/zz_register.go +++ b/apis/zz_register.go @@ -17,6 +17,7 @@ import ( v1alpha1 "github.com/edixos/provider-ovh/apis/accountmanagement/v1alpha1" v1alpha1additionalip "github.com/edixos/provider-ovh/apis/additionalip/v1alpha1" v1alpha1clouddiskarray "github.com/edixos/provider-ovh/apis/clouddiskarray/v1alpha1" + v1alpha1databases "github.com/edixos/provider-ovh/apis/databases/v1alpha1" v1alpha1dedicatedserver "github.com/edixos/provider-ovh/apis/dedicatedserver/v1alpha1" v1alpha1dns "github.com/edixos/provider-ovh/apis/dns/v1alpha1" v1alpha1lb "github.com/edixos/provider-ovh/apis/lb/v1alpha1" @@ -33,6 +34,7 @@ func init() { v1alpha1.SchemeBuilder.AddToScheme, v1alpha1additionalip.SchemeBuilder.AddToScheme, v1alpha1clouddiskarray.SchemeBuilder.AddToScheme, + v1alpha1databases.SchemeBuilder.AddToScheme, v1alpha1dedicatedserver.SchemeBuilder.AddToScheme, v1alpha1dns.SchemeBuilder.AddToScheme, v1alpha1lb.SchemeBuilder.AddToScheme, diff --git a/config/databases/config.go b/config/databases/config.go new file mode 100644 index 0000000..eb74403 --- /dev/null +++ b/config/databases/config.go @@ -0,0 +1,56 @@ +package databases + +import "github.com/crossplane/upjet/pkg/config" + +const ( + shortGroup = "databases" +) + +// Configure configures individual resources by adding custom ResourceConfigurators. +func Configure(p *config.Provider) { + p.AddResourceConfigurator("ovh_cloud_project_database", func(r *config.Resource) { + r.ShortGroup = shortGroup + }) + p.AddResourceConfigurator("ovh_cloud_project_database_database", func(r *config.Resource) { + r.ShortGroup = shortGroup + }) + p.AddResourceConfigurator("ovh_cloud_project_database_integration", func(r *config.Resource) { + r.ShortGroup = shortGroup + }) + p.AddResourceConfigurator("ovh_cloud_project_database_ip_restriction", func(r *config.Resource) { + r.ShortGroup = shortGroup + }) + p.AddResourceConfigurator("ovh_cloud_project_database_kafka_acl", func(r *config.Resource) { + r.ShortGroup = shortGroup + }) + p.AddResourceConfigurator("ovh_cloud_project_database_kafka_schemaregistryacl", func(r *config.Resource) { + r.ShortGroup = shortGroup + }) + p.AddResourceConfigurator("ovh_cloud_project_database_kafka_topic", func(r *config.Resource) { + r.ShortGroup = shortGroup + }) + p.AddResourceConfigurator("ovh_cloud_project_database_m3db_namespace", func(r *config.Resource) { + r.ShortGroup = shortGroup + }) + p.AddResourceConfigurator("ovh_cloud_project_database_m3db_user", func(r *config.Resource) { + r.ShortGroup = shortGroup + }) + p.AddResourceConfigurator("ovh_cloud_project_database_mongodb_user", func(r *config.Resource) { + r.ShortGroup = shortGroup + }) + p.AddResourceConfigurator("ovh_cloud_project_database_opensearch_pattern", func(r *config.Resource) { + r.ShortGroup = shortGroup + }) + p.AddResourceConfigurator("ovh_cloud_project_database_opensearch_user", func(r *config.Resource) { + r.ShortGroup = shortGroup + }) + p.AddResourceConfigurator("ovh_cloud_project_database_postgresql_user", func(r *config.Resource) { + r.ShortGroup = shortGroup + }) + p.AddResourceConfigurator("ovh_cloud_project_database_redis_user", func(r *config.Resource) { + r.ShortGroup = shortGroup + }) + p.AddResourceConfigurator("ovh_cloud_project_database_user", func(r *config.Resource) { + r.ShortGroup = shortGroup + }) +} diff --git a/config/external_name.go b/config/external_name.go index 791b555..fe0f2f0 100644 --- a/config/external_name.go +++ b/config/external_name.go @@ -53,6 +53,21 @@ var ExternalNameConfigs = map[string]config.ExternalName{ "ovh_dbaas_logs_cluster": config.NameAsIdentifier, "ovh_dbaas_logs_graylog_output_stream": config.NameAsIdentifier, "ovh_dbaas_logs_input": config.NameAsIdentifier, + "ovh_cloud_project_database": config.NameAsIdentifier, + "ovh_cloud_project_database_database": config.NameAsIdentifier, + "ovh_cloud_project_database_integration": config.NameAsIdentifier, + "ovh_cloud_project_database_ip_restriction": config.NameAsIdentifier, + "ovh_cloud_project_database_kafka_acl": config.NameAsIdentifier, + "ovh_cloud_project_database_kafka_schemaregistryacl": config.NameAsIdentifier, + "ovh_cloud_project_database_kafka_topic": config.NameAsIdentifier, + "ovh_cloud_project_database_m3db_namespace": config.NameAsIdentifier, + "ovh_cloud_project_database_m3db_user": config.NameAsIdentifier, + "ovh_cloud_project_database_mongodb_user": config.NameAsIdentifier, + "ovh_cloud_project_database_opensearch_pattern": config.NameAsIdentifier, + "ovh_cloud_project_database_opensearch_user": config.NameAsIdentifier, + "ovh_cloud_project_database_postgresql_user": config.NameAsIdentifier, + "ovh_cloud_project_database_redis_user": config.NameAsIdentifier, + "ovh_cloud_project_database_user": config.NameAsIdentifier, } // ExternalNameConfigurations applies all external name configs listed in the diff --git a/config/provider.go b/config/provider.go index f63f358..24e71b1 100644 --- a/config/provider.go +++ b/config/provider.go @@ -8,6 +8,8 @@ import ( // Note(turkenh): we are importing this to embed provider schema document _ "embed" + "github.com/edixos/provider-ovh/config/databases" + "github.com/edixos/provider-ovh/config/logs" "github.com/edixos/provider-ovh/config/lb" @@ -59,6 +61,7 @@ func GetProvider() *ujconfig.Provider { dns.Configure, lb.Configure, logs.Configure, + databases.Configure, } { configure(pc) } diff --git a/internal/controller/zz_setup.go b/internal/controller/zz_setup.go index 5e0450f..8561921 100755 --- a/internal/controller/zz_setup.go +++ b/internal/controller/zz_setup.go @@ -21,6 +21,21 @@ import ( reverse "github.com/edixos/provider-ovh/internal/controller/additionalip/reverse" service "github.com/edixos/provider-ovh/internal/controller/additionalip/service" cephacl "github.com/edixos/provider-ovh/internal/controller/clouddiskarray/cephacl" + projectdatabase "github.com/edixos/provider-ovh/internal/controller/databases/projectdatabase" + projectdatabasedatabase "github.com/edixos/provider-ovh/internal/controller/databases/projectdatabasedatabase" + projectdatabaseintegration "github.com/edixos/provider-ovh/internal/controller/databases/projectdatabaseintegration" + projectdatabaseiprestriction "github.com/edixos/provider-ovh/internal/controller/databases/projectdatabaseiprestriction" + projectdatabasekafkaacl "github.com/edixos/provider-ovh/internal/controller/databases/projectdatabasekafkaacl" + projectdatabasekafkaschemaregistryacl "github.com/edixos/provider-ovh/internal/controller/databases/projectdatabasekafkaschemaregistryacl" + projectdatabasekafkatopic "github.com/edixos/provider-ovh/internal/controller/databases/projectdatabasekafkatopic" + projectdatabasem3dbnamespace "github.com/edixos/provider-ovh/internal/controller/databases/projectdatabasem3dbnamespace" + projectdatabasem3dbuser "github.com/edixos/provider-ovh/internal/controller/databases/projectdatabasem3dbuser" + projectdatabasemongodbuser "github.com/edixos/provider-ovh/internal/controller/databases/projectdatabasemongodbuser" + projectdatabaseopensearchpattern "github.com/edixos/provider-ovh/internal/controller/databases/projectdatabaseopensearchpattern" + projectdatabaseopensearchuser "github.com/edixos/provider-ovh/internal/controller/databases/projectdatabaseopensearchuser" + projectdatabasepostgresqluser "github.com/edixos/provider-ovh/internal/controller/databases/projectdatabasepostgresqluser" + projectdatabaseredisuser "github.com/edixos/provider-ovh/internal/controller/databases/projectdatabaseredisuser" + projectdatabaseuser "github.com/edixos/provider-ovh/internal/controller/databases/projectdatabaseuser" installationtemplate "github.com/edixos/provider-ovh/internal/controller/dedicatedserver/installationtemplate" installationtemplatepartitionscheme "github.com/edixos/provider-ovh/internal/controller/dedicatedserver/installationtemplatepartitionscheme" installationtemplatepartitionschemehardwareraid "github.com/edixos/provider-ovh/internal/controller/dedicatedserver/installationtemplatepartitionschemehardwareraid" @@ -70,6 +85,21 @@ func Setup(mgr ctrl.Manager, o controller.Options) error { reverse.Setup, service.Setup, cephacl.Setup, + projectdatabase.Setup, + projectdatabasedatabase.Setup, + projectdatabaseintegration.Setup, + projectdatabaseiprestriction.Setup, + projectdatabasekafkaacl.Setup, + projectdatabasekafkaschemaregistryacl.Setup, + projectdatabasekafkatopic.Setup, + projectdatabasem3dbnamespace.Setup, + projectdatabasem3dbuser.Setup, + projectdatabasemongodbuser.Setup, + projectdatabaseopensearchpattern.Setup, + projectdatabaseopensearchuser.Setup, + projectdatabasepostgresqluser.Setup, + projectdatabaseredisuser.Setup, + projectdatabaseuser.Setup, installationtemplate.Setup, installationtemplatepartitionscheme.Setup, installationtemplatepartitionschemehardwareraid.Setup,