Skip to content

Commit

Permalink
rename to NewRESTClientForHost, reduce method overhead
Browse files Browse the repository at this point in the history
  • Loading branch information
elenz97 committed Jul 14, 2020
1 parent 69df1f3 commit 89774aa
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,13 @@ func NewRESTClient(cl *client.Harbor, authInfo runtime.ClientAuthInfoWriter) *RE
}
}

// NewRESTClientWithSwaggerClient constructs a new REST client containing a swagger
// NewRESTClientForHost constructs a new REST client containing a swagger
// API client using the defined host string + basePath as well as basic auth info.
func NewRESTClientWithSwaggerClient(host, basePath, username, password string) *RESTClient {
func NewRESTClientForHost(host, basePath, username, password string) *RESTClient {
swaggerClient := client.New(runtimeclient.New(host, basePath, []string{"http"}), strfmt.Default)
authInfo := runtimeclient.BasicAuth(username, password)

return &RESTClient{
user: user.NewClient(swaggerClient, authInfo),
project: project.NewClient(swaggerClient, authInfo),
registry: registry.NewClient(swaggerClient, authInfo),
replication: replication.NewClient(swaggerClient, authInfo),
system: system.NewClient(swaggerClient, authInfo),
}
return NewRESTClient(swaggerClient, authInfo)
}

// User Client
Expand Down

0 comments on commit 89774aa

Please sign in to comment.