From 3eea242da5defa47a292a687ac930d96551f355c Mon Sep 17 00:00:00 2001 From: Greeshma Date: Wed, 11 Sep 2024 16:50:22 +0530 Subject: [PATCH] APPS-8398: Retire list and get app tiers --- apps.go | 47 ----------------------------------------------- apps_test.go | 34 ---------------------------------- 2 files changed, 81 deletions(-) diff --git a/apps.go b/apps.go index ac79265..2e45f0a 100644 --- a/apps.go +++ b/apps.go @@ -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) @@ -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"` } @@ -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) diff --git a/apps_test.go b/apps_test.go index eb743d3..82d8f8b 100644 --- a/apps_test.go +++ b/apps_test.go @@ -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()