list/http_post: adds http post distribution lists
This commit is contained in:
parent
218779bd20
commit
21f7cbddcb
3 changed files with 38 additions and 0 deletions
|
@ -27,6 +27,7 @@ from app.terraform.bridge.hcloud import BridgeHcloudAutomation
|
||||||
from app.terraform.bridge.ovh import BridgeOvhAutomation
|
from app.terraform.bridge.ovh import BridgeOvhAutomation
|
||||||
from app.terraform.list.github import ListGithubAutomation
|
from app.terraform.list.github import ListGithubAutomation
|
||||||
from app.terraform.list.gitlab import ListGitlabAutomation
|
from app.terraform.list.gitlab import ListGitlabAutomation
|
||||||
|
from app.terraform.list.http_post import ListHttpPostAutomation
|
||||||
from app.terraform.list.s3 import ListS3Automation
|
from app.terraform.list.s3 import ListS3Automation
|
||||||
from app.terraform.proxy.meta import ProxyMetaAutomation
|
from app.terraform.proxy.meta import ProxyMetaAutomation
|
||||||
from app.terraform.proxy.azure_cdn import ProxyAzureCdnAutomation
|
from app.terraform.proxy.azure_cdn import ProxyAzureCdnAutomation
|
||||||
|
@ -54,6 +55,7 @@ jobs = {
|
||||||
EotkAWSAutomation,
|
EotkAWSAutomation,
|
||||||
ListGithubAutomation,
|
ListGithubAutomation,
|
||||||
ListGitlabAutomation,
|
ListGitlabAutomation,
|
||||||
|
ListHttpPostAutomation,
|
||||||
ListS3Automation,
|
ListS3Automation,
|
||||||
ProxyAzureCdnAutomation,
|
ProxyAzureCdnAutomation,
|
||||||
ProxyCloudfrontAutomation,
|
ProxyCloudfrontAutomation,
|
||||||
|
|
|
@ -57,6 +57,7 @@ class MirrorList(AbstractConfiguration):
|
||||||
providers_supported = {
|
providers_supported = {
|
||||||
"github": "GitHub",
|
"github": "GitHub",
|
||||||
"gitlab": "GitLab",
|
"gitlab": "GitLab",
|
||||||
|
"http_post": "HTTP POST",
|
||||||
"s3": "AWS S3",
|
"s3": "AWS S3",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,6 +86,8 @@ class MirrorList(AbstractConfiguration):
|
||||||
return f"https://raw.githubusercontent.com/{self.container}/{self.branch}/{self.filename}"
|
return f"https://raw.githubusercontent.com/{self.container}/{self.branch}/{self.filename}"
|
||||||
if self.provider == "s3":
|
if self.provider == "s3":
|
||||||
return f"s3://{self.container}/{self.filename}"
|
return f"s3://{self.container}/{self.filename}"
|
||||||
|
if self.provider == "http_post":
|
||||||
|
return self.container
|
||||||
return "Unknown provider"
|
return "Unknown provider"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
33
app/terraform/list/http_post.py
Normal file
33
app/terraform/list/http_post.py
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
from app.terraform.list import ListAutomation
|
||||||
|
|
||||||
|
|
||||||
|
class ListHttpPostAutomation(ListAutomation):
|
||||||
|
short_name = "list_http_post"
|
||||||
|
description = "Update mirror lists by HTTP POST"
|
||||||
|
provider = "http_post"
|
||||||
|
|
||||||
|
template_parameters = []
|
||||||
|
|
||||||
|
template = """
|
||||||
|
terraform {
|
||||||
|
{{ backend_config }}
|
||||||
|
required_providers {
|
||||||
|
http = {
|
||||||
|
version = "~> 3.2.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{% for list in lists %}
|
||||||
|
|
||||||
|
data "http" "post_{{ list.id }}" {
|
||||||
|
url = "{{ list.container }}"
|
||||||
|
method = "POST"
|
||||||
|
request_body = file("{{ list.format }}.{{ list.pool.pool_name }}.{{ list.encoding }}")
|
||||||
|
|
||||||
|
request_headers = {
|
||||||
|
Update-Key = "{{ list.filename }}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{% endfor %}
|
||||||
|
"""
|
Loading…
Add table
Add a link
Reference in a new issue