Skip to content

Commit

Permalink
registry: Add subscription tier slug argument to create
Browse files Browse the repository at this point in the history
As of GA, users are required to specify a subscription tier slug when creating a
registry. The subscription is also returned in the resposne, but for now we
ignore it to keep API compatibility.
  • Loading branch information
adamwg committed Nov 2, 2020
1 parent f9ae7dd commit fc093bc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
3 changes: 2 additions & 1 deletion registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ type RegistryServiceOp struct {

// RegistryCreateRequest represents a request to create a registry.
type RegistryCreateRequest struct {
Name string `json:"name,omitempty"`
Name string `json:"name,omitempty"`
SubscriptionTierSlug string `json:"subscription_tier_slug,omitempty"`
}

// RegistryDockerCredentialsRequest represents a request to retrieve docker
Expand Down
18 changes: 16 additions & 2 deletions registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,29 @@ func TestRegistry_Create(t *testing.T) {
}

createRequest := &RegistryCreateRequest{
Name: want.Name,
Name: want.Name,
SubscriptionTierSlug: "basic",
}

createResponseJSON := `
{
"registry": {
"name": "` + testRegistry + `",
"created_at": "` + testTimeString + `"
}
},
"subscription": {
"tier": {
"name": "Basic",
"slug": "basic",
"included_repositories": 5,
"included_storage_bytes": 5368709120,
"allow_storage_overage": true,
"included_bandwidth_bytes": 5368709120,
"monthly_price_in_cents": 500
},
"created_at": "` + testTimeString + `",
"updated_at": "` + testTimeString + `"
}
}`

mux.HandleFunc("/v2/registry", func(w http.ResponseWriter, r *http.Request) {
Expand Down

0 comments on commit fc093bc

Please sign in to comment.