Add codepipeline.list_pipelines
This commit is contained in:
parent
b2c44ce50d
commit
9871eda3c9
@ -1263,7 +1263,7 @@
|
|||||||
- [ ] update_deployment_group
|
- [ ] update_deployment_group
|
||||||
|
|
||||||
## codepipeline
|
## codepipeline
|
||||||
8% implemented
|
11% implemented
|
||||||
- [ ] acknowledge_job
|
- [ ] acknowledge_job
|
||||||
- [ ] acknowledge_third_party_job
|
- [ ] acknowledge_third_party_job
|
||||||
- [ ] create_custom_action_type
|
- [ ] create_custom_action_type
|
||||||
@ -1282,7 +1282,7 @@
|
|||||||
- [ ] list_action_executions
|
- [ ] list_action_executions
|
||||||
- [ ] list_action_types
|
- [ ] list_action_types
|
||||||
- [ ] list_pipeline_executions
|
- [ ] list_pipeline_executions
|
||||||
- [ ] list_pipelines
|
- [X] list_pipelines
|
||||||
- [ ] list_tags_for_resource
|
- [ ] list_tags_for_resource
|
||||||
- [ ] list_webhooks
|
- [ ] list_webhooks
|
||||||
- [ ] poll_for_jobs
|
- [ ] poll_for_jobs
|
||||||
|
@ -127,6 +127,21 @@ class CodePipelineBackend(BaseBackend):
|
|||||||
|
|
||||||
return codepipeline.pipeline
|
return codepipeline.pipeline
|
||||||
|
|
||||||
|
def list_pipelines(self):
|
||||||
|
pipelines = []
|
||||||
|
|
||||||
|
for name, codepipeline in self.pipelines.items():
|
||||||
|
pipelines.append(
|
||||||
|
{
|
||||||
|
"name": name,
|
||||||
|
"version": codepipeline.pipeline["version"],
|
||||||
|
"created": codepipeline.metadata["created"],
|
||||||
|
"updated": codepipeline.metadata["updated"],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
return sorted(pipelines, key=lambda i: i["name"])
|
||||||
|
|
||||||
|
|
||||||
codepipeline_backends = {}
|
codepipeline_backends = {}
|
||||||
for region in Session().get_available_regions("codepipeline"):
|
for region in Session().get_available_regions("codepipeline"):
|
||||||
|
@ -29,3 +29,8 @@ class CodePipelineResponse(BaseResponse):
|
|||||||
)
|
)
|
||||||
|
|
||||||
return json.dumps({"pipeline": pipeline})
|
return json.dumps({"pipeline": pipeline})
|
||||||
|
|
||||||
|
def list_pipelines(self):
|
||||||
|
pipelines = self.codepipeline_backend.list_pipelines()
|
||||||
|
|
||||||
|
return json.dumps({"pipelines": pipelines})
|
||||||
|
@ -698,6 +698,121 @@ def test_update_pipeline_errors():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@freeze_time("2019-01-01 12:00:00")
|
||||||
|
@mock_codepipeline
|
||||||
|
def test_list_pipelines():
|
||||||
|
client = boto3.client("codepipeline", region_name="us-east-1")
|
||||||
|
client.create_pipeline(
|
||||||
|
pipeline={
|
||||||
|
"name": "test-pipeline-1",
|
||||||
|
"roleArn": get_role_arn(),
|
||||||
|
"artifactStore": {
|
||||||
|
"type": "S3",
|
||||||
|
"location": "codepipeline-us-east-1-123456789012",
|
||||||
|
},
|
||||||
|
"stages": [
|
||||||
|
{
|
||||||
|
"name": "Stage-1",
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"name": "Action-1",
|
||||||
|
"actionTypeId": {
|
||||||
|
"category": "Source",
|
||||||
|
"owner": "AWS",
|
||||||
|
"provider": "S3",
|
||||||
|
"version": "1",
|
||||||
|
},
|
||||||
|
"configuration": {
|
||||||
|
"S3Bucket": "test-bucket",
|
||||||
|
"S3ObjectKey": "test-object",
|
||||||
|
},
|
||||||
|
"outputArtifacts": [{"name": "artifact"},],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Stage-2",
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"name": "Action-1",
|
||||||
|
"actionTypeId": {
|
||||||
|
"category": "Approval",
|
||||||
|
"owner": "AWS",
|
||||||
|
"provider": "Manual",
|
||||||
|
"version": "1",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
)
|
||||||
|
client.create_pipeline(
|
||||||
|
pipeline={
|
||||||
|
"name": "test-pipeline-2",
|
||||||
|
"roleArn": get_role_arn(),
|
||||||
|
"artifactStore": {
|
||||||
|
"type": "S3",
|
||||||
|
"location": "codepipeline-us-east-1-123456789012",
|
||||||
|
},
|
||||||
|
"stages": [
|
||||||
|
{
|
||||||
|
"name": "Stage-1",
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"name": "Action-1",
|
||||||
|
"actionTypeId": {
|
||||||
|
"category": "Source",
|
||||||
|
"owner": "AWS",
|
||||||
|
"provider": "S3",
|
||||||
|
"version": "1",
|
||||||
|
},
|
||||||
|
"configuration": {
|
||||||
|
"S3Bucket": "test-bucket",
|
||||||
|
"S3ObjectKey": "test-object",
|
||||||
|
},
|
||||||
|
"outputArtifacts": [{"name": "artifact"},],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Stage-2",
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"name": "Action-1",
|
||||||
|
"actionTypeId": {
|
||||||
|
"category": "Approval",
|
||||||
|
"owner": "AWS",
|
||||||
|
"provider": "Manual",
|
||||||
|
"version": "1",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.list_pipelines()
|
||||||
|
|
||||||
|
response["pipelines"].should.equal(
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "test-pipeline-1",
|
||||||
|
"version": 1,
|
||||||
|
"created": datetime.now(timezone.utc),
|
||||||
|
"updated": datetime.now(timezone.utc),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "test-pipeline-2",
|
||||||
|
"version": 1,
|
||||||
|
"created": datetime.now(timezone.utc),
|
||||||
|
"updated": datetime.now(timezone.utc),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@mock_iam
|
@mock_iam
|
||||||
def get_role_arn():
|
def get_role_arn():
|
||||||
iam = boto3.client("iam", region_name="us-east-1")
|
iam = boto3.client("iam", region_name="us-east-1")
|
||||||
|
Loading…
Reference in New Issue
Block a user