WIP implement tf backend git provider
This commit is contained in:
parent
f4da27f63f
commit
4539b84d6c
1 changed files with 44 additions and 0 deletions
44
src/main/python/ddadevops/domain/provider_tfGitBackend.py
Normal file
44
src/main/python/ddadevops/domain/provider_tfGitBackend.py
Normal file
|
@ -0,0 +1,44 @@
|
|||
from typing import List, Dict, Set, Any
|
||||
from .common import Validateable, CredentialMappingDefault
|
||||
|
||||
class TerraformGitBackend(Validateable, CredentialMappingDefault):
|
||||
def __init__(
|
||||
self,
|
||||
inp: dict,
|
||||
):
|
||||
self.stage = inp.get("stage")
|
||||
self.module = inp.get("module")
|
||||
self.git_backend_repo = inp.get("git_backend_repo")
|
||||
self.git_backend_ref = inp.get("git_backend_ref")
|
||||
self.git_backend_state = inp.get("git_backend_state")
|
||||
self.git_backend_username = inp.get("git_backend_username")
|
||||
self.git_backend_token = inp.get("git_backend_token")
|
||||
|
||||
def validate(self) -> List[str]:
|
||||
result = []
|
||||
result += self.__validate_is_not_empty__("stage")
|
||||
result += self.__validate_is_not_empty__("module")
|
||||
result += self.__validate_is_not_empty__("git_backend_repo")
|
||||
result += self.__validate_is_not_empty__("git_backend_ref")
|
||||
result += self.__validate_is_not_empty__("git_backend_state")
|
||||
result += self.__validate_is_not_empty__("git_backend_username")
|
||||
result += self.__validate_is_not_empty__("git_backend_token")
|
||||
|
||||
return result
|
||||
|
||||
def backend_config(self) -> Dict[str, Any]:
|
||||
return {
|
||||
"git_backend_repo": self.git_backend_repo,
|
||||
"git_backend_ref": self.git_backend_ref,
|
||||
"git_backend_state": self.git_backend_state,
|
||||
"git_backend_username": self.git_backend_username,
|
||||
"git_backend_token": self.git_backend_token,
|
||||
}
|
||||
|
||||
def project_vars(self):
|
||||
return {
|
||||
"git_backend_token": self.git_backend_token,
|
||||
"git_backend_username": self.git_backend_username,
|
||||
}
|
||||
|
||||
|
Loading…
Reference in a new issue