Skip to content

Commit c90d32b

Browse files
authored
Add /api to routes (#130)
* feat(compose): comelete compose prompt * fix(kuber): remove lb * feat(compose): compelete compose prompt * nothing * fix(compose): totally restructre docker compose generator * fix(compose): directory builder * fix(compose): compelete compose generation allgorithm * fix(compose): edit default values for documentation * feat(compose): add union type input for networks * fix(routes): add /api to all routes
1 parent a4b24fa commit c90d32b

File tree

9 files changed

+18
-61
lines changed

9 files changed

+18
-61
lines changed
Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +0,0 @@
1-
version: '3'
2-
services:
3-
web:
4-
build:
5-
context: .
6-
dockerfile: DockerFile
7-
args:
8-
foo: bar
9-
image: nginx:latest
10-
container_name: web_server
11-
command: command...
12-
volumes:
13-
- ./foo:bar
14-
environment:
15-
foo: bar
16-
ports:
17-
- 80:80
18-
networks:
19-
- app_network
20-
depends_on:
21-
- service 0
22-
web2:
23-
build:
24-
context: .
25-
dockerfile: DockerFile
26-
args:
27-
foo: bar
28-
image: nginx:latest
29-
container_name: web_server
30-
command: command...
31-
volumes:
32-
- ./foo:bar
33-
environment:
34-
foo: bar
35-
ports:
36-
- 80:80
37-
networks:
38-
- app_network
39-
depends_on:
40-
- service 0
41-
networks:
42-
app_network:
43-
driver: bridge

app/media/MyCompose_zip.zip

285 Bytes
Binary file not shown.

app/models/compose_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ class DockerCompose(BaseModel):
3333
version: str = "3"
3434
services: Dict[str, Service] = {"web":Service(), "web2":Service()}
3535
networks: Union[Optional[Dict[str, PreCreatedNetwork]],Optional[Dict[str, Network]]] = {"app_network": {"driver":"bridge"}}
36-
36+

app/routes/ansible.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from app.template_generators.ansible.install.main import ansible_install_template
1010
import os
1111

12-
@app.post("/ansible-install/nginx/")
12+
@app.post("/api/ansible-install/nginx/")
1313
async def ansible_install_generation_nginx(request:AnsibleInstallNginx) -> Output:
1414

1515
if os.environ.get("TEST"):
@@ -22,7 +22,7 @@ async def ansible_install_generation_nginx(request:AnsibleInstallNginx) -> Outpu
2222
return Output(output='output')
2323

2424

25-
@app.post("/ansible-install/docker/")
25+
@app.post("/api/ansible-install/docker/")
2626
async def ansible_install_generation_docker(request:AnsibleInstallDocker) -> Output:
2727

2828
if os.environ.get("TEST"):
@@ -35,7 +35,7 @@ async def ansible_install_generation_docker(request:AnsibleInstallDocker) -> Out
3535
return Output(output='output')
3636

3737

38-
@app.post("/ansible-install/kuber/")
38+
@app.post("/api/ansible-install/kuber/")
3939
async def ansible_install_generation_kuber(request:AnsibleInstallKuber) -> Output:
4040

4141
if os.environ.get("TEST"):

app/routes/docker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from app.template_generators.docker.compose import docker_compose_generator
66
import os
77

8-
@app.post("/docker-compose/")
8+
@app.post("/api/docker-compose/")
99
async def docker_compose_template(request:DockerCompose) -> Output:
1010

1111
if os.environ.get("TEST"):

app/routes/helm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from app.models import (HelmTemplateGeneration,Output)
55
from app.prompt_generators import (helm_template_generator)
66
import os
7-
@app.post("/Helm-template/")
7+
@app.post("/api/Helm-template/")
88
async def Helm_template_generation(request:HelmTemplateGeneration) -> Output:
99
if os.environ.get("TEST"):
1010
return Output(output='output')

app/routes/jcasc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from app.template_generators.jenkins.jcasc import jcasc_template_generator
66
import os
77

8-
@app.post("/jcasc-template/")
8+
@app.post("/api/jcasc-template/")
99
async def jcasc_template_generation(request:Jcasc) -> Output:
1010
if os.environ.get("TEST"):
1111
return Output(output='output')

app/routes/terraform.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@
3131
from app.template_generators.terraform.aws.EFS import (IaC_template_generator_efs)
3232
import os
3333

34-
@app.post("/IaC-basic/")
34+
@app.post("/api/IaC-basic/")
3535
async def IaC_basic_generation(request:IaCBasicInput) -> Output:
3636
if os.environ.get("TEST"):
3737
return Output(output='Terraform developed by hashicorp and it is very usefull')
3838
generated_prompt = IaC_basics_generator(request)
3939
output = gpt_service(generated_prompt)
4040
return Output(output=output)
4141

42-
@app.post("/IaC-bugfix/")
42+
@app.post("/api/IaC-bugfix/")
4343
async def IaC_bugfix_generation(request:IaCBugfixInput) -> Output:
4444
if os.environ.get("TEST"):
4545
return Output(output='fix this bug by adding x to the y')
@@ -48,15 +48,15 @@ async def IaC_bugfix_generation(request:IaCBugfixInput) -> Output:
4848
return Output(output=output)
4949

5050

51-
@app.post("/IaC-install/")
51+
@app.post("/api/IaC-install/")
5252
async def IaC_install_generation(request:IaCInstallationInput) -> Output:
5353
if os.environ.get("TEST"):
5454
return Output(output='apt-get install xyz \n apt-get update (covert them to shell file output)')
5555
generated_prompt = IaC_installation_generator(request)
5656
output = gpt_service(generated_prompt)
5757
return Output(output=output)
5858

59-
@app.post("/IaC-template/docker")
59+
@app.post("/api/IaC-template/docker")
6060
async def IaC_template_generation_docker(request:IaCTemplateGenerationDocker) -> Output:
6161
if os.environ.get("TEST"):
6262
return Output(output='output (nothing special)')
@@ -66,7 +66,7 @@ async def IaC_template_generation_docker(request:IaCTemplateGenerationDocker) ->
6666
execute_pythonfile("MyTerraform","terraform_generator")
6767
return Output(output='output')
6868

69-
@app.post("/IaC-template/aws/ec2")
69+
@app.post("/api/IaC-template/aws/ec2")
7070
async def IaC_template_generation_aws_ec2(request:IaCTemplateGenerationEC2) -> Output:
7171
if os.environ.get("TEST"):
7272
return Output(output='output (nothing special)')
@@ -77,7 +77,7 @@ async def IaC_template_generation_aws_ec2(request:IaCTemplateGenerationEC2) -> O
7777
execute_pythonfile("MyTerraform","terraform_generator")
7878
return Output(output='output')
7979

80-
@app.post("/IaC-template/aws/s3")
80+
@app.post("/api/IaC-template/aws/s3")
8181
async def IaC_template_generation_aws_s3(request:IaCTemplateGenerationS3) -> Output:
8282
if os.environ.get("TEST"):
8383
return Output(output='output (nothing special)')
@@ -87,7 +87,7 @@ async def IaC_template_generation_aws_s3(request:IaCTemplateGenerationS3) -> Out
8787
execute_pythonfile("MyTerraform","terraform_generator")
8888
return Output(output='output')
8989

90-
@app.post("/IaC-template/aws/iam")
90+
@app.post("/api/IaC-template/aws/iam")
9191
async def IaC_template_generation_aws_iam(request:IaCTemplateGenerationIAM) -> Output:
9292
if os.environ.get("TEST"):
9393
return Output(output='output (nothing special)')
@@ -98,7 +98,7 @@ async def IaC_template_generation_aws_iam(request:IaCTemplateGenerationIAM) -> O
9898
return Output(output='output')
9999

100100

101-
@app.post("/IaC-template/argocd")
101+
@app.post("/api/IaC-template/argocd")
102102
async def IaC_template_generation_argocd(request:IaCTemplateGenerationArgoCD) -> Output:
103103
if os.environ.get("TEST"):
104104
return Output(output='output (nothing special)')
@@ -110,7 +110,7 @@ async def IaC_template_generation_argocd(request:IaCTemplateGenerationArgoCD) ->
110110

111111

112112

113-
@app.post("/IaC-template/aws/elb")
113+
@app.post("/api/IaC-template/aws/elb")
114114
async def IaC_template_generation_aws_elb(request:IaCTemplateGenerationELB) -> Output:
115115
if os.environ.get("TEST"):
116116
return Output(output='output (nothing special)')
@@ -120,7 +120,7 @@ async def IaC_template_generation_aws_elb(request:IaCTemplateGenerationELB) -> O
120120
execute_pythonfile("MyTerraform","terraform_generator")
121121
return Output(output='output')
122122

123-
@app.post("/IaC-template/aws/efs")
123+
@app.post("/api/IaC-template/aws/efs")
124124
async def IaC_template_generation_aws_efs(request:IaCTemplateGenerationEFS) -> Output:
125125
if os.environ.get("TEST"):
126126
return Output(output='output (nothing special)')

app/routes/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def add_files_to_folder(files:list,folder:str):
2626
shutil.copy(filename, destination_file)
2727

2828

29-
@app.get("/download-folder{folder_name}/{source}")
29+
@app.get("/api/download-folder{folder_name}/{source}")
3030
async def download_folder_MyHelm(folder_name: str,source:str):
3131
folder_path = f"app/media/{folder_name}" # Adjust the path as needed
3232
if not os.path.exists(folder_path):

0 commit comments

Comments
 (0)