Skip to content

Commit

Permalink
rename client to restClient
Browse files Browse the repository at this point in the history
  • Loading branch information
MatousJobanek committed Jun 25, 2024
1 parent 2b19d34 commit c988270
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 49 deletions.
84 changes: 42 additions & 42 deletions pkg/kubeclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ func NewCRTRESTClient(cfg *rest.Config, informer informers.Informer, namespace s
config.NegotiatedSerializer = serializer.WithoutConversionCodecFactory{CodecFactory: serializer.NewCodecFactory(scheme)}
config.UserAgent = rest.DefaultKubernetesUserAgent()

client, err := rest.RESTClientFor(&config)
restClient, err := rest.RESTClientFor(&config)
if err != nil {
return nil, err
}

crtRESTClient := &CRTRESTClient{
RestClient: client,
RestClient: restClient,
Informer: informer,
Config: config,
NS: namespace,
Expand Down Expand Up @@ -94,11 +94,11 @@ type V1Alpha1REST struct {
func (c *V1Alpha1REST) UserSignups() UserSignupInterface {
return &userSignupClient{
crtClient: crtClient{
client: c.client.RestClient,
informer: c.client.Informer,
ns: c.client.NS,
cfg: c.client.Config,
scheme: c.client.Scheme,
restClient: c.client.RestClient,
informer: c.client.Informer,
ns: c.client.NS,
cfg: c.client.Config,
scheme: c.client.Scheme,
},
}
}
Expand All @@ -107,11 +107,11 @@ func (c *V1Alpha1REST) UserSignups() UserSignupInterface {
func (c *V1Alpha1REST) MasterUserRecords() MasterUserRecordInterface {
return &masterUserRecordClient{
crtClient: crtClient{
client: c.client.RestClient,
informer: c.client.Informer,
ns: c.client.NS,
cfg: c.client.Config,
scheme: c.client.Scheme,
restClient: c.client.RestClient,
informer: c.client.Informer,
ns: c.client.NS,
cfg: c.client.Config,
scheme: c.client.Scheme,
},
}
}
Expand All @@ -120,11 +120,11 @@ func (c *V1Alpha1REST) MasterUserRecords() MasterUserRecordInterface {
func (c *V1Alpha1REST) BannedUsers() BannedUserInterface {
return &bannedUserClient{
crtClient: crtClient{
client: c.client.RestClient,
informer: c.client.Informer,
ns: c.client.NS,
cfg: c.client.Config,
scheme: c.client.Scheme,
restClient: c.client.RestClient,
informer: c.client.Informer,
ns: c.client.NS,
cfg: c.client.Config,
scheme: c.client.Scheme,
},
}
}
Expand All @@ -133,11 +133,11 @@ func (c *V1Alpha1REST) BannedUsers() BannedUserInterface {
func (c *V1Alpha1REST) ToolchainStatuses() ToolchainStatusInterface {
return &toolchainStatusClient{
crtClient: crtClient{
client: c.client.RestClient,
informer: c.client.Informer,
ns: c.client.NS,
cfg: c.client.Config,
scheme: c.client.Scheme,
restClient: c.client.RestClient,
informer: c.client.Informer,
ns: c.client.NS,
cfg: c.client.Config,
scheme: c.client.Scheme,
},
}
}
Expand All @@ -146,11 +146,11 @@ func (c *V1Alpha1REST) ToolchainStatuses() ToolchainStatusInterface {
func (c *V1Alpha1REST) SocialEvents() SocialEventInterface {
return &socialeventClient{
crtClient: crtClient{
client: c.client.RestClient,
informer: c.client.Informer,
ns: c.client.NS,
cfg: c.client.Config,
scheme: c.client.Scheme,
restClient: c.client.RestClient,
informer: c.client.Informer,
ns: c.client.NS,
cfg: c.client.Config,
scheme: c.client.Scheme,

Check warning on line 153 in pkg/kubeclient/client.go

View check run for this annotation

Codecov / codecov/patch

pkg/kubeclient/client.go#L149-L153

Added lines #L149 - L153 were not covered by tests
},
}
}
Expand All @@ -159,11 +159,11 @@ func (c *V1Alpha1REST) SocialEvents() SocialEventInterface {
func (c *V1Alpha1REST) Spaces() SpaceInterface {
return &spaceClient{
crtClient: crtClient{
client: c.client.RestClient,
informer: c.client.Informer,
ns: c.client.NS,
cfg: c.client.Config,
scheme: c.client.Scheme,
restClient: c.client.RestClient,
informer: c.client.Informer,
ns: c.client.NS,
cfg: c.client.Config,
scheme: c.client.Scheme,

Check warning on line 166 in pkg/kubeclient/client.go

View check run for this annotation

Codecov / codecov/patch

pkg/kubeclient/client.go#L162-L166

Added lines #L162 - L166 were not covered by tests
},
}
}
Expand All @@ -172,19 +172,19 @@ func (c *V1Alpha1REST) Spaces() SpaceInterface {
func (c *V1Alpha1REST) SpaceBindings() SpaceBindingInterface {
return &spaceBindingClient{
crtClient: crtClient{
client: c.client.RestClient,
informer: c.client.Informer,
ns: c.client.NS,
cfg: c.client.Config,
scheme: c.client.Scheme,
restClient: c.client.RestClient,
informer: c.client.Informer,
ns: c.client.NS,
cfg: c.client.Config,
scheme: c.client.Scheme,

Check warning on line 179 in pkg/kubeclient/client.go

View check run for this annotation

Codecov / codecov/patch

pkg/kubeclient/client.go#L175-L179

Added lines #L175 - L179 were not covered by tests
},
}
}

type crtClient struct {
client rest.Interface
informer informers.Informer
ns string
cfg rest.Config
scheme *runtime.Scheme
restClient rest.Interface
informer informers.Informer
ns string
cfg rest.Config
scheme *runtime.Scheme
}
2 changes: 1 addition & 1 deletion pkg/kubeclient/mur.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type MasterUserRecordInterface interface {
// Get returns the MasterUserRecord with the specified name, or an error if something went wrong while attempting to retrieve it
func (c *masterUserRecordClient) Get(name string) (*crtapi.MasterUserRecord, error) {
result := &crtapi.MasterUserRecord{}
err := c.client.Get().
err := c.restClient.Get().

Check warning on line 21 in pkg/kubeclient/mur.go

View check run for this annotation

Codecov / codecov/patch

pkg/kubeclient/mur.go#L21

Added line #L21 was not covered by tests
Namespace(c.ns).
Resource(resources.MurResourcePlural).
Name(name).
Expand Down
6 changes: 3 additions & 3 deletions pkg/kubeclient/signup.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type UserSignupInterface interface {
// If not found then NotFound error returned
func (c *userSignupClient) Get(name string) (*crtapi.UserSignup, error) {
result := &crtapi.UserSignup{}
err := c.client.Get().
err := c.restClient.Get().

Check warning on line 34 in pkg/kubeclient/signup.go

View check run for this annotation

Codecov / codecov/patch

pkg/kubeclient/signup.go#L34

Added line #L34 was not covered by tests
Namespace(c.ns).
Resource(resources.UserSignupResourcePlural).
Name(name).
Expand All @@ -47,7 +47,7 @@ func (c *userSignupClient) Get(name string) (*crtapi.UserSignup, error) {
// an error if something went wrong
func (c *userSignupClient) Create(obj *crtapi.UserSignup) (*crtapi.UserSignup, error) {
result := &crtapi.UserSignup{}
err := c.client.Post().
err := c.restClient.Post().

Check warning on line 50 in pkg/kubeclient/signup.go

View check run for this annotation

Codecov / codecov/patch

pkg/kubeclient/signup.go#L50

Added line #L50 was not covered by tests
Namespace(c.ns).
Resource(resources.UserSignupResourcePlural).
Body(obj).
Expand All @@ -62,7 +62,7 @@ func (c *userSignupClient) Create(obj *crtapi.UserSignup) (*crtapi.UserSignup, e
// Update will update an existing UserSignup resource in the cluster, returning an error if something went wrong
func (c *userSignupClient) Update(obj *crtapi.UserSignup) (*crtapi.UserSignup, error) {
result := &crtapi.UserSignup{}
err := c.client.Put().
err := c.restClient.Put().

Check warning on line 65 in pkg/kubeclient/signup.go

View check run for this annotation

Codecov / codecov/patch

pkg/kubeclient/signup.go#L65

Added line #L65 was not covered by tests
Namespace(c.ns).
Resource(resources.UserSignupResourcePlural).
Name(obj.Name).
Expand Down
2 changes: 1 addition & 1 deletion pkg/kubeclient/socialevent.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type SocialEventInterface interface {
// Get returns the SocialEvent with the specified name, or an error if something went wrong while attempting to retrieve it
func (c *socialeventClient) Get(name string) (*crtapi.SocialEvent, error) {
result := &crtapi.SocialEvent{}
err := c.client.Get().
err := c.restClient.Get().

Check warning on line 24 in pkg/kubeclient/socialevent.go

View check run for this annotation

Codecov / codecov/patch

pkg/kubeclient/socialevent.go#L24

Added line #L24 was not covered by tests
Namespace(c.ns).
Resource(socialeventResourcePlural).
Name(name).
Expand Down
2 changes: 1 addition & 1 deletion pkg/kubeclient/space.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type SpaceInterface interface {
// List returns the Spaces that match for the provided selector, or an error if something went wrong while attempting to retrieve it
func (c *spaceClient) Get(name string) (*crtapi.Space, error) {
result := &crtapi.Space{}
err := c.client.Get().
err := c.restClient.Get().
Namespace(c.ns).

Check warning on line 22 in pkg/kubeclient/space.go

View check run for this annotation

Codecov / codecov/patch

pkg/kubeclient/space.go#L21-L22

Added lines #L21 - L22 were not covered by tests
Resource(resources.SpaceResourcePlural).
Name(name).
Expand Down
2 changes: 1 addition & 1 deletion pkg/kubeclient/toolchainstatus.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type ToolchainStatusInterface interface {
// If not found then NotFound error returned
func (c *toolchainStatusClient) Get() (*crtapi.ToolchainStatus, error) {
result := &crtapi.ToolchainStatus{}
err := c.client.Get().
err := c.restClient.Get().
Namespace(c.ns).
Resource(resources.ToolchainStatusPlural).
Name(resources.ToolchainStatusName).
Expand Down

0 comments on commit c988270

Please sign in to comment.