majuna/app/terraform/list/http_post.py

37 lines
845 B
Python
Raw Permalink Normal View History

2022-11-09 15:15:50 +00:00
from typing import List
from app.terraform.list import ListAutomation
class ListHttpPostAutomation(ListAutomation):
short_name = "list_http_post"
description = "Update mirror lists by HTTP POST"
provider = "http_post"
2022-11-09 15:15:50 +00:00
template_parameters: List[str] = []
template = """
terraform {
{{ backend_config }}
required_providers {
http = {
version = "~> 3.2.0"
}
}
}
{% for list in lists %}
2022-11-09 15:15:50 +00:00
data "http" "post_{{ list.id }}" {
url = "{{ list.container }}"
method = "POST"
request_body = file("{{ list.format }}.{{ list.pool.pool_name }}.{{ list.encoding }}")
request_headers = {
Authorization = "Bearer {{ list.filename }}"
Content-Type = "application/json"
}
}
{% endfor %}
"""