Skip to content

Commit

Permalink
APPS-8398: Retire list and get app tiers
Browse files Browse the repository at this point in the history
  • Loading branch information
greeshmapill committed Sep 11, 2024
1 parent d9ba192 commit 3eea242
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 81 deletions.
47 changes: 0 additions & 47 deletions apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ type AppsService interface {

ListRegions(ctx context.Context) ([]*AppRegion, *Response, error)

ListTiers(ctx context.Context) ([]*AppTier, *Response, error)
GetTier(ctx context.Context, slug string) (*AppTier, *Response, error)

ListInstanceSizes(ctx context.Context) ([]*AppInstanceSize, *Response, error)
GetInstanceSize(ctx context.Context, slug string) (*AppInstanceSize, *Response, error)

Expand Down Expand Up @@ -131,14 +128,6 @@ type deploymentsRoot struct {
Meta *Meta `json:"meta"`
}

type appTierRoot struct {
Tier *AppTier `json:"tier"`
}

type appTiersRoot struct {
Tiers []*AppTier `json:"tiers"`
}

type instanceSizeRoot struct {
InstanceSize *AppInstanceSize `json:"instance_size"`
}
Expand Down Expand Up @@ -383,42 +372,6 @@ func (s *AppsServiceOp) ListRegions(ctx context.Context) ([]*AppRegion, *Respons
return root.Regions, resp, nil
}

// ListTiers lists available app tiers.
//
// Deprecated: The '/v2/apps/tiers' endpoint has been deprecated as app tiers
// are no longer tied to instance sizes. The concept of tiers is being retired.
func (s *AppsServiceOp) ListTiers(ctx context.Context) ([]*AppTier, *Response, error) {
path := fmt.Sprintf("%s/tiers", appsBasePath)
req, err := s.client.NewRequest(ctx, http.MethodGet, path, nil)
if err != nil {
return nil, nil, err
}
root := new(appTiersRoot)
resp, err := s.client.Do(ctx, req, root)
if err != nil {
return nil, resp, err
}
return root.Tiers, resp, nil
}

// GetTier retrieves information about a specific app tier.
//
// Deprecated: The '/v2/apps/tiers/{slug}' endpoints have been deprecated as app
// tiers are no longer tied to instance sizes. The concept of tiers is being retired.
func (s *AppsServiceOp) GetTier(ctx context.Context, slug string) (*AppTier, *Response, error) {
path := fmt.Sprintf("%s/tiers/%s", appsBasePath, slug)
req, err := s.client.NewRequest(ctx, http.MethodGet, path, nil)
if err != nil {
return nil, nil, err
}
root := new(appTierRoot)
resp, err := s.client.Do(ctx, req, root)
if err != nil {
return nil, resp, err
}
return root.Tier, resp, nil
}

// ListInstanceSizes lists available instance sizes for service, worker, and job components.
func (s *AppsServiceOp) ListInstanceSizes(ctx context.Context) ([]*AppInstanceSize, *Response, error) {
path := fmt.Sprintf("%s/tiers/instance_sizes", appsBasePath)
Expand Down
34 changes: 0 additions & 34 deletions apps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -578,40 +578,6 @@ func TestApps_ListRegions(t *testing.T) {
assert.Equal(t, []*AppRegion{&testAppRegion}, regions)
}

func TestApps_ListTiers(t *testing.T) {
setup()
defer teardown()

ctx := context.Background()

mux.HandleFunc("/v2/apps/tiers", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, http.MethodGet)

json.NewEncoder(w).Encode(&appTiersRoot{Tiers: []*AppTier{&testAppTier}})
})

tiers, _, err := client.Apps.ListTiers(ctx)
require.NoError(t, err)
assert.Equal(t, []*AppTier{&testAppTier}, tiers)
}

func TestApps_GetTier(t *testing.T) {
setup()
defer teardown()

ctx := context.Background()

mux.HandleFunc(fmt.Sprintf("/v2/apps/tiers/%s", testAppTier.Slug), func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, http.MethodGet)

json.NewEncoder(w).Encode(&appTierRoot{Tier: &testAppTier})
})

tier, _, err := client.Apps.GetTier(ctx, testAppTier.Slug)
require.NoError(t, err)
assert.Equal(t, &testAppTier, tier)
}

func TestApps_ListInstanceSizes(t *testing.T) {
setup()
defer teardown()
Expand Down

0 comments on commit 3eea242

Please sign in to comment.