Skip to content

Commit

Permalink
Add an AWS marketplace redirect link (#321)
Browse files Browse the repository at this point in the history
* Add an AWS marketplace redirect link

* Update AWS Marketplace link endpoint
  • Loading branch information
meln1k authored Mar 4, 2024
1 parent 61f92b5 commit 64a563f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion fixbackend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ async def domain_events_swagger_ui_html(req: Request) -> HTMLResponse:
api_router.include_router(cloud_accounts_callback_router(), prefix="/cloud", tags=["cloud_accounts"])
api_router.include_router(users_router(), prefix="/users", tags=["users"])
api_router.include_router(subscription_router(), tags=["billing"])
api_router.include_router(billing_info_router(), prefix="/workspaces", tags=["billing"])
api_router.include_router(billing_info_router(cfg), prefix="/workspaces", tags=["billing"])
api_router.include_router(notification_router(deps), prefix="/workspaces", tags=["notification"])
api_router.include_router(roles_router(), prefix="/workspaces", tags=["roles"])

Expand Down
17 changes: 14 additions & 3 deletions fixbackend/billing_information/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@

from typing import List, Optional

from fastapi import APIRouter, Depends
from fastapi import APIRouter, Depends, Response, status

from fixbackend.auth.depedencies import AuthenticatedUser
from fixbackend.config import Config
from fixbackend.permissions.models import WorkspacePermissions
from fixbackend.permissions.permission_checker import WorkspacePermissionChecker
from fixbackend.billing_information import schemas
Expand All @@ -29,13 +30,13 @@
)
from fixbackend.billing_information.service import BillingEntryServiceDependency
from fixbackend.errors import ResourceNotFound
from fixbackend.ids import ProductTier, SubscriptionId
from fixbackend.ids import ProductTier, SubscriptionId, WorkspaceId
from fixbackend.subscription.subscription_repository import SubscriptionRepositoryDependency
from fixbackend.workspaces.dependencies import UserWorkspaceDependency
from fixbackend.workspaces.repository import WorkspaceRepositoryDependency


def billing_info_router() -> APIRouter:
def billing_info_router(config: Config) -> APIRouter:
router = APIRouter()

@router.get("/{workspace_id}/billing_entries/")
Expand Down Expand Up @@ -104,4 +105,14 @@ async def assign_subscription(

await workspace_repository.update_subscription(workspace.id, subscription_id)

@router.get("/{workspace_id}/aws_marketplace_product")
async def redirect_to_aws_marketplace_product(
workspace_id: WorkspaceId,
) -> Response:
response = Response(
status_code=status.HTTP_303_SEE_OTHER,
headers={"Location": config.aws_marketplace_url},
)
return response

return router

0 comments on commit 64a563f

Please sign in to comment.