@@ -172,6 +172,23 @@ func (c *ApiClient) GetSessionID() string {
172172 return c .sid
173173}
174174
175+ // Deprecated: Do not use.
176+ func (c * ApiClient ) Login (username string , password string , continueLastSession bool , domain string , readOnly bool , payload string ) (APIResponse , error ) {
177+ credentials := map [string ]interface {}{
178+ "user" : username ,
179+ "password" : password ,
180+ }
181+ return c .commonLoginLogic (credentials , continueLastSession , domain , readOnly , make (map [string ]interface {}))
182+ }
183+
184+ // Deprecated: Do not use.
185+ func (c * ApiClient ) LoginWithApiKey (apiKey string , continueLastSession bool , domain string , readOnly bool , payload string ) (APIResponse , error ) {
186+ credentials := map [string ]interface {}{
187+ "api-key" : apiKey ,
188+ }
189+ return c .commonLoginLogic (credentials , continueLastSession , domain , readOnly , make (map [string ]interface {}))
190+ }
191+
175192/*
176193Performs a 'login' API call to management server
177194
@@ -185,7 +202,7 @@ returns: APIResponse, error
185202side-effects: updates the class's uid and server variables
186203
187204*/
188- func (c * ApiClient ) Login (username string , password string , continueLastSession bool , domain string , readOnly bool , payload string ) (APIResponse , error ) {
205+ func (c * ApiClient ) ApiLogin (username string , password string , continueLastSession bool , domain string , readOnly bool , payload map [ string ] interface {} ) (APIResponse , error ) {
189206 credentials := map [string ]interface {}{
190207 "user" : username ,
191208 "password" : password ,
@@ -206,14 +223,14 @@ payload: [optional] More settings for the login command
206223returns: APIResponse object
207224side-effects: updates the class's uid and server variables
208225*/
209- func (c * ApiClient ) LoginWithApiKey (apiKey string , continueLastSession bool , domain string , readOnly bool , payload string ) (APIResponse , error ) {
226+ func (c * ApiClient ) ApiLoginWithApiKey (apiKey string , continueLastSession bool , domain string , readOnly bool , payload map [ string ] interface {} ) (APIResponse , error ) {
210227 credentials := map [string ]interface {}{
211228 "api-key" : apiKey ,
212229 }
213230 return c .commonLoginLogic (credentials , continueLastSession , domain , readOnly , payload )
214231}
215232
216- func (c * ApiClient ) commonLoginLogic (credentials map [string ]interface {}, continueLastSession bool , domain string , readOnly bool , payload string ) (APIResponse , error ) {
233+ func (c * ApiClient ) commonLoginLogic (credentials map [string ]interface {}, continueLastSession bool , domain string , readOnly bool , payload map [ string ] interface {} ) (APIResponse , error ) {
217234
218235 if c .context == WebContext {
219236 credentials ["continue-last-session" ] = continueLastSession
@@ -224,6 +241,10 @@ func (c *ApiClient) commonLoginLogic(credentials map[string]interface{}, continu
224241 credentials ["domain" ] = domain
225242 }
226243
244+ for k , v := range payload {
245+ credentials [k ] = v
246+ }
247+
227248 loginRes , errCall := c .ApiCall ("login" , credentials , "" , false , false )
228249 if errCall != nil {
229250 return loginRes , errCall
0 commit comments