@@ -31,7 +31,7 @@ import (
31
31
32
32
// @externalDocs.description OpenAPI
33
33
// @externalDocs.url https://swagger.io/resources/open-api/
34
- type API struct {
34
+ type api struct {
35
35
cfg types.APIConfig
36
36
37
37
logger logrus.FieldLogger
@@ -41,43 +41,43 @@ type API struct {
41
41
consoleController console.Controller
42
42
linuxInstallController linuxinstall.Controller
43
43
44
- handlers Handlers
44
+ handlers handlers
45
45
}
46
46
47
- type APIOption func (* API )
47
+ type apiOption func (* api )
48
48
49
- func WithAuthController (authController auth.Controller ) APIOption {
50
- return func (a * API ) {
49
+ func WithAuthController (authController auth.Controller ) apiOption {
50
+ return func (a * api ) {
51
51
a .authController = authController
52
52
}
53
53
}
54
54
55
- func WithConsoleController (consoleController console.Controller ) APIOption {
56
- return func (a * API ) {
55
+ func WithConsoleController (consoleController console.Controller ) apiOption {
56
+ return func (a * api ) {
57
57
a .consoleController = consoleController
58
58
}
59
59
}
60
60
61
- func WithLinuxInstallController (linuxInstallController linuxinstall.Controller ) APIOption {
62
- return func (a * API ) {
61
+ func WithLinuxInstallController (linuxInstallController linuxinstall.Controller ) apiOption {
62
+ return func (a * api ) {
63
63
a .linuxInstallController = linuxInstallController
64
64
}
65
65
}
66
66
67
- func WithLogger (logger logrus.FieldLogger ) APIOption {
68
- return func (a * API ) {
67
+ func WithLogger (logger logrus.FieldLogger ) apiOption {
68
+ return func (a * api ) {
69
69
a .logger = logger
70
70
}
71
71
}
72
72
73
- func WithMetricsReporter (metricsReporter metrics.ReporterInterface ) APIOption {
74
- return func (a * API ) {
73
+ func WithMetricsReporter (metricsReporter metrics.ReporterInterface ) apiOption {
74
+ return func (a * api ) {
75
75
a .metricsReporter = metricsReporter
76
76
}
77
77
}
78
78
79
- func New (cfg types.APIConfig , opts ... APIOption ) (* API , error ) {
80
- api := & API {
79
+ func New (cfg types.APIConfig , opts ... apiOption ) (* api , error ) {
80
+ api := & api {
81
81
cfg : cfg ,
82
82
}
83
83
@@ -97,7 +97,7 @@ func New(cfg types.APIConfig, opts ...APIOption) (*API, error) {
97
97
api .logger = l
98
98
}
99
99
100
- if err := api .InitHandlers ( api . cfg ); err != nil {
100
+ if err := api .initHandlers ( ); err != nil {
101
101
return nil , fmt .Errorf ("init handlers: %w" , err )
102
102
}
103
103
0 commit comments