prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  [Task] Change location to azure_location for porter parameters from API
  **Description**
   
  Change location to azure_location for porter parameters from API - as location appears to be a reserved word for porter
  
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `management_api_app/db/repositories/workspaces.py`
  Content:
  ```
  1 import uuid
  2 from typing import List
  3 
  4 from azure.cosmos import CosmosClient
  5 from pydantic import UUID4
  6 
  7 from core import config
  8 from db.errors import EntityDoesNotExist
  9 from db.repositories.base import BaseRepository
  10 from db.repositories.workspace_templates import WorkspaceTemplateRepository
  11 from models.domain.resource import Status
  12 from models.domain.workspace import Workspace
  13 from models.schemas.workspace import WorkspaceInCreate
  14 
  15 
  16 class WorkspaceRepository(BaseRepository):
  17     def __init__(self, client: CosmosClient):
  18         super().__init__(client, config.STATE_STORE_RESOURCES_CONTAINER)
  19 
  20     @staticmethod
  21     def _active_workspaces_query():
  22         return 'SELECT * FROM c WHERE c.resourceType = "workspace" AND c.isDeleted = false'
  23 
  24     def _get_template_version(self, template_name):
  25         workspace_template_repo = WorkspaceTemplateRepository(self._client)
  26         template = workspace_template_repo.get_current_workspace_template_by_name(template_name)
  27         return template["version"]
  28 
  29     def get_all_active_workspaces(self) -> List[Workspace]:
  30         query = self._active_workspaces_query()
  31         return self.query(query=query)
  32 
  33     def get_workspace_by_workspace_id(self, workspace_id: UUID4) -> Workspace:
  34         query = self._active_workspaces_query() + f' AND c.id="{workspace_id}"'
  35         workspaces = self.query(query=query)
  36         if not workspaces:
  37             raise EntityDoesNotExist
  38         return workspaces[0]
  39 
  40     def create_workspace_item(self, workspace_create: WorkspaceInCreate) -> Workspace:
  41         full_workspace_id = str(uuid.uuid4())
  42 
  43         try:
  44             template_version = self._get_template_version(workspace_create.workspaceType)
  45         except EntityDoesNotExist:
  46             raise ValueError(f"The workspace type '{workspace_create.workspaceType}' does not exist")
  47 
  48         resource_spec_parameters = {
  49             "location": config.RESOURCE_LOCATION,
  50             "workspace_id": full_workspace_id[-4:],
  51             "tre_id": config.TRE_ID,
  52             "address_space": "10.2.1.0/24"  # TODO: Calculate this value - Issue #52
  53         }
  54 
  55         workspace = Workspace(
  56             id=full_workspace_id,
  57             displayName=workspace_create.displayName,
  58             description=workspace_create.description,
  59             resourceTemplateName=workspace_create.workspaceType,
  60             resourceTemplateVersion=template_version,
  61             resourceTemplateParameters=resource_spec_parameters,
  62             status=Status.NotDeployed
  63         )
  64 
  65         return workspace
  66 
  67     def save_workspace(self, workspace: Workspace):
  68         self.create_item(workspace)
  69
  ```
  
  Path: `management_api_app/models/schemas/workspace_template.py`
  Content:
  ```
  1 from typing import List
  2 from pydantic import BaseModel, Field
  3 
  4 from models.domain.resource import ResourceType
  5 from models.domain.resource_template import ResourceTemplate, Parameter
  6 
  7 
  8 def get_sample_workspace_template_object(template_name: str = "tre-workspace-vanilla") -> ResourceTemplate:
  9     return ResourceTemplate(
  10         id="a7a7a7bd-7f4e-4a4e-b970-dc86a6b31dfb",
  11         name=template_name,
  12         description="vanilla workspace bundle",
  13         version="0.1.0",
  14         parameters=[
  15             Parameter(name="location", type="string"),
  16             Parameter(name="tre_id", type="string"),
  17             Parameter(name="workspace_id", type="string"),
  18             Parameter(name="address_space", type="string", default="10.2.1.0/24", description="VNet address space for the workspace services")
  19         ],
  20         resourceType=ResourceType.Workspace,
  21         current=True,
  22     )
  23 
  24 
  25 def get_sample_workspace_template() -> dict:
  26     return get_sample_workspace_template_object().dict()
  27 
  28 
  29 class WorkspaceTemplateNamesInList(BaseModel):
  30     templateNames: List[str]
  31 
  32     class Config:
  33         schema_extra = {
  34             "example": {
  35                 "templateNames": ["tre-workspace-vanilla", "tre-workspace-base"]
  36             }
  37         }
  38 
  39 
  40 class WorkspaceTemplateInCreate(BaseModel):
  41 
  42     name: str = Field(title="Name of workspace template")
  43     version: str = Field(title="Version of workspace template")
  44     description: str = Field(title=" Description of workspace template")
  45     properties: dict = Field({}, title="Workspace template properties",
  46                              description="Values for the properties required by the workspace template")
  47     resourceType: str = Field(title="Type of workspace template")
  48     current: bool = Field(title="Mark this version as current")
  49 
  50     class Config:
  51         schema_extra = {
  52             "example": {
  53                 "name": "My workspace template",
  54                 "version": "0.0.1",
  55                 "description": "workspace template for great product",
  56                 "properties": {},
  57                 "resourceType": "workspace",
  58                 "current": "true"
  59             }
  60         }
  61 
  62 
  63 class WorkspaceTemplateIdInResponse(BaseModel):
  64     resourceTemplateId: str
  65 
  66 
  67 class WorkspaceTemplateInResponse(BaseModel):
  68     workspaceTemplate: ResourceTemplate
  69 
  70     class Config:
  71         schema_extra = {
  72             "example": {
  73                 "resourceTemplateId": "49a7445c-aae6-41ec-a539-30dfa90ab1ae",
  74                 "workspaceTemplate": get_sample_workspace_template()
  75             }
  76         }
  77
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/management_api_app/db/repositories/workspaces.py b/management_api_app/db/repositories/workspaces.py
  --- a/management_api_app/db/repositories/workspaces.py
  +++ b/management_api_app/db/repositories/workspaces.py
  @@ -46,7 +46,7 @@
               raise ValueError(f"The workspace type '{workspace_create.workspaceType}' does not exist")
   
           resource_spec_parameters = {
  -            "location": config.RESOURCE_LOCATION,
  +            "azure_location": config.RESOURCE_LOCATION,
               "workspace_id": full_workspace_id[-4:],
               "tre_id": config.TRE_ID,
               "address_space": "10.2.1.0/24"  # TODO: Calculate this value - Issue #52
  diff --git a/management_api_app/models/schemas/workspace_template.py b/management_api_app/models/schemas/workspace_template.py
  --- a/management_api_app/models/schemas/workspace_template.py
  +++ b/management_api_app/models/schemas/workspace_template.py
  @@ -12,7 +12,7 @@
           description="vanilla workspace bundle",
           version="0.1.0",
           parameters=[
  -            Parameter(name="location", type="string"),
  +            Parameter(name="azure_location", type="string"),
               Parameter(name="tre_id", type="string"),
               Parameter(name="workspace_id", type="string"),
               Parameter(name="address_space", type="string", default="10.2.1.0/24", description="VNet address space for the workspace services")
  
verification_info: {"golden_diff": "diff --git a/management_api_app/db/repositories/workspaces.py b/management_api_app/db/repositories/workspaces.py\n--- a/management_api_app/db/repositories/workspaces.py\n+++ b/management_api_app/db/repositories/workspaces.py\n@@ -46,7 +46,7 @@\n             raise ValueError(f\"The workspace type '{workspace_create.workspaceType}' does not exist\")\n \n         resource_spec_parameters = {\n-            \"location\": config.RESOURCE_LOCATION,\n+            \"azure_location\": config.RESOURCE_LOCATION,\n             \"workspace_id\": full_workspace_id[-4:],\n             \"tre_id\": config.TRE_ID,\n             \"address_space\": \"10.2.1.0/24\"  # TODO: Calculate this value - Issue #52\ndiff --git a/management_api_app/models/schemas/workspace_template.py b/management_api_app/models/schemas/workspace_template.py\n--- a/management_api_app/models/schemas/workspace_template.py\n+++ b/management_api_app/models/schemas/workspace_template.py\n@@ -12,7 +12,7 @@\n         description=\"vanilla workspace bundle\",\n         version=\"0.1.0\",\n         parameters=[\n-            Parameter(name=\"location\", type=\"string\"),\n+            Parameter(name=\"azure_location\", type=\"string\"),\n             Parameter(name=\"tre_id\", type=\"string\"),\n             Parameter(name=\"workspace_id\", type=\"string\"),\n             Parameter(name=\"address_space\", type=\"string\", default=\"10.2.1.0/24\", description=\"VNet address space for the workspace services\")\n", "issue": "[Task] Change location to azure_location for porter parameters from API\n**Description**\r\n \r\nChange location to azure_location for porter parameters from API - as location appears to be a reserved word for porter\r\n\r\n\n", "before_files": [{"content": "import uuid\nfrom typing import List\n\nfrom azure.cosmos import CosmosClient\nfrom pydantic import UUID4\n\nfrom core import config\nfrom db.errors import EntityDoesNotExist\nfrom db.repositories.base import BaseRepository\nfrom db.repositories.workspace_templates import WorkspaceTemplateRepository\nfrom models.domain.resource import Status\nfrom models.domain.workspace import Workspace\nfrom models.schemas.workspace import WorkspaceInCreate\n\n\nclass WorkspaceRepository(BaseRepository):\n    def __init__(self, client: CosmosClient):\n        super().__init__(client, config.STATE_STORE_RESOURCES_CONTAINER)\n\n    @staticmethod\n    def _active_workspaces_query():\n        return 'SELECT * FROM c WHERE c.resourceType = \"workspace\" AND c.isDeleted = false'\n\n    def _get_template_version(self, template_name):\n        workspace_template_repo = WorkspaceTemplateRepository(self._client)\n        template = workspace_template_repo.get_current_workspace_template_by_name(template_name)\n        return template[\"version\"]\n\n    def get_all_active_workspaces(self) -> List[Workspace]:\n        query = self._active_workspaces_query()\n        return self.query(query=query)\n\n    def get_workspace_by_workspace_id(self, workspace_id: UUID4) -> Workspace:\n        query = self._active_workspaces_query() + f' AND c.id=\"{workspace_id}\"'\n        workspaces = self.query(query=query)\n        if not workspaces:\n            raise EntityDoesNotExist\n        return workspaces[0]\n\n    def create_workspace_item(self, workspace_create: WorkspaceInCreate) -> Workspace:\n        full_workspace_id = str(uuid.uuid4())\n\n        try:\n            template_version = self._get_template_version(workspace_create.workspaceType)\n        except EntityDoesNotExist:\n            raise ValueError(f\"The workspace type '{workspace_create.workspaceType}' does not exist\")\n\n        resource_spec_parameters = {\n            \"location\": config.RESOURCE_LOCATION,\n            \"workspace_id\": full_workspace_id[-4:],\n            \"tre_id\": config.TRE_ID,\n            \"address_space\": \"10.2.1.0/24\"  # TODO: Calculate this value - Issue #52\n        }\n\n        workspace = Workspace(\n            id=full_workspace_id,\n            displayName=workspace_create.displayName,\n            description=workspace_create.description,\n            resourceTemplateName=workspace_create.workspaceType,\n            resourceTemplateVersion=template_version,\n            resourceTemplateParameters=resource_spec_parameters,\n            status=Status.NotDeployed\n        )\n\n        return workspace\n\n    def save_workspace(self, workspace: Workspace):\n        self.create_item(workspace)\n", "path": "management_api_app/db/repositories/workspaces.py"}, {"content": "from typing import List\nfrom pydantic import BaseModel, Field\n\nfrom models.domain.resource import ResourceType\nfrom models.domain.resource_template import ResourceTemplate, Parameter\n\n\ndef get_sample_workspace_template_object(template_name: str = \"tre-workspace-vanilla\") -> ResourceTemplate:\n    return ResourceTemplate(\n        id=\"a7a7a7bd-7f4e-4a4e-b970-dc86a6b31dfb\",\n        name=template_name,\n        description=\"vanilla workspace bundle\",\n        version=\"0.1.0\",\n        parameters=[\n            Parameter(name=\"location\", type=\"string\"),\n            Parameter(name=\"tre_id\", type=\"string\"),\n            Parameter(name=\"workspace_id\", type=\"string\"),\n            Parameter(name=\"address_space\", type=\"string\", default=\"10.2.1.0/24\", description=\"VNet address space for the workspace services\")\n        ],\n        resourceType=ResourceType.Workspace,\n        current=True,\n    )\n\n\ndef get_sample_workspace_template() -> dict:\n    return get_sample_workspace_template_object().dict()\n\n\nclass WorkspaceTemplateNamesInList(BaseModel):\n    templateNames: List[str]\n\n    class Config:\n        schema_extra = {\n            \"example\": {\n                \"templateNames\": [\"tre-workspace-vanilla\", \"tre-workspace-base\"]\n            }\n        }\n\n\nclass WorkspaceTemplateInCreate(BaseModel):\n\n    name: str = Field(title=\"Name of workspace template\")\n    version: str = Field(title=\"Version of workspace template\")\n    description: str = Field(title=\" Description of workspace template\")\n    properties: dict = Field({}, title=\"Workspace template properties\",\n                             description=\"Values for the properties required by the workspace template\")\n    resourceType: str = Field(title=\"Type of workspace template\")\n    current: bool = Field(title=\"Mark this version as current\")\n\n    class Config:\n        schema_extra = {\n            \"example\": {\n                \"name\": \"My workspace template\",\n                \"version\": \"0.0.1\",\n                \"description\": \"workspace template for great product\",\n                \"properties\": {},\n                \"resourceType\": \"workspace\",\n                \"current\": \"true\"\n            }\n        }\n\n\nclass WorkspaceTemplateIdInResponse(BaseModel):\n    resourceTemplateId: str\n\n\nclass WorkspaceTemplateInResponse(BaseModel):\n    workspaceTemplate: ResourceTemplate\n\n    class Config:\n        schema_extra = {\n            \"example\": {\n                \"resourceTemplateId\": \"49a7445c-aae6-41ec-a539-30dfa90ab1ae\",\n                \"workspaceTemplate\": get_sample_workspace_template()\n            }\n        }\n", "path": "management_api_app/models/schemas/workspace_template.py"}], "after_files": [{"content": "import uuid\nfrom typing import List\n\nfrom azure.cosmos import CosmosClient\nfrom pydantic import UUID4\n\nfrom core import config\nfrom db.errors import EntityDoesNotExist\nfrom db.repositories.base import BaseRepository\nfrom db.repositories.workspace_templates import WorkspaceTemplateRepository\nfrom models.domain.resource import Status\nfrom models.domain.workspace import Workspace\nfrom models.schemas.workspace import WorkspaceInCreate\n\n\nclass WorkspaceRepository(BaseRepository):\n    def __init__(self, client: CosmosClient):\n        super().__init__(client, config.STATE_STORE_RESOURCES_CONTAINER)\n\n    @staticmethod\n    def _active_workspaces_query():\n        return 'SELECT * FROM c WHERE c.resourceType = \"workspace\" AND c.isDeleted = false'\n\n    def _get_template_version(self, template_name):\n        workspace_template_repo = WorkspaceTemplateRepository(self._client)\n        template = workspace_template_repo.get_current_workspace_template_by_name(template_name)\n        return template[\"version\"]\n\n    def get_all_active_workspaces(self) -> List[Workspace]:\n        query = self._active_workspaces_query()\n        return self.query(query=query)\n\n    def get_workspace_by_workspace_id(self, workspace_id: UUID4) -> Workspace:\n        query = self._active_workspaces_query() + f' AND c.id=\"{workspace_id}\"'\n        workspaces = self.query(query=query)\n        if not workspaces:\n            raise EntityDoesNotExist\n        return workspaces[0]\n\n    def create_workspace_item(self, workspace_create: WorkspaceInCreate) -> Workspace:\n        full_workspace_id = str(uuid.uuid4())\n\n        try:\n            template_version = self._get_template_version(workspace_create.workspaceType)\n        except EntityDoesNotExist:\n            raise ValueError(f\"The workspace type '{workspace_create.workspaceType}' does not exist\")\n\n        resource_spec_parameters = {\n            \"azure_location\": config.RESOURCE_LOCATION,\n            \"workspace_id\": full_workspace_id[-4:],\n            \"tre_id\": config.TRE_ID,\n            \"address_space\": \"10.2.1.0/24\"  # TODO: Calculate this value - Issue #52\n        }\n\n        workspace = Workspace(\n            id=full_workspace_id,\n            displayName=workspace_create.displayName,\n            description=workspace_create.description,\n            resourceTemplateName=workspace_create.workspaceType,\n            resourceTemplateVersion=template_version,\n            resourceTemplateParameters=resource_spec_parameters,\n            status=Status.NotDeployed\n        )\n\n        return workspace\n\n    def save_workspace(self, workspace: Workspace):\n        self.create_item(workspace)\n", "path": "management_api_app/db/repositories/workspaces.py"}, {"content": "from typing import List\nfrom pydantic import BaseModel, Field\n\nfrom models.domain.resource import ResourceType\nfrom models.domain.resource_template import ResourceTemplate, Parameter\n\n\ndef get_sample_workspace_template_object(template_name: str = \"tre-workspace-vanilla\") -> ResourceTemplate:\n    return ResourceTemplate(\n        id=\"a7a7a7bd-7f4e-4a4e-b970-dc86a6b31dfb\",\n        name=template_name,\n        description=\"vanilla workspace bundle\",\n        version=\"0.1.0\",\n        parameters=[\n            Parameter(name=\"azure_location\", type=\"string\"),\n            Parameter(name=\"tre_id\", type=\"string\"),\n            Parameter(name=\"workspace_id\", type=\"string\"),\n            Parameter(name=\"address_space\", type=\"string\", default=\"10.2.1.0/24\", description=\"VNet address space for the workspace services\")\n        ],\n        resourceType=ResourceType.Workspace,\n        current=True,\n    )\n\n\ndef get_sample_workspace_template() -> dict:\n    return get_sample_workspace_template_object().dict()\n\n\nclass WorkspaceTemplateNamesInList(BaseModel):\n    templateNames: List[str]\n\n    class Config:\n        schema_extra = {\n            \"example\": {\n                \"templateNames\": [\"tre-workspace-vanilla\", \"tre-workspace-base\"]\n            }\n        }\n\n\nclass WorkspaceTemplateInCreate(BaseModel):\n\n    name: str = Field(title=\"Name of workspace template\")\n    version: str = Field(title=\"Version of workspace template\")\n    description: str = Field(title=\" Description of workspace template\")\n    properties: dict = Field({}, title=\"Workspace template properties\",\n                             description=\"Values for the properties required by the workspace template\")\n    resourceType: str = Field(title=\"Type of workspace template\")\n    current: bool = Field(title=\"Mark this version as current\")\n\n    class Config:\n        schema_extra = {\n            \"example\": {\n                \"name\": \"My workspace template\",\n                \"version\": \"0.0.1\",\n                \"description\": \"workspace template for great product\",\n                \"properties\": {},\n                \"resourceType\": \"workspace\",\n                \"current\": \"true\"\n            }\n        }\n\n\nclass WorkspaceTemplateIdInResponse(BaseModel):\n    resourceTemplateId: str\n\n\nclass WorkspaceTemplateInResponse(BaseModel):\n    workspaceTemplate: ResourceTemplate\n\n    class Config:\n        schema_extra = {\n            \"example\": {\n                \"resourceTemplateId\": \"49a7445c-aae6-41ec-a539-30dfa90ab1ae\",\n                \"workspaceTemplate\": get_sample_workspace_template()\n            }\n        }\n", "path": "management_api_app/models/schemas/workspace_template.py"}]}