GetDataSourceConfig implements the S3Endpoint Interface by using the real object configs + the local datasource configs for bucket and base folder.
(ctx context.Context, _ *object.GetDataSourceConfigRequest)
| 281 | |
| 282 | // GetDataSourceConfig implements the S3Endpoint Interface by using the real object configs + the local datasource configs for bucket and base folder. |
| 283 | func (h *Handler) GetDataSourceConfig(ctx context.Context, _ *object.GetDataSourceConfigRequest) (*object.GetDataSourceConfigResponse, error) { |
| 284 | |
| 285 | sh, ok := h.getSyncer(ctx) |
| 286 | if !ok { |
| 287 | return nil, errors.WithMessage(errors.StatusInternalServerError, "cannot find datasource in context") |
| 288 | } |
| 289 | |
| 290 | if sh.SyncConfig == nil { |
| 291 | return nil, errors.WithMessage(errors.StatusServiceUnavailable, "syncConfig not initialized yet") |
| 292 | } |
| 293 | sh.SyncConfig.ObjectsHost = sh.ObjectConfig.RunningHost |
| 294 | sh.SyncConfig.ObjectsPort = sh.ObjectConfig.RunningPort |
| 295 | sh.SyncConfig.ObjectsSecure = sh.ObjectConfig.RunningSecure |
| 296 | sh.SyncConfig.ApiKey = sh.ObjectConfig.ApiKey |
| 297 | sh.SyncConfig.ApiSecret = sh.ObjectConfig.ApiSecret |
| 298 | |
| 299 | return &object.GetDataSourceConfigResponse{ |
| 300 | DataSource: sh.SyncConfig, |
| 301 | }, nil |
| 302 | } |
| 303 | |
| 304 | // CleanResourcesBeforeDelete gracefully stops the sync task and remove the associated resync job |
| 305 | func (h *Handler) CleanResourcesBeforeDelete(ctx context.Context, _ *object.CleanResourcesRequest) (*object.CleanResourcesResponse, error) { |