Skip to content

Commit 8e40ee0

Browse files
committed
chore(logs): refactor access token delete
1 parent 7a771cb commit 8e40ee0

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

internal/cmd/logs/access_token/delete/delete.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
5858
}
5959

6060
// Get the display name for confirmation
61-
accessTokenLabel, err := logUtils.GetAccessTokenName(ctx, apiClient, model.ProjectId, model.Region, model.InstanceId, model.AccessTokenId)
61+
accessTokenLabel, err := logUtils.GetAccessTokenName(ctx, apiClient.DefaultAPI, model.ProjectId, model.Region, model.InstanceId, model.AccessTokenId)
6262
if err != nil {
6363
params.Printer.Debug(print.ErrorLevel, "get access token: %v", err)
6464
}
@@ -113,5 +113,5 @@ func parseInput(p *print.Printer, cmd *cobra.Command, inputArgs []string) (*inpu
113113
}
114114

115115
func buildRequest(ctx context.Context, model *inputModel, apiClient *logs.APIClient) logs.ApiDeleteAccessTokenRequest {
116-
return apiClient.DeleteAccessToken(ctx, model.ProjectId, model.Region, model.InstanceId, model.AccessTokenId)
116+
return apiClient.DefaultAPI.DeleteAccessToken(ctx, model.ProjectId, model.Region, model.InstanceId, model.AccessTokenId)
117117
}

internal/cmd/logs/access_token/delete/delete_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type testCtxKey struct{}
2121

2222
var (
2323
testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo")
24-
testClient = &logs.APIClient{}
24+
testClient = &logs.APIClient{DefaultAPI: &logs.DefaultAPIService{}}
2525

2626
testProjectId = uuid.NewString()
2727
testInstanceId = uuid.NewString()
@@ -69,7 +69,7 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
6969
}
7070

7171
func fixtureRequest(mods ...func(request *logs.ApiDeleteAccessTokenRequest)) logs.ApiDeleteAccessTokenRequest {
72-
request := testClient.DeleteAccessToken(testCtx, testProjectId, testRegion, testInstanceId, testAccessTokenId)
72+
request := testClient.DefaultAPI.DeleteAccessToken(testCtx, testProjectId, testRegion, testInstanceId, testAccessTokenId)
7373
for _, mod := range mods {
7474
mod(&request)
7575
}
@@ -197,7 +197,7 @@ func TestBuildRequest(t *testing.T) {
197197

198198
diff := cmp.Diff(request, tt.expectedRequest,
199199
cmp.AllowUnexported(tt.expectedRequest),
200-
cmpopts.EquateComparable(testCtx),
200+
cmpopts.EquateComparable(testCtx, tt.expectedRequest),
201201
)
202202
if diff != "" {
203203
t.Fatalf("Data does not match: %s", diff)

0 commit comments

Comments
 (0)