moto/moto/codepipeline/responses.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

67 lines
1.9 KiB
Python
Raw Normal View History

2019-12-15 16:06:08 +01:00
import json
from moto.core.responses import BaseResponse
from .models import CodePipelineBackend, codepipeline_backends
2019-12-15 16:06:08 +01:00
class CodePipelineResponse(BaseResponse):
def __init__(self) -> None:
2022-08-13 09:49:43 +00:00
super().__init__(service_name="codepipeline")
2019-12-15 16:06:08 +01:00
@property
def codepipeline_backend(self) -> CodePipelineBackend:
2022-08-13 09:49:43 +00:00
return codepipeline_backends[self.current_account][self.region]
2019-12-15 16:06:08 +01:00
def create_pipeline(self) -> str:
2019-12-15 16:06:08 +01:00
pipeline, tags = self.codepipeline_backend.create_pipeline(
self._get_param("pipeline"), self._get_param("tags")
2019-12-15 16:06:08 +01:00
)
return json.dumps({"pipeline": pipeline, "tags": tags})
2019-12-15 16:54:58 +01:00
def get_pipeline(self) -> str:
2019-12-15 16:54:58 +01:00
pipeline, metadata = self.codepipeline_backend.get_pipeline(
self._get_param("name")
)
return json.dumps({"pipeline": pipeline, "metadata": metadata})
2019-12-15 17:28:59 +01:00
def update_pipeline(self) -> str:
2019-12-15 17:28:59 +01:00
pipeline = self.codepipeline_backend.update_pipeline(
self._get_param("pipeline")
)
return json.dumps({"pipeline": pipeline})
2019-12-15 17:44:54 +01:00
def list_pipelines(self) -> str:
2019-12-15 17:44:54 +01:00
pipelines = self.codepipeline_backend.list_pipelines()
return json.dumps({"pipelines": pipelines})
2019-12-15 17:58:38 +01:00
def delete_pipeline(self) -> str:
2019-12-15 17:58:38 +01:00
self.codepipeline_backend.delete_pipeline(self._get_param("name"))
return ""
def list_tags_for_resource(self) -> str:
tags = self.codepipeline_backend.list_tags_for_resource(
self._get_param("resourceArn")
)
return json.dumps({"tags": tags})
2019-12-23 19:33:37 +01:00
def tag_resource(self) -> str:
2019-12-23 19:33:37 +01:00
self.codepipeline_backend.tag_resource(
self._get_param("resourceArn"), self._get_param("tags")
)
return ""
2019-12-23 19:50:16 +01:00
def untag_resource(self) -> str:
2019-12-23 19:50:16 +01:00
self.codepipeline_backend.untag_resource(
self._get_param("resourceArn"), self._get_param("tagKeys")
)
return ""