Skip to content

Commit

Permalink
Fix some minor container registry inconsistencies (#284)
Browse files Browse the repository at this point in the history
* Remove pointer from docker creds create

* Remove list options from CR list regions

* Add omit empty on CR update pointers

* Revert "Remove pointer from docker creds create"

This reverts commit 9db8450.

* Remove extra arguments from CR list region test
  • Loading branch information
optik-aper authored Nov 17, 2023
1 parent 7eea7c4 commit 9f99244
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions container_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type ContainerRegistryService interface {
UpdateRepository(ctx context.Context, vcrID, imageName string, updateReq *ContainerRegistryRepoUpdateReq) (*ContainerRegistryRepo, *http.Response, error) //nolint:lll
DeleteRepository(ctx context.Context, vcrID, imageName string) error
CreateDockerCredentials(ctx context.Context, vcrID string, createOptions *DockerCredentialsOpt) (*ContainerRegistryDockerCredentials, *http.Response, error) //nolint:lll
ListRegions(ctx context.Context, options *ListOptions) ([]ContainerRegistryRegion, *Meta, *http.Response, error)
ListRegions(ctx context.Context) ([]ContainerRegistryRegion, *Meta, *http.Response, error)
ListPlans(ctx context.Context) (*ContainerRegistryPlans, *http.Response, error)
}

Expand Down Expand Up @@ -106,8 +106,8 @@ type ContainerRegistryReq struct {

// ContainerRegistryUpdateReq represents the data used to update a registry
type ContainerRegistryUpdateReq struct {
Public *bool `json:"public"`
Plan *string `json:"plan"`
Public *bool `json:"public,omitempty"`
Plan *string `json:"plan,omitempty"`
}

// ContainerRegistryRepo represents the data of a registry repository
Expand Down Expand Up @@ -392,7 +392,7 @@ func (h *ContainerRegistryServiceHandler) CreateDockerCredentials(ctx context.Co

// ListRegions will return a list of regions relevant to the container registry
// API operations
func (h *ContainerRegistryServiceHandler) ListRegions(ctx context.Context, options *ListOptions) ([]ContainerRegistryRegion, *Meta, *http.Response, error) { //nolint:lll
func (h *ContainerRegistryServiceHandler) ListRegions(ctx context.Context) ([]ContainerRegistryRegion, *Meta, *http.Response, error) {
req, errReq := h.client.NewRequest(ctx, http.MethodGet, fmt.Sprintf("%s/region/list", vcrPath), nil)
if errReq != nil {
return nil, nil, nil, errReq
Expand Down
4 changes: 2 additions & 2 deletions container_registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ func TestVCRServiceHandler_ListRegions(t *testing.T) {
fmt.Fprint(writer, response)
})

vcrRegions, meta, _, err := client.ContainerRegistry.ListRegions(ctx, nil)
vcrRegions, meta, _, err := client.ContainerRegistry.ListRegions(ctx)
if err != nil {
t.Errorf("ContainerRegistry.ListRegions returned %v", err)
}
Expand Down Expand Up @@ -1014,7 +1014,7 @@ func TestVCRServiceHandler_ListRegions(t *testing.T) {

c, can := context.WithTimeout(ctx, 1*time.Microsecond)
defer can()
_, _, _, err = client.ContainerRegistry.ListRegions(c, nil)
_, _, _, err = client.ContainerRegistry.ListRegions(c)
if err == nil {
t.Error("ContainerRegistry.ListRegions returned nil")
}
Expand Down

0 comments on commit 9f99244

Please sign in to comment.