@@ -54,21 +54,6 @@ func registerMarketplaceHandlers(api *operations.OperatorAPI) {
54
54
}
55
55
return operator_api .NewPostMPIntegrationCreated ()
56
56
})
57
-
58
- api .OperatorAPIPatchMPIntegrationHandler = operator_api .PatchMPIntegrationHandlerFunc (func (params operator_api.PatchMPIntegrationParams , session * models.Principal ) middleware.Responder {
59
- err := patchMPIntegrationResponse (session , params )
60
- if err != nil {
61
- return operator_api .NewPatchMPIntegrationDefault (int (err .Code )).WithPayload (err )
62
- }
63
- return operator_api .NewPatchMPIntegrationOK ()
64
- })
65
-
66
- api .OperatorAPIDeleteMPIntegrationHandler = operator_api .DeleteMPIntegrationHandlerFunc (func (params operator_api.DeleteMPIntegrationParams , session * models.Principal ) middleware.Responder {
67
- if err := deleteMPIntegrationResponse (session , params ); err != nil {
68
- return operator_api .NewDeleteMPIntegrationDefault (int (err .Code )).WithPayload (err )
69
- }
70
- return operator_api .NewDeleteMPIntegrationNoContent ()
71
- })
72
57
}
73
58
74
59
func getMPIntegrationResponse (session * models.Principal , params operator_api.GetMPIntegrationParams ) (* models.MpIntegration , * models.Error ) {
@@ -108,37 +93,21 @@ func postMPIntegrationResponse(session *models.Principal, params operator_api.Po
108
93
if err != nil {
109
94
return errors .ErrorWithContext (ctx , err )
110
95
}
111
- return setMPIntegration (ctx , params .Body .Email , false , & k8sClient {client : clientSet })
112
- }
113
-
114
- func patchMPIntegrationResponse (session * models.Principal , params operator_api.PatchMPIntegrationParams ) * models.Error {
115
- if true { // This block will be removed once service to register emails is deployed
116
- return & models.Error {Code : 501 }
117
- }
118
- clientSet , err := cluster .K8sClient (session .STSSessionToken )
119
- ctx , cancel := context .WithCancel (params .HTTPRequest .Context ())
120
- defer cancel ()
121
- if err != nil {
122
- return errors .ErrorWithContext (ctx , err )
123
- }
124
- return setMPIntegration (ctx , params .Body .Email , true , & k8sClient {client : clientSet })
96
+ return setMPIntegration (ctx , params .Body .Email , & k8sClient {client : clientSet })
125
97
}
126
98
127
- func setMPIntegration (ctx context.Context , email string , override bool , clientSet K8sClientI ) * models.Error {
99
+ func setMPIntegration (ctx context.Context , email string , clientSet K8sClientI ) * models.Error {
128
100
if email == "" {
129
101
return errors .ErrorWithContext (ctx , errors .ErrBadRequest , fmt .Errorf (emailNotSetMsg ))
130
102
}
131
- if _ , err := setMPEmail (ctx , email , override , clientSet ); err != nil {
103
+ if _ , err := setMPEmail (ctx , email , clientSet ); err != nil {
132
104
return errors .ErrorWithContext (ctx , err )
133
105
}
134
106
return nil
135
107
}
136
108
137
- func setMPEmail (ctx context.Context , email string , override bool , clientSet K8sClientI ) (* corev1.ConfigMap , error ) {
109
+ func setMPEmail (ctx context.Context , email string , clientSet K8sClientI ) (* corev1.ConfigMap , error ) {
138
110
cm := createCM (email )
139
- if override {
140
- return clientSet .updateConfigMap (ctx , "default" , cm , metav1.UpdateOptions {})
141
- }
142
111
return clientSet .createConfigMap (ctx , "default" , cm , metav1.CreateOptions {})
143
112
}
144
113
@@ -156,26 +125,6 @@ func createCM(email string) *corev1.ConfigMap {
156
125
}
157
126
}
158
127
159
- func deleteMPIntegrationResponse (session * models.Principal , params operator_api.DeleteMPIntegrationParams ) * models.Error {
160
- if true { // This block will be removed once service to register emails is deployed
161
- return & models.Error {Code : 501 }
162
- }
163
- clientSet , err := cluster .K8sClient (session .STSSessionToken )
164
- ctx , cancel := context .WithCancel (params .HTTPRequest .Context ())
165
- defer cancel ()
166
- if err != nil {
167
- return errors .ErrorWithContext (ctx , err )
168
- }
169
- return deleteMPIntegration (ctx , & k8sClient {client : clientSet })
170
- }
171
-
172
- func deleteMPIntegration (ctx context.Context , clientSet K8sClientI ) * models.Error {
173
- if err := clientSet .deleteConfigMap (ctx , "default" , getMPConfigMapKey (mpConfigMapKey ), metav1.DeleteOptions {}); err != nil {
174
- return errors .ErrorWithContext (ctx , err )
175
- }
176
- return nil
177
- }
178
-
179
128
func getMPConfigMapKey (envVar string ) string {
180
129
if mp := os .Getenv (envVar ); mp != "" {
181
130
return mp
0 commit comments