diff --git a/koku/api/resource_types/aws_regions/view.py b/koku/api/resource_types/aws_regions/view.py index c3f0957c87..b5ed2909e6 100644 --- a/koku/api/resource_types/aws_regions/view.py +++ b/koku/api/resource_types/aws_regions/view.py @@ -3,7 +3,6 @@ # SPDX-License-Identifier: Apache-2.0 # """View for AWS by regions.""" -import boto3 from django.conf import settings from django.db.models import F from django.utils.decorators import method_decorator @@ -11,8 +10,6 @@ from rest_framework import filters from rest_framework import generics from rest_framework import status -from rest_framework import views -from rest_framework.permissions import AllowAny from rest_framework.response import Response from api.common import CACHE_RH_IDENTITY_HEADER @@ -58,37 +55,3 @@ def list(self, request): return super().list(request) self.queryset = self.queryset.filter(usage_account_id__in=user_access) return super().list(request) - - -class AWSAllRegionView(views.APIView): - """API GET list view for AWS of all regions""" - - permission_classes = [AllowAny] - - @method_decorator(vary_on_headers(CACHE_RH_IDENTITY_HEADER)) - def get(self, request): - supported_query_params = ["limit", "offset", "search"] - error_message = {} - search_values = [] - # Test for only supported query_params - if self.request.query_params: - for key in self.request.query_params: - if key not in supported_query_params: - error_message[key] = [{"Unsupported parameter"}] - return Response(error_message, status=status.HTTP_400_BAD_REQUEST) - search_value_str = self.request.query_params.get("search") - if search_value_str: - search_values = search_value_str.split(",") - regions = boto3.Session().get_available_regions("s3") - filtered_regions = [] - for region in regions: - if any(value in region for value in search_values): - filtered_regions.append(region) - if not filtered_regions: - filtered_regions = regions - filtered_regions = list(set(filtered_regions)) - queryset = [{"value": region} for region in filtered_regions] - paginator = ResourceTypeViewPaginator() - paginated_queryset = paginator.paginate_queryset(queryset, request) - serializer = ResourceTypeSerializer(paginated_queryset, many=True) - return paginator.get_paginated_response(serializer.data) diff --git a/koku/api/resource_types/test/test_views.py b/koku/api/resource_types/test/test_views.py index 842331e058..05346ec3f3 100644 --- a/koku/api/resource_types/test/test_views.py +++ b/koku/api/resource_types/test/test_views.py @@ -78,7 +78,6 @@ class ResourceTypesViewTest(IamTestCase): ENDPOINTS_AWS = [ "aws-accounts", "aws-regions", - "aws-all-regions", "aws-services", "aws-organizational-units", "aws-categories", @@ -250,8 +249,6 @@ def test_rbacpermissions_aws_account_data_returns_null(self): """Test that Aws endpoints accept valid Aws permissions.""" for endpoint in self.ENDPOINTS_AWS: with self.subTest(endpoint=endpoint): - if endpoint == "aws-all-regions": - continue url = reverse(endpoint) response = self.client.get(url, **self.headers) self.assertEqual(response.status_code, status.HTTP_200_OK) diff --git a/koku/api/urls.py b/koku/api/urls.py index 4e431e6717..9db150afa2 100644 --- a/koku/api/urls.py +++ b/koku/api/urls.py @@ -12,7 +12,6 @@ from api.views import AccountSettings from api.views import AWSAccountRegionView from api.views import AWSAccountView -from api.views import AWSAllRegionView from api.views import AWSCategoryView from api.views import AWSCostForecastView from api.views import AWSCostView @@ -444,7 +443,6 @@ path("resource-types/azure-services/", AzureServiceView.as_view(), name="azure-services"), path("resource-types/aws-services/", AWSServiceView.as_view(), name="aws-services"), path("resource-types/aws-regions/", AWSAccountRegionView.as_view(), name="aws-regions"), - path("resource-types/aws-all-regions/", AWSAllRegionView.as_view(), name="aws-all-regions"), path( "resource-types/azure-subscription-guids/", AzureSubscriptionGuidView.as_view(), diff --git a/koku/api/views.py b/koku/api/views.py index 15fc54c4a3..f2a39252d3 100644 --- a/koku/api/views.py +++ b/koku/api/views.py @@ -58,7 +58,6 @@ from api.resource_types.aws_ec2_compute_os.view import AWSEC2ComputeOperatingSystemView from api.resource_types.aws_org_unit.view import AWSOrganizationalUnitView from api.resource_types.aws_regions.view import AWSAccountRegionView -from api.resource_types.aws_regions.view import AWSAllRegionView from api.resource_types.aws_services.view import AWSServiceView from api.resource_types.azure_regions.view import AzureRegionView from api.resource_types.azure_services.view import AzureServiceView