You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.1 KiB
63 lines
1.1 KiB
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\CloudFormation;
|
|
|
|
class Stack
|
|
{
|
|
protected $stack_data;
|
|
|
|
public function __construct(array $data)
|
|
{
|
|
$this->stack_data = $data;
|
|
}
|
|
|
|
public function getId(): string
|
|
{
|
|
return $this->stack_data['StackId'];
|
|
}
|
|
|
|
public function getName(): string
|
|
{
|
|
return $this->stack_data['StackName'];
|
|
}
|
|
|
|
public function getStatus(): string
|
|
{
|
|
return $this->stack_data['StackStatus'];
|
|
}
|
|
|
|
public function getStatusReason(): ?string
|
|
{
|
|
return $this->stack_data['StackStatusReason'] ?? null;
|
|
}
|
|
|
|
public function getParameters(): array
|
|
{
|
|
if (!isset($this->stack_data['Parameters']))
|
|
{
|
|
return [];
|
|
}
|
|
$parameters = [];
|
|
foreach ($this->stack_data['Parameters'] as $parameter)
|
|
{
|
|
$parameters[$parameter['ParameterKey']] = $parameter['ParameterValue'];
|
|
}
|
|
return $parameters;
|
|
}
|
|
|
|
public function getOutputs(): array
|
|
{
|
|
if (!isset($this->stack_data['Outputs']))
|
|
{
|
|
return [];
|
|
}
|
|
$outputs = [];
|
|
foreach ($this->stack_data['Outputs'] as $output)
|
|
{
|
|
$outputs[$output['OutputKey']] = $output['OutputValue'];
|
|
}
|
|
return $outputs;
|
|
}
|
|
}
|
|
|