@@ -26,14 +26,14 @@ import (
2626 progress_events "github.com/mongodb/mongodbatlas-cloudformation-resources/util/progressevent"
2727)
2828
29- func HandleCreate ( req * handler. Request , client * util.MongoDBClient , model * Model ) handler.ProgressEvent {
29+ func handleCreate ( client * util.MongoDBClient , model * Model ) handler.ProgressEvent {
3030 ctx := context .Background ()
3131 orgID := model .OrgId
3232 serviceAccountReq := NewOrgServiceAccountCreateReq (model )
3333
3434 serviceAccountResp , apiResp , err := client .AtlasSDK .ServiceAccountsApi .CreateOrgServiceAccount (ctx , * orgID , serviceAccountReq ).Execute ()
3535 if err != nil {
36- return HandleError (apiResp , constants .CREATE , err )
36+ return handleError (apiResp , constants .CREATE , err )
3737 }
3838
3939 resourceModel := GetOrgServiceAccountModel (serviceAccountResp , model )
@@ -45,14 +45,14 @@ func HandleCreate(req *handler.Request, client *util.MongoDBClient, model *Model
4545 }
4646}
4747
48- func HandleRead ( req * handler. Request , client * util.MongoDBClient , model * Model ) handler.ProgressEvent {
48+ func handleRead ( client * util.MongoDBClient , model * Model ) handler.ProgressEvent {
4949 ctx := context .Background ()
5050 orgID := model .OrgId
5151 clientID := model .ClientId
5252
5353 serviceAccount , apiResp , err := client .AtlasSDK .ServiceAccountsApi .GetOrgServiceAccount (ctx , * orgID , * clientID ).Execute ()
5454 if err != nil {
55- return HandleError (apiResp , constants .READ , err )
55+ return handleError (apiResp , constants .READ , err )
5656 }
5757
5858 resourceModel := GetOrgServiceAccountModel (serviceAccount , model )
@@ -69,7 +69,7 @@ func HandleRead(req *handler.Request, client *util.MongoDBClient, model *Model)
6969 }
7070}
7171
72- func HandleUpdate ( req * handler. Request , client * util.MongoDBClient , model * Model ) handler.ProgressEvent {
72+ func handleUpdate ( client * util.MongoDBClient , model * Model ) handler.ProgressEvent {
7373 ctx := context .Background ()
7474 orgID := model .OrgId
7575 clientID := model .ClientId
@@ -83,13 +83,13 @@ func HandleUpdate(req *handler.Request, client *util.MongoDBClient, model *Model
8383 HandlerErrorCode : string (types .HandlerErrorCodeNotFound ),
8484 }
8585 }
86- return HandleError (apiResp , constants .UPDATE , err )
86+ return handleError (apiResp , constants .UPDATE , err )
8787 }
8888
8989 serviceAccountReq := NewOrgServiceAccountUpdateReq (model )
9090 serviceAccountResp , apiResp , err := client .AtlasSDK .ServiceAccountsApi .UpdateOrgServiceAccount (ctx , * clientID , * orgID , serviceAccountReq ).Execute ()
9191 if err != nil {
92- return HandleError (apiResp , constants .UPDATE , err )
92+ return handleError (apiResp , constants .UPDATE , err )
9393 }
9494
9595 resourceModel := GetOrgServiceAccountModel (serviceAccountResp , model )
@@ -106,7 +106,7 @@ func HandleUpdate(req *handler.Request, client *util.MongoDBClient, model *Model
106106 }
107107}
108108
109- func HandleDelete ( req * handler. Request , client * util.MongoDBClient , model * Model ) handler.ProgressEvent {
109+ func handleDelete ( client * util.MongoDBClient , model * Model ) handler.ProgressEvent {
110110 ctx := context .Background ()
111111 orgID := model .OrgId
112112 clientID := model .ClientId
@@ -120,12 +120,12 @@ func HandleDelete(req *handler.Request, client *util.MongoDBClient, model *Model
120120 HandlerErrorCode : string (types .HandlerErrorCodeNotFound ),
121121 }
122122 }
123- return HandleError (resp , constants .DELETE , err )
123+ return handleError (resp , constants .DELETE , err )
124124 }
125125
126126 apiResp , err := client .AtlasSDK .ServiceAccountsApi .DeleteOrgServiceAccount (ctx , * clientID , * orgID ).Execute ()
127127 if err != nil {
128- return HandleError (apiResp , constants .DELETE , err )
128+ return handleError (apiResp , constants .DELETE , err )
129129 }
130130
131131 return handler.ProgressEvent {
@@ -134,13 +134,13 @@ func HandleDelete(req *handler.Request, client *util.MongoDBClient, model *Model
134134 }
135135}
136136
137- func HandleList ( req * handler. Request , client * util.MongoDBClient , model * Model ) handler.ProgressEvent {
137+ func handleList ( client * util.MongoDBClient , model * Model ) handler.ProgressEvent {
138138 ctx := context .Background ()
139139 orgID := model .OrgId
140140
141141 serviceAccounts , apiResp , err := client .AtlasSDK .ServiceAccountsApi .ListOrgServiceAccounts (ctx , * orgID ).Execute ()
142142 if err != nil {
143- return HandleError (apiResp , constants .LIST , err )
143+ return handleError (apiResp , constants .LIST , err )
144144 }
145145
146146 response := make ([]interface {}, 0 )
@@ -166,7 +166,7 @@ func HandleList(req *handler.Request, client *util.MongoDBClient, model *Model)
166166 }
167167}
168168
169- func HandleError (response * http.Response , method constants.CfnFunctions , err error ) handler.ProgressEvent {
169+ func handleError (response * http.Response , method constants.CfnFunctions , err error ) handler.ProgressEvent {
170170 errMsg := fmt .Sprintf ("%s error:%s" , method , err .Error ())
171171 return progress_events .GetFailedEventByResponse (errMsg , response )
172172}
0 commit comments