Skip to content

Commit d49c4d6

Browse files
committed
chore(logs): refactor instance describe
1 parent 0828dcc commit d49c4d6

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

internal/cmd/logs/instance/describe/describe.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command, inputArgs []string) (*inpu
8484
}
8585

8686
func buildRequest(ctx context.Context, model *inputModel, apiClient *logs.APIClient) logs.ApiGetLogsInstanceRequest {
87-
return apiClient.GetLogsInstance(ctx, model.ProjectId, model.Region, model.InstanceID)
87+
return apiClient.DefaultAPI.GetLogsInstance(ctx, model.ProjectId, model.Region, model.InstanceID)
8888
}
8989

9090
func outputResult(p *print.Printer, outputFormat string, instance *logs.LogsInstance) error {
@@ -93,13 +93,13 @@ func outputResult(p *print.Printer, outputFormat string, instance *logs.LogsInst
9393
}
9494
return p.OutputResult(outputFormat, instance, func() error {
9595
table := tables.NewTable()
96-
table.AddRow("ID", utils.PtrString(instance.Id))
96+
table.AddRow("ID", instance.Id)
9797
table.AddSeparator()
98-
table.AddRow("DISPLAY NAME", utils.PtrString(instance.DisplayName))
98+
table.AddRow("DISPLAY NAME", instance.DisplayName)
9999
table.AddSeparator()
100-
table.AddRow("RETENTION DAYS", utils.PtrString(instance.RetentionDays))
100+
table.AddRow("RETENTION DAYS", instance.RetentionDays)
101101
table.AddSeparator()
102-
table.AddRow("ACL IP RANGES", utils.PtrString(instance.Acl))
102+
table.AddRow("ACL IP RANGES", instance.Acl)
103103
table.AddSeparator()
104104
table.AddRow("DATA SOURCE", utils.PtrString(instance.DatasourceUrl))
105105
table.AddSeparator()

internal/cmd/logs/instance/describe/describe_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
type testCtxKey struct{}
1919

2020
var testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo")
21-
var testClient = &logs.APIClient{}
21+
var testClient = &logs.APIClient{DefaultAPI: &logs.DefaultAPIService{}}
2222
var testProjectId = uuid.NewString()
2323
var testInstanceId = uuid.NewString()
2424

@@ -51,7 +51,7 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
5151
}
5252

5353
func fixtureRequest(mods ...func(request *logs.ApiGetLogsInstanceRequest)) logs.ApiGetLogsInstanceRequest {
54-
request := testClient.GetLogsInstance(testCtx, testProjectId, testRegion, testInstanceId)
54+
request := testClient.DefaultAPI.GetLogsInstance(testCtx, testProjectId, testRegion, testInstanceId)
5555
for _, mod := range mods {
5656
mod(&request)
5757
}
@@ -140,7 +140,7 @@ func TestBuildRequest(t *testing.T) {
140140

141141
diff := cmp.Diff(request, tt.expectedRequest,
142142
cmp.AllowUnexported(tt.expectedRequest),
143-
cmpopts.EquateComparable(testCtx),
143+
cmpopts.EquateComparable(testCtx, tt.expectedRequest),
144144
)
145145
if diff != "" {
146146
t.Fatalf("Data does not match: %s", diff)

0 commit comments

Comments
 (0)