From 8984979bd2a2daab8a6632b994bdaba6c2a573a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wenkai=20Yin=28=E5=B0=B9=E6=96=87=E5=BC=80=29?= Date: Tue, 24 Mar 2020 20:45:45 +0800 Subject: [PATCH] Relocate/rename some packages (#11183) Fixes #11016 1. src/pkg/q->src/internal/q 2. src/internal->src/lib (internal is a reserved package name of golang) 3. src/api->src/controller Signed-off-by: Wenkai Yin --- src/chartserver/reverse_proxy.go | 2 +- src/common/http/client.go | 4 +- .../artifact/abstractor.go | 2 +- .../artifact/abstractor_test.go | 2 +- src/{api => controller}/artifact/const.go | 0 .../artifact/controller.go | 41 ++++++++++--------- .../artifact/controller_test.go | 12 +++--- src/{api => controller}/artifact/model.go | 2 +- .../artifact/processor/base/index.go | 4 +- .../artifact/processor/base/manifest.go | 4 +- .../artifact/processor/base/manifest_test.go | 0 .../artifact/processor/chart/chart.go | 6 +-- .../artifact/processor/chart/chart_test.go | 4 +- .../artifact/processor/cnab/cnab.go | 4 +- .../artifact/processor/cnab/cnab_test.go | 2 +- .../artifact/processor/default.go | 2 +- .../artifact/processor/default_test.go | 0 .../artifact/processor/image/index.go | 4 +- .../artifact/processor/image/index_test.go | 0 .../artifact/processor/image/manifest_v1.go | 4 +- .../processor/image/manifest_v1_test.go | 2 +- .../artifact/processor/image/manifest_v2.go | 6 +-- .../processor/image/manifest_v2_test.go | 4 +- .../artifact/processor/processor.go | 0 .../artifact/processor/processor_test.go | 0 src/{api => controller}/blob/controller.go | 4 +- .../blob/controller_test.go | 0 src/{api => controller}/blob/options.go | 0 .../chartmuseum/controller.go | 2 +- .../event/handler/auditlog/auditlog.go | 4 +- .../event/handler/auditlog/auditlog_test.go | 6 +-- src/{api => controller}/event/handler/init.go | 16 ++++---- .../event/handler/internal/artifact.go | 12 +++--- .../event/handler/internal/artifact_test.go | 0 .../event/handler/replication/replication.go | 2 +- .../event/handler/util/util.go | 0 .../handler/webhook/artifact/artifact.go | 6 +-- .../handler/webhook/artifact/artifact_test.go | 0 .../handler/webhook/artifact/replication.go | 4 +- .../webhook/artifact/replication_test.go | 2 +- .../event/handler/webhook/chart/chart.go | 4 +- .../event/handler/webhook/chart/chart_test.go | 2 +- .../event/handler/webhook/quota/quota.go | 4 +- .../event/handler/webhook/quota/quota_test.go | 2 +- .../event/handler/webhook/scan/delete.go | 10 ++--- .../event/handler/webhook/scan/scan.go | 10 ++--- .../event/handler/webhook/scan/scan_test.go | 6 +-- .../event/metadata/artifact.go | 2 +- .../event/metadata/artifact_test.go | 2 +- .../event/metadata/chart.go | 2 +- .../event/metadata/chart_test.go | 2 +- .../event/metadata/project.go | 2 +- .../event/metadata/project_test.go | 2 +- .../event/metadata/quota.go | 2 +- .../event/metadata/quota_test.go | 2 +- .../event/metadata/replication.go | 2 +- .../event/metadata/repository.go | 2 +- .../event/metadata/repository_test.go | 2 +- .../event/metadata/scan.go | 2 +- .../event/metadata/scan_test.go | 2 +- src/{api => controller}/event/metadata/tag.go | 2 +- .../event/metadata/tag_test.go | 2 +- src/{api => controller}/event/topic.go | 0 src/{api => controller}/project/controller.go | 2 +- .../project/controller_test.go | 2 +- src/{api => controller}/project/options.go | 0 src/{api => controller}/quota/controller.go | 6 +-- .../quota/controller_test.go | 2 +- .../quota/driver/driver.go | 2 +- .../quota/driver/project/project.go | 8 ++-- .../quota/driver/project/project_test.go | 0 .../quota/driver/project/util.go | 2 +- src/{api => controller}/quota/options.go | 0 src/{api => controller}/quota/util.go | 4 +- src/{api => controller}/quota/util_test.go | 4 +- .../repository/controller.go | 8 ++-- .../repository/controller_test.go | 6 +-- src/{api => controller}/scan/all_handler.go | 6 +-- .../scan/base_controller.go | 6 +-- .../scan/base_controller_test.go | 4 +- src/{api => controller}/scan/checker.go | 4 +- src/{api => controller}/scan/checker_test.go | 2 +- src/{api => controller}/scan/controller.go | 2 +- src/{api => controller}/scan/options.go | 0 .../scanner/base_controller.go | 2 +- .../scanner/base_controller_test.go | 2 +- src/{api => controller}/scanner/controller.go | 2 +- src/{api => controller}/scanner/options.go | 0 src/{api => controller}/tag/controller.go | 8 ++-- .../tag/controller_test.go | 4 +- src/{api => controller}/tag/model.go | 0 src/core/api/admin_job.go | 2 +- src/core/api/base.go | 2 +- src/core/api/chart_repository.go | 2 +- src/core/api/immutabletagrule.go | 2 +- src/core/api/internal.go | 6 +-- src/core/api/notification_job_test.go | 2 +- src/core/api/notification_policy.go | 2 +- src/core/api/notification_policy_test.go | 2 +- src/core/api/pro_scanner.go | 4 +- src/core/api/pro_scanner_test.go | 4 +- src/core/api/project.go | 2 +- src/core/api/robot.go | 2 +- src/core/api/scan_all.go | 6 +-- src/core/api/scanners.go | 4 +- src/core/api/scanners_test.go | 4 +- src/core/api/search.go | 6 +-- src/core/api/user.go | 4 +- src/core/controllers/base.go | 4 +- src/core/controllers/controllers_test.go | 6 +-- src/core/main.go | 2 +- .../service/notifications/admin/handler.go | 6 +-- .../service/notifications/jobs/handler.go | 4 +- src/jobservice/job/impl/context.go | 2 +- src/jobservice/job/impl/default_context.go | 2 +- .../job/impl/gc/garbage_collection.go | 4 +- src/{internal => lib}/authorizer.go | 2 +- src/{internal => lib}/context.go | 2 +- src/{internal => lib}/context_test.go | 2 +- src/{internal => lib}/error/errors.go | 0 src/{internal => lib}/error/errors_test.go | 0 src/{internal => lib}/link.go | 2 +- src/{internal => lib}/link_test.go | 2 +- src/{internal => lib}/orm/error.go | 2 +- src/{internal => lib}/orm/error_test.go | 2 +- src/{internal => lib}/orm/orm.go | 0 src/{internal => lib}/orm/orm_test.go | 0 src/{internal => lib}/orm/query.go | 2 +- src/{internal => lib}/orm/query_test.go | 0 src/{internal => lib}/orm/tx.go | 0 src/{pkg => lib}/q/builder.go | 2 +- src/{pkg => lib}/q/builder_test.go | 0 src/{pkg => lib}/q/query.go | 0 src/{internal => lib}/request.go | 2 +- src/{internal => lib}/request_test.go | 2 +- src/{internal => lib}/response_buffer.go | 2 +- src/{internal => lib}/response_buffer_test.go | 2 +- src/{internal => lib}/response_recorder.go | 2 +- .../response_recorder_test.go | 2 +- src/{internal => lib}/selector/candidate.go | 0 src/{internal => lib}/selector/result.go | 0 src/{internal => lib}/selector/selector.go | 0 .../selector/selectors/doublestar/selector.go | 2 +- .../selectors/doublestar/selector_test.go | 2 +- .../selector/selectors/index/index.go | 4 +- .../selector/selectors/label/selector.go | 2 +- .../selector/selectors/label/selector_test.go | 2 +- src/migration/artifact.go | 4 +- src/migration/migration.go | 2 +- src/pkg/artifact/dao/dao.go | 6 +-- src/pkg/artifact/dao/dao_test.go | 6 +-- src/pkg/artifact/manager.go | 2 +- src/pkg/artifact/manager_test.go | 2 +- src/pkg/artifactrash/dao/dao.go | 4 +- src/pkg/artifactrash/dao/dao_test.go | 4 +- src/pkg/audit/dao/dao.go | 6 +-- src/pkg/audit/dao/dao_test.go | 6 +-- src/pkg/audit/manager.go | 2 +- src/pkg/audit/manager_test.go | 2 +- src/pkg/blob/dao/dao.go | 4 +- src/pkg/clients/core/client.go | 2 +- src/pkg/clients/core/image.go | 2 +- src/pkg/immutabletag/dao/immutable.go | 2 +- src/pkg/immutabletag/match/matcher.go | 2 +- src/pkg/immutabletag/match/rule/match.go | 4 +- src/pkg/immutabletag/match/rule/match_test.go | 2 +- src/pkg/label/dao.go | 6 +-- src/pkg/label/dao_test.go | 6 +-- src/pkg/label/manager.go | 4 +- src/pkg/label/manager_test.go | 4 +- src/pkg/quota/dao/dao.go | 2 +- src/pkg/quota/dao/dao_test.go | 2 +- src/pkg/quota/manager.go | 2 +- src/pkg/registry/auth/authorizer.go | 4 +- src/pkg/registry/auth/basic/authorizer.go | 4 +- src/pkg/registry/auth/bearer/authorizer.go | 8 ++-- .../registry/auth/bearer/authorizer_test.go | 2 +- src/pkg/registry/auth/null/authorizer.go | 4 +- src/pkg/registry/client.go | 10 ++--- src/pkg/registry/client_test.go | 6 +-- src/pkg/repository/dao/dao.go | 6 +-- src/pkg/repository/dao/dao_test.go | 6 +-- src/pkg/repository/manager.go | 4 +- src/pkg/repository/manager_test.go | 2 +- src/pkg/retention/dep/client.go | 2 +- src/pkg/retention/dep/client_test.go | 6 +-- src/pkg/retention/job.go | 2 +- src/pkg/retention/job_test.go | 4 +- src/pkg/retention/launcher.go | 8 ++-- src/pkg/retention/launcher_test.go | 2 +- .../policy/action/index/index_test.go | 2 +- src/pkg/retention/policy/action/performer.go | 2 +- .../retention/policy/action/performer_test.go | 2 +- src/pkg/retention/policy/alg/or/processor.go | 2 +- .../retention/policy/alg/or/processor_test.go | 6 +-- src/pkg/retention/policy/alg/processor.go | 2 +- src/pkg/retention/policy/builder.go | 4 +- src/pkg/retention/policy/builder_test.go | 8 ++-- .../retention/policy/rule/always/evaluator.go | 2 +- .../policy/rule/always/evaluator_test.go | 2 +- .../retention/policy/rule/dayspl/evaluator.go | 2 +- .../policy/rule/dayspl/evaluator_test.go | 2 +- .../retention/policy/rule/daysps/evaluator.go | 2 +- .../policy/rule/daysps/evaluator_test.go | 2 +- src/pkg/retention/policy/rule/evaluator.go | 2 +- .../retention/policy/rule/index/index_test.go | 2 +- .../retention/policy/rule/lastx/evaluator.go | 2 +- .../policy/rule/lastx/evaluator_test.go | 2 +- .../policy/rule/latestk/evaluator.go | 2 +- .../policy/rule/latestk/evaluator_test.go | 2 +- .../policy/rule/latestpl/evaluator.go | 2 +- .../policy/rule/latestpl/evaluator_test.go | 2 +- .../policy/rule/latestps/evaluator.go | 2 +- .../policy/rule/latestps/evaluator_test.go | 2 +- .../policy/rule/nothing/evaluator.go | 2 +- .../policy/rule/nothing/evaluator_test.go | 2 +- src/pkg/robot/controller.go | 2 +- src/pkg/robot/controller_test.go | 2 +- src/pkg/robot/dao/robot.go | 2 +- src/pkg/robot/dao/robot_test.go | 2 +- src/pkg/robot/manager.go | 2 +- src/pkg/robot/manager_test.go | 2 +- src/pkg/scan/dao/scan/report.go | 2 +- src/pkg/scan/dao/scan/report_test.go | 2 +- src/pkg/scan/dao/scanner/registration.go | 2 +- src/pkg/scan/dao/scanner/registration_test.go | 2 +- src/pkg/scan/init.go | 2 +- src/pkg/scan/init_test.go | 2 +- src/pkg/scan/report/base_manager.go | 4 +- src/pkg/scan/scanner/manager.go | 2 +- src/pkg/scan/scanner/manager_test.go | 2 +- src/pkg/scan/scanner/mocks/manager.go | 2 +- src/pkg/tag/dao/dao.go | 6 +-- src/pkg/tag/dao/dao_test.go | 6 +-- src/pkg/tag/manager.go | 2 +- src/pkg/tag/manager_test.go | 2 +- .../adapter/harbor/image_registry.go | 2 +- src/replication/adapter/native/adapter.go | 6 +-- src/server/error/error.go | 2 +- src/server/error/error_test.go | 2 +- .../middleware/apiversion/api_version.go | 4 +- .../middleware/apiversion/api_version_test.go | 4 +- .../middleware/artifactinfo/artifact_info.go | 8 ++-- .../artifactinfo/artifact_info_test.go | 14 +++---- src/server/middleware/blob/controller.go | 6 +-- src/server/middleware/blob/copy_artifact.go | 4 +- .../middleware/blob/patch_blob_upload_test.go | 2 +- .../blob/post_initiate_blob_upload_test.go | 2 +- .../middleware/blob/put_blob_upload_test.go | 2 +- .../middleware/blob/put_manifest_test.go | 2 +- .../middleware/contenttrust/contenttrust.go | 14 +++---- src/server/middleware/csrf/csrf.go | 6 +-- src/server/middleware/immutable/pushmf.go | 12 +++--- .../middleware/immutable/pushmf_test.go | 8 ++-- src/server/middleware/middleware.go | 8 ++-- .../middleware/notification/notification.go | 4 +- .../notification/notification_test.go | 2 +- src/server/middleware/orm/orm.go | 2 +- src/server/middleware/orm/orm_test.go | 2 +- src/server/middleware/quota/controller.go | 10 ++--- src/server/middleware/quota/copy_artifact.go | 8 ++-- .../middleware/quota/copy_artifact_test.go | 2 +- .../quota/post_initiate_blob_upload.go | 4 +- .../middleware/quota/put_blob_upload.go | 2 +- src/server/middleware/quota/put_manifest.go | 8 ++-- .../middleware/quota/put_manifest_test.go | 2 +- src/server/middleware/quota/quota.go | 6 +-- src/server/middleware/quota/quota_test.go | 8 ++-- .../middleware/quota/upload_chart_version.go | 4 +- src/server/middleware/quota/util.go | 2 +- src/server/middleware/readonly/readonly.go | 2 +- src/server/middleware/security/auth_proxy.go | 4 +- .../middleware/security/auth_proxy_test.go | 4 +- src/server/middleware/security/idtoken.go | 4 +- .../middleware/security/idtoken_test.go | 6 +-- src/server/middleware/security/oidc_cli.go | 4 +- .../middleware/security/oidc_cli_test.go | 4 +- src/server/middleware/security/security.go | 4 +- src/server/middleware/session/session.go | 4 +- src/server/middleware/session/session_test.go | 4 +- .../middleware/transaction/transaction.go | 8 ++-- .../transaction/transaction_test.go | 2 +- src/server/middleware/util.go | 8 ++-- src/server/middleware/v2auth/auth.go | 8 ++-- src/server/middleware/v2auth/auth_test.go | 24 +++++------ .../middleware/vulnerable/controller.go | 6 +-- .../middleware/vulnerable/vulnerable.go | 14 +++---- .../middleware/vulnerable/vulnerable_test.go | 12 +++--- src/server/registry/catalog.go | 4 +- src/server/registry/catalog_test.go | 2 +- src/server/registry/manifest.go | 14 +++---- src/server/registry/manifest_test.go | 6 +-- src/server/registry/tag.go | 8 ++-- src/server/registry/tag_test.go | 4 +- src/server/v2.0/handler/artifact.go | 14 +++---- src/server/v2.0/handler/assembler/vul.go | 6 +-- src/server/v2.0/handler/auditlog.go | 4 +- src/server/v2.0/handler/base.go | 16 ++++---- src/server/v2.0/handler/model/artifact.go | 2 +- src/server/v2.0/handler/project.go | 2 +- src/server/v2.0/handler/repository.go | 10 ++--- src/server/v2.0/handler/scan.go | 6 +-- src/server/v2.0/handler/util.go | 6 +-- src/testing/api/artifact/controller.go | 6 +-- src/testing/api/blob/controller.go | 2 +- src/testing/api/project/controller.go | 2 +- src/testing/api/quota/controller.go | 2 +- src/testing/api/repository/controller.go | 2 +- src/testing/api/scan/checker.go | 2 +- src/testing/api/scan/controller.go | 4 +- src/testing/api/scanner/controller.go | 4 +- src/testing/api/tag/controller.go | 4 +- src/testing/clients/dumb_core_client.go | 2 +- src/testing/pkg/artifact/manager.go | 2 +- src/testing/pkg/immutabletag/matcher.go | 2 +- src/testing/pkg/notification/manager.go | 2 +- src/testing/pkg/repository/manager.go | 2 +- src/testing/pkg/scan/scanner/manager.go | 2 +- src/testing/pkg/tag/manager.go | 2 +- src/testing/suite.go | 4 +- 320 files changed, 592 insertions(+), 591 deletions(-) rename src/{api => controller}/artifact/abstractor.go (98%) rename src/{api => controller}/artifact/abstractor_test.go (99%) rename src/{api => controller}/artifact/const.go (100%) rename src/{api => controller}/artifact/controller.go (96%) rename src/{api => controller}/artifact/controller_test.go (98%) rename src/{api => controller}/artifact/model.go (97%) rename src/{api => controller}/artifact/processor/base/index.go (94%) rename src/{api => controller}/artifact/processor/base/manifest.go (96%) rename src/{api => controller}/artifact/processor/base/manifest_test.go (100%) rename src/{api => controller}/artifact/processor/chart/chart.go (95%) rename src/{api => controller}/artifact/processor/chart/chart_test.go (97%) rename src/{api => controller}/artifact/processor/cnab/cnab.go (93%) rename src/{api => controller}/artifact/processor/cnab/cnab_test.go (97%) rename src/{api => controller}/artifact/processor/default.go (97%) rename src/{api => controller}/artifact/processor/default_test.go (100%) rename src/{api => controller}/artifact/processor/image/index.go (90%) rename src/{api => controller}/artifact/processor/image/index_test.go (100%) rename src/{api => controller}/artifact/processor/image/manifest_v1.go (94%) rename src/{api => controller}/artifact/processor/image/manifest_v1_test.go (99%) rename src/{api => controller}/artifact/processor/image/manifest_v2.go (93%) rename src/{api => controller}/artifact/processor/image/manifest_v2_test.go (97%) rename src/{api => controller}/artifact/processor/processor.go (100%) rename src/{api => controller}/artifact/processor/processor_test.go (100%) rename src/{api => controller}/blob/controller.go (98%) rename src/{api => controller}/blob/controller_test.go (100%) rename src/{api => controller}/blob/options.go (100%) rename src/{api => controller}/chartmuseum/controller.go (98%) rename src/{api => controller}/event/handler/auditlog/auditlog.go (95%) rename src/{api => controller}/event/handler/auditlog/auditlog_test.go (94%) rename src/{api => controller}/event/handler/init.go (76%) rename src/{api => controller}/event/handler/internal/artifact.go (88%) rename src/{api => controller}/event/handler/internal/artifact_test.go (100%) rename src/{api => controller}/event/handler/replication/replication.go (98%) rename src/{api => controller}/event/handler/util/util.go (100%) rename src/{api => controller}/event/handler/webhook/artifact/artifact.go (96%) rename src/{api => controller}/event/handler/webhook/artifact/artifact_test.go (100%) rename src/{api => controller}/event/handler/webhook/artifact/replication.go (98%) rename src/{api => controller}/event/handler/webhook/artifact/replication_test.go (99%) rename src/{api => controller}/event/handler/webhook/chart/chart.go (96%) rename src/{api => controller}/event/handler/webhook/chart/chart_test.go (98%) rename src/{api => controller}/event/handler/webhook/quota/quota.go (96%) rename src/{api => controller}/event/handler/webhook/quota/quota_test.go (98%) rename src/{api => controller}/event/handler/webhook/scan/delete.go (89%) rename src/{api => controller}/event/handler/webhook/scan/scan.go (94%) rename src/{api => controller}/event/handler/webhook/scan/scan_test.go (96%) rename src/{api => controller}/event/metadata/artifact.go (98%) rename src/{api => controller}/event/metadata/artifact_test.go (97%) rename src/{api => controller}/event/metadata/chart.go (96%) rename src/{api => controller}/event/metadata/chart_test.go (97%) rename src/{api => controller}/event/metadata/project.go (96%) rename src/{api => controller}/event/metadata/project_test.go (96%) rename src/{api => controller}/event/metadata/quota.go (94%) rename src/{api => controller}/event/metadata/quota_test.go (95%) rename src/{api => controller}/event/metadata/replication.go (91%) rename src/{api => controller}/event/metadata/repository.go (95%) rename src/{api => controller}/event/metadata/repository_test.go (95%) rename src/{api => controller}/event/metadata/scan.go (94%) rename src/{api => controller}/event/metadata/scan_test.go (96%) rename src/{api => controller}/event/metadata/tag.go (97%) rename src/{api => controller}/event/metadata/tag_test.go (97%) rename src/{api => controller}/event/topic.go (100%) rename src/{api => controller}/project/controller.go (98%) rename src/{api => controller}/project/controller_test.go (96%) rename src/{api => controller}/project/options.go (100%) rename src/{api => controller}/quota/controller.go (98%) rename src/{api => controller}/quota/controller_test.go (99%) rename src/{api => controller}/quota/driver/driver.go (90%) rename src/{api => controller}/quota/driver/project/project.go (95%) rename src/{api => controller}/quota/driver/project/project_test.go (100%) rename src/{api => controller}/quota/driver/project/util.go (97%) rename src/{api => controller}/quota/options.go (100%) rename src/{api => controller}/quota/util.go (96%) rename src/{api => controller}/quota/util_test.go (97%) rename src/{api => controller}/repository/controller.go (96%) rename src/{api => controller}/repository/controller_test.go (96%) rename src/{api => controller}/scan/all_handler.go (94%) rename src/{api => controller}/scan/base_controller.go (99%) rename src/{api => controller}/scan/base_controller_test.go (99%) rename src/{api => controller}/scan/checker.go (96%) rename src/{api => controller}/scan/checker_test.go (98%) rename src/{api => controller}/scan/controller.go (98%) rename src/{api => controller}/scan/options.go (100%) rename src/{api => controller}/scanner/base_controller.go (99%) rename src/{api => controller}/scanner/base_controller_test.go (99%) rename src/{api => controller}/scanner/controller.go (99%) rename src/{api => controller}/scanner/options.go (100%) rename src/{api => controller}/tag/controller.go (97%) rename src/{api => controller}/tag/controller_test.go (98%) rename src/{api => controller}/tag/model.go (100%) rename src/{internal => lib}/authorizer.go (97%) rename src/{internal => lib}/context.go (99%) rename src/{internal => lib}/context_test.go (98%) rename src/{internal => lib}/error/errors.go (100%) rename src/{internal => lib}/error/errors_test.go (100%) rename src/{internal => lib}/link.go (99%) rename src/{internal => lib}/link_test.go (98%) rename src/{internal => lib}/orm/error.go (97%) rename src/{internal => lib}/orm/error_test.go (97%) rename src/{internal => lib}/orm/orm.go (100%) rename src/{internal => lib}/orm/orm_test.go (100%) rename src/{internal => lib}/orm/query.go (98%) rename src/{internal => lib}/orm/query_test.go (100%) rename src/{internal => lib}/orm/tx.go (100%) rename src/{pkg => lib}/q/builder.go (98%) rename src/{pkg => lib}/q/builder_test.go (100%) rename src/{pkg => lib}/q/query.go (100%) rename src/{internal => lib}/request.go (99%) rename src/{internal => lib}/request_test.go (98%) rename src/{internal => lib}/response_buffer.go (99%) rename src/{internal => lib}/response_buffer_test.go (99%) rename src/{internal => lib}/response_recorder.go (99%) rename src/{internal => lib}/response_recorder_test.go (98%) rename src/{internal => lib}/selector/candidate.go (100%) rename src/{internal => lib}/selector/result.go (100%) rename src/{internal => lib}/selector/selector.go (100%) rename src/{internal => lib}/selector/selectors/doublestar/selector.go (98%) rename src/{internal => lib}/selector/selectors/doublestar/selector_test.go (99%) rename src/{internal => lib}/selector/selectors/index/index.go (95%) rename src/{internal => lib}/selector/selectors/label/selector.go (96%) rename src/{internal => lib}/selector/selectors/label/selector_test.go (98%) diff --git a/src/chartserver/reverse_proxy.go b/src/chartserver/reverse_proxy.go index 02b883c8fb..189b47c41e 100644 --- a/src/chartserver/reverse_proxy.go +++ b/src/chartserver/reverse_proxy.go @@ -4,7 +4,7 @@ import ( "bytes" "encoding/json" "fmt" - "github.com/goharbor/harbor/src/api/event/metadata" + "github.com/goharbor/harbor/src/controller/event/metadata" "io/ioutil" "log" "net/http" diff --git a/src/common/http/client.go b/src/common/http/client.go index c971e3cd58..2c6099a34e 100644 --- a/src/common/http/client.go +++ b/src/common/http/client.go @@ -25,7 +25,7 @@ import ( "reflect" "github.com/goharbor/harbor/src/common/http/modifier" - "github.com/goharbor/harbor/src/internal" + "github.com/goharbor/harbor/src/lib" ) const ( @@ -264,7 +264,7 @@ func (c *Client) GetAndIteratePagination(endpoint string, v interface{}) error { resources = reflect.AppendSlice(resources, reflect.Indirect(res)) endpoint = "" - links := internal.ParseLinks(resp.Header.Get("Link")) + links := lib.ParseLinks(resp.Header.Get("Link")) for _, link := range links { if link.Rel == "next" { endpoint = url.Scheme + "://" + url.Host + link.URL diff --git a/src/api/artifact/abstractor.go b/src/controller/artifact/abstractor.go similarity index 98% rename from src/api/artifact/abstractor.go rename to src/controller/artifact/abstractor.go index 011d159afc..070c24af77 100644 --- a/src/api/artifact/abstractor.go +++ b/src/controller/artifact/abstractor.go @@ -21,7 +21,7 @@ import ( "github.com/docker/distribution/manifest/manifestlist" "github.com/docker/distribution/manifest/schema1" "github.com/docker/distribution/manifest/schema2" - "github.com/goharbor/harbor/src/api/artifact/processor" + "github.com/goharbor/harbor/src/controller/artifact/processor" "github.com/goharbor/harbor/src/pkg/artifact" "github.com/goharbor/harbor/src/pkg/registry" v1 "github.com/opencontainers/image-spec/specs-go/v1" diff --git a/src/api/artifact/abstractor_test.go b/src/controller/artifact/abstractor_test.go similarity index 99% rename from src/api/artifact/abstractor_test.go rename to src/controller/artifact/abstractor_test.go index 6b2f4812ef..ee7ffe050a 100644 --- a/src/api/artifact/abstractor_test.go +++ b/src/controller/artifact/abstractor_test.go @@ -18,7 +18,7 @@ import ( "github.com/docker/distribution" "github.com/docker/distribution/manifest/schema1" "github.com/docker/distribution/manifest/schema2" - "github.com/goharbor/harbor/src/api/artifact/processor" + "github.com/goharbor/harbor/src/controller/artifact/processor" "github.com/goharbor/harbor/src/pkg/artifact" tart "github.com/goharbor/harbor/src/testing/pkg/artifact" "github.com/goharbor/harbor/src/testing/pkg/registry" diff --git a/src/api/artifact/const.go b/src/controller/artifact/const.go similarity index 100% rename from src/api/artifact/const.go rename to src/controller/artifact/const.go diff --git a/src/api/artifact/controller.go b/src/controller/artifact/controller.go similarity index 96% rename from src/api/artifact/controller.go rename to src/controller/artifact/controller.go index e931e62ce4..abb781110b 100644 --- a/src/api/artifact/controller.go +++ b/src/controller/artifact/controller.go @@ -19,11 +19,25 @@ import ( "context" "errors" "fmt" - "github.com/goharbor/harbor/src/api/artifact/processor" - "github.com/goharbor/harbor/src/api/event/metadata" - "github.com/goharbor/harbor/src/api/tag" - "github.com/goharbor/harbor/src/internal" - "github.com/goharbor/harbor/src/internal/orm" + "strings" + "time" + + // registry image resolvers + _ "github.com/goharbor/harbor/src/controller/artifact/processor/image" + // register chart resolver + _ "github.com/goharbor/harbor/src/controller/artifact/processor/chart" + // register CNAB resolver + _ "github.com/goharbor/harbor/src/controller/artifact/processor/cnab" + + "github.com/goharbor/harbor/src/common/utils/log" + "github.com/goharbor/harbor/src/controller/artifact/processor" + "github.com/goharbor/harbor/src/controller/event/metadata" + "github.com/goharbor/harbor/src/controller/tag" + "github.com/goharbor/harbor/src/lib" + ierror "github.com/goharbor/harbor/src/lib/error" + "github.com/goharbor/harbor/src/lib/orm" + "github.com/goharbor/harbor/src/lib/q" + "github.com/goharbor/harbor/src/pkg/artifact" "github.com/goharbor/harbor/src/pkg/artifactrash" "github.com/goharbor/harbor/src/pkg/artifactrash/model" "github.com/goharbor/harbor/src/pkg/blob" @@ -32,23 +46,10 @@ import ( "github.com/goharbor/harbor/src/pkg/label" "github.com/goharbor/harbor/src/pkg/notification" "github.com/goharbor/harbor/src/pkg/registry" + "github.com/goharbor/harbor/src/pkg/repository" "github.com/goharbor/harbor/src/pkg/signature" model_tag "github.com/goharbor/harbor/src/pkg/tag/model/tag" "github.com/opencontainers/go-digest" - "strings" - "time" - - // registry image resolvers - _ "github.com/goharbor/harbor/src/api/artifact/processor/image" - // register chart resolver - _ "github.com/goharbor/harbor/src/api/artifact/processor/chart" - // register CNAB resolver - _ "github.com/goharbor/harbor/src/api/artifact/processor/cnab" - "github.com/goharbor/harbor/src/common/utils/log" - ierror "github.com/goharbor/harbor/src/internal/error" - "github.com/goharbor/harbor/src/pkg/artifact" - "github.com/goharbor/harbor/src/pkg/q" - "github.com/goharbor/harbor/src/pkg/repository" ) var ( @@ -583,7 +584,7 @@ func (c *controller) populateLabels(ctx context.Context, art *Artifact) { func (c *controller) populateAdditionLinks(ctx context.Context, artifact *Artifact) { types := processor.Get(artifact.MediaType).ListAdditionTypes() if len(types) > 0 { - version := internal.GetAPIVersion(ctx) + version := lib.GetAPIVersion(ctx) for _, t := range types { artifact.SetAdditionLink(strings.ToLower(t), version) } diff --git a/src/api/artifact/controller_test.go b/src/controller/artifact/controller_test.go similarity index 98% rename from src/api/artifact/controller_test.go rename to src/controller/artifact/controller_test.go index 5401fe0865..60906f5b05 100644 --- a/src/api/artifact/controller_test.go +++ b/src/controller/artifact/controller_test.go @@ -19,13 +19,13 @@ import ( "testing" "time" - "github.com/goharbor/harbor/src/api/tag" "github.com/goharbor/harbor/src/common/models" - "github.com/goharbor/harbor/src/internal" - ierror "github.com/goharbor/harbor/src/internal/error" - "github.com/goharbor/harbor/src/internal/orm" + "github.com/goharbor/harbor/src/controller/tag" + "github.com/goharbor/harbor/src/lib" + ierror "github.com/goharbor/harbor/src/lib/error" + "github.com/goharbor/harbor/src/lib/orm" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/artifact" - "github.com/goharbor/harbor/src/pkg/q" model_tag "github.com/goharbor/harbor/src/pkg/tag/model/tag" tagtesting "github.com/goharbor/harbor/src/testing/api/tag" ormtesting "github.com/goharbor/harbor/src/testing/lib/orm" @@ -113,7 +113,7 @@ func (c *controllerTestSuite) TestAssembleArtifact() { }, } c.tagCtl.On("List").Return([]*tag.Tag{tg}, nil) - ctx := internal.WithAPIVersion(nil, "2.0") + ctx := lib.WithAPIVersion(nil, "2.0") lb := &models.Label{ ID: 1, Name: "label", diff --git a/src/api/artifact/model.go b/src/controller/artifact/model.go similarity index 97% rename from src/api/artifact/model.go rename to src/controller/artifact/model.go index 2f6d9b5b8d..ea271e3b54 100644 --- a/src/api/artifact/model.go +++ b/src/controller/artifact/model.go @@ -18,9 +18,9 @@ import ( "fmt" "github.com/goharbor/harbor/src/server/v2.0/models" - "github.com/goharbor/harbor/src/api/tag" cmodels "github.com/goharbor/harbor/src/common/models" "github.com/goharbor/harbor/src/common/utils" + "github.com/goharbor/harbor/src/controller/tag" "github.com/goharbor/harbor/src/pkg/artifact" ) diff --git a/src/api/artifact/processor/base/index.go b/src/controller/artifact/processor/base/index.go similarity index 94% rename from src/api/artifact/processor/base/index.go rename to src/controller/artifact/processor/base/index.go index 092913f957..6d0d5600b2 100644 --- a/src/api/artifact/processor/base/index.go +++ b/src/controller/artifact/processor/base/index.go @@ -16,8 +16,8 @@ package base import ( "context" - "github.com/goharbor/harbor/src/api/artifact/processor" - ierror "github.com/goharbor/harbor/src/internal/error" + "github.com/goharbor/harbor/src/controller/artifact/processor" + ierror "github.com/goharbor/harbor/src/lib/error" "github.com/goharbor/harbor/src/pkg/artifact" "github.com/goharbor/harbor/src/pkg/registry" ) diff --git a/src/api/artifact/processor/base/manifest.go b/src/controller/artifact/processor/base/manifest.go similarity index 96% rename from src/api/artifact/processor/base/manifest.go rename to src/controller/artifact/processor/base/manifest.go index af2e12368b..bcf376f5d5 100644 --- a/src/api/artifact/processor/base/manifest.go +++ b/src/controller/artifact/processor/base/manifest.go @@ -17,8 +17,8 @@ package base import ( "context" "encoding/json" - "github.com/goharbor/harbor/src/api/artifact/processor" - ierror "github.com/goharbor/harbor/src/internal/error" + "github.com/goharbor/harbor/src/controller/artifact/processor" + ierror "github.com/goharbor/harbor/src/lib/error" "github.com/goharbor/harbor/src/pkg/artifact" "github.com/goharbor/harbor/src/pkg/registry" "github.com/opencontainers/image-spec/specs-go/v1" diff --git a/src/api/artifact/processor/base/manifest_test.go b/src/controller/artifact/processor/base/manifest_test.go similarity index 100% rename from src/api/artifact/processor/base/manifest_test.go rename to src/controller/artifact/processor/base/manifest_test.go diff --git a/src/api/artifact/processor/chart/chart.go b/src/controller/artifact/processor/chart/chart.go similarity index 95% rename from src/api/artifact/processor/chart/chart.go rename to src/controller/artifact/processor/chart/chart.go index 403fa87b4b..9a94961b01 100644 --- a/src/api/artifact/processor/chart/chart.go +++ b/src/controller/artifact/processor/chart/chart.go @@ -19,10 +19,10 @@ import ( "encoding/json" "io/ioutil" - ps "github.com/goharbor/harbor/src/api/artifact/processor" - "github.com/goharbor/harbor/src/api/artifact/processor/base" "github.com/goharbor/harbor/src/common/utils/log" - ierror "github.com/goharbor/harbor/src/internal/error" + ps "github.com/goharbor/harbor/src/controller/artifact/processor" + "github.com/goharbor/harbor/src/controller/artifact/processor/base" + ierror "github.com/goharbor/harbor/src/lib/error" "github.com/goharbor/harbor/src/pkg/artifact" "github.com/goharbor/harbor/src/pkg/chart" v1 "github.com/opencontainers/image-spec/specs-go/v1" diff --git a/src/api/artifact/processor/chart/chart_test.go b/src/controller/artifact/processor/chart/chart_test.go similarity index 97% rename from src/api/artifact/processor/chart/chart_test.go rename to src/controller/artifact/processor/chart/chart_test.go index 770e78106f..3b6e1414c0 100644 --- a/src/api/artifact/processor/chart/chart_test.go +++ b/src/controller/artifact/processor/chart/chart_test.go @@ -16,8 +16,8 @@ package chart import ( "github.com/docker/distribution" - "github.com/goharbor/harbor/src/api/artifact/processor/base" - ierror "github.com/goharbor/harbor/src/internal/error" + "github.com/goharbor/harbor/src/controller/artifact/processor/base" + ierror "github.com/goharbor/harbor/src/lib/error" "github.com/goharbor/harbor/src/pkg/artifact" chartserver "github.com/goharbor/harbor/src/pkg/chart" "github.com/goharbor/harbor/src/testing/pkg/chart" diff --git a/src/api/artifact/processor/cnab/cnab.go b/src/controller/artifact/processor/cnab/cnab.go similarity index 93% rename from src/api/artifact/processor/cnab/cnab.go rename to src/controller/artifact/processor/cnab/cnab.go index 4b62357a26..66e25a5be3 100644 --- a/src/api/artifact/processor/cnab/cnab.go +++ b/src/controller/artifact/processor/cnab/cnab.go @@ -17,9 +17,9 @@ package cnab import ( "context" - ps "github.com/goharbor/harbor/src/api/artifact/processor" - "github.com/goharbor/harbor/src/api/artifact/processor/base" "github.com/goharbor/harbor/src/common/utils/log" + ps "github.com/goharbor/harbor/src/controller/artifact/processor" + "github.com/goharbor/harbor/src/controller/artifact/processor/base" "github.com/goharbor/harbor/src/pkg/artifact" ) diff --git a/src/api/artifact/processor/cnab/cnab_test.go b/src/controller/artifact/processor/cnab/cnab_test.go similarity index 97% rename from src/api/artifact/processor/cnab/cnab_test.go rename to src/controller/artifact/processor/cnab/cnab_test.go index c63d149d43..dd5e5cedf2 100644 --- a/src/api/artifact/processor/cnab/cnab_test.go +++ b/src/controller/artifact/processor/cnab/cnab_test.go @@ -16,7 +16,7 @@ package cnab import ( "github.com/docker/distribution" - "github.com/goharbor/harbor/src/api/artifact/processor/base" + "github.com/goharbor/harbor/src/controller/artifact/processor/base" "github.com/goharbor/harbor/src/pkg/artifact" "github.com/goharbor/harbor/src/testing/pkg/registry" v1 "github.com/opencontainers/image-spec/specs-go/v1" diff --git a/src/api/artifact/processor/default.go b/src/controller/artifact/processor/default.go similarity index 97% rename from src/api/artifact/processor/default.go rename to src/controller/artifact/processor/default.go index 6899c1cee2..b9c5f9b9d7 100644 --- a/src/api/artifact/processor/default.go +++ b/src/controller/artifact/processor/default.go @@ -16,7 +16,7 @@ package processor import ( "context" - ierror "github.com/goharbor/harbor/src/internal/error" + ierror "github.com/goharbor/harbor/src/lib/error" "github.com/goharbor/harbor/src/pkg/artifact" "regexp" "strings" diff --git a/src/api/artifact/processor/default_test.go b/src/controller/artifact/processor/default_test.go similarity index 100% rename from src/api/artifact/processor/default_test.go rename to src/controller/artifact/processor/default_test.go diff --git a/src/api/artifact/processor/image/index.go b/src/controller/artifact/processor/image/index.go similarity index 90% rename from src/api/artifact/processor/image/index.go rename to src/controller/artifact/processor/image/index.go index 5b31d4d26e..bda1bc6e9b 100644 --- a/src/api/artifact/processor/image/index.go +++ b/src/controller/artifact/processor/image/index.go @@ -16,9 +16,9 @@ package image import ( "github.com/docker/distribution/manifest/manifestlist" - "github.com/goharbor/harbor/src/api/artifact/processor" - "github.com/goharbor/harbor/src/api/artifact/processor/base" "github.com/goharbor/harbor/src/common/utils/log" + "github.com/goharbor/harbor/src/controller/artifact/processor" + "github.com/goharbor/harbor/src/controller/artifact/processor/base" v1 "github.com/opencontainers/image-spec/specs-go/v1" ) diff --git a/src/api/artifact/processor/image/index_test.go b/src/controller/artifact/processor/image/index_test.go similarity index 100% rename from src/api/artifact/processor/image/index_test.go rename to src/controller/artifact/processor/image/index_test.go diff --git a/src/api/artifact/processor/image/manifest_v1.go b/src/controller/artifact/processor/image/manifest_v1.go similarity index 94% rename from src/api/artifact/processor/image/manifest_v1.go rename to src/controller/artifact/processor/image/manifest_v1.go index 5eef20e3e8..a1c7ba3739 100644 --- a/src/api/artifact/processor/image/manifest_v1.go +++ b/src/controller/artifact/processor/image/manifest_v1.go @@ -18,9 +18,9 @@ import ( "context" "encoding/json" "github.com/docker/distribution/manifest/schema1" - "github.com/goharbor/harbor/src/api/artifact/processor" "github.com/goharbor/harbor/src/common/utils/log" - ierror "github.com/goharbor/harbor/src/internal/error" + "github.com/goharbor/harbor/src/controller/artifact/processor" + ierror "github.com/goharbor/harbor/src/lib/error" "github.com/goharbor/harbor/src/pkg/artifact" ) diff --git a/src/api/artifact/processor/image/manifest_v1_test.go b/src/controller/artifact/processor/image/manifest_v1_test.go similarity index 99% rename from src/api/artifact/processor/image/manifest_v1_test.go rename to src/controller/artifact/processor/image/manifest_v1_test.go index 8cedd5bbec..6da23edecb 100644 --- a/src/api/artifact/processor/image/manifest_v1_test.go +++ b/src/controller/artifact/processor/image/manifest_v1_test.go @@ -15,7 +15,7 @@ package image import ( - ierror "github.com/goharbor/harbor/src/internal/error" + ierror "github.com/goharbor/harbor/src/lib/error" "github.com/goharbor/harbor/src/pkg/artifact" "github.com/stretchr/testify/suite" "testing" diff --git a/src/api/artifact/processor/image/manifest_v2.go b/src/controller/artifact/processor/image/manifest_v2.go similarity index 93% rename from src/api/artifact/processor/image/manifest_v2.go rename to src/controller/artifact/processor/image/manifest_v2.go index 3b76a4c187..f908efe32f 100644 --- a/src/api/artifact/processor/image/manifest_v2.go +++ b/src/controller/artifact/processor/image/manifest_v2.go @@ -18,10 +18,10 @@ import ( "context" "encoding/json" "github.com/docker/distribution/manifest/schema2" - "github.com/goharbor/harbor/src/api/artifact/processor" - "github.com/goharbor/harbor/src/api/artifact/processor/base" "github.com/goharbor/harbor/src/common/utils/log" - ierror "github.com/goharbor/harbor/src/internal/error" + "github.com/goharbor/harbor/src/controller/artifact/processor" + "github.com/goharbor/harbor/src/controller/artifact/processor/base" + ierror "github.com/goharbor/harbor/src/lib/error" "github.com/goharbor/harbor/src/pkg/artifact" "github.com/opencontainers/image-spec/specs-go/v1" ) diff --git a/src/api/artifact/processor/image/manifest_v2_test.go b/src/controller/artifact/processor/image/manifest_v2_test.go similarity index 97% rename from src/api/artifact/processor/image/manifest_v2_test.go rename to src/controller/artifact/processor/image/manifest_v2_test.go index 48de596b85..7d157ff80f 100644 --- a/src/api/artifact/processor/image/manifest_v2_test.go +++ b/src/controller/artifact/processor/image/manifest_v2_test.go @@ -17,8 +17,8 @@ package image import ( "github.com/docker/distribution" "github.com/docker/distribution/manifest/schema2" - "github.com/goharbor/harbor/src/api/artifact/processor/base" - ierror "github.com/goharbor/harbor/src/internal/error" + "github.com/goharbor/harbor/src/controller/artifact/processor/base" + ierror "github.com/goharbor/harbor/src/lib/error" "github.com/goharbor/harbor/src/pkg/artifact" "github.com/goharbor/harbor/src/testing/pkg/registry" "github.com/stretchr/testify/suite" diff --git a/src/api/artifact/processor/processor.go b/src/controller/artifact/processor/processor.go similarity index 100% rename from src/api/artifact/processor/processor.go rename to src/controller/artifact/processor/processor.go diff --git a/src/api/artifact/processor/processor_test.go b/src/controller/artifact/processor/processor_test.go similarity index 100% rename from src/api/artifact/processor/processor_test.go rename to src/controller/artifact/processor/processor_test.go diff --git a/src/api/blob/controller.go b/src/controller/blob/controller.go similarity index 98% rename from src/api/blob/controller.go rename to src/controller/blob/controller.go index 9ff18ef5d5..7f9232d520 100644 --- a/src/api/blob/controller.go +++ b/src/controller/blob/controller.go @@ -23,8 +23,8 @@ import ( "github.com/goharbor/harbor/src/common/models" "github.com/goharbor/harbor/src/common/utils/log" util "github.com/goharbor/harbor/src/common/utils/redis" - ierror "github.com/goharbor/harbor/src/internal/error" - "github.com/goharbor/harbor/src/internal/orm" + ierror "github.com/goharbor/harbor/src/lib/error" + "github.com/goharbor/harbor/src/lib/orm" "github.com/goharbor/harbor/src/pkg/blob" ) diff --git a/src/api/blob/controller_test.go b/src/controller/blob/controller_test.go similarity index 100% rename from src/api/blob/controller_test.go rename to src/controller/blob/controller_test.go diff --git a/src/api/blob/options.go b/src/controller/blob/options.go similarity index 100% rename from src/api/blob/options.go rename to src/controller/blob/options.go diff --git a/src/api/chartmuseum/controller.go b/src/controller/chartmuseum/controller.go similarity index 98% rename from src/api/chartmuseum/controller.go rename to src/controller/chartmuseum/controller.go index 4cd1087ee0..78f24c357d 100644 --- a/src/api/chartmuseum/controller.go +++ b/src/controller/chartmuseum/controller.go @@ -22,11 +22,11 @@ import ( "strings" "sync" - "github.com/goharbor/harbor/src/api/project" "github.com/goharbor/harbor/src/chartserver" "github.com/goharbor/harbor/src/common" "github.com/goharbor/harbor/src/common/config" commonhttp "github.com/goharbor/harbor/src/common/http" + "github.com/goharbor/harbor/src/controller/project" ) var ( diff --git a/src/api/event/handler/auditlog/auditlog.go b/src/controller/event/handler/auditlog/auditlog.go similarity index 95% rename from src/api/event/handler/auditlog/auditlog.go rename to src/controller/event/handler/auditlog/auditlog.go index 01437916e8..853d5d43d6 100644 --- a/src/api/event/handler/auditlog/auditlog.go +++ b/src/controller/event/handler/auditlog/auditlog.go @@ -17,9 +17,9 @@ package auditlog import ( "context" beegorm "github.com/astaxie/beego/orm" - "github.com/goharbor/harbor/src/api/event" "github.com/goharbor/harbor/src/common/utils/log" - "github.com/goharbor/harbor/src/internal/orm" + "github.com/goharbor/harbor/src/controller/event" + "github.com/goharbor/harbor/src/lib/orm" "github.com/goharbor/harbor/src/pkg/audit" am "github.com/goharbor/harbor/src/pkg/audit/model" ) diff --git a/src/api/event/handler/auditlog/auditlog_test.go b/src/controller/event/handler/auditlog/auditlog_test.go similarity index 94% rename from src/api/event/handler/auditlog/auditlog_test.go rename to src/controller/event/handler/auditlog/auditlog_test.go index ff9c25c5c6..ffc3227f98 100644 --- a/src/api/event/handler/auditlog/auditlog_test.go +++ b/src/controller/event/handler/auditlog/auditlog_test.go @@ -18,13 +18,13 @@ import ( "context" "testing" - "github.com/goharbor/harbor/src/api/event" - "github.com/goharbor/harbor/src/api/event/metadata" common_dao "github.com/goharbor/harbor/src/common/dao" + "github.com/goharbor/harbor/src/controller/event" + "github.com/goharbor/harbor/src/controller/event/metadata" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/audit/model" "github.com/goharbor/harbor/src/pkg/notifier" ne "github.com/goharbor/harbor/src/pkg/notifier/event" - "github.com/goharbor/harbor/src/pkg/q" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/suite" ) diff --git a/src/api/event/handler/init.go b/src/controller/event/handler/init.go similarity index 76% rename from src/api/event/handler/init.go rename to src/controller/event/handler/init.go index 5362a07bbc..2acb34932a 100644 --- a/src/api/event/handler/init.go +++ b/src/controller/event/handler/init.go @@ -1,14 +1,14 @@ package handler import ( - "github.com/goharbor/harbor/src/api/event" - "github.com/goharbor/harbor/src/api/event/handler/auditlog" - "github.com/goharbor/harbor/src/api/event/handler/internal" - "github.com/goharbor/harbor/src/api/event/handler/replication" - "github.com/goharbor/harbor/src/api/event/handler/webhook/artifact" - "github.com/goharbor/harbor/src/api/event/handler/webhook/chart" - "github.com/goharbor/harbor/src/api/event/handler/webhook/quota" - "github.com/goharbor/harbor/src/api/event/handler/webhook/scan" + "github.com/goharbor/harbor/src/controller/event" + "github.com/goharbor/harbor/src/controller/event/handler/auditlog" + "github.com/goharbor/harbor/src/controller/event/handler/internal" + "github.com/goharbor/harbor/src/controller/event/handler/replication" + "github.com/goharbor/harbor/src/controller/event/handler/webhook/artifact" + "github.com/goharbor/harbor/src/controller/event/handler/webhook/chart" + "github.com/goharbor/harbor/src/controller/event/handler/webhook/quota" + "github.com/goharbor/harbor/src/controller/event/handler/webhook/scan" "github.com/goharbor/harbor/src/pkg/notifier" ) diff --git a/src/api/event/handler/internal/artifact.go b/src/controller/event/handler/internal/artifact.go similarity index 88% rename from src/api/event/handler/internal/artifact.go rename to src/controller/event/handler/internal/artifact.go index 66327509b4..1fa227f3aa 100644 --- a/src/api/event/handler/internal/artifact.go +++ b/src/controller/event/handler/internal/artifact.go @@ -17,13 +17,13 @@ package internal import ( "context" beegorm "github.com/astaxie/beego/orm" - "github.com/goharbor/harbor/src/api/artifact" - "github.com/goharbor/harbor/src/api/event" - "github.com/goharbor/harbor/src/api/repository" - "github.com/goharbor/harbor/src/api/tag" "github.com/goharbor/harbor/src/common/utils/log" - "github.com/goharbor/harbor/src/internal/orm" - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/controller/artifact" + "github.com/goharbor/harbor/src/controller/event" + "github.com/goharbor/harbor/src/controller/repository" + "github.com/goharbor/harbor/src/controller/tag" + "github.com/goharbor/harbor/src/lib/orm" + "github.com/goharbor/harbor/src/lib/q" "time" ) diff --git a/src/api/event/handler/internal/artifact_test.go b/src/controller/event/handler/internal/artifact_test.go similarity index 100% rename from src/api/event/handler/internal/artifact_test.go rename to src/controller/event/handler/internal/artifact_test.go diff --git a/src/api/event/handler/replication/replication.go b/src/controller/event/handler/replication/replication.go similarity index 98% rename from src/api/event/handler/replication/replication.go rename to src/controller/event/handler/replication/replication.go index fd42712b9f..8b65a65dfe 100644 --- a/src/api/event/handler/replication/replication.go +++ b/src/controller/event/handler/replication/replication.go @@ -15,8 +15,8 @@ package replication import ( - "github.com/goharbor/harbor/src/api/event" "github.com/goharbor/harbor/src/common/utils/log" + "github.com/goharbor/harbor/src/controller/event" "github.com/goharbor/harbor/src/pkg/project" "github.com/goharbor/harbor/src/replication" repevent "github.com/goharbor/harbor/src/replication/event" diff --git a/src/api/event/handler/util/util.go b/src/controller/event/handler/util/util.go similarity index 100% rename from src/api/event/handler/util/util.go rename to src/controller/event/handler/util/util.go diff --git a/src/api/event/handler/webhook/artifact/artifact.go b/src/controller/event/handler/webhook/artifact/artifact.go similarity index 96% rename from src/api/event/handler/webhook/artifact/artifact.go rename to src/controller/event/handler/webhook/artifact/artifact.go index 2ed4b26efd..466f24f451 100644 --- a/src/api/event/handler/webhook/artifact/artifact.go +++ b/src/controller/event/handler/webhook/artifact/artifact.go @@ -18,11 +18,11 @@ import ( "context" "fmt" beegorm "github.com/astaxie/beego/orm" - "github.com/goharbor/harbor/src/api/event" - "github.com/goharbor/harbor/src/api/event/handler/util" "github.com/goharbor/harbor/src/common/models" "github.com/goharbor/harbor/src/common/utils/log" - "github.com/goharbor/harbor/src/internal/orm" + "github.com/goharbor/harbor/src/controller/event" + "github.com/goharbor/harbor/src/controller/event/handler/util" + "github.com/goharbor/harbor/src/lib/orm" "github.com/goharbor/harbor/src/pkg/notification" "github.com/goharbor/harbor/src/pkg/notifier/model" notifyModel "github.com/goharbor/harbor/src/pkg/notifier/model" diff --git a/src/api/event/handler/webhook/artifact/artifact_test.go b/src/controller/event/handler/webhook/artifact/artifact_test.go similarity index 100% rename from src/api/event/handler/webhook/artifact/artifact_test.go rename to src/controller/event/handler/webhook/artifact/artifact_test.go diff --git a/src/api/event/handler/webhook/artifact/replication.go b/src/controller/event/handler/webhook/artifact/replication.go similarity index 98% rename from src/api/event/handler/webhook/artifact/replication.go rename to src/controller/event/handler/webhook/artifact/replication.go index 4ac9db8420..c3bf5d670a 100644 --- a/src/api/event/handler/webhook/artifact/replication.go +++ b/src/controller/event/handler/webhook/artifact/replication.go @@ -5,10 +5,10 @@ import ( "fmt" "strings" - "github.com/goharbor/harbor/src/api/event" - "github.com/goharbor/harbor/src/api/event/handler/util" commonModels "github.com/goharbor/harbor/src/common/models" "github.com/goharbor/harbor/src/common/utils/log" + "github.com/goharbor/harbor/src/controller/event" + "github.com/goharbor/harbor/src/controller/event/handler/util" "github.com/goharbor/harbor/src/core/config" "github.com/goharbor/harbor/src/jobservice/job" "github.com/goharbor/harbor/src/pkg/notification" diff --git a/src/api/event/handler/webhook/artifact/replication_test.go b/src/controller/event/handler/webhook/artifact/replication_test.go similarity index 99% rename from src/api/event/handler/webhook/artifact/replication_test.go rename to src/controller/event/handler/webhook/artifact/replication_test.go index 10006fcd25..af6fbd04c6 100644 --- a/src/api/event/handler/webhook/artifact/replication_test.go +++ b/src/controller/event/handler/webhook/artifact/replication_test.go @@ -1,8 +1,8 @@ package artifact import ( - "github.com/goharbor/harbor/src/api/event" "github.com/goharbor/harbor/src/common/models" + "github.com/goharbor/harbor/src/controller/event" "github.com/goharbor/harbor/src/core/config" "github.com/goharbor/harbor/src/core/promgr/metamgr" "github.com/goharbor/harbor/src/pkg/notification" diff --git a/src/api/event/handler/webhook/chart/chart.go b/src/controller/event/handler/webhook/chart/chart.go similarity index 96% rename from src/api/event/handler/webhook/chart/chart.go rename to src/controller/event/handler/webhook/chart/chart.go index 09c849bf5d..91c279a582 100644 --- a/src/api/event/handler/webhook/chart/chart.go +++ b/src/controller/event/handler/webhook/chart/chart.go @@ -17,10 +17,10 @@ package chart import ( "errors" "fmt" - "github.com/goharbor/harbor/src/api/event" - "github.com/goharbor/harbor/src/api/event/handler/util" "github.com/goharbor/harbor/src/common/models" "github.com/goharbor/harbor/src/common/utils/log" + "github.com/goharbor/harbor/src/controller/event" + "github.com/goharbor/harbor/src/controller/event/handler/util" "github.com/goharbor/harbor/src/core/config" "github.com/goharbor/harbor/src/pkg/notification" "github.com/goharbor/harbor/src/pkg/notifier/model" diff --git a/src/api/event/handler/webhook/chart/chart_test.go b/src/controller/event/handler/webhook/chart/chart_test.go similarity index 98% rename from src/api/event/handler/webhook/chart/chart_test.go rename to src/controller/event/handler/webhook/chart/chart_test.go index d1dd200621..b600926ba3 100644 --- a/src/api/event/handler/webhook/chart/chart_test.go +++ b/src/controller/event/handler/webhook/chart/chart_test.go @@ -15,8 +15,8 @@ package chart import ( - "github.com/goharbor/harbor/src/api/event" common_dao "github.com/goharbor/harbor/src/common/dao" + "github.com/goharbor/harbor/src/controller/event" "testing" "github.com/goharbor/harbor/src/common/models" diff --git a/src/api/event/handler/webhook/quota/quota.go b/src/controller/event/handler/webhook/quota/quota.go similarity index 96% rename from src/api/event/handler/webhook/quota/quota.go rename to src/controller/event/handler/webhook/quota/quota.go index eb4242d622..1da58d82f3 100644 --- a/src/api/event/handler/webhook/quota/quota.go +++ b/src/controller/event/handler/webhook/quota/quota.go @@ -17,10 +17,10 @@ package quota import ( "errors" "fmt" - "github.com/goharbor/harbor/src/api/event" - "github.com/goharbor/harbor/src/api/event/handler/util" "github.com/goharbor/harbor/src/common/models" "github.com/goharbor/harbor/src/common/utils/log" + "github.com/goharbor/harbor/src/controller/event" + "github.com/goharbor/harbor/src/controller/event/handler/util" "github.com/goharbor/harbor/src/pkg/notification" "github.com/goharbor/harbor/src/pkg/notifier/model" notifyModel "github.com/goharbor/harbor/src/pkg/notifier/model" diff --git a/src/api/event/handler/webhook/quota/quota_test.go b/src/controller/event/handler/webhook/quota/quota_test.go similarity index 98% rename from src/api/event/handler/webhook/quota/quota_test.go rename to src/controller/event/handler/webhook/quota/quota_test.go index 10583a950f..5462b5e167 100644 --- a/src/api/event/handler/webhook/quota/quota_test.go +++ b/src/controller/event/handler/webhook/quota/quota_test.go @@ -15,8 +15,8 @@ package quota import ( - "github.com/goharbor/harbor/src/api/event" common_dao "github.com/goharbor/harbor/src/common/dao" + "github.com/goharbor/harbor/src/controller/event" "testing" "time" diff --git a/src/api/event/handler/webhook/scan/delete.go b/src/controller/event/handler/webhook/scan/delete.go similarity index 89% rename from src/api/event/handler/webhook/scan/delete.go rename to src/controller/event/handler/webhook/scan/delete.go index 0e8e54d0a4..cab0c06f25 100644 --- a/src/api/event/handler/webhook/scan/delete.go +++ b/src/controller/event/handler/webhook/scan/delete.go @@ -17,12 +17,12 @@ package scan import ( "context" bo "github.com/astaxie/beego/orm" - "github.com/goharbor/harbor/src/api/artifact" - "github.com/goharbor/harbor/src/api/event" - "github.com/goharbor/harbor/src/api/scan" "github.com/goharbor/harbor/src/common/utils/log" - "github.com/goharbor/harbor/src/internal/orm" - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/controller/artifact" + "github.com/goharbor/harbor/src/controller/event" + "github.com/goharbor/harbor/src/controller/scan" + "github.com/goharbor/harbor/src/lib/orm" + "github.com/goharbor/harbor/src/lib/q" "github.com/pkg/errors" ) diff --git a/src/api/event/handler/webhook/scan/scan.go b/src/controller/event/handler/webhook/scan/scan.go similarity index 94% rename from src/api/event/handler/webhook/scan/scan.go rename to src/controller/event/handler/webhook/scan/scan.go index 20bff8e0e8..613f6a27e0 100644 --- a/src/api/event/handler/webhook/scan/scan.go +++ b/src/controller/event/handler/webhook/scan/scan.go @@ -17,16 +17,16 @@ package scan import ( "context" o "github.com/astaxie/beego/orm" - "github.com/goharbor/harbor/src/api/artifact" - "github.com/goharbor/harbor/src/api/event" - "github.com/goharbor/harbor/src/api/event/handler/util" - "github.com/goharbor/harbor/src/internal/orm" + "github.com/goharbor/harbor/src/controller/artifact" + "github.com/goharbor/harbor/src/controller/event" + "github.com/goharbor/harbor/src/controller/event/handler/util" + "github.com/goharbor/harbor/src/lib/orm" "github.com/goharbor/harbor/src/pkg/notifier/model" "time" - "github.com/goharbor/harbor/src/api/scan" "github.com/goharbor/harbor/src/common/models" "github.com/goharbor/harbor/src/common/utils/log" + "github.com/goharbor/harbor/src/controller/scan" "github.com/goharbor/harbor/src/pkg/notification" "github.com/goharbor/harbor/src/pkg/project" v1 "github.com/goharbor/harbor/src/pkg/scan/rest/v1" diff --git a/src/api/event/handler/webhook/scan/scan_test.go b/src/controller/event/handler/webhook/scan/scan_test.go similarity index 96% rename from src/api/event/handler/webhook/scan/scan_test.go rename to src/controller/event/handler/webhook/scan/scan_test.go index 8574307835..e293570fa2 100644 --- a/src/api/event/handler/webhook/scan/scan_test.go +++ b/src/controller/event/handler/webhook/scan/scan_test.go @@ -15,14 +15,14 @@ package scan import ( - "github.com/goharbor/harbor/src/api/event" common_dao "github.com/goharbor/harbor/src/common/dao" + "github.com/goharbor/harbor/src/controller/event" "testing" "time" - "github.com/goharbor/harbor/src/api/artifact" - sc "github.com/goharbor/harbor/src/api/scan" "github.com/goharbor/harbor/src/common" + "github.com/goharbor/harbor/src/controller/artifact" + sc "github.com/goharbor/harbor/src/controller/scan" "github.com/goharbor/harbor/src/core/config" "github.com/goharbor/harbor/src/pkg/notification" "github.com/goharbor/harbor/src/pkg/notification/policy" diff --git a/src/api/event/metadata/artifact.go b/src/controller/event/metadata/artifact.go similarity index 98% rename from src/api/event/metadata/artifact.go rename to src/controller/event/metadata/artifact.go index 593fd1f28c..dcc668ede2 100644 --- a/src/api/event/metadata/artifact.go +++ b/src/controller/event/metadata/artifact.go @@ -16,8 +16,8 @@ package metadata import ( "context" - event2 "github.com/goharbor/harbor/src/api/event" "github.com/goharbor/harbor/src/common/security" + event2 "github.com/goharbor/harbor/src/controller/event" "github.com/goharbor/harbor/src/pkg/artifact" "github.com/goharbor/harbor/src/pkg/notifier/event" "time" diff --git a/src/api/event/metadata/artifact_test.go b/src/controller/event/metadata/artifact_test.go similarity index 97% rename from src/api/event/metadata/artifact_test.go rename to src/controller/event/metadata/artifact_test.go index 191da55907..1bb51e2a0d 100644 --- a/src/api/event/metadata/artifact_test.go +++ b/src/controller/event/metadata/artifact_test.go @@ -16,7 +16,7 @@ package metadata import ( "context" - event2 "github.com/goharbor/harbor/src/api/event" + event2 "github.com/goharbor/harbor/src/controller/event" "github.com/goharbor/harbor/src/pkg/artifact" "github.com/goharbor/harbor/src/pkg/notifier/event" "github.com/stretchr/testify/suite" diff --git a/src/api/event/metadata/chart.go b/src/controller/event/metadata/chart.go similarity index 96% rename from src/api/event/metadata/chart.go rename to src/controller/event/metadata/chart.go index eed1935217..36ddd71be8 100644 --- a/src/api/event/metadata/chart.go +++ b/src/controller/event/metadata/chart.go @@ -1,7 +1,7 @@ package metadata import ( - event2 "github.com/goharbor/harbor/src/api/event" + event2 "github.com/goharbor/harbor/src/controller/event" "github.com/goharbor/harbor/src/pkg/notifier/event" "time" ) diff --git a/src/api/event/metadata/chart_test.go b/src/controller/event/metadata/chart_test.go similarity index 97% rename from src/api/event/metadata/chart_test.go rename to src/controller/event/metadata/chart_test.go index 74df6b0fce..cc10cb4b7a 100644 --- a/src/api/event/metadata/chart_test.go +++ b/src/controller/event/metadata/chart_test.go @@ -15,7 +15,7 @@ package metadata import ( - event2 "github.com/goharbor/harbor/src/api/event" + event2 "github.com/goharbor/harbor/src/controller/event" "github.com/goharbor/harbor/src/pkg/notifier/event" "github.com/stretchr/testify/suite" "testing" diff --git a/src/api/event/metadata/project.go b/src/controller/event/metadata/project.go similarity index 96% rename from src/api/event/metadata/project.go rename to src/controller/event/metadata/project.go index 22f1d2dbbb..2ef05ac911 100644 --- a/src/api/event/metadata/project.go +++ b/src/controller/event/metadata/project.go @@ -15,7 +15,7 @@ package metadata import ( - event2 "github.com/goharbor/harbor/src/api/event" + event2 "github.com/goharbor/harbor/src/controller/event" "github.com/goharbor/harbor/src/pkg/notifier/event" "time" ) diff --git a/src/api/event/metadata/project_test.go b/src/controller/event/metadata/project_test.go similarity index 96% rename from src/api/event/metadata/project_test.go rename to src/controller/event/metadata/project_test.go index 5326c599cd..f51af5a827 100644 --- a/src/api/event/metadata/project_test.go +++ b/src/controller/event/metadata/project_test.go @@ -15,7 +15,7 @@ package metadata import ( - event2 "github.com/goharbor/harbor/src/api/event" + event2 "github.com/goharbor/harbor/src/controller/event" "github.com/goharbor/harbor/src/pkg/notifier/event" "github.com/stretchr/testify/suite" "testing" diff --git a/src/api/event/metadata/quota.go b/src/controller/event/metadata/quota.go similarity index 94% rename from src/api/event/metadata/quota.go rename to src/controller/event/metadata/quota.go index 8335b46df6..70ec26128f 100644 --- a/src/api/event/metadata/quota.go +++ b/src/controller/event/metadata/quota.go @@ -3,8 +3,8 @@ package metadata import ( "time" - event2 "github.com/goharbor/harbor/src/api/event" "github.com/goharbor/harbor/src/common/models" + event2 "github.com/goharbor/harbor/src/controller/event" "github.com/goharbor/harbor/src/pkg/notifier/event" "github.com/pkg/errors" ) diff --git a/src/api/event/metadata/quota_test.go b/src/controller/event/metadata/quota_test.go similarity index 95% rename from src/api/event/metadata/quota_test.go rename to src/controller/event/metadata/quota_test.go index a41a393d6f..543cfd5d47 100644 --- a/src/api/event/metadata/quota_test.go +++ b/src/controller/event/metadata/quota_test.go @@ -15,7 +15,7 @@ package metadata import ( - event2 "github.com/goharbor/harbor/src/api/event" + event2 "github.com/goharbor/harbor/src/controller/event" "github.com/goharbor/harbor/src/pkg/notifier/event" "github.com/stretchr/testify/suite" "testing" diff --git a/src/api/event/metadata/replication.go b/src/controller/event/metadata/replication.go similarity index 91% rename from src/api/event/metadata/replication.go rename to src/controller/event/metadata/replication.go index 91022c56c4..04694209a0 100644 --- a/src/api/event/metadata/replication.go +++ b/src/controller/event/metadata/replication.go @@ -3,7 +3,7 @@ package metadata import ( "time" - event2 "github.com/goharbor/harbor/src/api/event" + event2 "github.com/goharbor/harbor/src/controller/event" "github.com/goharbor/harbor/src/pkg/notifier/event" ) diff --git a/src/api/event/metadata/repository.go b/src/controller/event/metadata/repository.go similarity index 95% rename from src/api/event/metadata/repository.go rename to src/controller/event/metadata/repository.go index 861b223a04..e341bff0ca 100644 --- a/src/api/event/metadata/repository.go +++ b/src/controller/event/metadata/repository.go @@ -16,8 +16,8 @@ package metadata import ( "context" - event2 "github.com/goharbor/harbor/src/api/event" "github.com/goharbor/harbor/src/common/security" + event2 "github.com/goharbor/harbor/src/controller/event" "github.com/goharbor/harbor/src/pkg/notifier/event" "time" ) diff --git a/src/api/event/metadata/repository_test.go b/src/controller/event/metadata/repository_test.go similarity index 95% rename from src/api/event/metadata/repository_test.go rename to src/controller/event/metadata/repository_test.go index ca26a1268e..b37179cea7 100644 --- a/src/api/event/metadata/repository_test.go +++ b/src/controller/event/metadata/repository_test.go @@ -16,7 +16,7 @@ package metadata import ( "context" - event2 "github.com/goharbor/harbor/src/api/event" + event2 "github.com/goharbor/harbor/src/controller/event" "github.com/goharbor/harbor/src/pkg/notifier/event" "github.com/stretchr/testify/suite" "testing" diff --git a/src/api/event/metadata/scan.go b/src/controller/event/metadata/scan.go similarity index 94% rename from src/api/event/metadata/scan.go rename to src/controller/event/metadata/scan.go index 83cdd47f49..a58105afb3 100644 --- a/src/api/event/metadata/scan.go +++ b/src/controller/event/metadata/scan.go @@ -1,8 +1,8 @@ package metadata import ( - event2 "github.com/goharbor/harbor/src/api/event" "github.com/goharbor/harbor/src/common/models" + event2 "github.com/goharbor/harbor/src/controller/event" "github.com/goharbor/harbor/src/pkg/notifier/event" v1 "github.com/goharbor/harbor/src/pkg/scan/rest/v1" "github.com/pkg/errors" diff --git a/src/api/event/metadata/scan_test.go b/src/controller/event/metadata/scan_test.go similarity index 96% rename from src/api/event/metadata/scan_test.go rename to src/controller/event/metadata/scan_test.go index ff459fe27d..939cd5c95d 100644 --- a/src/api/event/metadata/scan_test.go +++ b/src/controller/event/metadata/scan_test.go @@ -15,7 +15,7 @@ package metadata import ( - event2 "github.com/goharbor/harbor/src/api/event" + event2 "github.com/goharbor/harbor/src/controller/event" "github.com/goharbor/harbor/src/pkg/notifier/event" v1 "github.com/goharbor/harbor/src/pkg/scan/rest/v1" "github.com/stretchr/testify/suite" diff --git a/src/api/event/metadata/tag.go b/src/controller/event/metadata/tag.go similarity index 97% rename from src/api/event/metadata/tag.go rename to src/controller/event/metadata/tag.go index 7df2da2f15..aa3edb4591 100644 --- a/src/api/event/metadata/tag.go +++ b/src/controller/event/metadata/tag.go @@ -16,8 +16,8 @@ package metadata import ( "context" - event2 "github.com/goharbor/harbor/src/api/event" "github.com/goharbor/harbor/src/common/security" + event2 "github.com/goharbor/harbor/src/controller/event" "github.com/goharbor/harbor/src/pkg/artifact" "github.com/goharbor/harbor/src/pkg/notifier/event" "time" diff --git a/src/api/event/metadata/tag_test.go b/src/controller/event/metadata/tag_test.go similarity index 97% rename from src/api/event/metadata/tag_test.go rename to src/controller/event/metadata/tag_test.go index f66a807ddd..281011a453 100644 --- a/src/api/event/metadata/tag_test.go +++ b/src/controller/event/metadata/tag_test.go @@ -16,7 +16,7 @@ package metadata import ( "context" - event2 "github.com/goharbor/harbor/src/api/event" + event2 "github.com/goharbor/harbor/src/controller/event" "github.com/goharbor/harbor/src/pkg/artifact" "github.com/goharbor/harbor/src/pkg/notifier/event" "github.com/stretchr/testify/suite" diff --git a/src/api/event/topic.go b/src/controller/event/topic.go similarity index 100% rename from src/api/event/topic.go rename to src/controller/event/topic.go diff --git a/src/api/project/controller.go b/src/controller/project/controller.go similarity index 98% rename from src/api/project/controller.go rename to src/controller/project/controller.go index 9495b097b8..94ad75d372 100644 --- a/src/api/project/controller.go +++ b/src/controller/project/controller.go @@ -20,7 +20,7 @@ import ( "github.com/goharbor/harbor/src/common/models" "github.com/goharbor/harbor/src/common/utils/log" "github.com/goharbor/harbor/src/core/promgr/metamgr" - ierror "github.com/goharbor/harbor/src/internal/error" + ierror "github.com/goharbor/harbor/src/lib/error" "github.com/goharbor/harbor/src/pkg/project" "github.com/goharbor/harbor/src/pkg/scan/whitelist" ) diff --git a/src/api/project/controller_test.go b/src/controller/project/controller_test.go similarity index 96% rename from src/api/project/controller_test.go rename to src/controller/project/controller_test.go index 5377d7a845..e50c9ca7a9 100644 --- a/src/api/project/controller_test.go +++ b/src/controller/project/controller_test.go @@ -20,7 +20,7 @@ import ( "testing" "github.com/goharbor/harbor/src/common/models" - ierror "github.com/goharbor/harbor/src/internal/error" + ierror "github.com/goharbor/harbor/src/lib/error" "github.com/goharbor/harbor/src/testing/pkg/project" "github.com/stretchr/testify/suite" ) diff --git a/src/api/project/options.go b/src/controller/project/options.go similarity index 100% rename from src/api/project/options.go rename to src/controller/project/options.go diff --git a/src/api/quota/controller.go b/src/controller/quota/controller.go similarity index 98% rename from src/api/quota/controller.go rename to src/controller/quota/controller.go index 8ab343be68..bcfa9ab61b 100644 --- a/src/api/quota/controller.go +++ b/src/controller/quota/controller.go @@ -22,14 +22,14 @@ import ( "github.com/garyburd/redigo/redis" "github.com/goharbor/harbor/src/common/utils/log" util "github.com/goharbor/harbor/src/common/utils/redis" - ierror "github.com/goharbor/harbor/src/internal/error" - "github.com/goharbor/harbor/src/internal/orm" + ierror "github.com/goharbor/harbor/src/lib/error" + "github.com/goharbor/harbor/src/lib/orm" "github.com/goharbor/harbor/src/pkg/quota" "github.com/goharbor/harbor/src/pkg/quota/driver" "github.com/goharbor/harbor/src/pkg/types" // quota driver - _ "github.com/goharbor/harbor/src/api/quota/driver" + _ "github.com/goharbor/harbor/src/controller/quota/driver" ) var ( diff --git a/src/api/quota/controller_test.go b/src/controller/quota/controller_test.go similarity index 99% rename from src/api/quota/controller_test.go rename to src/controller/quota/controller_test.go index b10bf18393..c196705672 100644 --- a/src/api/quota/controller_test.go +++ b/src/controller/quota/controller_test.go @@ -20,7 +20,7 @@ import ( "testing" "time" - "github.com/goharbor/harbor/src/internal/orm" + "github.com/goharbor/harbor/src/lib/orm" "github.com/goharbor/harbor/src/pkg/quota" "github.com/goharbor/harbor/src/pkg/quota/driver" "github.com/goharbor/harbor/src/pkg/types" diff --git a/src/api/quota/driver/driver.go b/src/controller/quota/driver/driver.go similarity index 90% rename from src/api/quota/driver/driver.go rename to src/controller/quota/driver/driver.go index 4a285e4c88..3e556252f9 100644 --- a/src/api/quota/driver/driver.go +++ b/src/controller/quota/driver/driver.go @@ -16,5 +16,5 @@ package driver import ( // project quota driver - _ "github.com/goharbor/harbor/src/api/quota/driver/project" + _ "github.com/goharbor/harbor/src/controller/quota/driver/project" ) diff --git a/src/api/quota/driver/project/project.go b/src/controller/quota/driver/project/project.go similarity index 95% rename from src/api/quota/driver/project/project.go rename to src/controller/quota/driver/project/project.go index a287952cb5..aaecbe269b 100644 --- a/src/api/quota/driver/project/project.go +++ b/src/controller/quota/driver/project/project.go @@ -19,14 +19,14 @@ import ( "fmt" "strconv" - "github.com/goharbor/harbor/src/api/artifact" - "github.com/goharbor/harbor/src/api/blob" - "github.com/goharbor/harbor/src/api/chartmuseum" "github.com/goharbor/harbor/src/common" "github.com/goharbor/harbor/src/common/config" "github.com/goharbor/harbor/src/common/models" "github.com/goharbor/harbor/src/common/utils/log" - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/controller/artifact" + "github.com/goharbor/harbor/src/controller/blob" + "github.com/goharbor/harbor/src/controller/chartmuseum" + "github.com/goharbor/harbor/src/lib/q" dr "github.com/goharbor/harbor/src/pkg/quota/driver" "github.com/goharbor/harbor/src/pkg/types" "github.com/graph-gophers/dataloader" diff --git a/src/api/quota/driver/project/project_test.go b/src/controller/quota/driver/project/project_test.go similarity index 100% rename from src/api/quota/driver/project/project_test.go rename to src/controller/quota/driver/project/project_test.go diff --git a/src/api/quota/driver/project/util.go b/src/controller/quota/driver/project/util.go similarity index 97% rename from src/api/quota/driver/project/util.go rename to src/controller/quota/driver/project/util.go index a3b101f78c..8b9acb6ea1 100644 --- a/src/api/quota/driver/project/util.go +++ b/src/controller/quota/driver/project/util.go @@ -20,7 +20,7 @@ import ( "github.com/goharbor/harbor/src/common/dao" "github.com/goharbor/harbor/src/common/models" - ierror "github.com/goharbor/harbor/src/internal/error" + ierror "github.com/goharbor/harbor/src/lib/error" "github.com/goharbor/harbor/src/pkg/project" "github.com/graph-gophers/dataloader" ) diff --git a/src/api/quota/options.go b/src/controller/quota/options.go similarity index 100% rename from src/api/quota/options.go rename to src/controller/quota/options.go diff --git a/src/api/quota/util.go b/src/controller/quota/util.go similarity index 96% rename from src/api/quota/util.go rename to src/controller/quota/util.go index 51317848d1..d2f27d0204 100644 --- a/src/api/quota/util.go +++ b/src/controller/quota/util.go @@ -19,10 +19,10 @@ import ( "fmt" "strconv" - "github.com/goharbor/harbor/src/api/project" "github.com/goharbor/harbor/src/common/models" "github.com/goharbor/harbor/src/common/utils/log" - ierror "github.com/goharbor/harbor/src/internal/error" + "github.com/goharbor/harbor/src/controller/project" + ierror "github.com/goharbor/harbor/src/lib/error" ) const ( diff --git a/src/api/quota/util_test.go b/src/controller/quota/util_test.go similarity index 97% rename from src/api/quota/util_test.go rename to src/controller/quota/util_test.go index 18c8e4a71b..0835192a5d 100644 --- a/src/api/quota/util_test.go +++ b/src/controller/quota/util_test.go @@ -20,9 +20,9 @@ import ( "testing" "time" - "github.com/goharbor/harbor/src/api/project" "github.com/goharbor/harbor/src/common/models" - "github.com/goharbor/harbor/src/internal/orm" + "github.com/goharbor/harbor/src/controller/project" + "github.com/goharbor/harbor/src/lib/orm" "github.com/goharbor/harbor/src/pkg/quota" "github.com/goharbor/harbor/src/pkg/quota/driver" "github.com/goharbor/harbor/src/pkg/types" diff --git a/src/api/repository/controller.go b/src/controller/repository/controller.go similarity index 96% rename from src/api/repository/controller.go rename to src/controller/repository/controller.go index 8b6cd76362..25061d5cee 100644 --- a/src/api/repository/controller.go +++ b/src/controller/repository/controller.go @@ -17,15 +17,15 @@ package repository import ( "context" - "github.com/goharbor/harbor/src/api/artifact" "github.com/goharbor/harbor/src/common/models" "github.com/goharbor/harbor/src/common/utils" "github.com/goharbor/harbor/src/common/utils/log" - ierror "github.com/goharbor/harbor/src/internal/error" - "github.com/goharbor/harbor/src/internal/orm" + "github.com/goharbor/harbor/src/controller/artifact" + ierror "github.com/goharbor/harbor/src/lib/error" + "github.com/goharbor/harbor/src/lib/orm" + "github.com/goharbor/harbor/src/lib/q" art "github.com/goharbor/harbor/src/pkg/artifact" "github.com/goharbor/harbor/src/pkg/project" - "github.com/goharbor/harbor/src/pkg/q" "github.com/goharbor/harbor/src/pkg/repository" ) diff --git a/src/api/repository/controller_test.go b/src/controller/repository/controller_test.go similarity index 96% rename from src/api/repository/controller_test.go rename to src/controller/repository/controller_test.go index 2c3aa12c23..0dd75bd378 100644 --- a/src/api/repository/controller_test.go +++ b/src/controller/repository/controller_test.go @@ -15,10 +15,10 @@ package repository import ( - "github.com/goharbor/harbor/src/api/artifact" "github.com/goharbor/harbor/src/common/models" - ierror "github.com/goharbor/harbor/src/internal/error" - "github.com/goharbor/harbor/src/internal/orm" + "github.com/goharbor/harbor/src/controller/artifact" + ierror "github.com/goharbor/harbor/src/lib/error" + "github.com/goharbor/harbor/src/lib/orm" artifacttesting "github.com/goharbor/harbor/src/testing/api/artifact" ormtesting "github.com/goharbor/harbor/src/testing/lib/orm" "github.com/goharbor/harbor/src/testing/mock" diff --git a/src/api/scan/all_handler.go b/src/controller/scan/all_handler.go similarity index 94% rename from src/api/scan/all_handler.go rename to src/controller/scan/all_handler.go index 30c84c40bc..ec728b30ac 100644 --- a/src/api/scan/all_handler.go +++ b/src/controller/scan/all_handler.go @@ -17,11 +17,11 @@ package scan import ( "context" - "github.com/goharbor/harbor/src/api/artifact" - "github.com/goharbor/harbor/src/api/repository" "github.com/goharbor/harbor/src/common/models" "github.com/goharbor/harbor/src/common/utils/log" - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/controller/artifact" + "github.com/goharbor/harbor/src/controller/repository" + "github.com/goharbor/harbor/src/lib/q" "github.com/pkg/errors" ) diff --git a/src/api/scan/base_controller.go b/src/controller/scan/base_controller.go similarity index 99% rename from src/api/scan/base_controller.go rename to src/controller/scan/base_controller.go index 99848b6e41..902a186c12 100644 --- a/src/api/scan/base_controller.go +++ b/src/controller/scan/base_controller.go @@ -20,16 +20,16 @@ import ( "fmt" "sync" - ar "github.com/goharbor/harbor/src/api/artifact" - sc "github.com/goharbor/harbor/src/api/scanner" cj "github.com/goharbor/harbor/src/common/job" jm "github.com/goharbor/harbor/src/common/job/models" "github.com/goharbor/harbor/src/common/rbac" "github.com/goharbor/harbor/src/common/utils/log" + ar "github.com/goharbor/harbor/src/controller/artifact" + sc "github.com/goharbor/harbor/src/controller/scanner" "github.com/goharbor/harbor/src/core/config" - ierror "github.com/goharbor/harbor/src/internal/error" "github.com/goharbor/harbor/src/jobservice/job" "github.com/goharbor/harbor/src/jobservice/logger" + ierror "github.com/goharbor/harbor/src/lib/error" "github.com/goharbor/harbor/src/pkg/permission/types" "github.com/goharbor/harbor/src/pkg/robot" "github.com/goharbor/harbor/src/pkg/robot/model" diff --git a/src/api/scan/base_controller_test.go b/src/controller/scan/base_controller_test.go similarity index 99% rename from src/api/scan/base_controller_test.go rename to src/controller/scan/base_controller_test.go index 3237671907..a1d6f7e812 100644 --- a/src/api/scan/base_controller_test.go +++ b/src/controller/scan/base_controller_test.go @@ -22,14 +22,14 @@ import ( "testing" "time" - "github.com/goharbor/harbor/src/api/artifact" "github.com/goharbor/harbor/src/common" cj "github.com/goharbor/harbor/src/common/job" jm "github.com/goharbor/harbor/src/common/job/models" "github.com/goharbor/harbor/src/common/rbac" + "github.com/goharbor/harbor/src/controller/artifact" "github.com/goharbor/harbor/src/jobservice/job" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/permission/types" - "github.com/goharbor/harbor/src/pkg/q" "github.com/goharbor/harbor/src/pkg/robot/model" sca "github.com/goharbor/harbor/src/pkg/scan" "github.com/goharbor/harbor/src/pkg/scan/dao/scan" diff --git a/src/api/scan/checker.go b/src/controller/scan/checker.go similarity index 96% rename from src/api/scan/checker.go rename to src/controller/scan/checker.go index 0e30d686b8..f6755a933b 100644 --- a/src/api/scan/checker.go +++ b/src/controller/scan/checker.go @@ -17,8 +17,8 @@ package scan import ( "context" - "github.com/goharbor/harbor/src/api/artifact" - "github.com/goharbor/harbor/src/api/scanner" + "github.com/goharbor/harbor/src/controller/artifact" + "github.com/goharbor/harbor/src/controller/scanner" models "github.com/goharbor/harbor/src/pkg/scan/dao/scanner" ) diff --git a/src/api/scan/checker_test.go b/src/controller/scan/checker_test.go similarity index 98% rename from src/api/scan/checker_test.go rename to src/controller/scan/checker_test.go index 523fc056e0..5fc4138714 100644 --- a/src/api/scan/checker_test.go +++ b/src/controller/scan/checker_test.go @@ -18,7 +18,7 @@ import ( "context" "testing" - "github.com/goharbor/harbor/src/api/artifact" + "github.com/goharbor/harbor/src/controller/artifact" "github.com/goharbor/harbor/src/pkg/scan/dao/scanner" v1 "github.com/goharbor/harbor/src/pkg/scan/rest/v1" artifacttesting "github.com/goharbor/harbor/src/testing/api/artifact" diff --git a/src/api/scan/controller.go b/src/controller/scan/controller.go similarity index 98% rename from src/api/scan/controller.go rename to src/controller/scan/controller.go index 3629a53c19..a1df8a4570 100644 --- a/src/api/scan/controller.go +++ b/src/controller/scan/controller.go @@ -17,7 +17,7 @@ package scan import ( "context" - "github.com/goharbor/harbor/src/api/artifact" + "github.com/goharbor/harbor/src/controller/artifact" "github.com/goharbor/harbor/src/jobservice/job" "github.com/goharbor/harbor/src/pkg/scan/all" "github.com/goharbor/harbor/src/pkg/scan/dao/scan" diff --git a/src/api/scan/options.go b/src/controller/scan/options.go similarity index 100% rename from src/api/scan/options.go rename to src/controller/scan/options.go diff --git a/src/api/scanner/base_controller.go b/src/controller/scanner/base_controller.go similarity index 99% rename from src/api/scanner/base_controller.go rename to src/controller/scanner/base_controller.go index 70c50aca36..1c2f87bfb6 100644 --- a/src/api/scanner/base_controller.go +++ b/src/controller/scanner/base_controller.go @@ -18,7 +18,7 @@ import ( "github.com/goharbor/harbor/src/common/utils/log" "github.com/goharbor/harbor/src/core/promgr/metamgr" "github.com/goharbor/harbor/src/jobservice/logger" - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/scan/dao/scanner" v1 "github.com/goharbor/harbor/src/pkg/scan/rest/v1" rscanner "github.com/goharbor/harbor/src/pkg/scan/scanner" diff --git a/src/api/scanner/base_controller_test.go b/src/controller/scanner/base_controller_test.go similarity index 99% rename from src/api/scanner/base_controller_test.go rename to src/controller/scanner/base_controller_test.go index 21e9278aea..4720abcd57 100644 --- a/src/api/scanner/base_controller_test.go +++ b/src/controller/scanner/base_controller_test.go @@ -18,7 +18,7 @@ import ( "testing" "github.com/goharbor/harbor/src/common/models" - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/scan/dao/scanner" v1 "github.com/goharbor/harbor/src/pkg/scan/rest/v1" mocktesting "github.com/goharbor/harbor/src/testing/mock" diff --git a/src/api/scanner/controller.go b/src/controller/scanner/controller.go similarity index 99% rename from src/api/scanner/controller.go rename to src/controller/scanner/controller.go index 390a5c7f1a..dde0d57165 100644 --- a/src/api/scanner/controller.go +++ b/src/controller/scanner/controller.go @@ -15,7 +15,7 @@ package scanner import ( - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/scan/dao/scanner" v1 "github.com/goharbor/harbor/src/pkg/scan/rest/v1" ) diff --git a/src/api/scanner/options.go b/src/controller/scanner/options.go similarity index 100% rename from src/api/scanner/options.go rename to src/controller/scanner/options.go diff --git a/src/api/tag/controller.go b/src/controller/tag/controller.go similarity index 97% rename from src/api/tag/controller.go rename to src/controller/tag/controller.go index ba5e792d9b..eb626f69d3 100644 --- a/src/api/tag/controller.go +++ b/src/controller/tag/controller.go @@ -4,13 +4,13 @@ import ( "context" "github.com/goharbor/harbor/src/common/utils" "github.com/goharbor/harbor/src/common/utils/log" - ierror "github.com/goharbor/harbor/src/internal/error" - "github.com/goharbor/harbor/src/internal/orm" - "github.com/goharbor/harbor/src/internal/selector" + ierror "github.com/goharbor/harbor/src/lib/error" + "github.com/goharbor/harbor/src/lib/orm" + "github.com/goharbor/harbor/src/lib/q" + "github.com/goharbor/harbor/src/lib/selector" "github.com/goharbor/harbor/src/pkg/artifact" "github.com/goharbor/harbor/src/pkg/immutabletag/match" "github.com/goharbor/harbor/src/pkg/immutabletag/match/rule" - "github.com/goharbor/harbor/src/pkg/q" "github.com/goharbor/harbor/src/pkg/signature" "github.com/goharbor/harbor/src/pkg/tag" model_tag "github.com/goharbor/harbor/src/pkg/tag/model/tag" diff --git a/src/api/tag/controller_test.go b/src/controller/tag/controller_test.go similarity index 98% rename from src/api/tag/controller_test.go rename to src/controller/tag/controller_test.go index 99a0eaffd8..4ccfbc22cf 100644 --- a/src/api/tag/controller_test.go +++ b/src/controller/tag/controller_test.go @@ -3,8 +3,8 @@ package tag import ( "github.com/goharbor/harbor/src/common" coreConfig "github.com/goharbor/harbor/src/core/config" - ierror "github.com/goharbor/harbor/src/internal/error" - "github.com/goharbor/harbor/src/internal/orm" + ierror "github.com/goharbor/harbor/src/lib/error" + "github.com/goharbor/harbor/src/lib/orm" pkg_artifact "github.com/goharbor/harbor/src/pkg/artifact" "github.com/goharbor/harbor/src/pkg/tag/model/tag" ormtesting "github.com/goharbor/harbor/src/testing/lib/orm" diff --git a/src/api/tag/model.go b/src/controller/tag/model.go similarity index 100% rename from src/api/tag/model.go rename to src/controller/tag/model.go diff --git a/src/core/api/admin_job.go b/src/core/api/admin_job.go index 4240ac0784..8fc9671cb3 100644 --- a/src/core/api/admin_job.go +++ b/src/core/api/admin_job.go @@ -21,12 +21,12 @@ import ( "strconv" "time" - "github.com/goharbor/harbor/src/api/scan" "github.com/goharbor/harbor/src/common/dao" common_http "github.com/goharbor/harbor/src/common/http" common_job "github.com/goharbor/harbor/src/common/job" common_models "github.com/goharbor/harbor/src/common/models" "github.com/goharbor/harbor/src/common/utils/log" + "github.com/goharbor/harbor/src/controller/scan" "github.com/goharbor/harbor/src/core/api/models" utils_core "github.com/goharbor/harbor/src/core/utils" "github.com/pkg/errors" diff --git a/src/core/api/base.go b/src/core/api/base.go index 0066ef30af..e8d607d6a7 100644 --- a/src/core/api/base.go +++ b/src/core/api/base.go @@ -29,7 +29,7 @@ import ( "github.com/goharbor/harbor/src/common/utils/log" "github.com/goharbor/harbor/src/core/config" "github.com/goharbor/harbor/src/core/promgr" - internal_errors "github.com/goharbor/harbor/src/internal/error" + internal_errors "github.com/goharbor/harbor/src/lib/error" "github.com/goharbor/harbor/src/pkg/project" "github.com/goharbor/harbor/src/pkg/repository" "github.com/goharbor/harbor/src/pkg/retention" diff --git a/src/core/api/chart_repository.go b/src/core/api/chart_repository.go index ad0cacb49a..0f19e7d3f0 100755 --- a/src/core/api/chart_repository.go +++ b/src/core/api/chart_repository.go @@ -5,7 +5,7 @@ import ( "context" "errors" "fmt" - "github.com/goharbor/harbor/src/api/event/metadata" + "github.com/goharbor/harbor/src/controller/event/metadata" "io" "io/ioutil" "mime/multipart" diff --git a/src/core/api/immutabletagrule.go b/src/core/api/immutabletagrule.go index 8b1435eff8..336b7ad308 100644 --- a/src/core/api/immutabletagrule.go +++ b/src/core/api/immutabletagrule.go @@ -7,7 +7,7 @@ import ( "strings" "github.com/goharbor/harbor/src/common/rbac" - internal_errors "github.com/goharbor/harbor/src/internal/error" + internal_errors "github.com/goharbor/harbor/src/lib/error" "github.com/goharbor/harbor/src/pkg/immutabletag" "github.com/goharbor/harbor/src/pkg/immutabletag/model" ) diff --git a/src/core/api/internal.go b/src/core/api/internal.go index 29d186722c..c4b61e2864 100644 --- a/src/core/api/internal.go +++ b/src/core/api/internal.go @@ -18,14 +18,14 @@ import ( "context" o "github.com/astaxie/beego/orm" - "github.com/goharbor/harbor/src/api/quota" "github.com/goharbor/harbor/src/common" "github.com/goharbor/harbor/src/common/dao" "github.com/goharbor/harbor/src/common/models" "github.com/goharbor/harbor/src/common/utils/log" + "github.com/goharbor/harbor/src/controller/quota" "github.com/goharbor/harbor/src/core/config" - ierror "github.com/goharbor/harbor/src/internal/error" - "github.com/goharbor/harbor/src/internal/orm" + ierror "github.com/goharbor/harbor/src/lib/error" + "github.com/goharbor/harbor/src/lib/orm" "github.com/pkg/errors" ) diff --git a/src/core/api/notification_job_test.go b/src/core/api/notification_job_test.go index 88c2fbfece..043cad17f8 100644 --- a/src/core/api/notification_job_test.go +++ b/src/core/api/notification_job_test.go @@ -1,7 +1,7 @@ package api import ( - "github.com/goharbor/harbor/src/api/event" + "github.com/goharbor/harbor/src/controller/event" "net/http" "testing" "time" diff --git a/src/core/api/notification_policy.go b/src/core/api/notification_policy.go index 23057bde73..1510f10adb 100755 --- a/src/core/api/notification_policy.go +++ b/src/core/api/notification_policy.go @@ -7,11 +7,11 @@ import ( "strconv" "time" - "github.com/goharbor/harbor/src/api/event" "github.com/goharbor/harbor/src/common/models" "github.com/goharbor/harbor/src/common/rbac" "github.com/goharbor/harbor/src/common/utils" "github.com/goharbor/harbor/src/common/utils/log" + "github.com/goharbor/harbor/src/controller/event" "github.com/goharbor/harbor/src/pkg/notification" ) diff --git a/src/core/api/notification_policy_test.go b/src/core/api/notification_policy_test.go index b0d59ea21e..1bd0f9a9a6 100644 --- a/src/core/api/notification_policy_test.go +++ b/src/core/api/notification_policy_test.go @@ -1,7 +1,7 @@ package api import ( - "github.com/goharbor/harbor/src/api/event" + "github.com/goharbor/harbor/src/controller/event" "net/http" "testing" diff --git a/src/core/api/pro_scanner.go b/src/core/api/pro_scanner.go index 4c14ace0f6..5d9c06e958 100644 --- a/src/core/api/pro_scanner.go +++ b/src/core/api/pro_scanner.go @@ -15,9 +15,9 @@ package api import ( - "github.com/goharbor/harbor/src/api/scanner" "github.com/goharbor/harbor/src/common/rbac" - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/controller/scanner" + "github.com/goharbor/harbor/src/lib/q" "github.com/pkg/errors" ) diff --git a/src/core/api/pro_scanner_test.go b/src/core/api/pro_scanner_test.go index 566a09fdbf..1901f1b3a9 100644 --- a/src/core/api/pro_scanner_test.go +++ b/src/core/api/pro_scanner_test.go @@ -19,8 +19,8 @@ import ( "net/http" "testing" - sc "github.com/goharbor/harbor/src/api/scanner" - "github.com/goharbor/harbor/src/pkg/q" + sc "github.com/goharbor/harbor/src/controller/scanner" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/scan/dao/scanner" scannertesting "github.com/goharbor/harbor/src/testing/api/scanner" "github.com/stretchr/testify/assert" diff --git a/src/core/api/project.go b/src/core/api/project.go index bf6d8aa13d..44c80b34ac 100644 --- a/src/core/api/project.go +++ b/src/core/api/project.go @@ -22,7 +22,6 @@ import ( "strings" "sync" - "github.com/goharbor/harbor/src/api/event/metadata" "github.com/goharbor/harbor/src/common" "github.com/goharbor/harbor/src/common/dao" "github.com/goharbor/harbor/src/common/dao/project" @@ -32,6 +31,7 @@ import ( "github.com/goharbor/harbor/src/common/utils" errutil "github.com/goharbor/harbor/src/common/utils/error" "github.com/goharbor/harbor/src/common/utils/log" + "github.com/goharbor/harbor/src/controller/event/metadata" "github.com/goharbor/harbor/src/core/config" evt "github.com/goharbor/harbor/src/pkg/notifier/event" "github.com/goharbor/harbor/src/pkg/scan/vuln" diff --git a/src/core/api/robot.go b/src/core/api/robot.go index 354943d07b..8e72ba9774 100644 --- a/src/core/api/robot.go +++ b/src/core/api/robot.go @@ -22,7 +22,7 @@ import ( "github.com/goharbor/harbor/src/common/dao" "github.com/goharbor/harbor/src/common/models" "github.com/goharbor/harbor/src/common/rbac" - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/robot" "github.com/goharbor/harbor/src/pkg/robot/model" "github.com/pkg/errors" diff --git a/src/core/api/scan_all.go b/src/core/api/scan_all.go index 717187cec2..fce953e4ee 100644 --- a/src/core/api/scan_all.go +++ b/src/core/api/scan_all.go @@ -6,13 +6,13 @@ import ( "strconv" "strings" - "github.com/goharbor/harbor/src/api/scan" - "github.com/goharbor/harbor/src/api/scanner" common_job "github.com/goharbor/harbor/src/common/job" cm "github.com/goharbor/harbor/src/common/models" + "github.com/goharbor/harbor/src/controller/scan" + "github.com/goharbor/harbor/src/controller/scanner" "github.com/goharbor/harbor/src/core/api/models" "github.com/goharbor/harbor/src/jobservice/job" - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/scan/all" "github.com/pkg/errors" ) diff --git a/src/core/api/scanners.go b/src/core/api/scanners.go index 3c598fc70a..884c4509e9 100644 --- a/src/core/api/scanners.go +++ b/src/core/api/scanners.go @@ -18,8 +18,8 @@ import ( "fmt" "net/http" - s "github.com/goharbor/harbor/src/api/scanner" - "github.com/goharbor/harbor/src/pkg/q" + s "github.com/goharbor/harbor/src/controller/scanner" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/scan/dao/scanner" "github.com/pkg/errors" ) diff --git a/src/core/api/scanners_test.go b/src/core/api/scanners_test.go index a9903e7414..4fd7dbae51 100644 --- a/src/core/api/scanners_test.go +++ b/src/core/api/scanners_test.go @@ -19,8 +19,8 @@ import ( "net/http" "testing" - sc "github.com/goharbor/harbor/src/api/scanner" - "github.com/goharbor/harbor/src/pkg/q" + sc "github.com/goharbor/harbor/src/controller/scanner" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/scan/dao/scanner" scannertesting "github.com/goharbor/harbor/src/testing/api/scanner" "github.com/stretchr/testify/assert" diff --git a/src/core/api/search.go b/src/core/api/search.go index da58e5c1a4..041b68aacf 100644 --- a/src/core/api/search.go +++ b/src/core/api/search.go @@ -18,14 +18,14 @@ import ( "fmt" "strings" - "github.com/goharbor/harbor/src/api/artifact" "github.com/goharbor/harbor/src/common/dao" "github.com/goharbor/harbor/src/common/models" "github.com/goharbor/harbor/src/common/utils" "github.com/goharbor/harbor/src/common/utils/log" + "github.com/goharbor/harbor/src/controller/artifact" "github.com/goharbor/harbor/src/core/config" - "github.com/goharbor/harbor/src/internal/orm" - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/lib/orm" + "github.com/goharbor/harbor/src/lib/q" "k8s.io/helm/cmd/helm/search" ) diff --git a/src/core/api/user.go b/src/core/api/user.go index 052981dfe7..8cbcf2de4d 100644 --- a/src/core/api/user.go +++ b/src/core/api/user.go @@ -29,7 +29,7 @@ import ( "github.com/goharbor/harbor/src/common/utils" "github.com/goharbor/harbor/src/common/utils/log" "github.com/goharbor/harbor/src/core/config" - "github.com/goharbor/harbor/src/internal" + "github.com/goharbor/harbor/src/lib" "github.com/goharbor/harbor/src/pkg/permission/types" ) @@ -324,7 +324,7 @@ func (ua *UserAPI) Post() { return } - if !ua.IsAdmin && !internal.GetCarrySession(ua.Ctx.Request.Context()) { + if !ua.IsAdmin && !lib.GetCarrySession(ua.Ctx.Request.Context()) { ua.SendForbiddenError(errors.New("self-registration cannot be triggered via API")) return } diff --git a/src/core/controllers/base.go b/src/core/controllers/base.go index a776cca2d0..87cc4c1369 100644 --- a/src/core/controllers/base.go +++ b/src/core/controllers/base.go @@ -36,7 +36,7 @@ import ( "github.com/goharbor/harbor/src/core/api" "github.com/goharbor/harbor/src/core/auth" "github.com/goharbor/harbor/src/core/config" - "github.com/goharbor/harbor/src/internal" + "github.com/goharbor/harbor/src/lib" ) // CommonController handles request from UI that doesn't expect a page, such as /SwitchLanguage /logout ... @@ -60,7 +60,7 @@ type messageDetail struct { } func redirectForOIDC(ctx context.Context, username string) bool { - if internal.GetAuthMode(ctx) != common.OIDCAuth { + if lib.GetAuthMode(ctx) != common.OIDCAuth { return false } u, err := dao.GetUser(models.User{Username: username}) diff --git a/src/core/controllers/controllers_test.go b/src/core/controllers/controllers_test.go index 2b8414e014..2d9bf7b0ff 100644 --- a/src/core/controllers/controllers_test.go +++ b/src/core/controllers/controllers_test.go @@ -17,7 +17,7 @@ import ( "context" "fmt" "github.com/goharbor/harbor/src/core/middlewares" - "github.com/goharbor/harbor/src/internal" + "github.com/goharbor/harbor/src/lib" "net/http" "net/http/httptest" "os" @@ -86,9 +86,9 @@ func TestUserResettable(t *testing.T) { } func TestRedirectForOIDC(t *testing.T) { - ctx := internal.WithAuthMode(context.Background(), common.DBAuth) + ctx := lib.WithAuthMode(context.Background(), common.DBAuth) assert.False(t, redirectForOIDC(ctx, "nonexist")) - ctx = internal.WithAuthMode(context.Background(), common.OIDCAuth) + ctx = lib.WithAuthMode(context.Background(), common.OIDCAuth) assert.True(t, redirectForOIDC(ctx, "nonexist")) assert.False(t, redirectForOIDC(ctx, "admin")) diff --git a/src/core/main.go b/src/core/main.go index 5d56225ea1..1402121d5e 100755 --- a/src/core/main.go +++ b/src/core/main.go @@ -24,13 +24,13 @@ import ( "github.com/astaxie/beego" _ "github.com/astaxie/beego/session/redis" - _ "github.com/goharbor/harbor/src/api/event/handler" "github.com/goharbor/harbor/src/common/dao" common_http "github.com/goharbor/harbor/src/common/http" "github.com/goharbor/harbor/src/common/job" "github.com/goharbor/harbor/src/common/models" "github.com/goharbor/harbor/src/common/utils" "github.com/goharbor/harbor/src/common/utils/log" + _ "github.com/goharbor/harbor/src/controller/event/handler" "github.com/goharbor/harbor/src/core/api" _ "github.com/goharbor/harbor/src/core/auth/authproxy" _ "github.com/goharbor/harbor/src/core/auth/db" diff --git a/src/core/service/notifications/admin/handler.go b/src/core/service/notifications/admin/handler.go index 4032621ebb..cace3ca956 100644 --- a/src/core/service/notifications/admin/handler.go +++ b/src/core/service/notifications/admin/handler.go @@ -19,17 +19,17 @@ import ( "encoding/json" o "github.com/astaxie/beego/orm" - "github.com/goharbor/harbor/src/api/quota" - "github.com/goharbor/harbor/src/api/scan" "github.com/goharbor/harbor/src/common/dao" "github.com/goharbor/harbor/src/common/job" job_model "github.com/goharbor/harbor/src/common/job/models" "github.com/goharbor/harbor/src/common/models" "github.com/goharbor/harbor/src/common/utils/log" + "github.com/goharbor/harbor/src/controller/quota" + "github.com/goharbor/harbor/src/controller/scan" "github.com/goharbor/harbor/src/core/config" "github.com/goharbor/harbor/src/core/service/notifications" - "github.com/goharbor/harbor/src/internal/orm" j "github.com/goharbor/harbor/src/jobservice/job" + "github.com/goharbor/harbor/src/lib/orm" ) var statusMap = map[string]string{ diff --git a/src/core/service/notifications/jobs/handler.go b/src/core/service/notifications/jobs/handler.go index a717235bc9..ee9156cf20 100755 --- a/src/core/service/notifications/jobs/handler.go +++ b/src/core/service/notifications/jobs/handler.go @@ -20,11 +20,11 @@ import ( "github.com/goharbor/harbor/src/core/service/notifications" - "github.com/goharbor/harbor/src/api/event/metadata" - "github.com/goharbor/harbor/src/api/scan" "github.com/goharbor/harbor/src/common/job" "github.com/goharbor/harbor/src/common/models" "github.com/goharbor/harbor/src/common/utils/log" + "github.com/goharbor/harbor/src/controller/event/metadata" + "github.com/goharbor/harbor/src/controller/scan" jjob "github.com/goharbor/harbor/src/jobservice/job" "github.com/goharbor/harbor/src/pkg/notification" "github.com/goharbor/harbor/src/pkg/notifier/event" diff --git a/src/jobservice/job/impl/context.go b/src/jobservice/job/impl/context.go index 854fa8c62c..7d9bcf8b17 100644 --- a/src/jobservice/job/impl/context.go +++ b/src/jobservice/job/impl/context.go @@ -18,7 +18,7 @@ import ( "context" "fmt" o "github.com/astaxie/beego/orm" - "github.com/goharbor/harbor/src/internal/orm" + "github.com/goharbor/harbor/src/lib/orm" "math" "sync" "time" diff --git a/src/jobservice/job/impl/default_context.go b/src/jobservice/job/impl/default_context.go index 2a9bde383c..51dc772b61 100644 --- a/src/jobservice/job/impl/default_context.go +++ b/src/jobservice/job/impl/default_context.go @@ -18,9 +18,9 @@ import ( "context" "errors" o "github.com/astaxie/beego/orm" - "github.com/goharbor/harbor/src/internal/orm" "github.com/goharbor/harbor/src/jobservice/job" "github.com/goharbor/harbor/src/jobservice/logger" + "github.com/goharbor/harbor/src/lib/orm" ) // DefaultContext provides a basic job context diff --git a/src/jobservice/job/impl/gc/garbage_collection.go b/src/jobservice/job/impl/gc/garbage_collection.go index 6cdff81f9f..93811ab658 100644 --- a/src/jobservice/job/impl/gc/garbage_collection.go +++ b/src/jobservice/job/impl/gc/garbage_collection.go @@ -16,9 +16,9 @@ package gc import ( "fmt" - "github.com/goharbor/harbor/src/api/artifact" + "github.com/goharbor/harbor/src/controller/artifact" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/artifactrash" - "github.com/goharbor/harbor/src/pkg/q" "os" "time" diff --git a/src/internal/authorizer.go b/src/lib/authorizer.go similarity index 97% rename from src/internal/authorizer.go rename to src/lib/authorizer.go index 2c76b0a3e4..25b8d991e4 100644 --- a/src/internal/authorizer.go +++ b/src/lib/authorizer.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package internal +package lib import "github.com/goharbor/harbor/src/common/http/modifier" diff --git a/src/internal/context.go b/src/lib/context.go similarity index 99% rename from src/internal/context.go rename to src/lib/context.go index e12040a7d7..20f7f5ebd6 100644 --- a/src/internal/context.go +++ b/src/lib/context.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package internal +package lib import "context" diff --git a/src/internal/context_test.go b/src/lib/context_test.go similarity index 98% rename from src/internal/context_test.go rename to src/lib/context_test.go index b48f5c821b..499d54829d 100644 --- a/src/internal/context_test.go +++ b/src/lib/context_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package internal +package lib import ( "context" diff --git a/src/internal/error/errors.go b/src/lib/error/errors.go similarity index 100% rename from src/internal/error/errors.go rename to src/lib/error/errors.go diff --git a/src/internal/error/errors_test.go b/src/lib/error/errors_test.go similarity index 100% rename from src/internal/error/errors_test.go rename to src/lib/error/errors_test.go diff --git a/src/internal/link.go b/src/lib/link.go similarity index 99% rename from src/internal/link.go rename to src/lib/link.go index 3f185e5f23..450f2e6683 100644 --- a/src/internal/link.go +++ b/src/lib/link.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package internal +package lib import ( "fmt" diff --git a/src/internal/link_test.go b/src/lib/link_test.go similarity index 98% rename from src/internal/link_test.go rename to src/lib/link_test.go index 34e1fc4da9..30a20ce136 100644 --- a/src/internal/link_test.go +++ b/src/lib/link_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package internal +package lib import ( "github.com/stretchr/testify/assert" diff --git a/src/internal/orm/error.go b/src/lib/orm/error.go similarity index 97% rename from src/internal/orm/error.go rename to src/lib/orm/error.go index a081966177..438d152213 100644 --- a/src/internal/orm/error.go +++ b/src/lib/orm/error.go @@ -18,7 +18,7 @@ import ( "errors" "github.com/astaxie/beego/orm" - ierror "github.com/goharbor/harbor/src/internal/error" + ierror "github.com/goharbor/harbor/src/lib/error" "github.com/lib/pq" ) diff --git a/src/internal/orm/error_test.go b/src/lib/orm/error_test.go similarity index 97% rename from src/internal/orm/error_test.go rename to src/lib/orm/error_test.go index c1fb140fac..6680bf52f5 100644 --- a/src/internal/orm/error_test.go +++ b/src/lib/orm/error_test.go @@ -17,7 +17,7 @@ package orm import ( "errors" "github.com/astaxie/beego/orm" - "github.com/goharbor/harbor/src/internal/error" + "github.com/goharbor/harbor/src/lib/error" "github.com/lib/pq" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/src/internal/orm/orm.go b/src/lib/orm/orm.go similarity index 100% rename from src/internal/orm/orm.go rename to src/lib/orm/orm.go diff --git a/src/internal/orm/orm_test.go b/src/lib/orm/orm_test.go similarity index 100% rename from src/internal/orm/orm_test.go rename to src/lib/orm/orm_test.go diff --git a/src/internal/orm/query.go b/src/lib/orm/query.go similarity index 98% rename from src/internal/orm/query.go rename to src/lib/orm/query.go index 9130690ef7..1a9a39791d 100644 --- a/src/internal/orm/query.go +++ b/src/lib/orm/query.go @@ -21,7 +21,7 @@ import ( "github.com/astaxie/beego/orm" "github.com/goharbor/harbor/src/common/dao" - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/lib/q" ) // QuerySetter generates the query setter according to the query. "ignoredCols" is used to set the diff --git a/src/internal/orm/query_test.go b/src/lib/orm/query_test.go similarity index 100% rename from src/internal/orm/query_test.go rename to src/lib/orm/query_test.go diff --git a/src/internal/orm/tx.go b/src/lib/orm/tx.go similarity index 100% rename from src/internal/orm/tx.go rename to src/lib/orm/tx.go diff --git a/src/pkg/q/builder.go b/src/lib/q/builder.go similarity index 98% rename from src/pkg/q/builder.go rename to src/lib/q/builder.go index 5022673f61..7047fe4e34 100644 --- a/src/pkg/q/builder.go +++ b/src/lib/q/builder.go @@ -17,7 +17,7 @@ package q import ( "fmt" "github.com/goharbor/harbor/src/common/utils/log" - ierror "github.com/goharbor/harbor/src/internal/error" + ierror "github.com/goharbor/harbor/src/lib/error" "net/url" "strconv" "strings" diff --git a/src/pkg/q/builder_test.go b/src/lib/q/builder_test.go similarity index 100% rename from src/pkg/q/builder_test.go rename to src/lib/q/builder_test.go diff --git a/src/pkg/q/query.go b/src/lib/q/query.go similarity index 100% rename from src/pkg/q/query.go rename to src/lib/q/query.go diff --git a/src/internal/request.go b/src/lib/request.go similarity index 99% rename from src/internal/request.go rename to src/lib/request.go index c32601f614..11cea6b829 100644 --- a/src/internal/request.go +++ b/src/lib/request.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package internal +package lib import ( "bytes" diff --git a/src/internal/request_test.go b/src/lib/request_test.go similarity index 98% rename from src/internal/request_test.go rename to src/lib/request_test.go index f747190df3..b6a32db0a8 100644 --- a/src/internal/request_test.go +++ b/src/lib/request_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package internal +package lib import ( "io/ioutil" diff --git a/src/internal/response_buffer.go b/src/lib/response_buffer.go similarity index 99% rename from src/internal/response_buffer.go rename to src/lib/response_buffer.go index a4d4821d2b..edfbd4fe82 100644 --- a/src/internal/response_buffer.go +++ b/src/lib/response_buffer.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package internal +package lib import ( "bytes" diff --git a/src/internal/response_buffer_test.go b/src/lib/response_buffer_test.go similarity index 99% rename from src/internal/response_buffer_test.go rename to src/lib/response_buffer_test.go index 13b0003af0..dda8ac83db 100644 --- a/src/internal/response_buffer_test.go +++ b/src/lib/response_buffer_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package internal +package lib import ( "github.com/stretchr/testify/suite" diff --git a/src/internal/response_recorder.go b/src/lib/response_recorder.go similarity index 99% rename from src/internal/response_recorder.go rename to src/lib/response_recorder.go index 6378d5a414..2a71de7589 100644 --- a/src/internal/response_recorder.go +++ b/src/lib/response_recorder.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package internal +package lib import "net/http" diff --git a/src/internal/response_recorder_test.go b/src/lib/response_recorder_test.go similarity index 98% rename from src/internal/response_recorder_test.go rename to src/lib/response_recorder_test.go index 5ed0cea376..90d59859cb 100644 --- a/src/internal/response_recorder_test.go +++ b/src/lib/response_recorder_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package internal +package lib import ( "github.com/stretchr/testify/suite" diff --git a/src/internal/selector/candidate.go b/src/lib/selector/candidate.go similarity index 100% rename from src/internal/selector/candidate.go rename to src/lib/selector/candidate.go diff --git a/src/internal/selector/result.go b/src/lib/selector/result.go similarity index 100% rename from src/internal/selector/result.go rename to src/lib/selector/result.go diff --git a/src/internal/selector/selector.go b/src/lib/selector/selector.go similarity index 100% rename from src/internal/selector/selector.go rename to src/lib/selector/selector.go diff --git a/src/internal/selector/selectors/doublestar/selector.go b/src/lib/selector/selectors/doublestar/selector.go similarity index 98% rename from src/internal/selector/selectors/doublestar/selector.go rename to src/lib/selector/selectors/doublestar/selector.go index af50fd23cd..3a246be0c7 100644 --- a/src/internal/selector/selectors/doublestar/selector.go +++ b/src/lib/selector/selectors/doublestar/selector.go @@ -17,7 +17,7 @@ package doublestar import ( "encoding/json" "github.com/bmatcuk/doublestar" - iselector "github.com/goharbor/harbor/src/internal/selector" + iselector "github.com/goharbor/harbor/src/lib/selector" ) const ( diff --git a/src/internal/selector/selectors/doublestar/selector_test.go b/src/lib/selector/selectors/doublestar/selector_test.go similarity index 99% rename from src/internal/selector/selectors/doublestar/selector_test.go rename to src/lib/selector/selectors/doublestar/selector_test.go index ce2e9dab9f..afecba0c3c 100644 --- a/src/internal/selector/selectors/doublestar/selector_test.go +++ b/src/lib/selector/selectors/doublestar/selector_test.go @@ -16,7 +16,7 @@ package doublestar import ( "fmt" - iselector "github.com/goharbor/harbor/src/internal/selector" + iselector "github.com/goharbor/harbor/src/lib/selector" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" diff --git a/src/internal/selector/selectors/index/index.go b/src/lib/selector/selectors/index/index.go similarity index 95% rename from src/internal/selector/selectors/index/index.go rename to src/lib/selector/selectors/index/index.go index 059cfd55e4..0c246aeec9 100644 --- a/src/internal/selector/selectors/index/index.go +++ b/src/lib/selector/selectors/index/index.go @@ -15,10 +15,10 @@ package index import ( - "github.com/goharbor/harbor/src/internal/selector" + "github.com/goharbor/harbor/src/lib/selector" "sync" - "github.com/goharbor/harbor/src/internal/selector/selectors/doublestar" + "github.com/goharbor/harbor/src/lib/selector/selectors/doublestar" "github.com/pkg/errors" ) diff --git a/src/internal/selector/selectors/label/selector.go b/src/lib/selector/selectors/label/selector.go similarity index 96% rename from src/internal/selector/selectors/label/selector.go rename to src/lib/selector/selectors/label/selector.go index de61c4ec76..7523ce42f7 100644 --- a/src/internal/selector/selectors/label/selector.go +++ b/src/lib/selector/selectors/label/selector.go @@ -15,7 +15,7 @@ package label import ( - iselector "github.com/goharbor/harbor/src/internal/selector" + iselector "github.com/goharbor/harbor/src/lib/selector" "strings" ) diff --git a/src/internal/selector/selectors/label/selector_test.go b/src/lib/selector/selectors/label/selector_test.go similarity index 98% rename from src/internal/selector/selectors/label/selector_test.go rename to src/lib/selector/selectors/label/selector_test.go index 21058d9351..1f723ee00c 100644 --- a/src/internal/selector/selectors/label/selector_test.go +++ b/src/lib/selector/selectors/label/selector_test.go @@ -16,7 +16,7 @@ package label import ( "fmt" - iselector "github.com/goharbor/harbor/src/internal/selector" + iselector "github.com/goharbor/harbor/src/lib/selector" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" diff --git a/src/migration/artifact.go b/src/migration/artifact.go index dfacdb9c73..b51ea3c633 100644 --- a/src/migration/artifact.go +++ b/src/migration/artifact.go @@ -16,11 +16,11 @@ package migration import ( "context" - art "github.com/goharbor/harbor/src/api/artifact" "github.com/goharbor/harbor/src/common/utils/log" + art "github.com/goharbor/harbor/src/controller/artifact" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/artifact" "github.com/goharbor/harbor/src/pkg/project" - "github.com/goharbor/harbor/src/pkg/q" "github.com/goharbor/harbor/src/pkg/repository" ) diff --git a/src/migration/migration.go b/src/migration/migration.go index 44273dc0d4..3d782d9fd7 100644 --- a/src/migration/migration.go +++ b/src/migration/migration.go @@ -21,7 +21,7 @@ import ( "github.com/goharbor/harbor/src/common/dao" "github.com/goharbor/harbor/src/common/models" "github.com/goharbor/harbor/src/common/utils/log" - "github.com/goharbor/harbor/src/internal/orm" + "github.com/goharbor/harbor/src/lib/orm" "github.com/golang-migrate/migrate" ) diff --git a/src/pkg/artifact/dao/dao.go b/src/pkg/artifact/dao/dao.go index cb2840e987..74b2f42635 100644 --- a/src/pkg/artifact/dao/dao.go +++ b/src/pkg/artifact/dao/dao.go @@ -20,9 +20,9 @@ import ( "strings" beegoorm "github.com/astaxie/beego/orm" - ierror "github.com/goharbor/harbor/src/internal/error" - "github.com/goharbor/harbor/src/internal/orm" - "github.com/goharbor/harbor/src/pkg/q" + ierror "github.com/goharbor/harbor/src/lib/error" + "github.com/goharbor/harbor/src/lib/orm" + "github.com/goharbor/harbor/src/lib/q" ) // DAO is the data access object interface for artifact diff --git a/src/pkg/artifact/dao/dao_test.go b/src/pkg/artifact/dao/dao_test.go index 66615d676f..9a9f5d9efb 100644 --- a/src/pkg/artifact/dao/dao_test.go +++ b/src/pkg/artifact/dao/dao_test.go @@ -18,9 +18,9 @@ import ( "context" beegoorm "github.com/astaxie/beego/orm" common_dao "github.com/goharbor/harbor/src/common/dao" - ierror "github.com/goharbor/harbor/src/internal/error" - "github.com/goharbor/harbor/src/internal/orm" - "github.com/goharbor/harbor/src/pkg/q" + ierror "github.com/goharbor/harbor/src/lib/error" + "github.com/goharbor/harbor/src/lib/orm" + "github.com/goharbor/harbor/src/lib/q" tagdao "github.com/goharbor/harbor/src/pkg/tag/dao" "github.com/goharbor/harbor/src/pkg/tag/model/tag" v1 "github.com/opencontainers/image-spec/specs-go/v1" diff --git a/src/pkg/artifact/manager.go b/src/pkg/artifact/manager.go index 2340778f11..e45bdf68ad 100644 --- a/src/pkg/artifact/manager.go +++ b/src/pkg/artifact/manager.go @@ -16,8 +16,8 @@ package artifact import ( "context" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/artifact/dao" - "github.com/goharbor/harbor/src/pkg/q" ) var ( diff --git a/src/pkg/artifact/manager_test.go b/src/pkg/artifact/manager_test.go index 53cd9797da..63e5e5167b 100644 --- a/src/pkg/artifact/manager_test.go +++ b/src/pkg/artifact/manager_test.go @@ -19,8 +19,8 @@ import ( "testing" "time" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/artifact/dao" - "github.com/goharbor/harbor/src/pkg/q" v1 "github.com/opencontainers/image-spec/specs-go/v1" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/suite" diff --git a/src/pkg/artifactrash/dao/dao.go b/src/pkg/artifactrash/dao/dao.go index fb8b092515..370ae60bbf 100644 --- a/src/pkg/artifactrash/dao/dao.go +++ b/src/pkg/artifactrash/dao/dao.go @@ -4,8 +4,8 @@ import ( "context" "time" - ierror "github.com/goharbor/harbor/src/internal/error" - "github.com/goharbor/harbor/src/internal/orm" + ierror "github.com/goharbor/harbor/src/lib/error" + "github.com/goharbor/harbor/src/lib/orm" "github.com/goharbor/harbor/src/pkg/artifactrash/model" ) diff --git a/src/pkg/artifactrash/dao/dao_test.go b/src/pkg/artifactrash/dao/dao_test.go index 5511f5f203..135d5d5602 100644 --- a/src/pkg/artifactrash/dao/dao_test.go +++ b/src/pkg/artifactrash/dao/dao_test.go @@ -5,8 +5,8 @@ import ( "errors" beegoorm "github.com/astaxie/beego/orm" common_dao "github.com/goharbor/harbor/src/common/dao" - ierror "github.com/goharbor/harbor/src/internal/error" - "github.com/goharbor/harbor/src/internal/orm" + ierror "github.com/goharbor/harbor/src/lib/error" + "github.com/goharbor/harbor/src/lib/orm" artdao "github.com/goharbor/harbor/src/pkg/artifact/dao" "github.com/goharbor/harbor/src/pkg/artifactrash/model" v1 "github.com/opencontainers/image-spec/specs-go/v1" diff --git a/src/pkg/audit/dao/dao.go b/src/pkg/audit/dao/dao.go index 19fd27de31..ce2c56adff 100644 --- a/src/pkg/audit/dao/dao.go +++ b/src/pkg/audit/dao/dao.go @@ -16,10 +16,10 @@ package dao import ( "context" - ierror "github.com/goharbor/harbor/src/internal/error" - "github.com/goharbor/harbor/src/internal/orm" + ierror "github.com/goharbor/harbor/src/lib/error" + "github.com/goharbor/harbor/src/lib/orm" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/audit/model" - "github.com/goharbor/harbor/src/pkg/q" ) // DAO is the data access object for audit log diff --git a/src/pkg/audit/dao/dao_test.go b/src/pkg/audit/dao/dao_test.go index dfd0a47f0e..87e4570e73 100644 --- a/src/pkg/audit/dao/dao_test.go +++ b/src/pkg/audit/dao/dao_test.go @@ -19,10 +19,10 @@ import ( "errors" beegoorm "github.com/astaxie/beego/orm" common_dao "github.com/goharbor/harbor/src/common/dao" - ierror "github.com/goharbor/harbor/src/internal/error" - "github.com/goharbor/harbor/src/internal/orm" + ierror "github.com/goharbor/harbor/src/lib/error" + "github.com/goharbor/harbor/src/lib/orm" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/audit/model" - "github.com/goharbor/harbor/src/pkg/q" "github.com/stretchr/testify/suite" "testing" ) diff --git a/src/pkg/audit/manager.go b/src/pkg/audit/manager.go index 4cde9a2504..795f1cc5c4 100644 --- a/src/pkg/audit/manager.go +++ b/src/pkg/audit/manager.go @@ -16,9 +16,9 @@ package audit import ( "context" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/audit/dao" "github.com/goharbor/harbor/src/pkg/audit/model" - "github.com/goharbor/harbor/src/pkg/q" ) // Mgr is the global audit log manager instance diff --git a/src/pkg/audit/manager_test.go b/src/pkg/audit/manager_test.go index 394c74934f..a5bfb9930c 100644 --- a/src/pkg/audit/manager_test.go +++ b/src/pkg/audit/manager_test.go @@ -16,8 +16,8 @@ package audit import ( "context" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/audit/model" - "github.com/goharbor/harbor/src/pkg/q" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/suite" "testing" diff --git a/src/pkg/blob/dao/dao.go b/src/pkg/blob/dao/dao.go index 411f059b8c..b82c262234 100644 --- a/src/pkg/blob/dao/dao.go +++ b/src/pkg/blob/dao/dao.go @@ -21,9 +21,9 @@ import ( "time" "github.com/docker/distribution/manifest/schema2" - "github.com/goharbor/harbor/src/internal/orm" + "github.com/goharbor/harbor/src/lib/orm" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/blob/models" - "github.com/goharbor/harbor/src/pkg/q" ) // DAO the dao for Blob, ArtifactAndBlob and ProjectBlob diff --git a/src/pkg/clients/core/client.go b/src/pkg/clients/core/client.go index 5225a19d01..a80200a69f 100644 --- a/src/pkg/clients/core/client.go +++ b/src/pkg/clients/core/client.go @@ -16,7 +16,7 @@ package core import ( "fmt" - modelsv2 "github.com/goharbor/harbor/src/api/artifact" + modelsv2 "github.com/goharbor/harbor/src/controller/artifact" "net/http" "github.com/goharbor/harbor/src/chartserver" diff --git a/src/pkg/clients/core/image.go b/src/pkg/clients/core/image.go index 79f3cfeb3d..dfcbdd54e9 100644 --- a/src/pkg/clients/core/image.go +++ b/src/pkg/clients/core/image.go @@ -16,7 +16,7 @@ package core import ( "fmt" - modelsv2 "github.com/goharbor/harbor/src/api/artifact" + modelsv2 "github.com/goharbor/harbor/src/controller/artifact" ) func (c *client) ListAllArtifacts(project, repository string) ([]*modelsv2.Artifact, error) { diff --git a/src/pkg/immutabletag/dao/immutable.go b/src/pkg/immutabletag/dao/immutable.go index 9e591767bf..64c6e0d239 100644 --- a/src/pkg/immutabletag/dao/immutable.go +++ b/src/pkg/immutabletag/dao/immutable.go @@ -6,7 +6,7 @@ import ( "errors" "github.com/astaxie/beego/orm" "github.com/goharbor/harbor/src/common/dao" - internal_errors "github.com/goharbor/harbor/src/internal/error" + internal_errors "github.com/goharbor/harbor/src/lib/error" "github.com/goharbor/harbor/src/pkg/immutabletag/dao/model" ) diff --git a/src/pkg/immutabletag/match/matcher.go b/src/pkg/immutabletag/match/matcher.go index 0d1717c523..eda90e7b74 100644 --- a/src/pkg/immutabletag/match/matcher.go +++ b/src/pkg/immutabletag/match/matcher.go @@ -1,7 +1,7 @@ package match import ( - "github.com/goharbor/harbor/src/internal/selector" + "github.com/goharbor/harbor/src/lib/selector" ) // ImmutableTagMatcher ... diff --git a/src/pkg/immutabletag/match/rule/match.go b/src/pkg/immutabletag/match/rule/match.go index f656d21c5d..d54d31908e 100644 --- a/src/pkg/immutabletag/match/rule/match.go +++ b/src/pkg/immutabletag/match/rule/match.go @@ -1,8 +1,8 @@ package rule import ( - iselector "github.com/goharbor/harbor/src/internal/selector" - "github.com/goharbor/harbor/src/internal/selector/selectors/index" + iselector "github.com/goharbor/harbor/src/lib/selector" + "github.com/goharbor/harbor/src/lib/selector/selectors/index" "github.com/goharbor/harbor/src/pkg/immutabletag" "github.com/goharbor/harbor/src/pkg/immutabletag/match" "github.com/goharbor/harbor/src/pkg/immutabletag/model" diff --git a/src/pkg/immutabletag/match/rule/match_test.go b/src/pkg/immutabletag/match/rule/match_test.go index ce839bdd3d..c29dddb31f 100644 --- a/src/pkg/immutabletag/match/rule/match_test.go +++ b/src/pkg/immutabletag/match/rule/match_test.go @@ -2,7 +2,7 @@ package rule import ( "github.com/goharbor/harbor/src/common/dao" - "github.com/goharbor/harbor/src/internal/selector" + "github.com/goharbor/harbor/src/lib/selector" "github.com/goharbor/harbor/src/pkg/immutabletag" "github.com/goharbor/harbor/src/pkg/immutabletag/model" "github.com/stretchr/testify/assert" diff --git a/src/pkg/label/dao.go b/src/pkg/label/dao.go index 59e5fd41b3..d7df044504 100644 --- a/src/pkg/label/dao.go +++ b/src/pkg/label/dao.go @@ -18,9 +18,9 @@ import ( "context" beego_orm "github.com/astaxie/beego/orm" "github.com/goharbor/harbor/src/common/models" - ierror "github.com/goharbor/harbor/src/internal/error" - "github.com/goharbor/harbor/src/internal/orm" - "github.com/goharbor/harbor/src/pkg/q" + ierror "github.com/goharbor/harbor/src/lib/error" + "github.com/goharbor/harbor/src/lib/orm" + "github.com/goharbor/harbor/src/lib/q" ) func init() { diff --git a/src/pkg/label/dao_test.go b/src/pkg/label/dao_test.go index 143335034f..5ab0383663 100644 --- a/src/pkg/label/dao_test.go +++ b/src/pkg/label/dao_test.go @@ -19,10 +19,10 @@ import ( beegoorm "github.com/astaxie/beego/orm" common_dao "github.com/goharbor/harbor/src/common/dao" "github.com/goharbor/harbor/src/common/models" - ierror "github.com/goharbor/harbor/src/internal/error" - "github.com/goharbor/harbor/src/internal/orm" + ierror "github.com/goharbor/harbor/src/lib/error" + "github.com/goharbor/harbor/src/lib/orm" + "github.com/goharbor/harbor/src/lib/q" artdao "github.com/goharbor/harbor/src/pkg/artifact/dao" - "github.com/goharbor/harbor/src/pkg/q" v1 "github.com/opencontainers/image-spec/specs-go/v1" "github.com/stretchr/testify/suite" "testing" diff --git a/src/pkg/label/manager.go b/src/pkg/label/manager.go index 801f1e6878..7a2aa97457 100644 --- a/src/pkg/label/manager.go +++ b/src/pkg/label/manager.go @@ -17,8 +17,8 @@ package label import ( "context" "github.com/goharbor/harbor/src/common/models" - ierror "github.com/goharbor/harbor/src/internal/error" - "github.com/goharbor/harbor/src/pkg/q" + ierror "github.com/goharbor/harbor/src/lib/error" + "github.com/goharbor/harbor/src/lib/q" "time" ) diff --git a/src/pkg/label/manager_test.go b/src/pkg/label/manager_test.go index afcb9c7e62..2cb9d11026 100644 --- a/src/pkg/label/manager_test.go +++ b/src/pkg/label/manager_test.go @@ -17,8 +17,8 @@ package label import ( "context" "github.com/goharbor/harbor/src/common/models" - ierror "github.com/goharbor/harbor/src/internal/error" - "github.com/goharbor/harbor/src/pkg/q" + ierror "github.com/goharbor/harbor/src/lib/error" + "github.com/goharbor/harbor/src/lib/q" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/suite" "testing" diff --git a/src/pkg/quota/dao/dao.go b/src/pkg/quota/dao/dao.go index 00794427ba..76bea61f70 100644 --- a/src/pkg/quota/dao/dao.go +++ b/src/pkg/quota/dao/dao.go @@ -18,7 +18,7 @@ import ( "context" "time" - "github.com/goharbor/harbor/src/internal/orm" + "github.com/goharbor/harbor/src/lib/orm" "github.com/goharbor/harbor/src/pkg/quota/models" "github.com/goharbor/harbor/src/pkg/types" ) diff --git a/src/pkg/quota/dao/dao_test.go b/src/pkg/quota/dao/dao_test.go index 525caae4a0..33ea6d9de5 100644 --- a/src/pkg/quota/dao/dao_test.go +++ b/src/pkg/quota/dao/dao_test.go @@ -19,7 +19,7 @@ import ( "sync" "testing" - "github.com/goharbor/harbor/src/internal/orm" + "github.com/goharbor/harbor/src/lib/orm" "github.com/goharbor/harbor/src/pkg/types" htesting "github.com/goharbor/harbor/src/testing" "github.com/stretchr/testify/suite" diff --git a/src/pkg/quota/manager.go b/src/pkg/quota/manager.go index 1b71b47505..03cea9f033 100644 --- a/src/pkg/quota/manager.go +++ b/src/pkg/quota/manager.go @@ -17,7 +17,7 @@ package quota import ( "context" - "github.com/goharbor/harbor/src/internal/orm" + "github.com/goharbor/harbor/src/lib/orm" "github.com/goharbor/harbor/src/pkg/quota/dao" "github.com/goharbor/harbor/src/pkg/quota/models" "github.com/goharbor/harbor/src/pkg/types" diff --git a/src/pkg/registry/auth/authorizer.go b/src/pkg/registry/auth/authorizer.go index 9b5189115a..c7dbf3385f 100644 --- a/src/pkg/registry/auth/authorizer.go +++ b/src/pkg/registry/auth/authorizer.go @@ -24,14 +24,14 @@ import ( "github.com/docker/distribution/registry/client/auth/challenge" commonhttp "github.com/goharbor/harbor/src/common/http" "github.com/goharbor/harbor/src/common/http/modifier" - "github.com/goharbor/harbor/src/internal" + "github.com/goharbor/harbor/src/lib" "github.com/goharbor/harbor/src/pkg/registry/auth/basic" "github.com/goharbor/harbor/src/pkg/registry/auth/bearer" "github.com/goharbor/harbor/src/pkg/registry/auth/null" ) // NewAuthorizer creates an authorizer that can handle different auth schemes -func NewAuthorizer(username, password string, trType uint) internal.Authorizer { +func NewAuthorizer(username, password string, trType uint) lib.Authorizer { return &authorizer{ username: username, password: password, diff --git a/src/pkg/registry/auth/basic/authorizer.go b/src/pkg/registry/auth/basic/authorizer.go index 6e0294f2bb..4c9b1a4619 100644 --- a/src/pkg/registry/auth/basic/authorizer.go +++ b/src/pkg/registry/auth/basic/authorizer.go @@ -15,12 +15,12 @@ package basic import ( - "github.com/goharbor/harbor/src/internal" + "github.com/goharbor/harbor/src/lib" "net/http" ) // NewAuthorizer return a basic authorizer -func NewAuthorizer(username, password string) internal.Authorizer { +func NewAuthorizer(username, password string) lib.Authorizer { return &authorizer{ username: username, password: password, diff --git a/src/pkg/registry/auth/bearer/authorizer.go b/src/pkg/registry/auth/bearer/authorizer.go index 46ce8d3d35..fec90f8852 100644 --- a/src/pkg/registry/auth/bearer/authorizer.go +++ b/src/pkg/registry/auth/bearer/authorizer.go @@ -17,8 +17,8 @@ package bearer import ( "encoding/json" "fmt" - "github.com/goharbor/harbor/src/internal" - ierror "github.com/goharbor/harbor/src/internal/error" + "github.com/goharbor/harbor/src/lib" + ierror "github.com/goharbor/harbor/src/lib/error" "io/ioutil" "net/http" "net/url" @@ -30,7 +30,7 @@ const ( // NewAuthorizer return a bearer token authorizer // The parameter "a" is an authorizer used to fetch the token -func NewAuthorizer(realm, service string, a internal.Authorizer, transport ...*http.Transport) internal.Authorizer { +func NewAuthorizer(realm, service string, a lib.Authorizer, transport ...*http.Transport) lib.Authorizer { authorizer := &authorizer{ realm: realm, service: service, @@ -48,7 +48,7 @@ func NewAuthorizer(realm, service string, a internal.Authorizer, transport ...*h type authorizer struct { realm string service string - authorizer internal.Authorizer + authorizer lib.Authorizer cache *cache client *http.Client } diff --git a/src/pkg/registry/auth/bearer/authorizer_test.go b/src/pkg/registry/auth/bearer/authorizer_test.go index 11e3ef5ca6..d9d90aa0c6 100644 --- a/src/pkg/registry/auth/bearer/authorizer_test.go +++ b/src/pkg/registry/auth/bearer/authorizer_test.go @@ -16,7 +16,7 @@ package bearer import ( "fmt" - ierror "github.com/goharbor/harbor/src/internal/error" + ierror "github.com/goharbor/harbor/src/lib/error" "github.com/goharbor/harbor/src/pkg/registry/auth/basic" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/src/pkg/registry/auth/null/authorizer.go b/src/pkg/registry/auth/null/authorizer.go index 8d42cb5d70..aca5777cf9 100644 --- a/src/pkg/registry/auth/null/authorizer.go +++ b/src/pkg/registry/auth/null/authorizer.go @@ -15,12 +15,12 @@ package null import ( - "github.com/goharbor/harbor/src/internal" + "github.com/goharbor/harbor/src/lib" "net/http" ) // NewAuthorizer returns a null authorizer -func NewAuthorizer() internal.Authorizer { +func NewAuthorizer() lib.Authorizer { return &authorizer{} } diff --git a/src/pkg/registry/client.go b/src/pkg/registry/client.go index f55d110a1a..4fdf52578c 100644 --- a/src/pkg/registry/client.go +++ b/src/pkg/registry/client.go @@ -32,8 +32,8 @@ import ( "github.com/docker/distribution/manifest/schema2" commonhttp "github.com/goharbor/harbor/src/common/http" "github.com/goharbor/harbor/src/core/config" - "github.com/goharbor/harbor/src/internal" - ierror "github.com/goharbor/harbor/src/internal/error" + "github.com/goharbor/harbor/src/lib" + ierror "github.com/goharbor/harbor/src/lib/error" "github.com/goharbor/harbor/src/pkg/registry/auth" "github.com/opencontainers/go-digest" v1 "github.com/opencontainers/image-spec/specs-go/v1" @@ -116,7 +116,7 @@ func NewClient(url, username, password string, insecure bool) Client { } // NewClientWithAuthorizer creates a registry client with the provided authorizer -func NewClientWithAuthorizer(url string, authorizer internal.Authorizer, insecure bool) Client { +func NewClientWithAuthorizer(url string, authorizer lib.Authorizer, insecure bool) Client { var transportType uint if insecure { transportType = commonhttp.InsecureTransport @@ -135,7 +135,7 @@ func NewClientWithAuthorizer(url string, authorizer internal.Authorizer, insecur type client struct { url string - authorizer internal.Authorizer + authorizer lib.Authorizer client *http.Client } @@ -552,7 +552,7 @@ func (c *client) do(req *http.Request) (*http.Response, error) { // parse the next page link from the link header func next(link string) string { - links := internal.ParseLinks(link) + links := lib.ParseLinks(link) for _, lk := range links { if lk.Rel == "next" { return lk.URL diff --git a/src/pkg/registry/client_test.go b/src/pkg/registry/client_test.go index 2e78f05aef..114026545f 100644 --- a/src/pkg/registry/client_test.go +++ b/src/pkg/registry/client_test.go @@ -18,7 +18,7 @@ import ( "encoding/json" "github.com/docker/distribution/manifest/schema2" "github.com/goharbor/harbor/src/common/utils/test" - "github.com/goharbor/harbor/src/internal" + "github.com/goharbor/harbor/src/lib" "github.com/stretchr/testify/suite" "io/ioutil" "net/http" @@ -58,7 +58,7 @@ func (c *clientTestSuite) TestCatalog() { repos := &repositories{ Repositories: []string{"library/alpine"}, } - link := internal.Link{ + link := lib.Link{ URL: `/v2/_catalog?last=library/alpine`, Rel: "next", } @@ -109,7 +109,7 @@ func (c *clientTestSuite) TestListTags() { tgs := &tags{ Tags: []string{"1.0"}, } - link := internal.Link{ + link := lib.Link{ URL: `/v2/library/hello-world/tags/list?last=1.0`, Rel: "next", } diff --git a/src/pkg/repository/dao/dao.go b/src/pkg/repository/dao/dao.go index a14a87a73d..b200c517f1 100644 --- a/src/pkg/repository/dao/dao.go +++ b/src/pkg/repository/dao/dao.go @@ -18,9 +18,9 @@ import ( "context" o "github.com/astaxie/beego/orm" "github.com/goharbor/harbor/src/common/models" - ierror "github.com/goharbor/harbor/src/internal/error" - "github.com/goharbor/harbor/src/internal/orm" - "github.com/goharbor/harbor/src/pkg/q" + ierror "github.com/goharbor/harbor/src/lib/error" + "github.com/goharbor/harbor/src/lib/orm" + "github.com/goharbor/harbor/src/lib/q" "time" ) diff --git a/src/pkg/repository/dao/dao_test.go b/src/pkg/repository/dao/dao_test.go index 3075ed0554..de7b5a310e 100644 --- a/src/pkg/repository/dao/dao_test.go +++ b/src/pkg/repository/dao/dao_test.go @@ -21,9 +21,9 @@ import ( beegoorm "github.com/astaxie/beego/orm" common_dao "github.com/goharbor/harbor/src/common/dao" "github.com/goharbor/harbor/src/common/models" - ierror "github.com/goharbor/harbor/src/internal/error" - "github.com/goharbor/harbor/src/internal/orm" - "github.com/goharbor/harbor/src/pkg/q" + ierror "github.com/goharbor/harbor/src/lib/error" + "github.com/goharbor/harbor/src/lib/orm" + "github.com/goharbor/harbor/src/lib/q" "github.com/stretchr/testify/suite" "testing" "time" diff --git a/src/pkg/repository/manager.go b/src/pkg/repository/manager.go index 7c4341122c..0fa7c39478 100644 --- a/src/pkg/repository/manager.go +++ b/src/pkg/repository/manager.go @@ -17,8 +17,8 @@ package repository import ( "context" "github.com/goharbor/harbor/src/common/models" - ierror "github.com/goharbor/harbor/src/internal/error" - "github.com/goharbor/harbor/src/pkg/q" + ierror "github.com/goharbor/harbor/src/lib/error" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/repository/dao" ) diff --git a/src/pkg/repository/manager_test.go b/src/pkg/repository/manager_test.go index d5ba76c4c0..b1eaa6e7a3 100644 --- a/src/pkg/repository/manager_test.go +++ b/src/pkg/repository/manager_test.go @@ -17,7 +17,7 @@ package repository import ( "context" "github.com/goharbor/harbor/src/common/models" - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/lib/q" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/suite" "testing" diff --git a/src/pkg/retention/dep/client.go b/src/pkg/retention/dep/client.go index 93e5208ef7..0e098f4614 100644 --- a/src/pkg/retention/dep/client.go +++ b/src/pkg/retention/dep/client.go @@ -17,7 +17,7 @@ package dep import ( "errors" "fmt" - "github.com/goharbor/harbor/src/internal/selector" + "github.com/goharbor/harbor/src/lib/selector" "net/http" "time" diff --git a/src/pkg/retention/dep/client_test.go b/src/pkg/retention/dep/client_test.go index 3dd3b5c7bf..fe1d3fe6db 100644 --- a/src/pkg/retention/dep/client_test.go +++ b/src/pkg/retention/dep/client_test.go @@ -15,9 +15,9 @@ package dep import ( - modelsv2 "github.com/goharbor/harbor/src/api/artifact" - "github.com/goharbor/harbor/src/api/tag" - "github.com/goharbor/harbor/src/internal/selector" + modelsv2 "github.com/goharbor/harbor/src/controller/artifact" + "github.com/goharbor/harbor/src/controller/tag" + "github.com/goharbor/harbor/src/lib/selector" model_tag "github.com/goharbor/harbor/src/pkg/tag/model/tag" "testing" diff --git a/src/pkg/retention/job.go b/src/pkg/retention/job.go index 2201396b51..3d18c62f02 100644 --- a/src/pkg/retention/job.go +++ b/src/pkg/retention/job.go @@ -18,7 +18,7 @@ import ( "bytes" "encoding/json" "fmt" - "github.com/goharbor/harbor/src/internal/selector" + "github.com/goharbor/harbor/src/lib/selector" "strings" "time" diff --git a/src/pkg/retention/job_test.go b/src/pkg/retention/job_test.go index 5d063d768a..0556e9cfc2 100644 --- a/src/pkg/retention/job_test.go +++ b/src/pkg/retention/job_test.go @@ -17,13 +17,13 @@ package retention import ( "context" "fmt" - "github.com/goharbor/harbor/src/internal/selector" + "github.com/goharbor/harbor/src/lib/selector" "testing" "time" - "github.com/goharbor/harbor/src/internal/selector/selectors/doublestar" "github.com/goharbor/harbor/src/jobservice/job" "github.com/goharbor/harbor/src/jobservice/logger" + "github.com/goharbor/harbor/src/lib/selector/selectors/doublestar" "github.com/goharbor/harbor/src/pkg/retention/dep" "github.com/goharbor/harbor/src/pkg/retention/policy" "github.com/goharbor/harbor/src/pkg/retention/policy/action" diff --git a/src/pkg/retention/launcher.go b/src/pkg/retention/launcher.go index cb11f389b2..0f50c474c1 100644 --- a/src/pkg/retention/launcher.go +++ b/src/pkg/retention/launcher.go @@ -17,12 +17,12 @@ package retention import ( "fmt" beegoorm "github.com/astaxie/beego/orm" - "github.com/goharbor/harbor/src/internal/orm" - "github.com/goharbor/harbor/src/internal/selector" + "github.com/goharbor/harbor/src/lib/orm" + "github.com/goharbor/harbor/src/lib/selector" "time" - "github.com/goharbor/harbor/src/internal/selector/selectors/index" "github.com/goharbor/harbor/src/jobservice/job" + "github.com/goharbor/harbor/src/lib/selector/selectors/index" cjob "github.com/goharbor/harbor/src/common/job" "github.com/goharbor/harbor/src/common/job/models" @@ -30,8 +30,8 @@ import ( "github.com/goharbor/harbor/src/common/utils" "github.com/goharbor/harbor/src/common/utils/log" "github.com/goharbor/harbor/src/core/config" + pq "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/project" - pq "github.com/goharbor/harbor/src/pkg/q" "github.com/goharbor/harbor/src/pkg/repository" "github.com/goharbor/harbor/src/pkg/retention/policy" "github.com/goharbor/harbor/src/pkg/retention/policy/lwp" diff --git a/src/pkg/retention/launcher_test.go b/src/pkg/retention/launcher_test.go index f0cfe02edc..5fc7a3c4f9 100644 --- a/src/pkg/retention/launcher_test.go +++ b/src/pkg/retention/launcher_test.go @@ -18,7 +18,7 @@ import ( "fmt" "github.com/goharbor/harbor/src/common/job" "github.com/goharbor/harbor/src/common/models" - _ "github.com/goharbor/harbor/src/internal/selector/selectors/doublestar" + _ "github.com/goharbor/harbor/src/lib/selector/selectors/doublestar" "github.com/goharbor/harbor/src/pkg/project" "github.com/goharbor/harbor/src/pkg/retention/policy" "github.com/goharbor/harbor/src/pkg/retention/policy/rule" diff --git a/src/pkg/retention/policy/action/index/index_test.go b/src/pkg/retention/policy/action/index/index_test.go index db14805eaa..3292d9da83 100644 --- a/src/pkg/retention/policy/action/index/index_test.go +++ b/src/pkg/retention/policy/action/index/index_test.go @@ -15,7 +15,7 @@ package index import ( - "github.com/goharbor/harbor/src/internal/selector" + "github.com/goharbor/harbor/src/lib/selector" "testing" "time" diff --git a/src/pkg/retention/policy/action/performer.go b/src/pkg/retention/policy/action/performer.go index b74b683b39..edfce24b57 100644 --- a/src/pkg/retention/policy/action/performer.go +++ b/src/pkg/retention/policy/action/performer.go @@ -17,7 +17,7 @@ package action import ( "github.com/goharbor/harbor/src/common/utils" "github.com/goharbor/harbor/src/common/utils/log" - "github.com/goharbor/harbor/src/internal/selector" + "github.com/goharbor/harbor/src/lib/selector" "github.com/goharbor/harbor/src/pkg/immutabletag/match/rule" "github.com/goharbor/harbor/src/pkg/retention/dep" ) diff --git a/src/pkg/retention/policy/action/performer_test.go b/src/pkg/retention/policy/action/performer_test.go index 54783065ab..881087fd3a 100644 --- a/src/pkg/retention/policy/action/performer_test.go +++ b/src/pkg/retention/policy/action/performer_test.go @@ -16,7 +16,7 @@ package action import ( "github.com/goharbor/harbor/src/common/dao" - "github.com/goharbor/harbor/src/internal/selector" + "github.com/goharbor/harbor/src/lib/selector" "github.com/goharbor/harbor/src/pkg/immutabletag" "testing" "time" diff --git a/src/pkg/retention/policy/alg/or/processor.go b/src/pkg/retention/policy/alg/or/processor.go index e5dbb72aeb..a75f711795 100644 --- a/src/pkg/retention/policy/alg/or/processor.go +++ b/src/pkg/retention/policy/alg/or/processor.go @@ -15,7 +15,7 @@ package or import ( - "github.com/goharbor/harbor/src/internal/selector" + "github.com/goharbor/harbor/src/lib/selector" "sync" "github.com/goharbor/harbor/src/common/utils/log" diff --git a/src/pkg/retention/policy/alg/or/processor_test.go b/src/pkg/retention/policy/alg/or/processor_test.go index 1e4b9690a5..5cb2ad8933 100644 --- a/src/pkg/retention/policy/alg/or/processor_test.go +++ b/src/pkg/retention/policy/alg/or/processor_test.go @@ -17,12 +17,12 @@ package or import ( "errors" "github.com/goharbor/harbor/src/common/dao" - "github.com/goharbor/harbor/src/internal/selector" + "github.com/goharbor/harbor/src/lib/selector" "testing" "time" - "github.com/goharbor/harbor/src/internal/selector/selectors/doublestar" - "github.com/goharbor/harbor/src/internal/selector/selectors/label" + "github.com/goharbor/harbor/src/lib/selector/selectors/doublestar" + "github.com/goharbor/harbor/src/lib/selector/selectors/label" "github.com/goharbor/harbor/src/pkg/retention/dep" "github.com/goharbor/harbor/src/pkg/retention/policy/action" "github.com/goharbor/harbor/src/pkg/retention/policy/alg" diff --git a/src/pkg/retention/policy/alg/processor.go b/src/pkg/retention/policy/alg/processor.go index 3945793739..4ddd7762ce 100644 --- a/src/pkg/retention/policy/alg/processor.go +++ b/src/pkg/retention/policy/alg/processor.go @@ -15,7 +15,7 @@ package alg import ( - "github.com/goharbor/harbor/src/internal/selector" + "github.com/goharbor/harbor/src/lib/selector" "github.com/goharbor/harbor/src/pkg/retention/policy/action" "github.com/goharbor/harbor/src/pkg/retention/policy/rule" ) diff --git a/src/pkg/retention/policy/builder.go b/src/pkg/retention/policy/builder.go index f4e4cda96d..e732883896 100644 --- a/src/pkg/retention/policy/builder.go +++ b/src/pkg/retention/policy/builder.go @@ -16,13 +16,13 @@ package policy import ( "fmt" - "github.com/goharbor/harbor/src/internal/selector" + "github.com/goharbor/harbor/src/lib/selector" index4 "github.com/goharbor/harbor/src/pkg/retention/policy/action/index" index3 "github.com/goharbor/harbor/src/pkg/retention/policy/alg/index" - index2 "github.com/goharbor/harbor/src/internal/selector/selectors/index" + index2 "github.com/goharbor/harbor/src/lib/selector/selectors/index" "github.com/goharbor/harbor/src/pkg/retention/policy/rule/index" diff --git a/src/pkg/retention/policy/builder_test.go b/src/pkg/retention/policy/builder_test.go index 88e4359f50..9e0db9eee6 100644 --- a/src/pkg/retention/policy/builder_test.go +++ b/src/pkg/retention/policy/builder_test.go @@ -16,7 +16,7 @@ package policy import ( "github.com/goharbor/harbor/src/common/dao" - "github.com/goharbor/harbor/src/internal/selector" + "github.com/goharbor/harbor/src/lib/selector" "testing" "time" @@ -24,7 +24,7 @@ import ( index2 "github.com/goharbor/harbor/src/pkg/retention/policy/alg/index" - "github.com/goharbor/harbor/src/internal/selector/selectors/index" + "github.com/goharbor/harbor/src/lib/selector/selectors/index" "github.com/goharbor/harbor/src/pkg/retention/dep" @@ -32,9 +32,9 @@ import ( "github.com/goharbor/harbor/src/pkg/retention/policy/alg/or" - "github.com/goharbor/harbor/src/internal/selector/selectors/label" + "github.com/goharbor/harbor/src/lib/selector/selectors/label" - "github.com/goharbor/harbor/src/internal/selector/selectors/doublestar" + "github.com/goharbor/harbor/src/lib/selector/selectors/doublestar" "github.com/goharbor/harbor/src/pkg/retention/policy/rule/latestps" diff --git a/src/pkg/retention/policy/rule/always/evaluator.go b/src/pkg/retention/policy/rule/always/evaluator.go index 7cd35968d9..4018247397 100644 --- a/src/pkg/retention/policy/rule/always/evaluator.go +++ b/src/pkg/retention/policy/rule/always/evaluator.go @@ -15,7 +15,7 @@ package always import ( - "github.com/goharbor/harbor/src/internal/selector" + "github.com/goharbor/harbor/src/lib/selector" "github.com/goharbor/harbor/src/pkg/retention/policy/action" "github.com/goharbor/harbor/src/pkg/retention/policy/rule" ) diff --git a/src/pkg/retention/policy/rule/always/evaluator_test.go b/src/pkg/retention/policy/rule/always/evaluator_test.go index 3e767612ee..92edea9328 100644 --- a/src/pkg/retention/policy/rule/always/evaluator_test.go +++ b/src/pkg/retention/policy/rule/always/evaluator_test.go @@ -15,7 +15,7 @@ package always import ( - "github.com/goharbor/harbor/src/internal/selector" + "github.com/goharbor/harbor/src/lib/selector" "testing" "github.com/goharbor/harbor/src/pkg/retention/policy/rule" diff --git a/src/pkg/retention/policy/rule/dayspl/evaluator.go b/src/pkg/retention/policy/rule/dayspl/evaluator.go index 71bb04ca65..f63361b72b 100644 --- a/src/pkg/retention/policy/rule/dayspl/evaluator.go +++ b/src/pkg/retention/policy/rule/dayspl/evaluator.go @@ -17,7 +17,7 @@ package dayspl import ( "fmt" "github.com/goharbor/harbor/src/common/utils" - "github.com/goharbor/harbor/src/internal/selector" + "github.com/goharbor/harbor/src/lib/selector" "time" "github.com/goharbor/harbor/src/common/utils/log" diff --git a/src/pkg/retention/policy/rule/dayspl/evaluator_test.go b/src/pkg/retention/policy/rule/dayspl/evaluator_test.go index 3c49b6b27d..ad3b1e9d15 100644 --- a/src/pkg/retention/policy/rule/dayspl/evaluator_test.go +++ b/src/pkg/retention/policy/rule/dayspl/evaluator_test.go @@ -17,7 +17,7 @@ package dayspl import ( "errors" "fmt" - "github.com/goharbor/harbor/src/internal/selector" + "github.com/goharbor/harbor/src/lib/selector" "github.com/stretchr/testify/assert" "testing" "time" diff --git a/src/pkg/retention/policy/rule/daysps/evaluator.go b/src/pkg/retention/policy/rule/daysps/evaluator.go index b17d55c98e..ab102c022b 100644 --- a/src/pkg/retention/policy/rule/daysps/evaluator.go +++ b/src/pkg/retention/policy/rule/daysps/evaluator.go @@ -17,7 +17,7 @@ package daysps import ( "fmt" "github.com/goharbor/harbor/src/common/utils" - "github.com/goharbor/harbor/src/internal/selector" + "github.com/goharbor/harbor/src/lib/selector" "time" "github.com/goharbor/harbor/src/common/utils/log" diff --git a/src/pkg/retention/policy/rule/daysps/evaluator_test.go b/src/pkg/retention/policy/rule/daysps/evaluator_test.go index e694c6fbc8..6a8b3fd0bf 100644 --- a/src/pkg/retention/policy/rule/daysps/evaluator_test.go +++ b/src/pkg/retention/policy/rule/daysps/evaluator_test.go @@ -17,7 +17,7 @@ package daysps import ( "errors" "fmt" - "github.com/goharbor/harbor/src/internal/selector" + "github.com/goharbor/harbor/src/lib/selector" "testing" "time" diff --git a/src/pkg/retention/policy/rule/evaluator.go b/src/pkg/retention/policy/rule/evaluator.go index ff3f73e44d..c71b3b1103 100644 --- a/src/pkg/retention/policy/rule/evaluator.go +++ b/src/pkg/retention/policy/rule/evaluator.go @@ -15,7 +15,7 @@ package rule import ( - "github.com/goharbor/harbor/src/internal/selector" + "github.com/goharbor/harbor/src/lib/selector" ) // Evaluator defines method of executing rule diff --git a/src/pkg/retention/policy/rule/index/index_test.go b/src/pkg/retention/policy/rule/index/index_test.go index ff5c69b74f..8c7ef318e9 100644 --- a/src/pkg/retention/policy/rule/index/index_test.go +++ b/src/pkg/retention/policy/rule/index/index_test.go @@ -15,7 +15,7 @@ package index import ( - "github.com/goharbor/harbor/src/internal/selector" + "github.com/goharbor/harbor/src/lib/selector" "testing" "time" diff --git a/src/pkg/retention/policy/rule/lastx/evaluator.go b/src/pkg/retention/policy/rule/lastx/evaluator.go index 382eda9ba6..88932d1247 100644 --- a/src/pkg/retention/policy/rule/lastx/evaluator.go +++ b/src/pkg/retention/policy/rule/lastx/evaluator.go @@ -16,7 +16,7 @@ package lastx import ( "github.com/goharbor/harbor/src/common/utils" - "github.com/goharbor/harbor/src/internal/selector" + "github.com/goharbor/harbor/src/lib/selector" "time" "github.com/goharbor/harbor/src/common/utils/log" diff --git a/src/pkg/retention/policy/rule/lastx/evaluator_test.go b/src/pkg/retention/policy/rule/lastx/evaluator_test.go index 97fc595e35..fb0b65c824 100644 --- a/src/pkg/retention/policy/rule/lastx/evaluator_test.go +++ b/src/pkg/retention/policy/rule/lastx/evaluator_test.go @@ -2,7 +2,7 @@ package lastx import ( "fmt" - "github.com/goharbor/harbor/src/internal/selector" + "github.com/goharbor/harbor/src/lib/selector" "testing" "time" diff --git a/src/pkg/retention/policy/rule/latestk/evaluator.go b/src/pkg/retention/policy/rule/latestk/evaluator.go index 3a2ce890bc..f2b2c8c763 100644 --- a/src/pkg/retention/policy/rule/latestk/evaluator.go +++ b/src/pkg/retention/policy/rule/latestk/evaluator.go @@ -16,7 +16,7 @@ package latestk import ( "github.com/goharbor/harbor/src/common/utils" - "github.com/goharbor/harbor/src/internal/selector" + "github.com/goharbor/harbor/src/lib/selector" "sort" "github.com/goharbor/harbor/src/common/utils/log" diff --git a/src/pkg/retention/policy/rule/latestk/evaluator_test.go b/src/pkg/retention/policy/rule/latestk/evaluator_test.go index 42f88f0c1d..b1c16211db 100644 --- a/src/pkg/retention/policy/rule/latestk/evaluator_test.go +++ b/src/pkg/retention/policy/rule/latestk/evaluator_test.go @@ -16,7 +16,7 @@ package latestk import ( "fmt" - "github.com/goharbor/harbor/src/internal/selector" + "github.com/goharbor/harbor/src/lib/selector" "testing" "github.com/goharbor/harbor/src/pkg/retention/policy/rule" diff --git a/src/pkg/retention/policy/rule/latestpl/evaluator.go b/src/pkg/retention/policy/rule/latestpl/evaluator.go index 422a2c40d9..91030258c7 100644 --- a/src/pkg/retention/policy/rule/latestpl/evaluator.go +++ b/src/pkg/retention/policy/rule/latestpl/evaluator.go @@ -17,7 +17,7 @@ package latestpl import ( "fmt" "github.com/goharbor/harbor/src/common/utils" - "github.com/goharbor/harbor/src/internal/selector" + "github.com/goharbor/harbor/src/lib/selector" "math" "sort" diff --git a/src/pkg/retention/policy/rule/latestpl/evaluator_test.go b/src/pkg/retention/policy/rule/latestpl/evaluator_test.go index bcb74de6dd..aff6d249bf 100644 --- a/src/pkg/retention/policy/rule/latestpl/evaluator_test.go +++ b/src/pkg/retention/policy/rule/latestpl/evaluator_test.go @@ -17,7 +17,7 @@ package latestpl import ( "errors" "fmt" - "github.com/goharbor/harbor/src/internal/selector" + "github.com/goharbor/harbor/src/lib/selector" "math/rand" "testing" diff --git a/src/pkg/retention/policy/rule/latestps/evaluator.go b/src/pkg/retention/policy/rule/latestps/evaluator.go index 796810003d..d0adb98a4c 100644 --- a/src/pkg/retention/policy/rule/latestps/evaluator.go +++ b/src/pkg/retention/policy/rule/latestps/evaluator.go @@ -17,7 +17,7 @@ package latestps import ( "fmt" "github.com/goharbor/harbor/src/common/utils" - "github.com/goharbor/harbor/src/internal/selector" + "github.com/goharbor/harbor/src/lib/selector" "math" "sort" diff --git a/src/pkg/retention/policy/rule/latestps/evaluator_test.go b/src/pkg/retention/policy/rule/latestps/evaluator_test.go index 37cfbe20e4..82e7c965fa 100644 --- a/src/pkg/retention/policy/rule/latestps/evaluator_test.go +++ b/src/pkg/retention/policy/rule/latestps/evaluator_test.go @@ -3,7 +3,7 @@ package latestps import ( "errors" "fmt" - "github.com/goharbor/harbor/src/internal/selector" + "github.com/goharbor/harbor/src/lib/selector" "math/rand" "testing" diff --git a/src/pkg/retention/policy/rule/nothing/evaluator.go b/src/pkg/retention/policy/rule/nothing/evaluator.go index 1884037ea2..5741863243 100644 --- a/src/pkg/retention/policy/rule/nothing/evaluator.go +++ b/src/pkg/retention/policy/rule/nothing/evaluator.go @@ -15,7 +15,7 @@ package nothing import ( - "github.com/goharbor/harbor/src/internal/selector" + "github.com/goharbor/harbor/src/lib/selector" "github.com/goharbor/harbor/src/pkg/retention/policy/action" "github.com/goharbor/harbor/src/pkg/retention/policy/rule" ) diff --git a/src/pkg/retention/policy/rule/nothing/evaluator_test.go b/src/pkg/retention/policy/rule/nothing/evaluator_test.go index 64f8b3f2c9..6f088ba27f 100644 --- a/src/pkg/retention/policy/rule/nothing/evaluator_test.go +++ b/src/pkg/retention/policy/rule/nothing/evaluator_test.go @@ -15,7 +15,7 @@ package nothing import ( - "github.com/goharbor/harbor/src/internal/selector" + "github.com/goharbor/harbor/src/lib/selector" "testing" "github.com/goharbor/harbor/src/pkg/retention/policy/rule" diff --git a/src/pkg/robot/controller.go b/src/pkg/robot/controller.go index 2eddf772a6..8d47cd1784 100644 --- a/src/pkg/robot/controller.go +++ b/src/pkg/robot/controller.go @@ -6,7 +6,7 @@ import ( "github.com/goharbor/harbor/src/common" "github.com/goharbor/harbor/src/common/utils/log" "github.com/goharbor/harbor/src/core/config" - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/robot/model" "github.com/goharbor/harbor/src/pkg/token" robot_claim "github.com/goharbor/harbor/src/pkg/token/claims/robot" diff --git a/src/pkg/robot/controller_test.go b/src/pkg/robot/controller_test.go index 7d320edb2e..6a4905f02f 100644 --- a/src/pkg/robot/controller_test.go +++ b/src/pkg/robot/controller_test.go @@ -8,8 +8,8 @@ import ( "github.com/goharbor/harbor/src/common/rbac" "github.com/goharbor/harbor/src/common/utils/test" core_cfg "github.com/goharbor/harbor/src/core/config" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/permission/types" - "github.com/goharbor/harbor/src/pkg/q" "github.com/goharbor/harbor/src/pkg/robot/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/src/pkg/robot/dao/robot.go b/src/pkg/robot/dao/robot.go index b7532a4ebf..c78df19e79 100644 --- a/src/pkg/robot/dao/robot.go +++ b/src/pkg/robot/dao/robot.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/astaxie/beego/orm" "github.com/goharbor/harbor/src/common/dao" - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/robot/model" "strings" "time" diff --git a/src/pkg/robot/dao/robot_test.go b/src/pkg/robot/dao/robot_test.go index b55d722d45..02e6f6ea21 100644 --- a/src/pkg/robot/dao/robot_test.go +++ b/src/pkg/robot/dao/robot_test.go @@ -2,7 +2,7 @@ package dao import ( "github.com/goharbor/harbor/src/common/dao" - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/robot/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/src/pkg/robot/manager.go b/src/pkg/robot/manager.go index 9a435e1f32..8a1b8ada91 100644 --- a/src/pkg/robot/manager.go +++ b/src/pkg/robot/manager.go @@ -1,7 +1,7 @@ package robot import ( - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/robot/dao" "github.com/goharbor/harbor/src/pkg/robot/model" ) diff --git a/src/pkg/robot/manager_test.go b/src/pkg/robot/manager_test.go index e1bd1fd067..83ef8790ea 100644 --- a/src/pkg/robot/manager_test.go +++ b/src/pkg/robot/manager_test.go @@ -1,7 +1,7 @@ package robot import ( - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/robot/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" diff --git a/src/pkg/scan/dao/scan/report.go b/src/pkg/scan/dao/scan/report.go index 43a59fd938..fa024e58d3 100644 --- a/src/pkg/scan/dao/scan/report.go +++ b/src/pkg/scan/dao/scan/report.go @@ -22,7 +22,7 @@ import ( "github.com/astaxie/beego/orm" "github.com/goharbor/harbor/src/common/dao" "github.com/goharbor/harbor/src/common/utils/log" - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/lib/q" "github.com/pkg/errors" ) diff --git a/src/pkg/scan/dao/scan/report_test.go b/src/pkg/scan/dao/scan/report_test.go index 1830daddf6..b97f0b6870 100644 --- a/src/pkg/scan/dao/scan/report_test.go +++ b/src/pkg/scan/dao/scan/report_test.go @@ -19,7 +19,7 @@ import ( "github.com/goharbor/harbor/src/common/dao" "github.com/goharbor/harbor/src/jobservice/job" - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/lib/q" v1 "github.com/goharbor/harbor/src/pkg/scan/rest/v1" "github.com/pkg/errors" "github.com/stretchr/testify/assert" diff --git a/src/pkg/scan/dao/scanner/registration.go b/src/pkg/scan/dao/scanner/registration.go index 4dab9ca09f..0c1ffd8213 100644 --- a/src/pkg/scan/dao/scanner/registration.go +++ b/src/pkg/scan/dao/scanner/registration.go @@ -20,7 +20,7 @@ import ( "github.com/astaxie/beego/orm" "github.com/goharbor/harbor/src/common/dao" - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/types" "github.com/pkg/errors" ) diff --git a/src/pkg/scan/dao/scanner/registration_test.go b/src/pkg/scan/dao/scanner/registration_test.go index b44c4a4358..bbf2e48d43 100644 --- a/src/pkg/scan/dao/scanner/registration_test.go +++ b/src/pkg/scan/dao/scanner/registration_test.go @@ -18,7 +18,7 @@ import ( "testing" "github.com/goharbor/harbor/src/common/dao" - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/lib/q" "github.com/google/uuid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/src/pkg/scan/init.go b/src/pkg/scan/init.go index 347740f607..565b6ca609 100644 --- a/src/pkg/scan/init.go +++ b/src/pkg/scan/init.go @@ -16,7 +16,7 @@ package scan import ( "github.com/goharbor/harbor/src/common/utils/log" - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/scan/dao/scanner" sc "github.com/goharbor/harbor/src/pkg/scan/scanner" "github.com/goharbor/harbor/src/pkg/types" diff --git a/src/pkg/scan/init_test.go b/src/pkg/scan/init_test.go index aabe4af228..28be5a91ab 100644 --- a/src/pkg/scan/init_test.go +++ b/src/pkg/scan/init_test.go @@ -15,7 +15,7 @@ package scan import ( - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/scan/dao/scanner" "github.com/goharbor/harbor/src/pkg/scan/scanner/mocks" "github.com/pkg/errors" diff --git a/src/pkg/scan/report/base_manager.go b/src/pkg/scan/report/base_manager.go index bd78d517ab..3a7ab33e35 100644 --- a/src/pkg/scan/report/base_manager.go +++ b/src/pkg/scan/report/base_manager.go @@ -17,9 +17,9 @@ package report import ( "time" - ierror "github.com/goharbor/harbor/src/internal/error" "github.com/goharbor/harbor/src/jobservice/job" - "github.com/goharbor/harbor/src/pkg/q" + ierror "github.com/goharbor/harbor/src/lib/error" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/scan/all" "github.com/goharbor/harbor/src/pkg/scan/dao/scan" "github.com/google/uuid" diff --git a/src/pkg/scan/scanner/manager.go b/src/pkg/scan/scanner/manager.go index c6421fe51e..0f2d988b39 100644 --- a/src/pkg/scan/scanner/manager.go +++ b/src/pkg/scan/scanner/manager.go @@ -15,7 +15,7 @@ package scanner import ( - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/scan/dao/scanner" "github.com/google/uuid" "github.com/pkg/errors" diff --git a/src/pkg/scan/scanner/manager_test.go b/src/pkg/scan/scanner/manager_test.go index 6f8a485d24..5ee71c03e1 100644 --- a/src/pkg/scan/scanner/manager_test.go +++ b/src/pkg/scan/scanner/manager_test.go @@ -18,7 +18,7 @@ import ( "testing" "github.com/goharbor/harbor/src/common/dao" - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/scan/dao/scanner" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/src/pkg/scan/scanner/mocks/manager.go b/src/pkg/scan/scanner/mocks/manager.go index 15731b986d..caf0c8e1bb 100644 --- a/src/pkg/scan/scanner/mocks/manager.go +++ b/src/pkg/scan/scanner/mocks/manager.go @@ -3,7 +3,7 @@ package mocks import ( - q "github.com/goharbor/harbor/src/pkg/q" + q "github.com/goharbor/harbor/src/lib/q" mock "github.com/stretchr/testify/mock" scanner "github.com/goharbor/harbor/src/pkg/scan/dao/scanner" diff --git a/src/pkg/tag/dao/dao.go b/src/pkg/tag/dao/dao.go index f3cbf4b86a..6d268fa2cd 100644 --- a/src/pkg/tag/dao/dao.go +++ b/src/pkg/tag/dao/dao.go @@ -17,9 +17,9 @@ package dao import ( "context" beego_orm "github.com/astaxie/beego/orm" - ierror "github.com/goharbor/harbor/src/internal/error" - "github.com/goharbor/harbor/src/internal/orm" - "github.com/goharbor/harbor/src/pkg/q" + ierror "github.com/goharbor/harbor/src/lib/error" + "github.com/goharbor/harbor/src/lib/orm" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/tag/model/tag" ) diff --git a/src/pkg/tag/dao/dao_test.go b/src/pkg/tag/dao/dao_test.go index 4ac3df9d61..5ec2b64b0d 100644 --- a/src/pkg/tag/dao/dao_test.go +++ b/src/pkg/tag/dao/dao_test.go @@ -19,10 +19,10 @@ import ( "errors" beegoorm "github.com/astaxie/beego/orm" common_dao "github.com/goharbor/harbor/src/common/dao" - ierror "github.com/goharbor/harbor/src/internal/error" - "github.com/goharbor/harbor/src/internal/orm" + ierror "github.com/goharbor/harbor/src/lib/error" + "github.com/goharbor/harbor/src/lib/orm" + "github.com/goharbor/harbor/src/lib/q" artdao "github.com/goharbor/harbor/src/pkg/artifact/dao" - "github.com/goharbor/harbor/src/pkg/q" "github.com/goharbor/harbor/src/pkg/tag/model/tag" "github.com/stretchr/testify/suite" "testing" diff --git a/src/pkg/tag/manager.go b/src/pkg/tag/manager.go index f8a6ee9ad3..6357b41056 100644 --- a/src/pkg/tag/manager.go +++ b/src/pkg/tag/manager.go @@ -16,7 +16,7 @@ package tag import ( "context" - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/tag/dao" "github.com/goharbor/harbor/src/pkg/tag/model/tag" ) diff --git a/src/pkg/tag/manager_test.go b/src/pkg/tag/manager_test.go index 534188b50b..09f335c400 100644 --- a/src/pkg/tag/manager_test.go +++ b/src/pkg/tag/manager_test.go @@ -16,7 +16,7 @@ package tag import ( "context" - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/tag/model/tag" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/suite" diff --git a/src/replication/adapter/harbor/image_registry.go b/src/replication/adapter/harbor/image_registry.go index 4ed7b36652..2bd499c901 100644 --- a/src/replication/adapter/harbor/image_registry.go +++ b/src/replication/adapter/harbor/image_registry.go @@ -16,11 +16,11 @@ package harbor import ( "fmt" - "github.com/goharbor/harbor/src/api/artifact" "github.com/goharbor/harbor/src/common/api" "github.com/goharbor/harbor/src/common/models" "github.com/goharbor/harbor/src/common/utils" "github.com/goharbor/harbor/src/common/utils/log" + "github.com/goharbor/harbor/src/controller/artifact" adp "github.com/goharbor/harbor/src/replication/adapter" "github.com/goharbor/harbor/src/replication/filter" "github.com/goharbor/harbor/src/replication/model" diff --git a/src/replication/adapter/native/adapter.go b/src/replication/adapter/native/adapter.go index e8dce8e3b8..c5f5b5662f 100644 --- a/src/replication/adapter/native/adapter.go +++ b/src/replication/adapter/native/adapter.go @@ -20,8 +20,8 @@ import ( "github.com/goharbor/harbor/src/common/utils" "github.com/goharbor/harbor/src/common/utils/log" - "github.com/goharbor/harbor/src/internal" - ierror "github.com/goharbor/harbor/src/internal/error" + "github.com/goharbor/harbor/src/lib" + ierror "github.com/goharbor/harbor/src/lib/error" "github.com/goharbor/harbor/src/pkg/registry" adp "github.com/goharbor/harbor/src/replication/adapter" "github.com/goharbor/harbor/src/replication/filter" @@ -78,7 +78,7 @@ func NewAdapter(reg *model.Registry) *Adapter { } // NewAdapterWithAuthorizer returns an instance of the Adapter with provided authorizer -func NewAdapterWithAuthorizer(reg *model.Registry, authorizer internal.Authorizer) *Adapter { +func NewAdapterWithAuthorizer(reg *model.Registry, authorizer lib.Authorizer) *Adapter { return &Adapter{ registry: reg, Client: registry.NewClientWithAuthorizer(reg.URL, authorizer, reg.Insecure), diff --git a/src/server/error/error.go b/src/server/error/error.go index c4bb11c9b0..efdf9e7f72 100644 --- a/src/server/error/error.go +++ b/src/server/error/error.go @@ -22,7 +22,7 @@ import ( "github.com/go-openapi/runtime/middleware" commonhttp "github.com/goharbor/harbor/src/common/http" "github.com/goharbor/harbor/src/common/utils/log" - ierror "github.com/goharbor/harbor/src/internal/error" + ierror "github.com/goharbor/harbor/src/lib/error" "net/http" "strings" ) diff --git a/src/server/error/error_test.go b/src/server/error/error_test.go index 94be36c4d5..2ac41d2d58 100644 --- a/src/server/error/error_test.go +++ b/src/server/error/error_test.go @@ -18,7 +18,7 @@ import ( "errors" openapi "github.com/go-openapi/errors" commonhttp "github.com/goharbor/harbor/src/common/http" - ierror "github.com/goharbor/harbor/src/internal/error" + ierror "github.com/goharbor/harbor/src/lib/error" "github.com/stretchr/testify/assert" "net/http" "net/http/httptest" diff --git a/src/server/middleware/apiversion/api_version.go b/src/server/middleware/apiversion/api_version.go index f6da0ed0cc..bdec4c9468 100644 --- a/src/server/middleware/apiversion/api_version.go +++ b/src/server/middleware/apiversion/api_version.go @@ -15,7 +15,7 @@ package apiversion import ( - "github.com/goharbor/harbor/src/internal" + "github.com/goharbor/harbor/src/lib" "github.com/goharbor/harbor/src/server/middleware" "net/http" ) @@ -24,7 +24,7 @@ import ( func Middleware(version string) middleware.Middleware { return func(handler http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { - ctx := internal.WithAPIVersion(req.Context(), version) + ctx := lib.WithAPIVersion(req.Context(), version) handler.ServeHTTP(w, req.WithContext(ctx)) }) } diff --git a/src/server/middleware/apiversion/api_version_test.go b/src/server/middleware/apiversion/api_version_test.go index e372bbc8e5..f09b99b5d9 100644 --- a/src/server/middleware/apiversion/api_version_test.go +++ b/src/server/middleware/apiversion/api_version_test.go @@ -15,7 +15,7 @@ package apiversion import ( - "github.com/goharbor/harbor/src/internal" + "github.com/goharbor/harbor/src/lib" "github.com/stretchr/testify/assert" "net/http" "net/http/httptest" @@ -27,7 +27,7 @@ func TestMiddleware(t *testing.T) { middleware := Middleware("1.0") req := httptest.NewRequest("GET", "http://localhost", nil) handler := http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { - version = internal.GetAPIVersion(req.Context()) + version = lib.GetAPIVersion(req.Context()) }) middleware(handler).ServeHTTP(nil, req) assert.Equal(t, "1.0", version) diff --git a/src/server/middleware/artifactinfo/artifact_info.go b/src/server/middleware/artifactinfo/artifact_info.go index 527c9ebe0d..7e7a40b021 100644 --- a/src/server/middleware/artifactinfo/artifact_info.go +++ b/src/server/middleware/artifactinfo/artifact_info.go @@ -22,8 +22,8 @@ import ( "strings" "github.com/goharbor/harbor/src/common/utils/log" - "github.com/goharbor/harbor/src/internal" - ierror "github.com/goharbor/harbor/src/internal/error" + "github.com/goharbor/harbor/src/lib" + ierror "github.com/goharbor/harbor/src/lib/error" serror "github.com/goharbor/harbor/src/server/error" "github.com/goharbor/harbor/src/server/middleware" "github.com/opencontainers/go-digest" @@ -62,7 +62,7 @@ func Middleware() func(http.Handler) http.Handler { serror.SendError(rw, ierror.BadRequestError(err)) return } - art := internal.ArtifactInfo{ + art := lib.ArtifactInfo{ Repository: repo, ProjectName: pn, } @@ -87,7 +87,7 @@ func Middleware() func(http.Handler) http.Handler { art.BlobMountProjectName = bmp art.BlobMountRepository = bmr } - ctx := internal.WithArtifactInfo(req.Context(), art) + ctx := lib.WithArtifactInfo(req.Context(), art) next.ServeHTTP(rw, req.WithContext(ctx)) }) } diff --git a/src/server/middleware/artifactinfo/artifact_info_test.go b/src/server/middleware/artifactinfo/artifact_info_test.go index 2fef05774a..d5de72c9b7 100644 --- a/src/server/middleware/artifactinfo/artifact_info_test.go +++ b/src/server/middleware/artifactinfo/artifact_info_test.go @@ -21,7 +21,7 @@ import ( "net/url" "testing" - "github.com/goharbor/harbor/src/internal" + "github.com/goharbor/harbor/src/lib" "github.com/goharbor/harbor/src/server/middleware" "github.com/stretchr/testify/assert" ) @@ -123,11 +123,11 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, req *http.Request) { } func TestPopulateArtifactInfo(t *testing.T) { - none := internal.ArtifactInfo{} + none := lib.ArtifactInfo{} cases := []struct { req *http.Request sc int - art internal.ArtifactInfo + art lib.ArtifactInfo }{ { req: httptest.NewRequest(http.MethodDelete, "/v2/hello-world/manifests/latest", nil), @@ -137,7 +137,7 @@ func TestPopulateArtifactInfo(t *testing.T) { { req: httptest.NewRequest(http.MethodDelete, "/v2/library/hello-world/manifests/latest", nil), sc: http.StatusOK, - art: internal.ArtifactInfo{ + art: lib.ArtifactInfo{ Repository: "library/hello-world", Reference: "latest", ProjectName: "library", @@ -152,7 +152,7 @@ func TestPopulateArtifactInfo(t *testing.T) { { req: httptest.NewRequest(http.MethodPost, "/v2/library/ubuntu/blobs/uploads/?from=old/ubuntu&mount=sha256:08e4a417ff4e3913d8723a05cc34055db01c2fd165b588e049c5bad16ce6094f", nil), sc: http.StatusOK, - art: internal.ArtifactInfo{ + art: lib.ArtifactInfo{ Repository: "library/ubuntu", ProjectName: "library", BlobMountRepository: "old/ubuntu", @@ -163,7 +163,7 @@ func TestPopulateArtifactInfo(t *testing.T) { { req: httptest.NewRequest(http.MethodDelete, "/v2/library/hello-world/manifests/sha256:08e4a417ff4e3913d8723a05cc34055db01c2fd165b588e049c5bad16ce6094f", nil), sc: http.StatusOK, - art: internal.ArtifactInfo{ + art: lib.ArtifactInfo{ Repository: "library/hello-world", Reference: "sha256:08e4a417ff4e3913d8723a05cc34055db01c2fd165b588e049c5bad16ce6094f", Digest: "sha256:08e4a417ff4e3913d8723a05cc34055db01c2fd165b588e049c5bad16ce6094f", @@ -179,7 +179,7 @@ func TestPopulateArtifactInfo(t *testing.T) { Middleware()(next).ServeHTTP(rec, tt.req) assert.Equal(t, tt.sc, rec.Code) if tt.art != none { - a := internal.GetArtifactInfo(next.ctx) + a := lib.GetArtifactInfo(next.ctx) assert.NotEqual(t, none, a) assert.Equal(t, tt.art, a) } diff --git a/src/server/middleware/blob/controller.go b/src/server/middleware/blob/controller.go index 263b16d036..bf34b39ca4 100644 --- a/src/server/middleware/blob/controller.go +++ b/src/server/middleware/blob/controller.go @@ -15,9 +15,9 @@ package blob import ( - "github.com/goharbor/harbor/src/api/artifact" - "github.com/goharbor/harbor/src/api/blob" - "github.com/goharbor/harbor/src/api/project" + "github.com/goharbor/harbor/src/controller/artifact" + "github.com/goharbor/harbor/src/controller/blob" + "github.com/goharbor/harbor/src/controller/project" ) var ( diff --git a/src/server/middleware/blob/copy_artifact.go b/src/server/middleware/blob/copy_artifact.go index a6600466df..495a8db1f2 100644 --- a/src/server/middleware/blob/copy_artifact.go +++ b/src/server/middleware/blob/copy_artifact.go @@ -32,9 +32,9 @@ import ( "net/http" "strings" - "github.com/goharbor/harbor/src/api/artifact" "github.com/goharbor/harbor/src/common/utils/log" - ierror "github.com/goharbor/harbor/src/internal/error" + "github.com/goharbor/harbor/src/controller/artifact" + ierror "github.com/goharbor/harbor/src/lib/error" "github.com/goharbor/harbor/src/pkg/blob" "github.com/goharbor/harbor/src/pkg/distribution" "github.com/goharbor/harbor/src/server/middleware" diff --git a/src/server/middleware/blob/patch_blob_upload_test.go b/src/server/middleware/blob/patch_blob_upload_test.go index f04c8e95e6..b944162810 100644 --- a/src/server/middleware/blob/patch_blob_upload_test.go +++ b/src/server/middleware/blob/patch_blob_upload_test.go @@ -20,7 +20,7 @@ import ( "net/http/httptest" "testing" - "github.com/goharbor/harbor/src/api/blob" + "github.com/goharbor/harbor/src/controller/blob" "github.com/google/uuid" "github.com/stretchr/testify/suite" ) diff --git a/src/server/middleware/blob/post_initiate_blob_upload_test.go b/src/server/middleware/blob/post_initiate_blob_upload_test.go index 22a78423a1..a94e6caad3 100644 --- a/src/server/middleware/blob/post_initiate_blob_upload_test.go +++ b/src/server/middleware/blob/post_initiate_blob_upload_test.go @@ -20,7 +20,7 @@ import ( "net/http/httptest" "testing" - "github.com/goharbor/harbor/src/api/blob" + "github.com/goharbor/harbor/src/controller/blob" htesting "github.com/goharbor/harbor/src/testing" "github.com/stretchr/testify/suite" ) diff --git a/src/server/middleware/blob/put_blob_upload_test.go b/src/server/middleware/blob/put_blob_upload_test.go index fa19f6a219..422d0c1b25 100644 --- a/src/server/middleware/blob/put_blob_upload_test.go +++ b/src/server/middleware/blob/put_blob_upload_test.go @@ -20,7 +20,7 @@ import ( "net/http/httptest" "testing" - "github.com/goharbor/harbor/src/api/blob" + "github.com/goharbor/harbor/src/controller/blob" htesting "github.com/goharbor/harbor/src/testing" "github.com/google/uuid" "github.com/stretchr/testify/suite" diff --git a/src/server/middleware/blob/put_manifest_test.go b/src/server/middleware/blob/put_manifest_test.go index fba86ed073..06facac21a 100644 --- a/src/server/middleware/blob/put_manifest_test.go +++ b/src/server/middleware/blob/put_manifest_test.go @@ -21,7 +21,7 @@ import ( "strings" "testing" - "github.com/goharbor/harbor/src/api/blob" + "github.com/goharbor/harbor/src/controller/blob" "github.com/goharbor/harbor/src/pkg/distribution" htesting "github.com/goharbor/harbor/src/testing" "github.com/google/uuid" diff --git a/src/server/middleware/contenttrust/contenttrust.go b/src/server/middleware/contenttrust/contenttrust.go index fa08884025..e8d1c12d2b 100644 --- a/src/server/middleware/contenttrust/contenttrust.go +++ b/src/server/middleware/contenttrust/contenttrust.go @@ -4,11 +4,11 @@ import ( "net/http" "net/http/httptest" - "github.com/goharbor/harbor/src/api/project" "github.com/goharbor/harbor/src/common/rbac" "github.com/goharbor/harbor/src/common/security" - "github.com/goharbor/harbor/src/internal" - internal_errors "github.com/goharbor/harbor/src/internal/error" + "github.com/goharbor/harbor/src/controller/project" + "github.com/goharbor/harbor/src/lib" + internal_errors "github.com/goharbor/harbor/src/lib/error" "github.com/goharbor/harbor/src/pkg/signature" serror "github.com/goharbor/harbor/src/server/error" "github.com/goharbor/harbor/src/server/middleware" @@ -45,12 +45,12 @@ func Middleware() func(http.Handler) http.Handler { } } -func validate(req *http.Request) (bool, internal.ArtifactInfo) { - none := internal.ArtifactInfo{} +func validate(req *http.Request) (bool, lib.ArtifactInfo) { + none := lib.ArtifactInfo{} if err := middleware.EnsureArtifactDigest(req.Context()); err != nil { return false, none } - af := internal.GetArtifactInfo(req.Context()) + af := lib.GetArtifactInfo(req.Context()) if af == none { return false, none } @@ -74,7 +74,7 @@ func validate(req *http.Request) (bool, internal.ArtifactInfo) { // isArtifactSigned use the sign manager to check the signature, it could handle pull by tag or digtest // if pull by digest, any tag of the artifact is signed, will return true. -func isArtifactSigned(req *http.Request, art internal.ArtifactInfo) (bool, error) { +func isArtifactSigned(req *http.Request, art lib.ArtifactInfo) (bool, error) { checker, err := signature.GetManager().GetCheckerByRepo(req.Context(), art.Repository) if err != nil { return false, err diff --git a/src/server/middleware/csrf/csrf.go b/src/server/middleware/csrf/csrf.go index 47a1d2d5b0..dfe94cb439 100644 --- a/src/server/middleware/csrf/csrf.go +++ b/src/server/middleware/csrf/csrf.go @@ -9,8 +9,8 @@ import ( "github.com/goharbor/harbor/src/common/utils" "github.com/goharbor/harbor/src/common/utils/log" "github.com/goharbor/harbor/src/core/config" - "github.com/goharbor/harbor/src/internal" - ierror "github.com/goharbor/harbor/src/internal/error" + "github.com/goharbor/harbor/src/lib" + ierror "github.com/goharbor/harbor/src/lib/error" serror "github.com/goharbor/harbor/src/server/error" "github.com/goharbor/harbor/src/server/middleware" "github.com/gorilla/csrf" @@ -82,7 +82,7 @@ func csrfSkipper(req *http.Request) bool { if (strings.HasPrefix(path, "/v2/") || strings.HasPrefix(path, "/api/") || strings.HasPrefix(path, "/chartrepo/") || - strings.HasPrefix(path, "/service/")) && !internal.GetCarrySession(req.Context()) { + strings.HasPrefix(path, "/service/")) && !lib.GetCarrySession(req.Context()) { return true } return false diff --git a/src/server/middleware/immutable/pushmf.go b/src/server/middleware/immutable/pushmf.go index 1bfa4c656c..535fc8e531 100644 --- a/src/server/middleware/immutable/pushmf.go +++ b/src/server/middleware/immutable/pushmf.go @@ -5,12 +5,12 @@ import ( "fmt" "net/http" - "github.com/goharbor/harbor/src/api/artifact" - "github.com/goharbor/harbor/src/api/tag" common_util "github.com/goharbor/harbor/src/common/utils" "github.com/goharbor/harbor/src/common/utils/log" - "github.com/goharbor/harbor/src/internal" - internal_errors "github.com/goharbor/harbor/src/internal/error" + "github.com/goharbor/harbor/src/controller/artifact" + "github.com/goharbor/harbor/src/controller/tag" + "github.com/goharbor/harbor/src/lib" + internal_errors "github.com/goharbor/harbor/src/lib/error" serror "github.com/goharbor/harbor/src/server/error" ) @@ -38,8 +38,8 @@ func Middleware() func(http.Handler) http.Handler { // If the pushing image matched by any of immutable rule, will have to whether it is the first time to push it, // as the immutable rule only impacts the existing tag. func handlePush(req *http.Request) error { - none := internal.ArtifactInfo{} - art := internal.GetArtifactInfo(req.Context()) + none := lib.ArtifactInfo{} + art := lib.GetArtifactInfo(req.Context()) if art == none { return errors.New("cannot get the manifest information from request context") } diff --git a/src/server/middleware/immutable/pushmf_test.go b/src/server/middleware/immutable/pushmf_test.go index a730f24638..90c61b29bf 100644 --- a/src/server/middleware/immutable/pushmf_test.go +++ b/src/server/middleware/immutable/pushmf_test.go @@ -12,8 +12,8 @@ import ( "github.com/goharbor/harbor/src/common/dao" "github.com/goharbor/harbor/src/common/models" - "github.com/goharbor/harbor/src/internal" - internal_orm "github.com/goharbor/harbor/src/internal/orm" + "github.com/goharbor/harbor/src/lib" + internal_orm "github.com/goharbor/harbor/src/lib/orm" "github.com/goharbor/harbor/src/pkg/artifact" "github.com/goharbor/harbor/src/pkg/immutabletag" immu_model "github.com/goharbor/harbor/src/pkg/immutabletag/model" @@ -35,7 +35,7 @@ func doPutManifestRequest(projectID int64, projectName, name, tag, dgt string, n url := fmt.Sprintf("/v2/%s/manifests/%s", repository, tag) req, _ := http.NewRequest("PUT", url, nil) - afInfo := internal.ArtifactInfo{ + afInfo := lib.ArtifactInfo{ ProjectName: projectName, Repository: repository, Tag: tag, @@ -52,7 +52,7 @@ func doPutManifestRequest(projectID int64, projectName, name, tag, dgt string, n } } *req = *(req.WithContext(internal_orm.NewContext(context.TODO(), dao.GetOrmer()))) - *req = *(req.WithContext(internal.WithArtifactInfo(req.Context(), afInfo))) + *req = *(req.WithContext(lib.WithArtifactInfo(req.Context(), afInfo))) h := Middleware()(n) h.ServeHTTP(rr, req) diff --git a/src/server/middleware/middleware.go b/src/server/middleware/middleware.go index 1329177273..7510757c0f 100644 --- a/src/server/middleware/middleware.go +++ b/src/server/middleware/middleware.go @@ -17,7 +17,7 @@ package middleware import ( "net/http" - "github.com/goharbor/harbor/src/internal" + "github.com/goharbor/harbor/src/lib" serror "github.com/goharbor/harbor/src/server/error" ) @@ -62,7 +62,7 @@ func New(fn func(http.ResponseWriter, *http.Request, http.Handler), skippers ... // BeforeRequest make a middleware which will call hook before the next handler func BeforeRequest(hook func(*http.Request) error, skippers ...Skipper) func(http.Handler) http.Handler { return New(func(w http.ResponseWriter, r *http.Request, next http.Handler) { - if err := hook(internal.NopCloseRequest(r)); err != nil { + if err := hook(lib.NopCloseRequest(r)); err != nil { serror.SendError(w, err) return } @@ -75,9 +75,9 @@ func BeforeRequest(hook func(*http.Request) error, skippers ...Skipper) func(htt // AfterResponse make a middleware which will call hook after the next handler func AfterResponse(hook func(http.ResponseWriter, *http.Request, int) error, skippers ...Skipper) func(http.Handler) http.Handler { return New(func(w http.ResponseWriter, r *http.Request, next http.Handler) { - res, ok := w.(*internal.ResponseBuffer) + res, ok := w.(*lib.ResponseBuffer) if !ok { - res = internal.NewResponseBuffer(w) + res = lib.NewResponseBuffer(w) defer res.Flush() } diff --git a/src/server/middleware/notification/notification.go b/src/server/middleware/notification/notification.go index e2ee37b77a..8101b1b1a0 100644 --- a/src/server/middleware/notification/notification.go +++ b/src/server/middleware/notification/notification.go @@ -17,7 +17,7 @@ package notification import ( "net/http" - "github.com/goharbor/harbor/src/internal" + "github.com/goharbor/harbor/src/lib" "github.com/goharbor/harbor/src/pkg/notification" "github.com/goharbor/harbor/src/pkg/notifier/event" "github.com/goharbor/harbor/src/server/middleware" @@ -26,7 +26,7 @@ import ( // Middleware sends the notification after transaction success func Middleware(skippers ...middleware.Skipper) func(http.Handler) http.Handler { return middleware.New(func(w http.ResponseWriter, r *http.Request, next http.Handler) { - res := internal.NewResponseRecorder(w) + res := lib.NewResponseRecorder(w) evc := notification.NewEventCtx() next.ServeHTTP(res, r.WithContext(notification.NewContext(r.Context(), evc))) if res.Success() || evc.MustNotify { diff --git a/src/server/middleware/notification/notification_test.go b/src/server/middleware/notification/notification_test.go index de23e708a2..5027c51993 100644 --- a/src/server/middleware/notification/notification_test.go +++ b/src/server/middleware/notification/notification_test.go @@ -21,7 +21,7 @@ import ( "net/http/httptest" "testing" - "github.com/goharbor/harbor/src/api/event/metadata" + "github.com/goharbor/harbor/src/controller/event/metadata" "github.com/goharbor/harbor/src/pkg/artifact" "github.com/goharbor/harbor/src/pkg/notification" "github.com/stretchr/testify/suite" diff --git a/src/server/middleware/orm/orm.go b/src/server/middleware/orm/orm.go index 76fb9e539f..583ded8e88 100644 --- a/src/server/middleware/orm/orm.go +++ b/src/server/middleware/orm/orm.go @@ -18,7 +18,7 @@ import ( "net/http" o "github.com/astaxie/beego/orm" - "github.com/goharbor/harbor/src/internal/orm" + "github.com/goharbor/harbor/src/lib/orm" "github.com/goharbor/harbor/src/server/middleware" ) diff --git a/src/server/middleware/orm/orm_test.go b/src/server/middleware/orm/orm_test.go index f452079ab7..2ad0cfb3a9 100644 --- a/src/server/middleware/orm/orm_test.go +++ b/src/server/middleware/orm/orm_test.go @@ -20,7 +20,7 @@ import ( "testing" o "github.com/astaxie/beego/orm" - "github.com/goharbor/harbor/src/internal/orm" + "github.com/goharbor/harbor/src/lib/orm" "github.com/stretchr/testify/assert" ) diff --git a/src/server/middleware/quota/controller.go b/src/server/middleware/quota/controller.go index 6e0e98489b..c1603a92d9 100644 --- a/src/server/middleware/quota/controller.go +++ b/src/server/middleware/quota/controller.go @@ -15,11 +15,11 @@ package quota import ( - "github.com/goharbor/harbor/src/api/artifact" - "github.com/goharbor/harbor/src/api/blob" - "github.com/goharbor/harbor/src/api/chartmuseum" - "github.com/goharbor/harbor/src/api/project" - "github.com/goharbor/harbor/src/api/quota" + "github.com/goharbor/harbor/src/controller/artifact" + "github.com/goharbor/harbor/src/controller/blob" + "github.com/goharbor/harbor/src/controller/chartmuseum" + "github.com/goharbor/harbor/src/controller/project" + "github.com/goharbor/harbor/src/controller/quota" ) var ( diff --git a/src/server/middleware/quota/copy_artifact.go b/src/server/middleware/quota/copy_artifact.go index 6335776a71..492f8c99ec 100644 --- a/src/server/middleware/quota/copy_artifact.go +++ b/src/server/middleware/quota/copy_artifact.go @@ -35,14 +35,14 @@ import ( "strings" "time" - "github.com/goharbor/harbor/src/api/artifact" - "github.com/goharbor/harbor/src/api/event/metadata" "github.com/goharbor/harbor/src/common/utils/log" - ierror "github.com/goharbor/harbor/src/internal/error" + "github.com/goharbor/harbor/src/controller/artifact" + "github.com/goharbor/harbor/src/controller/event/metadata" + ierror "github.com/goharbor/harbor/src/lib/error" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/blob" "github.com/goharbor/harbor/src/pkg/distribution" "github.com/goharbor/harbor/src/pkg/notifier/event" - "github.com/goharbor/harbor/src/pkg/q" "github.com/goharbor/harbor/src/pkg/types" ) diff --git a/src/server/middleware/quota/copy_artifact_test.go b/src/server/middleware/quota/copy_artifact_test.go index 25ad5bd000..051721ec69 100644 --- a/src/server/middleware/quota/copy_artifact_test.go +++ b/src/server/middleware/quota/copy_artifact_test.go @@ -33,8 +33,8 @@ import ( "net/http/httptest" "testing" - "github.com/goharbor/harbor/src/api/artifact" commonmodels "github.com/goharbor/harbor/src/common/models" + "github.com/goharbor/harbor/src/controller/artifact" "github.com/goharbor/harbor/src/pkg/notification" "github.com/goharbor/harbor/src/pkg/quota" "github.com/goharbor/harbor/src/pkg/types" diff --git a/src/server/middleware/quota/post_initiate_blob_upload.go b/src/server/middleware/quota/post_initiate_blob_upload.go index c64ac613c5..45a805d54f 100644 --- a/src/server/middleware/quota/post_initiate_blob_upload.go +++ b/src/server/middleware/quota/post_initiate_blob_upload.go @@ -18,9 +18,9 @@ import ( "net/http" "strconv" - "github.com/goharbor/harbor/src/api/blob" "github.com/goharbor/harbor/src/common/utils/log" - ierror "github.com/goharbor/harbor/src/internal/error" + "github.com/goharbor/harbor/src/controller/blob" + ierror "github.com/goharbor/harbor/src/lib/error" "github.com/goharbor/harbor/src/pkg/types" ) diff --git a/src/server/middleware/quota/put_blob_upload.go b/src/server/middleware/quota/put_blob_upload.go index ecd3a4b3c2..4f39240c25 100644 --- a/src/server/middleware/quota/put_blob_upload.go +++ b/src/server/middleware/quota/put_blob_upload.go @@ -18,8 +18,8 @@ import ( "net/http" "strconv" - "github.com/goharbor/harbor/src/api/blob" "github.com/goharbor/harbor/src/common/utils/log" + "github.com/goharbor/harbor/src/controller/blob" "github.com/goharbor/harbor/src/pkg/distribution" "github.com/goharbor/harbor/src/pkg/types" ) diff --git a/src/server/middleware/quota/put_manifest.go b/src/server/middleware/quota/put_manifest.go index 75a8947018..d61dd8c0f4 100644 --- a/src/server/middleware/quota/put_manifest.go +++ b/src/server/middleware/quota/put_manifest.go @@ -20,10 +20,10 @@ import ( "strconv" "time" - "github.com/goharbor/harbor/src/api/blob" - "github.com/goharbor/harbor/src/api/event/metadata" "github.com/goharbor/harbor/src/common/utils/log" - "github.com/goharbor/harbor/src/internal" + "github.com/goharbor/harbor/src/controller/blob" + "github.com/goharbor/harbor/src/controller/event/metadata" + "github.com/goharbor/harbor/src/lib" "github.com/goharbor/harbor/src/pkg/blob/models" "github.com/goharbor/harbor/src/pkg/distribution" "github.com/goharbor/harbor/src/pkg/notifier/event" @@ -42,7 +42,7 @@ func PutManifestMiddleware() func(http.Handler) http.Handler { var ( unmarshalManifest = func(r *http.Request) (distribution.Manifest, distribution.Descriptor, error) { - internal.NopCloseRequest(r) + lib.NopCloseRequest(r) body, err := ioutil.ReadAll(r.Body) if err != nil { diff --git a/src/server/middleware/quota/put_manifest_test.go b/src/server/middleware/quota/put_manifest_test.go index 2ca177a171..f6aa21e635 100644 --- a/src/server/middleware/quota/put_manifest_test.go +++ b/src/server/middleware/quota/put_manifest_test.go @@ -22,7 +22,7 @@ import ( "github.com/docker/distribution/manifest/schema2" commonmodels "github.com/goharbor/harbor/src/common/models" - ierror "github.com/goharbor/harbor/src/internal/error" + ierror "github.com/goharbor/harbor/src/lib/error" "github.com/goharbor/harbor/src/pkg/blob/models" "github.com/goharbor/harbor/src/pkg/distribution" "github.com/goharbor/harbor/src/pkg/notification" diff --git a/src/server/middleware/quota/quota.go b/src/server/middleware/quota/quota.go index ac480eac93..12dc14c103 100644 --- a/src/server/middleware/quota/quota.go +++ b/src/server/middleware/quota/quota.go @@ -21,7 +21,7 @@ import ( "strings" "github.com/goharbor/harbor/src/common/utils/log" - "github.com/goharbor/harbor/src/internal" + "github.com/goharbor/harbor/src/lib" "github.com/goharbor/harbor/src/pkg/notification" "github.com/goharbor/harbor/src/pkg/notifier/event" "github.com/goharbor/harbor/src/pkg/quota" @@ -103,9 +103,9 @@ func RequestMiddleware(config RequestConfig, skippers ...middleware.Skipper) fun return } - res, ok := w.(*internal.ResponseBuffer) + res, ok := w.(*lib.ResponseBuffer) if !ok { - res = internal.NewResponseBuffer(w) + res = lib.NewResponseBuffer(w) defer res.Flush() } diff --git a/src/server/middleware/quota/quota_test.go b/src/server/middleware/quota/quota_test.go index e609f03d2d..d1bbb9bc6e 100644 --- a/src/server/middleware/quota/quota_test.go +++ b/src/server/middleware/quota/quota_test.go @@ -20,11 +20,11 @@ import ( "net/http/httptest" "testing" - "github.com/goharbor/harbor/src/api/artifact" - "github.com/goharbor/harbor/src/api/blob" - "github.com/goharbor/harbor/src/api/project" - "github.com/goharbor/harbor/src/api/quota" "github.com/goharbor/harbor/src/common/models" + "github.com/goharbor/harbor/src/controller/artifact" + "github.com/goharbor/harbor/src/controller/blob" + "github.com/goharbor/harbor/src/controller/project" + "github.com/goharbor/harbor/src/controller/quota" "github.com/goharbor/harbor/src/pkg/types" artifacttesting "github.com/goharbor/harbor/src/testing/api/artifact" blobtesting "github.com/goharbor/harbor/src/testing/api/blob" diff --git a/src/server/middleware/quota/upload_chart_version.go b/src/server/middleware/quota/upload_chart_version.go index 4ea46d0838..8bdafc9b4a 100644 --- a/src/server/middleware/quota/upload_chart_version.go +++ b/src/server/middleware/quota/upload_chart_version.go @@ -21,7 +21,7 @@ import ( "strconv" "github.com/goharbor/harbor/src/common/api" - "github.com/goharbor/harbor/src/internal" + "github.com/goharbor/harbor/src/lib" "github.com/goharbor/harbor/src/pkg/types" "github.com/goharbor/harbor/src/server/middleware" "k8s.io/helm/pkg/chartutil" @@ -60,7 +60,7 @@ var ( ) func uploadChartVersionResources(r *http.Request, reference, referenceID string) (types.ResourceList, error) { - internal.NopCloseRequest(r) + lib.NopCloseRequest(r) ct, err := parseChart(r) if err != nil { diff --git a/src/server/middleware/quota/util.go b/src/server/middleware/quota/util.go index 2477121c02..b90520f9a9 100644 --- a/src/server/middleware/quota/util.go +++ b/src/server/middleware/quota/util.go @@ -18,7 +18,7 @@ import ( "fmt" "net/http" - "github.com/goharbor/harbor/src/api/quota" + "github.com/goharbor/harbor/src/controller/quota" "github.com/goharbor/harbor/src/server/middleware/util" ) diff --git a/src/server/middleware/readonly/readonly.go b/src/server/middleware/readonly/readonly.go index 30c3a4f5e1..5220718c5c 100644 --- a/src/server/middleware/readonly/readonly.go +++ b/src/server/middleware/readonly/readonly.go @@ -19,7 +19,7 @@ import ( "net/http" "github.com/goharbor/harbor/src/core/config" - internal_errors "github.com/goharbor/harbor/src/internal/error" + internal_errors "github.com/goharbor/harbor/src/lib/error" "github.com/goharbor/harbor/src/server/middleware" ) diff --git a/src/server/middleware/security/auth_proxy.go b/src/server/middleware/security/auth_proxy.go index fb431dfff9..c0a0e79aba 100644 --- a/src/server/middleware/security/auth_proxy.go +++ b/src/server/middleware/security/auth_proxy.go @@ -26,7 +26,7 @@ import ( "github.com/goharbor/harbor/src/common/utils/log" "github.com/goharbor/harbor/src/core/auth" "github.com/goharbor/harbor/src/core/config" - "github.com/goharbor/harbor/src/internal" + "github.com/goharbor/harbor/src/lib" "github.com/goharbor/harbor/src/pkg/authproxy" ) @@ -34,7 +34,7 @@ type authProxy struct{} func (a *authProxy) Generate(req *http.Request) security.Context { log := log.G(req.Context()) - if internal.GetAuthMode(req.Context()) != common.HTTPAuth { + if lib.GetAuthMode(req.Context()) != common.HTTPAuth { return nil } // only support docker login diff --git a/src/server/middleware/security/auth_proxy_test.go b/src/server/middleware/security/auth_proxy_test.go index 318b651bc1..f364a5ba2d 100644 --- a/src/server/middleware/security/auth_proxy_test.go +++ b/src/server/middleware/security/auth_proxy_test.go @@ -22,7 +22,7 @@ import ( "github.com/goharbor/harbor/src/common/utils/test" _ "github.com/goharbor/harbor/src/core/auth/authproxy" "github.com/goharbor/harbor/src/core/config" - "github.com/goharbor/harbor/src/internal" + "github.com/goharbor/harbor/src/lib" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "io/ioutil" @@ -62,7 +62,7 @@ func TestAuthProxy(t *testing.T) { // No onboard req, err := http.NewRequest(http.MethodGet, "http://127.0.0.1/service/token", nil) require.Nil(t, err) - req = req.WithContext(internal.WithAuthMode(req.Context(), common.HTTPAuth)) + req = req.WithContext(lib.WithAuthMode(req.Context(), common.HTTPAuth)) req.SetBasicAuth("tokenreview$administrator@vsphere.local", "reviEwt0k3n") ctx := authProxy.Generate(req) assert.NotNil(t, ctx) diff --git a/src/server/middleware/security/idtoken.go b/src/server/middleware/security/idtoken.go index 19449d3b51..a3fd0749c6 100644 --- a/src/server/middleware/security/idtoken.go +++ b/src/server/middleware/security/idtoken.go @@ -27,14 +27,14 @@ import ( "github.com/goharbor/harbor/src/common/utils/log" "github.com/goharbor/harbor/src/common/utils/oidc" "github.com/goharbor/harbor/src/core/config" - "github.com/goharbor/harbor/src/internal" + "github.com/goharbor/harbor/src/lib" ) type idToken struct{} func (i *idToken) Generate(req *http.Request) security.Context { log := log.G(req.Context()) - if internal.GetAuthMode(req.Context()) != common.OIDCAuth { + if lib.GetAuthMode(req.Context()) != common.OIDCAuth { return nil } if !strings.HasPrefix(req.URL.Path, "/api") { diff --git a/src/server/middleware/security/idtoken_test.go b/src/server/middleware/security/idtoken_test.go index 73f79e1e7d..8d399ce6c3 100644 --- a/src/server/middleware/security/idtoken_test.go +++ b/src/server/middleware/security/idtoken_test.go @@ -16,7 +16,7 @@ package security import ( "github.com/goharbor/harbor/src/common" - "github.com/goharbor/harbor/src/internal" + "github.com/goharbor/harbor/src/lib" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "net/http" @@ -35,14 +35,14 @@ func TestIDToken(t *testing.T) { // not the candidate request req, err = http.NewRequest(http.MethodGet, "http://127.0.0.1/chartrepo/", nil) require.Nil(t, err) - req = req.WithContext(internal.WithAuthMode(req.Context(), common.DBAuth)) + req = req.WithContext(lib.WithAuthMode(req.Context(), common.DBAuth)) ctx = idToken.Generate(req) assert.Nil(t, ctx) // contains no authorization header req, err = http.NewRequest(http.MethodGet, "http://127.0.0.1/api/projects/", nil) require.Nil(t, err) - req = req.WithContext(internal.WithAuthMode(req.Context(), common.OIDCAuth)) + req = req.WithContext(lib.WithAuthMode(req.Context(), common.OIDCAuth)) ctx = idToken.Generate(req) assert.Nil(t, ctx) } diff --git a/src/server/middleware/security/oidc_cli.go b/src/server/middleware/security/oidc_cli.go index d784584e3a..549711b716 100644 --- a/src/server/middleware/security/oidc_cli.go +++ b/src/server/middleware/security/oidc_cli.go @@ -26,7 +26,7 @@ import ( "github.com/goharbor/harbor/src/common/utils/log" "github.com/goharbor/harbor/src/common/utils/oidc" "github.com/goharbor/harbor/src/core/config" - "github.com/goharbor/harbor/src/internal" + "github.com/goharbor/harbor/src/lib" ) type oidcCli struct{} @@ -41,7 +41,7 @@ func (o *oidcCli) Generate(req *http.Request) security.Context { !strings.HasPrefix(path, fmt.Sprintf("/api/%s/chartrepo/", api.APIVersion)) { return nil } - if internal.GetAuthMode(req.Context()) != common.OIDCAuth { + if lib.GetAuthMode(req.Context()) != common.OIDCAuth { return nil } username, secret, ok := req.BasicAuth() diff --git a/src/server/middleware/security/oidc_cli_test.go b/src/server/middleware/security/oidc_cli_test.go index 203920298a..ce5b25aef1 100644 --- a/src/server/middleware/security/oidc_cli_test.go +++ b/src/server/middleware/security/oidc_cli_test.go @@ -17,7 +17,7 @@ package security import ( "github.com/goharbor/harbor/src/common" "github.com/goharbor/harbor/src/common/utils/oidc" - "github.com/goharbor/harbor/src/internal" + "github.com/goharbor/harbor/src/lib" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "net/http" @@ -42,7 +42,7 @@ func TestOIDCCli(t *testing.T) { username := "oidcModiferTester" password := "oidcSecret" oidc.SetHardcodeVerifierForTest(password) - req = req.WithContext(internal.WithAuthMode(req.Context(), common.OIDCAuth)) + req = req.WithContext(lib.WithAuthMode(req.Context(), common.OIDCAuth)) req.SetBasicAuth(username, password) ctx = oidcCli.Generate(req) assert.NotNil(t, ctx) diff --git a/src/server/middleware/security/security.go b/src/server/middleware/security/security.go index c30c1cef34..f99cbe4eba 100644 --- a/src/server/middleware/security/security.go +++ b/src/server/middleware/security/security.go @@ -20,7 +20,7 @@ import ( "github.com/goharbor/harbor/src/common/security" "github.com/goharbor/harbor/src/common/utils/log" "github.com/goharbor/harbor/src/core/config" - "github.com/goharbor/harbor/src/internal" + "github.com/goharbor/harbor/src/lib" ) var ( @@ -48,7 +48,7 @@ func Middleware() func(http.Handler) http.Handler { log := log.G(r.Context()) mode, err := config.AuthMode() if err == nil { - r = r.WithContext(internal.WithAuthMode(r.Context(), mode)) + r = r.WithContext(lib.WithAuthMode(r.Context(), mode)) } else { log.Warningf("failed to get auth mode: %v", err) } diff --git a/src/server/middleware/session/session.go b/src/server/middleware/session/session.go index 486386be5a..9b6afb879b 100644 --- a/src/server/middleware/session/session.go +++ b/src/server/middleware/session/session.go @@ -16,7 +16,7 @@ package session import ( "github.com/goharbor/harbor/src/core/config" - "github.com/goharbor/harbor/src/internal" + "github.com/goharbor/harbor/src/lib" "net/http" ) @@ -29,7 +29,7 @@ func Middleware() func(http.Handler) http.Handler { // cookie is added by beego. _, err := r.Cookie(config.SessionCookieName) if err == nil { - r = r.WithContext(internal.WithCarrySession(r.Context(), true)) + r = r.WithContext(lib.WithCarrySession(r.Context(), true)) } handler.ServeHTTP(w, r) }) diff --git a/src/server/middleware/session/session_test.go b/src/server/middleware/session/session_test.go index c14db60819..c747c8e2d7 100644 --- a/src/server/middleware/session/session_test.go +++ b/src/server/middleware/session/session_test.go @@ -18,7 +18,7 @@ import ( "github.com/astaxie/beego" beegosession "github.com/astaxie/beego/session" "github.com/goharbor/harbor/src/core/config" - "github.com/goharbor/harbor/src/internal" + "github.com/goharbor/harbor/src/lib" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "net/http" @@ -30,7 +30,7 @@ import ( func TestSession(t *testing.T) { carrySession := false handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - carrySession = internal.GetCarrySession(r.Context()) + carrySession = lib.GetCarrySession(r.Context()) }) // no session req, err := http.NewRequest("POST", "http://127.0.0.1:8080/api/users", nil) diff --git a/src/server/middleware/transaction/transaction.go b/src/server/middleware/transaction/transaction.go index eff597c429..2364dcc5b9 100644 --- a/src/server/middleware/transaction/transaction.go +++ b/src/server/middleware/transaction/transaction.go @@ -21,8 +21,8 @@ import ( "net/http" "github.com/goharbor/harbor/src/common/utils/log" - "github.com/goharbor/harbor/src/internal" - "github.com/goharbor/harbor/src/internal/orm" + "github.com/goharbor/harbor/src/lib" + "github.com/goharbor/harbor/src/lib/orm" serror "github.com/goharbor/harbor/src/server/error" "github.com/goharbor/harbor/src/server/middleware" ) @@ -49,9 +49,9 @@ func MustCommit(r *http.Request) error { // Middleware middleware which add transaction for the http request with default config func Middleware(skippers ...middleware.Skipper) func(http.Handler) http.Handler { return middleware.New(func(w http.ResponseWriter, r *http.Request, next http.Handler) { - res, ok := w.(*internal.ResponseBuffer) + res, ok := w.(*lib.ResponseBuffer) if !ok { - res = internal.NewResponseBuffer(w) + res = lib.NewResponseBuffer(w) defer res.Flush() } diff --git a/src/server/middleware/transaction/transaction_test.go b/src/server/middleware/transaction/transaction_test.go index 3b39af58b9..bebb42c175 100644 --- a/src/server/middleware/transaction/transaction_test.go +++ b/src/server/middleware/transaction/transaction_test.go @@ -23,7 +23,7 @@ import ( "testing" o "github.com/astaxie/beego/orm" - "github.com/goharbor/harbor/src/internal/orm" + "github.com/goharbor/harbor/src/lib/orm" "github.com/goharbor/harbor/src/server/middleware" "github.com/stretchr/testify/assert" ) diff --git a/src/server/middleware/util.go b/src/server/middleware/util.go index cc6dc919e5..75296e1d6a 100644 --- a/src/server/middleware/util.go +++ b/src/server/middleware/util.go @@ -8,11 +8,11 @@ import ( "regexp" "github.com/docker/distribution/reference" - "github.com/goharbor/harbor/src/api/artifact" "github.com/goharbor/harbor/src/common/utils/log" + "github.com/goharbor/harbor/src/controller/artifact" "github.com/goharbor/harbor/src/core/config" "github.com/goharbor/harbor/src/core/promgr" - "github.com/goharbor/harbor/src/internal" + "github.com/goharbor/harbor/src/lib" "github.com/opencontainers/go-digest" ) @@ -40,8 +40,8 @@ var ( // EnsureArtifactDigest get artifactInfo from context and set the digest for artifact that has project name repository and reference func EnsureArtifactDigest(ctx context.Context) error { - info := internal.GetArtifactInfo(ctx) - none := internal.ArtifactInfo{} + info := lib.GetArtifactInfo(ctx) + none := lib.ArtifactInfo{} if info == none { return fmt.Errorf("no artifact info in context") diff --git a/src/server/middleware/v2auth/auth.go b/src/server/middleware/v2auth/auth.go index 730f9976f2..08d59d6636 100644 --- a/src/server/middleware/v2auth/auth.go +++ b/src/server/middleware/v2auth/auth.go @@ -25,8 +25,8 @@ import ( "github.com/goharbor/harbor/src/common/utils/log" "github.com/goharbor/harbor/src/core/config" "github.com/goharbor/harbor/src/core/promgr" - "github.com/goharbor/harbor/src/internal" - ierror "github.com/goharbor/harbor/src/internal/error" + "github.com/goharbor/harbor/src/lib" + ierror "github.com/goharbor/harbor/src/lib/error" serror "github.com/goharbor/harbor/src/server/error" "github.com/goharbor/harbor/src/server/middleware" ) @@ -44,8 +44,8 @@ func (rc *reqChecker) check(req *http.Request) error { if !ok { return fmt.Errorf("the security context got from request is nil") } - none := internal.ArtifactInfo{} - if a := internal.GetArtifactInfo(req.Context()); a != none { + none := lib.ArtifactInfo{} + if a := lib.GetArtifactInfo(req.Context()); a != none { action := getAction(req) if action == "" { return nil diff --git a/src/server/middleware/v2auth/auth_test.go b/src/server/middleware/v2auth/auth_test.go index 6da753e7ea..c9ac605337 100644 --- a/src/server/middleware/v2auth/auth_test.go +++ b/src/server/middleware/v2auth/auth_test.go @@ -27,7 +27,7 @@ import ( "github.com/goharbor/harbor/src/common/rbac" "github.com/goharbor/harbor/src/common/security" "github.com/goharbor/harbor/src/core/promgr/metamgr" - "github.com/goharbor/harbor/src/internal" + "github.com/goharbor/harbor/src/lib" "github.com/goharbor/harbor/src/pkg/permission/types" securitytesting "github.com/goharbor/harbor/src/testing/common/security" "github.com/goharbor/harbor/src/testing/mock" @@ -116,17 +116,17 @@ func TestMiddleware(t *testing.T) { }) baseCtx := security.NewContext(context.Background(), sc) - ar1 := internal.ArtifactInfo{ + ar1 := lib.ArtifactInfo{ Repository: "project_1/hello-world", Reference: "v1", ProjectName: "project_1", } - ar2 := internal.ArtifactInfo{ + ar2 := lib.ArtifactInfo{ Repository: "library/ubuntu", Reference: "14.04", ProjectName: "library", } - ar3 := internal.ArtifactInfo{ + ar3 := lib.ArtifactInfo{ Repository: "project_1/ubuntu", Reference: "14.04", ProjectName: "project_1", @@ -134,7 +134,7 @@ func TestMiddleware(t *testing.T) { BlobMountProjectName: "project_2", BlobMountDigest: "sha256:08e4a417ff4e3913d8723a05cc34055db01c2fd165b588e049c5bad16ce6094f", } - ar4 := internal.ArtifactInfo{ + ar4 := lib.ArtifactInfo{ Repository: "project_1/ubuntu", Reference: "14.04", ProjectName: "project_1", @@ -142,7 +142,7 @@ func TestMiddleware(t *testing.T) { BlobMountProjectName: "project_3", BlobMountDigest: "sha256:08e4a417ff4e3913d8723a05cc34055db01c2fd165b588e049c5bad16ce6094f", } - ar5 := internal.ArtifactInfo{ + ar5 := lib.ArtifactInfo{ Repository: "project_1/ubuntu", Reference: "14.04", ProjectName: "project_1", @@ -151,12 +151,12 @@ func TestMiddleware(t *testing.T) { BlobMountDigest: "sha256:08e4a417ff4e3913d8723a05cc34055db01c2fd165b588e049c5bad16ce6094f", } - ctx1 := internal.WithArtifactInfo(baseCtx, ar1) - ctx2 := internal.WithArtifactInfo(baseCtx, ar2) - ctx2x := internal.WithArtifactInfo(context.Background(), ar2) // no securityCtx - ctx3 := internal.WithArtifactInfo(baseCtx, ar3) - ctx4 := internal.WithArtifactInfo(baseCtx, ar4) - ctx5 := internal.WithArtifactInfo(baseCtx, ar5) + ctx1 := lib.WithArtifactInfo(baseCtx, ar1) + ctx2 := lib.WithArtifactInfo(baseCtx, ar2) + ctx2x := lib.WithArtifactInfo(context.Background(), ar2) // no securityCtx + ctx3 := lib.WithArtifactInfo(baseCtx, ar3) + ctx4 := lib.WithArtifactInfo(baseCtx, ar4) + ctx5 := lib.WithArtifactInfo(baseCtx, ar5) req1a, _ := http.NewRequest(http.MethodGet, "/v2/project_1/hello-world/manifest/v1", nil) req1b, _ := http.NewRequest(http.MethodDelete, "/v2/project_1/hello-world/manifest/v1", nil) req2, _ := http.NewRequest(http.MethodGet, "/v2/library/ubuntu/manifest/14.04", nil) diff --git a/src/server/middleware/vulnerable/controller.go b/src/server/middleware/vulnerable/controller.go index b6b537182e..d063d99245 100644 --- a/src/server/middleware/vulnerable/controller.go +++ b/src/server/middleware/vulnerable/controller.go @@ -15,9 +15,9 @@ package vulnerable import ( - "github.com/goharbor/harbor/src/api/artifact" - "github.com/goharbor/harbor/src/api/project" - "github.com/goharbor/harbor/src/api/scan" + "github.com/goharbor/harbor/src/controller/artifact" + "github.com/goharbor/harbor/src/controller/project" + "github.com/goharbor/harbor/src/controller/scan" ) var ( diff --git a/src/server/middleware/vulnerable/vulnerable.go b/src/server/middleware/vulnerable/vulnerable.go index 99a73ce934..b210d2dd7a 100644 --- a/src/server/middleware/vulnerable/vulnerable.go +++ b/src/server/middleware/vulnerable/vulnerable.go @@ -18,14 +18,14 @@ import ( "fmt" "net/http" - "github.com/goharbor/harbor/src/api/artifact" - "github.com/goharbor/harbor/src/api/project" - "github.com/goharbor/harbor/src/api/scan" "github.com/goharbor/harbor/src/common/rbac" "github.com/goharbor/harbor/src/common/security" "github.com/goharbor/harbor/src/common/utils/log" - "github.com/goharbor/harbor/src/internal" - ierror "github.com/goharbor/harbor/src/internal/error" + "github.com/goharbor/harbor/src/controller/artifact" + "github.com/goharbor/harbor/src/controller/project" + "github.com/goharbor/harbor/src/controller/scan" + "github.com/goharbor/harbor/src/lib" + ierror "github.com/goharbor/harbor/src/lib/error" "github.com/goharbor/harbor/src/pkg/scan/report" v1 "github.com/goharbor/harbor/src/pkg/scan/rest/v1" "github.com/goharbor/harbor/src/pkg/scan/vuln" @@ -45,8 +45,8 @@ func Middleware() func(http.Handler) http.Handler { logger := log.G(ctx).WithFields(log.Fields{"middleware": "vulnerable"}) - none := internal.ArtifactInfo{} - info := internal.GetArtifactInfo(ctx) + none := lib.ArtifactInfo{} + info := lib.GetArtifactInfo(ctx) if info == none { return fmt.Errorf("artifactinfo middleware required before this middleware") } diff --git a/src/server/middleware/vulnerable/vulnerable_test.go b/src/server/middleware/vulnerable/vulnerable_test.go index 177925b449..818db6240c 100644 --- a/src/server/middleware/vulnerable/vulnerable_test.go +++ b/src/server/middleware/vulnerable/vulnerable_test.go @@ -21,12 +21,12 @@ import ( "testing" "github.com/docker/distribution/manifest/manifestlist" - "github.com/goharbor/harbor/src/api/artifact" - "github.com/goharbor/harbor/src/api/project" - "github.com/goharbor/harbor/src/api/scan" "github.com/goharbor/harbor/src/common/models" "github.com/goharbor/harbor/src/common/security" - "github.com/goharbor/harbor/src/internal" + "github.com/goharbor/harbor/src/controller/artifact" + "github.com/goharbor/harbor/src/controller/project" + "github.com/goharbor/harbor/src/controller/scan" + "github.com/goharbor/harbor/src/lib" v1 "github.com/goharbor/harbor/src/pkg/scan/rest/v1" "github.com/goharbor/harbor/src/pkg/scan/vuln" artifacttesting "github.com/goharbor/harbor/src/testing/api/artifact" @@ -109,14 +109,14 @@ func (suite *MiddlewareTestSuite) TearDownTest() { func (suite *MiddlewareTestSuite) makeRequest() *http.Request { req := httptest.NewRequest("GET", "/v1/library/photon/manifests/2.0", nil) - info := internal.ArtifactInfo{ + info := lib.ArtifactInfo{ Repository: "library/photon", Reference: "2.0", Tag: "2.0", Digest: "", } - return req.WithContext(internal.WithArtifactInfo(req.Context(), info)) + return req.WithContext(lib.WithArtifactInfo(req.Context(), info)) } func (suite *MiddlewareTestSuite) TestGetArtifactFailed() { diff --git a/src/server/registry/catalog.go b/src/server/registry/catalog.go index fc5ab73928..16310c2c61 100644 --- a/src/server/registry/catalog.go +++ b/src/server/registry/catalog.go @@ -17,8 +17,8 @@ package registry import ( "encoding/json" "fmt" - "github.com/goharbor/harbor/src/api/repository" - ierror "github.com/goharbor/harbor/src/internal/error" + "github.com/goharbor/harbor/src/controller/repository" + ierror "github.com/goharbor/harbor/src/lib/error" serror "github.com/goharbor/harbor/src/server/error" "github.com/goharbor/harbor/src/server/registry/util" "net/http" diff --git a/src/server/registry/catalog_test.go b/src/server/registry/catalog_test.go index 1e4fcdd5e7..6494a32054 100644 --- a/src/server/registry/catalog_test.go +++ b/src/server/registry/catalog_test.go @@ -16,8 +16,8 @@ package registry import ( "encoding/json" - "github.com/goharbor/harbor/src/api/repository" "github.com/goharbor/harbor/src/common/models" + "github.com/goharbor/harbor/src/controller/repository" repotesting "github.com/goharbor/harbor/src/testing/api/repository" "github.com/stretchr/testify/suite" "net/http" diff --git a/src/server/registry/manifest.go b/src/server/registry/manifest.go index b207f18f3d..3d91dbddd7 100644 --- a/src/server/registry/manifest.go +++ b/src/server/registry/manifest.go @@ -15,12 +15,12 @@ package registry import ( - "github.com/goharbor/harbor/src/api/artifact" - "github.com/goharbor/harbor/src/api/event/metadata" - "github.com/goharbor/harbor/src/api/repository" "github.com/goharbor/harbor/src/common/utils/log" - "github.com/goharbor/harbor/src/internal" - ierror "github.com/goharbor/harbor/src/internal/error" + "github.com/goharbor/harbor/src/controller/artifact" + "github.com/goharbor/harbor/src/controller/event/metadata" + "github.com/goharbor/harbor/src/controller/repository" + "github.com/goharbor/harbor/src/lib" + ierror "github.com/goharbor/harbor/src/lib/error" "github.com/goharbor/harbor/src/pkg/notification" "github.com/goharbor/harbor/src/pkg/registry" serror "github.com/goharbor/harbor/src/server/error" @@ -47,7 +47,7 @@ func getManifest(w http.ResponseWriter, req *http.Request) { req.URL.RawPath = req.URL.EscapedPath() } - recorder := internal.NewResponseRecorder(w) + recorder := lib.NewResponseRecorder(w) proxy.ServeHTTP(recorder, req) // fire event, ignore the HEAD request and pulling request from replication service if !recorder.Success() || req.Method == http.MethodHead || @@ -104,7 +104,7 @@ func putManifest(w http.ResponseWriter, req *http.Request) { return } - buffer := internal.NewResponseBuffer(w) + buffer := lib.NewResponseBuffer(w) // proxy the req to the backend docker registry proxy.ServeHTTP(buffer, req) if !buffer.Success() { diff --git a/src/server/registry/manifest_test.go b/src/server/registry/manifest_test.go index 90f032c403..8fa5927ea9 100644 --- a/src/server/registry/manifest_test.go +++ b/src/server/registry/manifest_test.go @@ -22,9 +22,9 @@ import ( "net/http/httptest" "testing" - "github.com/goharbor/harbor/src/api/artifact" - "github.com/goharbor/harbor/src/api/repository" - ierror "github.com/goharbor/harbor/src/internal/error" + "github.com/goharbor/harbor/src/controller/artifact" + "github.com/goharbor/harbor/src/controller/repository" + ierror "github.com/goharbor/harbor/src/lib/error" arttesting "github.com/goharbor/harbor/src/testing/api/artifact" repotesting "github.com/goharbor/harbor/src/testing/api/repository" "github.com/goharbor/harbor/src/testing/mock" diff --git a/src/server/registry/tag.go b/src/server/registry/tag.go index 24390c2860..8faa88df69 100644 --- a/src/server/registry/tag.go +++ b/src/server/registry/tag.go @@ -17,10 +17,10 @@ package registry import ( "encoding/json" "fmt" - "github.com/goharbor/harbor/src/api/repository" - "github.com/goharbor/harbor/src/api/tag" - ierror "github.com/goharbor/harbor/src/internal/error" - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/controller/repository" + "github.com/goharbor/harbor/src/controller/tag" + ierror "github.com/goharbor/harbor/src/lib/error" + "github.com/goharbor/harbor/src/lib/q" serror "github.com/goharbor/harbor/src/server/error" "github.com/goharbor/harbor/src/server/registry/util" "github.com/goharbor/harbor/src/server/router" diff --git a/src/server/registry/tag_test.go b/src/server/registry/tag_test.go index deaa17fc3d..c16283c00c 100644 --- a/src/server/registry/tag_test.go +++ b/src/server/registry/tag_test.go @@ -16,9 +16,9 @@ package registry import ( "encoding/json" - "github.com/goharbor/harbor/src/api/repository" - "github.com/goharbor/harbor/src/api/tag" "github.com/goharbor/harbor/src/common/models" + "github.com/goharbor/harbor/src/controller/repository" + "github.com/goharbor/harbor/src/controller/tag" model_tag "github.com/goharbor/harbor/src/pkg/tag/model/tag" repotesting "github.com/goharbor/harbor/src/testing/api/repository" tagtesting "github.com/goharbor/harbor/src/testing/api/tag" diff --git a/src/server/v2.0/handler/artifact.go b/src/server/v2.0/handler/artifact.go index 8a4f2e373a..7bd593a897 100644 --- a/src/server/v2.0/handler/artifact.go +++ b/src/server/v2.0/handler/artifact.go @@ -17,7 +17,7 @@ package handler import ( "context" "fmt" - "github.com/goharbor/harbor/src/api/event/metadata" + "github.com/goharbor/harbor/src/controller/event/metadata" "github.com/goharbor/harbor/src/pkg/notification" "net/http" "strings" @@ -26,14 +26,14 @@ import ( "github.com/docker/distribution/reference" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" - "github.com/goharbor/harbor/src/api/artifact" - "github.com/goharbor/harbor/src/api/artifact/processor" - "github.com/goharbor/harbor/src/api/repository" - "github.com/goharbor/harbor/src/api/scan" - "github.com/goharbor/harbor/src/api/tag" "github.com/goharbor/harbor/src/common/rbac" "github.com/goharbor/harbor/src/common/utils" - ierror "github.com/goharbor/harbor/src/internal/error" + "github.com/goharbor/harbor/src/controller/artifact" + "github.com/goharbor/harbor/src/controller/artifact/processor" + "github.com/goharbor/harbor/src/controller/repository" + "github.com/goharbor/harbor/src/controller/scan" + "github.com/goharbor/harbor/src/controller/tag" + ierror "github.com/goharbor/harbor/src/lib/error" "github.com/goharbor/harbor/src/server/v2.0/handler/assembler" "github.com/goharbor/harbor/src/server/v2.0/handler/model" "github.com/goharbor/harbor/src/server/v2.0/models" diff --git a/src/server/v2.0/handler/assembler/vul.go b/src/server/v2.0/handler/assembler/vul.go index 8fee53445a..de23920ed7 100644 --- a/src/server/v2.0/handler/assembler/vul.go +++ b/src/server/v2.0/handler/assembler/vul.go @@ -17,9 +17,9 @@ package assembler import ( "context" - "github.com/goharbor/harbor/src/api/scan" "github.com/goharbor/harbor/src/common/utils/log" - "github.com/goharbor/harbor/src/internal" + "github.com/goharbor/harbor/src/controller/scan" + "github.com/goharbor/harbor/src/lib" v1 "github.com/goharbor/harbor/src/pkg/scan/rest/v1" "github.com/goharbor/harbor/src/server/v2.0/handler/model" ) @@ -56,7 +56,7 @@ func (assembler *VulAssembler) WithArtifacts(artifacts ...*model.Artifact) *VulA // Assemble assemble vul for the artifacts func (assembler *VulAssembler) Assemble(ctx context.Context) error { - version := internal.GetAPIVersion(ctx) + version := lib.GetAPIVersion(ctx) for _, artifact := range assembler.artifacts { isScannable, err := assembler.scanChecker.IsScannable(ctx, &artifact.Artifact) diff --git a/src/server/v2.0/handler/auditlog.go b/src/server/v2.0/handler/auditlog.go index cb67404d0c..c977471e97 100644 --- a/src/server/v2.0/handler/auditlog.go +++ b/src/server/v2.0/handler/auditlog.go @@ -7,9 +7,9 @@ import ( "github.com/go-openapi/runtime/middleware" "github.com/goharbor/harbor/src/common/rbac" "github.com/goharbor/harbor/src/common/security" - ierror "github.com/goharbor/harbor/src/internal/error" + ierror "github.com/goharbor/harbor/src/lib/error" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/audit" - "github.com/goharbor/harbor/src/pkg/q" "github.com/goharbor/harbor/src/server/v2.0/models" "github.com/goharbor/harbor/src/server/v2.0/restapi/operations/auditlog" operation "github.com/goharbor/harbor/src/server/v2.0/restapi/operations/auditlog" diff --git a/src/server/v2.0/handler/base.go b/src/server/v2.0/handler/base.go index a55f8bdc8d..1e3b906ed8 100644 --- a/src/server/v2.0/handler/base.go +++ b/src/server/v2.0/handler/base.go @@ -19,18 +19,18 @@ package handler import ( "context" "errors" - "github.com/goharbor/harbor/src/internal" - ierror "github.com/goharbor/harbor/src/internal/error" - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/lib" + ierror "github.com/goharbor/harbor/src/lib/error" + "github.com/goharbor/harbor/src/lib/q" "net/url" "strconv" "github.com/go-openapi/runtime/middleware" - "github.com/goharbor/harbor/src/api/project" "github.com/goharbor/harbor/src/common/rbac" "github.com/goharbor/harbor/src/common/security" "github.com/goharbor/harbor/src/common/utils" "github.com/goharbor/harbor/src/common/utils/log" + "github.com/goharbor/harbor/src/controller/project" errs "github.com/goharbor/harbor/src/server/error" ) @@ -134,7 +134,7 @@ func (b *BaseAPI) BuildQuery(ctx context.Context, query *string, pageNumber, pag } // Links return Links based on the provided pagination information -func (b *BaseAPI) Links(ctx context.Context, u *url.URL, total, pageNumber, pageSize int64) internal.Links { +func (b *BaseAPI) Links(ctx context.Context, u *url.URL, total, pageNumber, pageSize int64) lib.Links { ul := *u // try to unescape the repository name which contains escaped slashes if escapedPath, err := url.PathUnescape(ul.Path); err == nil { @@ -142,7 +142,7 @@ func (b *BaseAPI) Links(ctx context.Context, u *url.URL, total, pageNumber, page } else { log.Errorf("failed to unescape the path %s: %v", ul.Path, err) } - var links internal.Links + var links lib.Links // prev if pageNumber > 1 && (pageNumber-1)*pageSize < total { q := ul.Query() @@ -154,7 +154,7 @@ func (b *BaseAPI) Links(ctx context.Context, u *url.URL, total, pageNumber, page } else { log.Errorf("failed to unescape the query %s: %v", ul.RawQuery, err) } - link := &internal.Link{ + link := &lib.Link{ URL: ul.String(), Rel: "prev", } @@ -171,7 +171,7 @@ func (b *BaseAPI) Links(ctx context.Context, u *url.URL, total, pageNumber, page } else { log.Errorf("failed to unescape the query %s: %v", ul.RawQuery, err) } - link := &internal.Link{ + link := &lib.Link{ URL: ul.String(), Rel: "next", } diff --git a/src/server/v2.0/handler/model/artifact.go b/src/server/v2.0/handler/model/artifact.go index 2a26425676..9fec0ed250 100644 --- a/src/server/v2.0/handler/model/artifact.go +++ b/src/server/v2.0/handler/model/artifact.go @@ -18,8 +18,8 @@ import ( "encoding/json" "github.com/go-openapi/strfmt" - "github.com/goharbor/harbor/src/api/artifact" "github.com/goharbor/harbor/src/common/utils/log" + "github.com/goharbor/harbor/src/controller/artifact" "github.com/goharbor/harbor/src/server/v2.0/models" ) diff --git a/src/server/v2.0/handler/project.go b/src/server/v2.0/handler/project.go index 360e617821..fb5cf4441b 100644 --- a/src/server/v2.0/handler/project.go +++ b/src/server/v2.0/handler/project.go @@ -3,8 +3,8 @@ package handler import ( "context" "github.com/go-openapi/runtime/middleware" - "github.com/goharbor/harbor/src/api/project" "github.com/goharbor/harbor/src/common/rbac" + "github.com/goharbor/harbor/src/controller/project" "github.com/goharbor/harbor/src/pkg/audit" "github.com/goharbor/harbor/src/server/v2.0/models" operation "github.com/goharbor/harbor/src/server/v2.0/restapi/operations/project" diff --git a/src/server/v2.0/handler/repository.go b/src/server/v2.0/handler/repository.go index ececf3aeb0..e11d2c6279 100644 --- a/src/server/v2.0/handler/repository.go +++ b/src/server/v2.0/handler/repository.go @@ -17,17 +17,17 @@ package handler import ( "context" "fmt" - "github.com/goharbor/harbor/src/api/event/metadata" + "github.com/goharbor/harbor/src/controller/event/metadata" "github.com/goharbor/harbor/src/pkg/notification" "github.com/go-openapi/runtime/middleware" - "github.com/goharbor/harbor/src/api/artifact" - "github.com/goharbor/harbor/src/api/project" - "github.com/goharbor/harbor/src/api/repository" cmodels "github.com/goharbor/harbor/src/common/models" "github.com/goharbor/harbor/src/common/rbac" "github.com/goharbor/harbor/src/common/utils/log" - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/controller/artifact" + "github.com/goharbor/harbor/src/controller/project" + "github.com/goharbor/harbor/src/controller/repository" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/server/v2.0/models" operation "github.com/goharbor/harbor/src/server/v2.0/restapi/operations/repository" ) diff --git a/src/server/v2.0/handler/scan.go b/src/server/v2.0/handler/scan.go index 6d62d91ab5..3a850bdbbf 100644 --- a/src/server/v2.0/handler/scan.go +++ b/src/server/v2.0/handler/scan.go @@ -19,10 +19,10 @@ import ( "fmt" "github.com/go-openapi/runtime/middleware" - "github.com/goharbor/harbor/src/api/artifact" - "github.com/goharbor/harbor/src/api/scan" "github.com/goharbor/harbor/src/common/rbac" - ierror "github.com/goharbor/harbor/src/internal/error" + "github.com/goharbor/harbor/src/controller/artifact" + "github.com/goharbor/harbor/src/controller/scan" + ierror "github.com/goharbor/harbor/src/lib/error" operation "github.com/goharbor/harbor/src/server/v2.0/restapi/operations/scan" ) diff --git a/src/server/v2.0/handler/util.go b/src/server/v2.0/handler/util.go index 914567e120..27e4dc9792 100644 --- a/src/server/v2.0/handler/util.go +++ b/src/server/v2.0/handler/util.go @@ -21,10 +21,10 @@ import ( "net/url" "reflect" - "github.com/goharbor/harbor/src/api/artifact" - "github.com/goharbor/harbor/src/api/artifact/processor" - "github.com/goharbor/harbor/src/api/scan" "github.com/goharbor/harbor/src/common/utils/log" + "github.com/goharbor/harbor/src/controller/artifact" + "github.com/goharbor/harbor/src/controller/artifact/processor" + "github.com/goharbor/harbor/src/controller/scan" "github.com/goharbor/harbor/src/pkg/scan/report" v1 "github.com/goharbor/harbor/src/pkg/scan/rest/v1" ) diff --git a/src/testing/api/artifact/controller.go b/src/testing/api/artifact/controller.go index 5b3b0d6b4f..2dc087fcad 100644 --- a/src/testing/api/artifact/controller.go +++ b/src/testing/api/artifact/controller.go @@ -5,13 +5,13 @@ package artifact import ( context "context" - artifact "github.com/goharbor/harbor/src/api/artifact" + artifact "github.com/goharbor/harbor/src/controller/artifact" mock "github.com/stretchr/testify/mock" - processor "github.com/goharbor/harbor/src/api/artifact/processor" + processor "github.com/goharbor/harbor/src/controller/artifact/processor" - q "github.com/goharbor/harbor/src/pkg/q" + q "github.com/goharbor/harbor/src/lib/q" time "time" ) diff --git a/src/testing/api/blob/controller.go b/src/testing/api/blob/controller.go index 6a039431ff..62d3c1f1e0 100644 --- a/src/testing/api/blob/controller.go +++ b/src/testing/api/blob/controller.go @@ -3,7 +3,7 @@ package blob import ( - blob "github.com/goharbor/harbor/src/api/blob" + blob "github.com/goharbor/harbor/src/controller/blob" blobmodels "github.com/goharbor/harbor/src/pkg/blob/models" context "context" diff --git a/src/testing/api/project/controller.go b/src/testing/api/project/controller.go index 37941a4508..32d2153174 100644 --- a/src/testing/api/project/controller.go +++ b/src/testing/api/project/controller.go @@ -8,7 +8,7 @@ import ( models "github.com/goharbor/harbor/src/common/models" mock "github.com/stretchr/testify/mock" - project "github.com/goharbor/harbor/src/api/project" + project "github.com/goharbor/harbor/src/controller/project" ) // Controller is an autogenerated mock type for the Controller type diff --git a/src/testing/api/quota/controller.go b/src/testing/api/quota/controller.go index 9ebfd3a800..95331467b8 100644 --- a/src/testing/api/quota/controller.go +++ b/src/testing/api/quota/controller.go @@ -8,7 +8,7 @@ import ( models "github.com/goharbor/harbor/src/pkg/quota/models" mock "github.com/stretchr/testify/mock" - quota "github.com/goharbor/harbor/src/api/quota" + quota "github.com/goharbor/harbor/src/controller/quota" types "github.com/goharbor/harbor/src/pkg/types" ) diff --git a/src/testing/api/repository/controller.go b/src/testing/api/repository/controller.go index ae0103fe4c..376867ecc0 100644 --- a/src/testing/api/repository/controller.go +++ b/src/testing/api/repository/controller.go @@ -17,7 +17,7 @@ package repository import ( "context" "github.com/goharbor/harbor/src/common/models" - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/lib/q" "github.com/stretchr/testify/mock" ) diff --git a/src/testing/api/scan/checker.go b/src/testing/api/scan/checker.go index d0fd65f478..b5d3f20728 100644 --- a/src/testing/api/scan/checker.go +++ b/src/testing/api/scan/checker.go @@ -5,7 +5,7 @@ package scan import ( context "context" - artifact "github.com/goharbor/harbor/src/api/artifact" + artifact "github.com/goharbor/harbor/src/controller/artifact" mock "github.com/stretchr/testify/mock" ) diff --git a/src/testing/api/scan/controller.go b/src/testing/api/scan/controller.go index 7ff80a9d35..1b8fdcefd8 100644 --- a/src/testing/api/scan/controller.go +++ b/src/testing/api/scan/controller.go @@ -3,7 +3,7 @@ package scan import ( - artifact "github.com/goharbor/harbor/src/api/artifact" + artifact "github.com/goharbor/harbor/src/controller/artifact" all "github.com/goharbor/harbor/src/pkg/scan/all" context "context" @@ -16,7 +16,7 @@ import ( report "github.com/goharbor/harbor/src/pkg/scan/report" - scan "github.com/goharbor/harbor/src/api/scan" + scan "github.com/goharbor/harbor/src/controller/scan" ) // Controller is an autogenerated mock type for the Controller type diff --git a/src/testing/api/scanner/controller.go b/src/testing/api/scanner/controller.go index d83735b449..6fd2320078 100644 --- a/src/testing/api/scanner/controller.go +++ b/src/testing/api/scanner/controller.go @@ -3,10 +3,10 @@ package scanner import ( - apiscanner "github.com/goharbor/harbor/src/api/scanner" + apiscanner "github.com/goharbor/harbor/src/controller/scanner" mock "github.com/stretchr/testify/mock" - q "github.com/goharbor/harbor/src/pkg/q" + q "github.com/goharbor/harbor/src/lib/q" scanner "github.com/goharbor/harbor/src/pkg/scan/dao/scanner" diff --git a/src/testing/api/tag/controller.go b/src/testing/api/tag/controller.go index d74afeee20..505a853a23 100644 --- a/src/testing/api/tag/controller.go +++ b/src/testing/api/tag/controller.go @@ -2,8 +2,8 @@ package tag import ( "context" - "github.com/goharbor/harbor/src/api/tag" - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/controller/tag" + "github.com/goharbor/harbor/src/lib/q" "github.com/stretchr/testify/mock" ) diff --git a/src/testing/clients/dumb_core_client.go b/src/testing/clients/dumb_core_client.go index 9e4c76a5a4..28b40721cb 100644 --- a/src/testing/clients/dumb_core_client.go +++ b/src/testing/clients/dumb_core_client.go @@ -15,8 +15,8 @@ package clients import ( - modelsv2 "github.com/goharbor/harbor/src/api/artifact" "github.com/goharbor/harbor/src/chartserver" + modelsv2 "github.com/goharbor/harbor/src/controller/artifact" ) // DumbCoreClient provides an empty implement for pkg/clients/core.Client diff --git a/src/testing/pkg/artifact/manager.go b/src/testing/pkg/artifact/manager.go index e086fa7497..e8b007157d 100644 --- a/src/testing/pkg/artifact/manager.go +++ b/src/testing/pkg/artifact/manager.go @@ -16,8 +16,8 @@ package artifact import ( "context" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/artifact" - "github.com/goharbor/harbor/src/pkg/q" "github.com/stretchr/testify/mock" ) diff --git a/src/testing/pkg/immutabletag/matcher.go b/src/testing/pkg/immutabletag/matcher.go index 8b4d17f0c0..e382443831 100644 --- a/src/testing/pkg/immutabletag/matcher.go +++ b/src/testing/pkg/immutabletag/matcher.go @@ -1,7 +1,7 @@ package immutabletag import ( - "github.com/goharbor/harbor/src/internal/selector" + "github.com/goharbor/harbor/src/lib/selector" "github.com/stretchr/testify/mock" ) diff --git a/src/testing/pkg/notification/manager.go b/src/testing/pkg/notification/manager.go index 0634032f2c..52a6dedc0e 100644 --- a/src/testing/pkg/notification/manager.go +++ b/src/testing/pkg/notification/manager.go @@ -1,8 +1,8 @@ package notification import ( - "github.com/goharbor/harbor/src/api/event" "github.com/goharbor/harbor/src/common/models" + "github.com/goharbor/harbor/src/controller/event" ) type FakedPolicyMgr struct { diff --git a/src/testing/pkg/repository/manager.go b/src/testing/pkg/repository/manager.go index cf7d306978..a7fd6c98fe 100644 --- a/src/testing/pkg/repository/manager.go +++ b/src/testing/pkg/repository/manager.go @@ -17,7 +17,7 @@ package repository import ( "context" "github.com/goharbor/harbor/src/common/models" - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/lib/q" "github.com/stretchr/testify/mock" ) diff --git a/src/testing/pkg/scan/scanner/manager.go b/src/testing/pkg/scan/scanner/manager.go index cbf6ad8aa6..c993963fc0 100644 --- a/src/testing/pkg/scan/scanner/manager.go +++ b/src/testing/pkg/scan/scanner/manager.go @@ -3,7 +3,7 @@ package scanner import ( - q "github.com/goharbor/harbor/src/pkg/q" + q "github.com/goharbor/harbor/src/lib/q" mock "github.com/stretchr/testify/mock" scanner "github.com/goharbor/harbor/src/pkg/scan/dao/scanner" diff --git a/src/testing/pkg/tag/manager.go b/src/testing/pkg/tag/manager.go index 9bed8894ce..f87e56b0bc 100644 --- a/src/testing/pkg/tag/manager.go +++ b/src/testing/pkg/tag/manager.go @@ -16,7 +16,7 @@ package tag import ( "context" - "github.com/goharbor/harbor/src/pkg/q" + "github.com/goharbor/harbor/src/lib/q" "github.com/goharbor/harbor/src/pkg/tag/model/tag" "github.com/stretchr/testify/mock" ) diff --git a/src/testing/suite.go b/src/testing/suite.go index e69cc8c38c..0e4755d9e9 100644 --- a/src/testing/suite.go +++ b/src/testing/suite.go @@ -29,8 +29,8 @@ import ( "github.com/goharbor/harbor/src/common/dao" "github.com/goharbor/harbor/src/common/models" "github.com/goharbor/harbor/src/core/config" - ierror "github.com/goharbor/harbor/src/internal/error" - "github.com/goharbor/harbor/src/internal/orm" + ierror "github.com/goharbor/harbor/src/lib/error" + "github.com/goharbor/harbor/src/lib/orm" "github.com/goharbor/harbor/src/pkg/types" "github.com/opencontainers/go-digest" "github.com/stretchr/testify/suite"