data_management_grpc.go 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. package service
  2. import "context"
  3. type DataManagementPostgresConfig struct {
  4. Host string `json:"host"`
  5. Port int32 `json:"port"`
  6. User string `json:"user"`
  7. Password string `json:"password,omitempty"`
  8. PasswordConfigured bool `json:"password_configured"`
  9. Database string `json:"database"`
  10. SSLMode string `json:"ssl_mode"`
  11. ContainerName string `json:"container_name"`
  12. }
  13. type DataManagementRedisConfig struct {
  14. Addr string `json:"addr"`
  15. Username string `json:"username"`
  16. Password string `json:"password,omitempty"`
  17. PasswordConfigured bool `json:"password_configured"`
  18. DB int32 `json:"db"`
  19. ContainerName string `json:"container_name"`
  20. }
  21. type DataManagementS3Config struct {
  22. Enabled bool `json:"enabled"`
  23. Endpoint string `json:"endpoint"`
  24. Region string `json:"region"`
  25. Bucket string `json:"bucket"`
  26. AccessKeyID string `json:"access_key_id"`
  27. SecretAccessKey string `json:"secret_access_key,omitempty"`
  28. SecretAccessKeyConfigured bool `json:"secret_access_key_configured"`
  29. Prefix string `json:"prefix"`
  30. ForcePathStyle bool `json:"force_path_style"`
  31. UseSSL bool `json:"use_ssl"`
  32. }
  33. type DataManagementConfig struct {
  34. SourceMode string `json:"source_mode"`
  35. BackupRoot string `json:"backup_root"`
  36. SQLitePath string `json:"sqlite_path,omitempty"`
  37. RetentionDays int32 `json:"retention_days"`
  38. KeepLast int32 `json:"keep_last"`
  39. ActivePostgresID string `json:"active_postgres_profile_id"`
  40. ActiveRedisID string `json:"active_redis_profile_id"`
  41. Postgres DataManagementPostgresConfig `json:"postgres"`
  42. Redis DataManagementRedisConfig `json:"redis"`
  43. S3 DataManagementS3Config `json:"s3"`
  44. ActiveS3ProfileID string `json:"active_s3_profile_id"`
  45. }
  46. type DataManagementTestS3Result struct {
  47. OK bool `json:"ok"`
  48. Message string `json:"message"`
  49. }
  50. type DataManagementCreateBackupJobInput struct {
  51. BackupType string
  52. UploadToS3 bool
  53. TriggeredBy string
  54. IdempotencyKey string
  55. S3ProfileID string
  56. PostgresID string
  57. RedisID string
  58. }
  59. type DataManagementListBackupJobsInput struct {
  60. PageSize int32
  61. PageToken string
  62. Status string
  63. BackupType string
  64. }
  65. type DataManagementArtifactInfo struct {
  66. LocalPath string `json:"local_path"`
  67. SizeBytes int64 `json:"size_bytes"`
  68. SHA256 string `json:"sha256"`
  69. }
  70. type DataManagementS3ObjectInfo struct {
  71. Bucket string `json:"bucket"`
  72. Key string `json:"key"`
  73. ETag string `json:"etag"`
  74. }
  75. type DataManagementBackupJob struct {
  76. JobID string `json:"job_id"`
  77. BackupType string `json:"backup_type"`
  78. Status string `json:"status"`
  79. TriggeredBy string `json:"triggered_by"`
  80. IdempotencyKey string `json:"idempotency_key,omitempty"`
  81. UploadToS3 bool `json:"upload_to_s3"`
  82. S3ProfileID string `json:"s3_profile_id,omitempty"`
  83. PostgresID string `json:"postgres_profile_id,omitempty"`
  84. RedisID string `json:"redis_profile_id,omitempty"`
  85. StartedAt string `json:"started_at,omitempty"`
  86. FinishedAt string `json:"finished_at,omitempty"`
  87. ErrorMessage string `json:"error_message,omitempty"`
  88. Artifact DataManagementArtifactInfo `json:"artifact"`
  89. S3Object DataManagementS3ObjectInfo `json:"s3"`
  90. }
  91. type DataManagementSourceProfile struct {
  92. SourceType string `json:"source_type"`
  93. ProfileID string `json:"profile_id"`
  94. Name string `json:"name"`
  95. IsActive bool `json:"is_active"`
  96. Config DataManagementSourceConfig `json:"config"`
  97. PasswordConfigured bool `json:"password_configured"`
  98. CreatedAt string `json:"created_at,omitempty"`
  99. UpdatedAt string `json:"updated_at,omitempty"`
  100. }
  101. type DataManagementSourceConfig struct {
  102. Host string `json:"host"`
  103. Port int32 `json:"port"`
  104. User string `json:"user"`
  105. Password string `json:"password,omitempty"`
  106. Database string `json:"database"`
  107. SSLMode string `json:"ssl_mode"`
  108. Addr string `json:"addr"`
  109. Username string `json:"username"`
  110. DB int32 `json:"db"`
  111. ContainerName string `json:"container_name"`
  112. }
  113. type DataManagementCreateSourceProfileInput struct {
  114. SourceType string
  115. ProfileID string
  116. Name string
  117. Config DataManagementSourceConfig
  118. SetActive bool
  119. }
  120. type DataManagementUpdateSourceProfileInput struct {
  121. SourceType string
  122. ProfileID string
  123. Name string
  124. Config DataManagementSourceConfig
  125. }
  126. type DataManagementS3Profile struct {
  127. ProfileID string `json:"profile_id"`
  128. Name string `json:"name"`
  129. IsActive bool `json:"is_active"`
  130. S3 DataManagementS3Config `json:"s3"`
  131. SecretAccessKeyConfigured bool `json:"secret_access_key_configured"`
  132. CreatedAt string `json:"created_at,omitempty"`
  133. UpdatedAt string `json:"updated_at,omitempty"`
  134. }
  135. type DataManagementCreateS3ProfileInput struct {
  136. ProfileID string
  137. Name string
  138. S3 DataManagementS3Config
  139. SetActive bool
  140. }
  141. type DataManagementUpdateS3ProfileInput struct {
  142. ProfileID string
  143. Name string
  144. S3 DataManagementS3Config
  145. }
  146. type DataManagementListBackupJobsResult struct {
  147. Items []DataManagementBackupJob `json:"items"`
  148. NextPageToken string `json:"next_page_token,omitempty"`
  149. }
  150. func (s *DataManagementService) GetConfig(ctx context.Context) (DataManagementConfig, error) {
  151. _ = ctx
  152. return DataManagementConfig{}, s.deprecatedError()
  153. }
  154. func (s *DataManagementService) UpdateConfig(ctx context.Context, cfg DataManagementConfig) (DataManagementConfig, error) {
  155. _, _ = ctx, cfg
  156. return DataManagementConfig{}, s.deprecatedError()
  157. }
  158. func (s *DataManagementService) ListSourceProfiles(ctx context.Context, sourceType string) ([]DataManagementSourceProfile, error) {
  159. _, _ = ctx, sourceType
  160. return nil, s.deprecatedError()
  161. }
  162. func (s *DataManagementService) CreateSourceProfile(ctx context.Context, input DataManagementCreateSourceProfileInput) (DataManagementSourceProfile, error) {
  163. _, _ = ctx, input
  164. return DataManagementSourceProfile{}, s.deprecatedError()
  165. }
  166. func (s *DataManagementService) UpdateSourceProfile(ctx context.Context, input DataManagementUpdateSourceProfileInput) (DataManagementSourceProfile, error) {
  167. _, _ = ctx, input
  168. return DataManagementSourceProfile{}, s.deprecatedError()
  169. }
  170. func (s *DataManagementService) DeleteSourceProfile(ctx context.Context, sourceType, profileID string) error {
  171. _, _, _ = ctx, sourceType, profileID
  172. return s.deprecatedError()
  173. }
  174. func (s *DataManagementService) SetActiveSourceProfile(ctx context.Context, sourceType, profileID string) (DataManagementSourceProfile, error) {
  175. _, _, _ = ctx, sourceType, profileID
  176. return DataManagementSourceProfile{}, s.deprecatedError()
  177. }
  178. func (s *DataManagementService) ValidateS3(ctx context.Context, cfg DataManagementS3Config) (DataManagementTestS3Result, error) {
  179. _, _ = ctx, cfg
  180. return DataManagementTestS3Result{}, s.deprecatedError()
  181. }
  182. func (s *DataManagementService) ListS3Profiles(ctx context.Context) ([]DataManagementS3Profile, error) {
  183. _ = ctx
  184. return nil, s.deprecatedError()
  185. }
  186. func (s *DataManagementService) CreateS3Profile(ctx context.Context, input DataManagementCreateS3ProfileInput) (DataManagementS3Profile, error) {
  187. _, _ = ctx, input
  188. return DataManagementS3Profile{}, s.deprecatedError()
  189. }
  190. func (s *DataManagementService) UpdateS3Profile(ctx context.Context, input DataManagementUpdateS3ProfileInput) (DataManagementS3Profile, error) {
  191. _, _ = ctx, input
  192. return DataManagementS3Profile{}, s.deprecatedError()
  193. }
  194. func (s *DataManagementService) DeleteS3Profile(ctx context.Context, profileID string) error {
  195. _, _ = ctx, profileID
  196. return s.deprecatedError()
  197. }
  198. func (s *DataManagementService) SetActiveS3Profile(ctx context.Context, profileID string) (DataManagementS3Profile, error) {
  199. _, _ = ctx, profileID
  200. return DataManagementS3Profile{}, s.deprecatedError()
  201. }
  202. func (s *DataManagementService) CreateBackupJob(ctx context.Context, input DataManagementCreateBackupJobInput) (DataManagementBackupJob, error) {
  203. _, _ = ctx, input
  204. return DataManagementBackupJob{}, s.deprecatedError()
  205. }
  206. func (s *DataManagementService) ListBackupJobs(ctx context.Context, input DataManagementListBackupJobsInput) (DataManagementListBackupJobsResult, error) {
  207. _, _ = ctx, input
  208. return DataManagementListBackupJobsResult{}, s.deprecatedError()
  209. }
  210. func (s *DataManagementService) GetBackupJob(ctx context.Context, jobID string) (DataManagementBackupJob, error) {
  211. _, _ = ctx, jobID
  212. return DataManagementBackupJob{}, s.deprecatedError()
  213. }
  214. func (s *DataManagementService) deprecatedError() error {
  215. return ErrDataManagementDeprecated.WithMetadata(map[string]string{"socket_path": s.SocketPath()})
  216. }