Skip to content

Commit 19e03b0

Browse files
authored
Generate CodeDeploy client (#516)
* Generate CodeDeploy client * Added docs and some tests * Added tests * cs
0 parents  commit 19e03b0

21 files changed

+550
-0
lines changed

.gitattributes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/.github export-ignore
2+
/tests export-ignore
3+
/.gitignore export-ignore
4+
/Makefile export-ignore
5+
/phpunit.xml.dist export-ignore

.github/FUNDING.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# These are supported funding model platforms
2+
3+
github: [nyholm, jderusse]

.github/workflows/.editorconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[*.yml]
2+
indent_size = 2

.github/workflows/checks.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: BC Check
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
roave-bc-check:
10+
name: Roave BC Check
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v2
16+
17+
- name: Roave BC Check
18+
uses: docker://nyholm/roave-bc-check-ga

.github/workflows/ci.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
10+
build:
11+
name: Build
12+
runs-on: ubuntu-latest
13+
strategy:
14+
max-parallel: 10
15+
matrix:
16+
php: ['7.2', '7.3', '7.4']
17+
18+
steps:
19+
- name: Set up PHP
20+
uses: shivammathur/setup-php@2.1.2
21+
with:
22+
php-version: ${{ matrix.php }}
23+
coverage: xdebug
24+
ini-values: xdebug.overload_var_dump=1
25+
tools: prestissimo
26+
27+
- name: Checkout code
28+
uses: actions/checkout@v2
29+
30+
- name: Initialize tests
31+
run: make initialize
32+
33+
- name: Download dependencies
34+
run: |
35+
composer config minimum-stability dev
36+
composer req symfony/phpunit-bridge --no-update
37+
composer update --no-interaction --prefer-dist --optimize-autoloader --prefer-stable
38+
39+
- name: Run tests
40+
run: ./vendor/bin/simple-phpunit

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/vendor/
2+
.php_cs.cache
3+
.phpunit.result.cache
4+
composer.lock

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Change Log
2+
3+
## 0.1.0
4+
5+
First version

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2020 Jérémy Derussé, Tobias Nyholm
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.EXPORT_ALL_VARIABLES:
2+
3+
initialize: start-docker
4+
start-docker:
5+
echo "Noop"
6+
7+
test: initialize
8+
./vendor/bin/simple-phpunit
9+
10+
clean: stop-docker
11+
stop-docker:
12+
echo "Noop"

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# AsyncAws CodeDeploy Client
2+
3+
![](https://github.com/async-aws/code-deploy/workflows/Tests/badge.svg?branch=master)
4+
![](https://github.com/async-aws/code-deploy/workflows/BC%20Check/badge.svg?branch=master)
5+
6+
An API client for CodeDeploy.
7+
8+
## Install
9+
10+
```cli
11+
composer require async-aws/code-deploy
12+
```
13+
14+
## Documentation
15+
16+
See https://async-aws.com/clients/code-deploy.html for documentation.
17+
18+
## Contribute
19+
20+
Contributions are welcome and appreciated. Please read https://async-aws.com/contribute/

composer.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "async-aws/code-deploy",
3+
"type": "library",
4+
"description": "AsyncAws CodeDeploy client.",
5+
"keywords": [
6+
"aws",
7+
"code-deploy"
8+
],
9+
"license": "MIT",
10+
"require": {
11+
"php": "^7.2.5",
12+
"ext-json": "*",
13+
"async-aws/core": "^0.5"
14+
},
15+
"extra": {
16+
"branch-alias": {
17+
"dev-master": "0.1-dev"
18+
}
19+
},
20+
"autoload": {
21+
"psr-4": {
22+
"AsyncAws\\CodeDeploy\\": "src"
23+
}
24+
},
25+
"autoload-dev": {
26+
"psr-4": {
27+
"AsyncAws\\CodeDeploy\\Tests\\": "tests/"
28+
}
29+
}
30+
}

phpunit.xml.dist

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.2/phpunit.xsd"
5+
backupGlobals="false"
6+
colors="true"
7+
bootstrap="vendor/autoload.php"
8+
failOnRisky="true"
9+
failOnWarning="true"
10+
>
11+
<php>
12+
<ini name="error_reporting" value="-1" />
13+
</php>
14+
15+
<testsuites>
16+
<testsuite name="Test Suite">
17+
<directory>./tests/</directory>
18+
</testsuite>
19+
</testsuites>
20+
21+
<filter>
22+
<whitelist>
23+
<directory>./src</directory>
24+
</whitelist>
25+
</filter>
26+
</phpunit>

src/CodeDeployClient.php

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
namespace AsyncAws\CodeDeploy;
4+
5+
use AsyncAws\CodeDeploy\Input\PutLifecycleEventHookExecutionStatusInput;
6+
use AsyncAws\CodeDeploy\Result\PutLifecycleEventHookExecutionStatusOutput;
7+
use AsyncAws\Core\AbstractApi;
8+
use AsyncAws\Core\RequestContext;
9+
10+
class CodeDeployClient extends AbstractApi
11+
{
12+
/**
13+
* Sets the result of a Lambda validation function. The function validates one or both lifecycle events
14+
* (`BeforeAllowTraffic` and `AfterAllowTraffic`) and returns `Succeeded` or `Failed`.
15+
*
16+
* @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-codedeploy-2014-10-06.html#putlifecycleeventhookexecutionstatus
17+
*
18+
* @param array{
19+
* deploymentId?: string,
20+
* lifecycleEventHookExecutionId?: string,
21+
* status?: \AsyncAws\CodeDeploy\Enum\LifecycleEventStatus::*,
22+
* @region?: string,
23+
* }|PutLifecycleEventHookExecutionStatusInput $input
24+
*/
25+
public function putLifecycleEventHookExecutionStatus($input = []): PutLifecycleEventHookExecutionStatusOutput
26+
{
27+
$input = PutLifecycleEventHookExecutionStatusInput::create($input);
28+
$response = $this->getResponse($input->request(), new RequestContext(['operation' => 'PutLifecycleEventHookExecutionStatus', 'region' => $input->getRegion()]));
29+
30+
return new PutLifecycleEventHookExecutionStatusOutput($response);
31+
}
32+
33+
protected function getServiceCode(): string
34+
{
35+
return 'codedeploy';
36+
}
37+
38+
protected function getSignatureScopeName(): string
39+
{
40+
return 'codedeploy';
41+
}
42+
43+
protected function getSignatureVersion(): string
44+
{
45+
return 'v4';
46+
}
47+
}

src/Enum/LifecycleEventStatus.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace AsyncAws\CodeDeploy\Enum;
4+
5+
final class LifecycleEventStatus
6+
{
7+
public const FAILED = 'Failed';
8+
public const IN_PROGRESS = 'InProgress';
9+
public const PENDING = 'Pending';
10+
public const SKIPPED = 'Skipped';
11+
public const SUCCEEDED = 'Succeeded';
12+
public const UNKNOWN = 'Unknown';
13+
14+
public static function exists(string $value): bool
15+
{
16+
return isset([
17+
self::FAILED => true,
18+
self::IN_PROGRESS => true,
19+
self::PENDING => true,
20+
self::SKIPPED => true,
21+
self::SUCCEEDED => true,
22+
self::UNKNOWN => true,
23+
][$value]);
24+
}
25+
}

0 commit comments

Comments
 (0)