diff --git a/client/client.go b/client/client.go index ba481b3..43e1014 100644 --- a/client/client.go +++ b/client/client.go @@ -143,6 +143,24 @@ func (m *CmdbClient) CreateStage(req *pb.CreateStageRequest) (*pb.CreateStageRes return res, nil } + +func (m *CmdbClient) GetLifecycles() (*pb.ListLifecyclesResponse, error) { + + // We can now create stubs that wrap conn: + stub := pb.NewLifecyclesClient(m.Conn) + + // Now we can use the stub to make RPCs + ctx := metadata.NewOutgoingContext(context.Background(), + metadata.Pairs("Authorization", "Bearer "+m.ApiKey)) + reqList := &pb.ListLifecycleRequest{} + respList, err := stub.List(ctx, reqList) + if err != nil { + return nil, err + } + + return respList, nil +} + func (m *CmdbClient) CreateEnvironment(req *pb.CreateEnvironmentRequest) (*pb.CreateEnvironmentResponse, error) { // We can now create stubs that wrap conn: @@ -208,10 +226,10 @@ func (m *CmdbClient) CreateApplicationInstance(req *pb.CreateApplicationInstance return res, nil } -func (m *CmdbClient) CreateChartVersion(req *pb.CreateChartVersionRequest) (*pb.CreateChartVersionResponse, error) { +func (m *CmdbClient) CreateChartVersion(req *pb.CreateAppVersionRequest) (*pb.CreateAppVersionResponse, error) { // We can now create stubs that wrap conn: - stub := pb.NewChartVersionsClient(m.Conn) + stub := pb.NewAppVersionsClient(m.Conn) // Now we can use the stub to make RPCs ctx := metadata.NewOutgoingContext(context.Background(), diff --git a/db/migrations/00008_app_configs.down.sql b/db/migrations/00008_app_configs.down.sql new file mode 100644 index 0000000..974bf47 --- /dev/null +++ b/db/migrations/00008_app_configs.down.sql @@ -0,0 +1,4 @@ + +DROP TRIGGER app_configs_updated_at on app_configs; + +DROP TABLE app_configs; diff --git a/db/migrations/00008_app_configs.up.sql b/db/migrations/00008_app_configs.up.sql new file mode 100644 index 0000000..840c6d8 --- /dev/null +++ b/db/migrations/00008_app_configs.up.sql @@ -0,0 +1,18 @@ + +CREATE TABLE app_configs ( + id serial primary key, + account_id text, + created_at timestamptz DEFAULT current_timestamp, + updated_at timestamptz DEFAULT NULL, + name text DEFAULT NULL, + description text DEFAULT NULL, + config_yaml text DEFAULT NULL, + application_id int REFERENCES applications(id) ON DELETE CASCADE, + lifecycle_id int REFERENCES lifecycles(id) ON DELETE CASCADE +); + +CREATE TRIGGER app_configs_updated_at + BEFORE UPDATE OR INSERT ON app_configs + FOR EACH ROW + EXECUTE PROCEDURE set_updated_at(); + diff --git a/db/migrations/00008_application_instances.down.sql b/db/migrations/00009_application_instances.down.sql similarity index 100% rename from db/migrations/00008_application_instances.down.sql rename to db/migrations/00009_application_instances.down.sql diff --git a/db/migrations/00008_application_instances.up.sql b/db/migrations/00009_application_instances.up.sql similarity index 100% rename from db/migrations/00008_application_instances.up.sql rename to db/migrations/00009_application_instances.up.sql diff --git a/db/migrations/00009_vaults.down.sql b/db/migrations/00010_vaults.down.sql similarity index 100% rename from db/migrations/00009_vaults.down.sql rename to db/migrations/00010_vaults.down.sql diff --git a/db/migrations/00009_vaults.up.sql b/db/migrations/00010_vaults.up.sql similarity index 100% rename from db/migrations/00009_vaults.up.sql rename to db/migrations/00010_vaults.up.sql diff --git a/db/migrations/00010_secrets.down.sql b/db/migrations/00011_secrets.down.sql similarity index 100% rename from db/migrations/00010_secrets.down.sql rename to db/migrations/00011_secrets.down.sql diff --git a/db/migrations/00010_secrets.up.sql b/db/migrations/00011_secrets.up.sql similarity index 100% rename from db/migrations/00010_secrets.up.sql rename to db/migrations/00011_secrets.up.sql diff --git a/db/migrations/00011_artifacts.down.sql b/db/migrations/00012_artifacts.down.sql similarity index 100% rename from db/migrations/00011_artifacts.down.sql rename to db/migrations/00012_artifacts.down.sql diff --git a/db/migrations/00011_artifacts.up.sql b/db/migrations/00012_artifacts.up.sql similarity index 100% rename from db/migrations/00011_artifacts.up.sql rename to db/migrations/00012_artifacts.up.sql diff --git a/db/migrations/00012_kube_clusters.down.sql b/db/migrations/00013_kube_clusters.down.sql similarity index 100% rename from db/migrations/00012_kube_clusters.down.sql rename to db/migrations/00013_kube_clusters.down.sql diff --git a/db/migrations/00012_kube_clusters.up.sql b/db/migrations/00013_kube_clusters.up.sql similarity index 100% rename from db/migrations/00012_kube_clusters.up.sql rename to db/migrations/00013_kube_clusters.up.sql diff --git a/db/migrations/00013_deployments.down.sql b/db/migrations/00014_deployments.down.sql similarity index 100% rename from db/migrations/00013_deployments.down.sql rename to db/migrations/00014_deployments.down.sql diff --git a/db/migrations/00013_deployments.up.sql b/db/migrations/00014_deployments.up.sql similarity index 100% rename from db/migrations/00013_deployments.up.sql rename to db/migrations/00014_deployments.up.sql diff --git a/pkg/pb/cmdb.proto b/pkg/pb/cmdb.proto index 91bf853..d6eaaeb 100644 --- a/pkg/pb/cmdb.proto +++ b/pkg/pb/cmdb.proto @@ -450,7 +450,7 @@ service Lifecycles { // ------------------------------------------------------------ -// AppConfig represents a custom configuration for Application +// dro represents a custom configuration for Application // ------------------------------------------------------------ message AppConfig { option (gorm.opts) = {