Skip to content

Commit bac7aa2

Browse files
committed
mirror at 20230506190017
1 parent 7530f08 commit bac7aa2

File tree

8 files changed

+27
-35
lines changed

8 files changed

+27
-35
lines changed

api/client/client.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func (err *Error) apiError() error {
3434
}
3535

3636
type invoker interface {
37-
invoke(ctx context.Context, api string, r interface{}, res interface{}) error
37+
invoke(ctx context.Context, api string, r any, res any) error
3838
}
3939

4040
type Client struct {
@@ -117,7 +117,7 @@ func (c *Client) Deployer() api.Deployer {
117117
return deployerClient{c}
118118
}
119119

120-
func (c *Client) invoke(ctx context.Context, api string, r interface{}, res interface{}) error {
120+
func (c *Client) invoke(ctx context.Context, api string, r any, res any) error {
121121
if err := validRequest(r); err != nil {
122122
return err
123123
}
@@ -150,9 +150,9 @@ func (c *Client) invoke(ctx context.Context, api string, r interface{}, res inte
150150

151151
var errMsg Error
152152
var respBody struct {
153-
OK bool `json:"ok"`
154-
Result interface{} `json:"result"`
155-
Error interface{} `json:"error"`
153+
OK bool `json:"ok"`
154+
Result any `json:"result"`
155+
Error any `json:"error"`
156156
}
157157
respBody.Result = res
158158
respBody.Error = &errMsg
@@ -168,7 +168,7 @@ func (c *Client) invoke(ctx context.Context, api string, r interface{}, res inte
168168
return nil
169169
}
170170

171-
func validRequest(r interface{}) error {
171+
func validRequest(r any) error {
172172
if r == nil {
173173
return nil
174174
}

api/deployment.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ func (t *DeploymentType) UnmarshalJSON(b []byte) error {
135135
return t.parseString(s)
136136
}
137137

138-
func (t DeploymentType) MarshalYAML() (interface{}, error) {
138+
func (t DeploymentType) MarshalYAML() (any, error) {
139139
return t.String(), nil
140140
}
141141

142-
func (t *DeploymentType) UnmarshalYAML(unmarshal func(interface{}) error) error {
142+
func (t *DeploymentType) UnmarshalYAML(unmarshal func(any) error) error {
143143
var s string
144144
err := unmarshal(&s)
145145
if err != nil {

api/disk.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ func (m *DiskListResult) Table() [][]string {
118118
}
119119

120120
type DiskItem struct {
121-
ID int64 `json:"id" yaml:"id"`
122-
ProjectID int64 `json:"projectId" yaml:"projectId"`
121+
Project string `json:"project" yaml:"project"`
123122
Location string `json:"location" yaml:"location"`
124123
Name string `json:"name" yaml:"name"`
125124
Size int64 `json:"size" yaml:"size"`

api/domainstatus.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ func (s *DomainStatus) UnmarshalJSON(b []byte) error {
4343
return nil
4444
}
4545

46-
func (s DomainStatus) MarshalYAML() (interface{}, error) {
46+
func (s DomainStatus) MarshalYAML() (any, error) {
4747
return s.String(), nil
4848
}
4949

50-
func (s *DomainStatus) UnmarshalYAML(unmarshal func(interface{}) error) error {
50+
func (s *DomainStatus) UnmarshalYAML(unmarshal func(any) error) error {
5151
var t string
5252
err := unmarshal(&t)
5353
if err != nil {

api/project.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ type ProjectGet struct {
8484
}
8585

8686
type ProjectItem struct {
87-
ID int64 `json:"id" yaml:"id"`
87+
ID string `json:"id" yaml:"id"`
8888
Project string `json:"project" yaml:"project"`
8989
Name string `json:"name" yaml:"name"`
9090
BillingAccount string `json:"billingAccount" yaml:"billingAccount"`
@@ -110,7 +110,6 @@ type ProjectQuota struct {
110110
}
111111

112112
type ProjectConfig struct {
113-
DomainCloudflare bool `json:"domainCloudflare" yaml:"domainCloudflare"`
114113
DomainAllowDisableCDN bool `json:"domainAllowDisableCdn" yaml:"domainAllowDisableCDN"`
115114
DomainWildcard bool `json:"domainWildcard" yaml:"domainWildcard"`
116115
}

api/status.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ func (s *Status) UnmarshalJSON(b []byte) error {
7272
return nil
7373
}
7474

75-
func (s Status) MarshalYAML() (interface{}, error) {
75+
func (s Status) MarshalYAML() (any, error) {
7676
return s.String(), nil
7777
}
7878

79-
func (s *Status) UnmarshalYAML(unmarshal func(interface{}) error) error {
79+
func (s *Status) UnmarshalYAML(unmarshal func(any) error) error {
8080
var t string
8181
err := unmarshal(&t)
8282
if err != nil {

api/workloadidentity.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package api
22

33
import (
44
"context"
5-
"fmt"
65
"strings"
76
"time"
87
"unicode/utf8"
@@ -99,8 +98,7 @@ func (m *WorkloadIdentityList) Valid() error {
9998
}
10099

101100
type WorkloadIdentityItem struct {
102-
ID int64 `json:"id" yaml:"id"`
103-
ProjectID int64 `json:"projectId" yaml:"projectId"`
101+
Project string `json:"project" yaml:"project"`
104102
Location string `json:"location" yaml:"location"`
105103
Name string `json:"name" yaml:"name"`
106104
GSA string `json:"gsa" yaml:"gsa"`
@@ -110,10 +108,6 @@ type WorkloadIdentityItem struct {
110108
CreatedBy string `json:"createdBy" yaml:"createdBy"`
111109
}
112110

113-
func (m *WorkloadIdentityItem) ResourceID() string {
114-
return fmt.Sprintf("%s-%d", m.Name, m.ProjectID)
115-
}
116-
117111
func (m *WorkloadIdentityItem) Table() [][]string {
118112
table := [][]string{
119113
{"NAME", "GSA", "LOCATION", "AGE"},

internal/runner/runner.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func (rn Runner) output() *os.File {
3131
return rn.Output
3232
}
3333

34-
func (rn Runner) print(v interface{}) error {
34+
func (rn Runner) print(v any) error {
3535
switch rn.OutputMode {
3636
case "", "table":
3737
rn.printTable(v.(tablePrinter).Table())
@@ -128,7 +128,7 @@ func (rn Runner) me(args ...string) error {
128128
s := rn.API.Me()
129129

130130
var (
131-
resp interface{}
131+
resp any
132132
err error
133133
)
134134

@@ -165,7 +165,7 @@ func (rn Runner) location(args ...string) error {
165165
s := rn.API.Location()
166166

167167
var (
168-
resp interface{}
168+
resp any
169169
err error
170170
)
171171

@@ -199,7 +199,7 @@ func (rn Runner) project(args ...string) error {
199199
s := rn.API.Project()
200200

201201
var (
202-
resp interface{}
202+
resp any
203203
err error
204204
)
205205

@@ -267,7 +267,7 @@ func (rn Runner) role(args ...string) error {
267267
s := rn.API.Role()
268268

269269
var (
270-
resp interface{}
270+
resp any
271271
err error
272272
)
273273

@@ -350,7 +350,7 @@ func (rn Runner) deployment(args ...string) error {
350350
s := rn.API.Deployment()
351351

352352
var (
353-
resp interface{}
353+
resp any
354354
err error
355355
)
356356

@@ -425,7 +425,7 @@ func (rn Runner) route(args ...string) error {
425425
s := rn.API.Route()
426426

427427
var (
428-
resp interface{}
428+
resp any
429429
err error
430430
)
431431

@@ -488,7 +488,7 @@ func (rn Runner) deploymentSet(args ...string) error {
488488
s := rn.API.Deployment()
489489

490490
var (
491-
resp interface{}
491+
resp any
492492
err error
493493
)
494494

@@ -524,7 +524,7 @@ func (rn Runner) disk(args ...string) error {
524524
s := rn.API.Disk()
525525

526526
var (
527-
resp interface{}
527+
resp any
528528
err error
529529
)
530530

@@ -584,7 +584,7 @@ func (rn Runner) pullSecret(args ...string) error {
584584
s := rn.API.PullSecret()
585585

586586
var (
587-
resp interface{}
587+
resp any
588588
err error
589589
)
590590

@@ -638,7 +638,7 @@ func (rn Runner) workloadIdentity(args ...string) error {
638638
s := rn.API.WorkloadIdentity()
639639

640640
var (
641-
resp interface{}
641+
resp any
642642
err error
643643
)
644644

@@ -690,7 +690,7 @@ func (rn Runner) serviceAccount(args ...string) error {
690690
s := rn.API.ServiceAccount()
691691

692692
var (
693-
resp interface{}
693+
resp any
694694
err error
695695
)
696696

0 commit comments

Comments
 (0)