diff --git a/pkg/controller/doc.go b/pkg/controller/doc.go deleted file mode 100644 index 497f989f..00000000 --- a/pkg/controller/doc.go +++ /dev/null @@ -1,17 +0,0 @@ -/* -Copyright 2021 The Crossplane Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package controller diff --git a/pkg/controller/gitlab.go b/pkg/controller/gitlab.go deleted file mode 100644 index 208d77b7..00000000 --- a/pkg/controller/gitlab.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2021 The Crossplane Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package controller - -import ( - ctrl "sigs.k8s.io/controller-runtime" - - "github.com/crossplane/crossplane-runtime/pkg/controller" - - "github.com/crossplane-contrib/provider-gitlab/pkg/controller/config" - "github.com/crossplane-contrib/provider-gitlab/pkg/controller/groups" - groupsDeployToken "github.com/crossplane-contrib/provider-gitlab/pkg/controller/groups/deploytokens" - groupsMembers "github.com/crossplane-contrib/provider-gitlab/pkg/controller/groups/members" - groupsVariables "github.com/crossplane-contrib/provider-gitlab/pkg/controller/groups/variables" - "github.com/crossplane-contrib/provider-gitlab/pkg/controller/projects" - projectsAccessToken "github.com/crossplane-contrib/provider-gitlab/pkg/controller/projects/accesstokens" - projectsDeployKeys "github.com/crossplane-contrib/provider-gitlab/pkg/controller/projects/deploykeys" - projectsDeployToken "github.com/crossplane-contrib/provider-gitlab/pkg/controller/projects/deploytokens" - projectsHooks "github.com/crossplane-contrib/provider-gitlab/pkg/controller/projects/hooks" - projectsMembers "github.com/crossplane-contrib/provider-gitlab/pkg/controller/projects/members" - projectsPipelineschedules "github.com/crossplane-contrib/provider-gitlab/pkg/controller/projects/pipelineschedules" - projectsVariables "github.com/crossplane-contrib/provider-gitlab/pkg/controller/projects/variables" -) - -// Setup creates all Gitlab API controllers with the supplied logger and adds -// them to the supplied manager. -func Setup(mgr ctrl.Manager, o controller.Options) error { - for _, setup := range []func(ctrl.Manager, controller.Options) error{ - config.Setup, - groups.SetupGroup, - groupsMembers.SetupMember, - groupsDeployToken.SetupDeployToken, - groupsVariables.SetupVariable, - projects.SetupProject, - projectsHooks.SetupHook, - projectsMembers.SetupMember, - projectsDeployToken.SetupDeployToken, - projectsAccessToken.SetupAccessToken, - projectsVariables.SetupVariable, - projectsDeployKeys.SetupDeployKey, - projectsPipelineschedules.SetupPipelineSchedule, - } { - if err := setup(mgr, o); err != nil { - return err - } - } - return nil -} diff --git a/pkg/controller/groups/group.go b/pkg/controller/groups/groups/group.go similarity index 100% rename from pkg/controller/groups/group.go rename to pkg/controller/groups/groups/group.go diff --git a/pkg/controller/groups/group_test.go b/pkg/controller/groups/groups/group_test.go similarity index 100% rename from pkg/controller/groups/group_test.go rename to pkg/controller/groups/groups/group_test.go diff --git a/pkg/controller/groups/setup.go b/pkg/controller/groups/setup.go new file mode 100644 index 00000000..57dceac6 --- /dev/null +++ b/pkg/controller/groups/setup.go @@ -0,0 +1,43 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package groups + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/crossplane/crossplane-runtime/pkg/controller" + + "github.com/crossplane-contrib/provider-gitlab/pkg/controller/groups/deploytokens" + "github.com/crossplane-contrib/provider-gitlab/pkg/controller/groups/groups" + "github.com/crossplane-contrib/provider-gitlab/pkg/controller/groups/members" + "github.com/crossplane-contrib/provider-gitlab/pkg/controller/groups/variables" +) + +// Setup all group controllers +func Setup(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + groups.SetupGroup, + members.SetupMember, + deploytokens.SetupDeployToken, + variables.SetupVariable, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/pkg/controller/projects/project.go b/pkg/controller/projects/projects/project.go similarity index 100% rename from pkg/controller/projects/project.go rename to pkg/controller/projects/projects/project.go diff --git a/pkg/controller/projects/project_test.go b/pkg/controller/projects/projects/project_test.go similarity index 100% rename from pkg/controller/projects/project_test.go rename to pkg/controller/projects/projects/project_test.go diff --git a/pkg/controller/projects/setup.go b/pkg/controller/projects/setup.go new file mode 100644 index 00000000..04e5ed4a --- /dev/null +++ b/pkg/controller/projects/setup.go @@ -0,0 +1,51 @@ +/* +Copyright 2024 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package projects + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/crossplane/crossplane-runtime/pkg/controller" + + "github.com/crossplane-contrib/provider-gitlab/pkg/controller/projects/accesstokens" + "github.com/crossplane-contrib/provider-gitlab/pkg/controller/projects/deploykeys" + "github.com/crossplane-contrib/provider-gitlab/pkg/controller/projects/deploytokens" + "github.com/crossplane-contrib/provider-gitlab/pkg/controller/projects/hooks" + "github.com/crossplane-contrib/provider-gitlab/pkg/controller/projects/members" + "github.com/crossplane-contrib/provider-gitlab/pkg/controller/projects/pipelineschedules" + "github.com/crossplane-contrib/provider-gitlab/pkg/controller/projects/projects" + "github.com/crossplane-contrib/provider-gitlab/pkg/controller/projects/variables" +) + +// Setup all project controllers +func Setup(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + projects.SetupProject, + hooks.SetupHook, + members.SetupMember, + deploytokens.SetupDeployToken, + accesstokens.SetupAccessToken, + variables.SetupVariable, + deploykeys.SetupDeployKey, + pipelineschedules.SetupPipelineSchedule, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/pkg/controller/setup.go b/pkg/controller/setup.go new file mode 100644 index 00000000..e5a1d402 --- /dev/null +++ b/pkg/controller/setup.go @@ -0,0 +1,42 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/crossplane/crossplane-runtime/pkg/controller" + + "github.com/crossplane-contrib/provider-gitlab/pkg/controller/config" + "github.com/crossplane-contrib/provider-gitlab/pkg/controller/groups" + "github.com/crossplane-contrib/provider-gitlab/pkg/controller/projects" +) + +// Setup creates all Gitlab API controllers with the supplied logger and adds +// them to the supplied manager. +func Setup(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + config.Setup, + groups.Setup, + projects.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +}