@@ -17,7 +17,7 @@ import (
17
17
"github.com/redhat-developer/app-services-cli/pkg/core/localize"
18
18
"github.com/redhat-developer/app-services-cli/pkg/core/logging"
19
19
"github.com/redhat-developer/app-services-cli/pkg/shared/factory"
20
- svcacctmgmtclient "github.com/redhat-developer/app-services-sdk-go/serviceaccountmgmt /apiv1/client"
20
+ kafkamgmtclient "github.com/redhat-developer/app-services-sdk-go/kafkamgmt /apiv1/client"
21
21
22
22
"github.com/AlecAivazis/survey/v2"
23
23
"github.com/spf13/cobra"
@@ -107,19 +107,16 @@ func runResetCredentials(opts *options) (err error) {
107
107
108
108
api := conn .API ()
109
109
110
- if opts .id != "" {
111
- _ , httpRes , newErr := api .ServiceAccountMgmt ().GetServiceAccount (opts .Context , opts .id ).Execute ()
112
- if httpRes != nil {
113
- defer httpRes .Body .Close ()
114
- }
115
- if newErr != nil {
116
- return newErr
117
- }
110
+ _ , httpRes , err := api .ServiceAccountMgmt ().GetServiceAccountById (opts .Context , opts .id ).Execute ()
111
+ if httpRes != nil {
112
+ defer httpRes .Body .Close ()
113
+ }
118
114
115
+ if err != nil {
116
+ return err
119
117
}
120
118
121
119
if opts .interactive {
122
-
123
120
err = runInteractivePrompt (opts )
124
121
if err != nil {
125
122
return err
@@ -159,10 +156,12 @@ func runResetCredentials(opts *options) (err error) {
159
156
160
157
opts .Logger .Info (icon .SuccessPrefix (), opts .localizer .MustLocalize ("serviceAccount.resetCredentials.log.info.resetSuccess" , localize .NewEntry ("ID" , updatedServiceAccount .GetId ())))
161
158
159
+ providerUrls , err := svcaccountcmdutil .GetProvidersDetails (conn , opts .Context )
160
+
162
161
creds := & credentials.Credentials {
163
162
ClientID : updatedServiceAccount .GetClientId (),
164
- ClientSecret : updatedServiceAccount .GetSecret (),
165
- TokenURL : conn . API (). GetConfig (). AuthURL . String () + "/protocol/openid-connect/token" ,
163
+ ClientSecret : updatedServiceAccount .GetClientSecret (),
164
+ TokenURL : providerUrls . GetTokenUrl () ,
166
165
}
167
166
168
167
// save the credentials to a file
@@ -179,7 +178,7 @@ func runResetCredentials(opts *options) (err error) {
179
178
return nil
180
179
}
181
180
182
- func resetCredentials (opts * options ) (* svcacctmgmtclient. ServiceAccountData , error ) {
181
+ func resetCredentials (opts * options ) (* kafkamgmtclient. ServiceAccount , error ) {
183
182
conn , err := opts .Connection ()
184
183
if err != nil {
185
184
return nil , err
@@ -190,7 +189,7 @@ func resetCredentials(opts *options) (*svcacctmgmtclient.ServiceAccountData, err
190
189
191
190
opts .Logger .Debug (opts .localizer .MustLocalize ("serviceAccount.resetCredentials.log.debug.resettingCredentials" , localize .NewEntry ("ID" , opts .id )))
192
191
193
- serviceacct , httpRes , err := api .ServiceAccountMgmt ().ResetServiceAccountSecret (opts .Context , opts .id ).Execute ()
192
+ serviceacct , httpRes , err := api .ServiceAccountMgmt ().ResetServiceAccountCreds (opts .Context , opts .id ).Execute ()
194
193
if httpRes != nil {
195
194
defer httpRes .Body .Close ()
196
195
}
0 commit comments