Skip to content
This repository has been archived by the owner on Nov 29, 2022. It is now read-only.

Commit

Permalink
## [0.17.1] - 2020-02-12
Browse files Browse the repository at this point in the history
### Fixed
- Fix Function Params to be more flexible in `SsmService`
  • Loading branch information
문정기 committed Feb 12, 2020
1 parent abb9d89 commit aed431a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [0.17.1] - 2020-02-12
### Fixed
- Fix Function Params to be more flexible in `SsmService`

## [0.17.0] - 2020-02-12
## Added
- Add `SsmService` in AWS
Expand Down
16 changes: 9 additions & 7 deletions lib/AWS/SsmService.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class SsmService extends AbstractAwsService
public const TYPE_STRING_LIST = 'StringList';
public const TYPE_SECURE_STRING = 'SecureString';


protected function getAwsClass(): string
{
return SsmClient::class;
Expand Down Expand Up @@ -70,14 +69,14 @@ public function getParameterAsMap(string $name): array
}
}

public function setParameter(string $name, array $params, string $type = self::TYPE_STRING): void
public function setParameter(string $name, array $params, bool $is_overwrite = true, array $options = []): void
{
$value = implode(PHP_EOL, $params);

$this->putParameter($name, $value, $type);
$this->putParameter($name, $value, $is_overwrite, $options);
}

public function setParameterFromMap(string $name, array $params, string $type = self::TYPE_STRING): void
public function setParameterFromMap(string $name, array $params, bool $is_overwrite = true, array $options = []): void
{
$value_string = '';
foreach ($params as $key => $value) {
Expand All @@ -87,17 +86,20 @@ public function setParameterFromMap(string $name, array $params, string $type =
$value_string .= $key . '=' . $value . PHP_EOL;
}

$this->putParameter($name, $value_string, $type);
$this->putParameter($name, $value_string, $is_overwrite, $options);
}

private function putParameter(string $name, string $value, string $type): void
private function putParameter(string $name, string $value, bool $is_overwrite, array $options): void
{
$params = [
'Type' => $type,
'Type' => self::TYPE_STRING,
'Name' => $name,
'Value' => $value,
'Overwrite' => $is_overwrite,
];

$params = array_merge($params, $options);

try {
$result = $this->client->putParameter($params);
} catch (AwsException $e) {
Expand Down

0 comments on commit aed431a

Please sign in to comment.