| 1 |
<?php |
| 2 |
|
| 3 |
namespace Dudlewebs\WPMCS\s3\Aws\Api; |
| 4 |
|
| 5 |
/** |
| 6 |
* Represents an API operation. |
| 7 |
*/ |
| 8 |
class Operation extends AbstractModel |
| 9 |
{ |
| 10 |
private $input; |
| 11 |
private $output; |
| 12 |
private $errors; |
| 13 |
public function __construct(array $definition, ShapeMap $shapeMap) |
| 14 |
{ |
| 15 |
$definition['type'] = 'structure'; |
| 16 |
if (!isset($definition['http']['method'])) { |
| 17 |
$definition['http']['method'] = 'POST'; |
| 18 |
} |
| 19 |
if (!isset($definition['http']['requestUri'])) { |
| 20 |
$definition['http']['requestUri'] = '/'; |
| 21 |
} |
| 22 |
parent::__construct($definition, $shapeMap); |
| 23 |
} |
| 24 |
/** |
| 25 |
* Returns an associative array of the HTTP attribute of the operation: |
| 26 |
* |
| 27 |
* - method: HTTP method of the operation |
| 28 |
* - requestUri: URI of the request (can include URI template placeholders) |
| 29 |
* |
| 30 |
* @return array |
| 31 |
*/ |
| 32 |
public function getHttp() |
| 33 |
{ |
| 34 |
return $this->definition['http']; |
| 35 |
} |
| 36 |
/** |
| 37 |
* Get the input shape of the operation. |
| 38 |
* |
| 39 |
* @return StructureShape |
| 40 |
*/ |
| 41 |
public function getInput() |
| 42 |
{ |
| 43 |
if (!$this->input) { |
| 44 |
if ($input = $this['input']) { |
| 45 |
$this->input = $this->shapeFor($input); |
| 46 |
} else { |
| 47 |
$this->input = new StructureShape([], $this->shapeMap); |
| 48 |
} |
| 49 |
} |
| 50 |
return $this->input; |
| 51 |
} |
| 52 |
/** |
| 53 |
* Get the output shape of the operation. |
| 54 |
* |
| 55 |
* @return StructureShape |
| 56 |
*/ |
| 57 |
public function getOutput() |
| 58 |
{ |
| 59 |
if (!$this->output) { |
| 60 |
if ($output = $this['output']) { |
| 61 |
$this->output = $this->shapeFor($output); |
| 62 |
} else { |
| 63 |
$this->output = new StructureShape([], $this->shapeMap); |
| 64 |
} |
| 65 |
} |
| 66 |
return $this->output; |
| 67 |
} |
| 68 |
/** |
| 69 |
* Get an array of operation error shapes. |
| 70 |
* |
| 71 |
* @return Shape[] |
| 72 |
*/ |
| 73 |
public function getErrors() |
| 74 |
{ |
| 75 |
if ($this->errors === null) { |
| 76 |
if ($errors = $this['errors']) { |
| 77 |
foreach ($errors as $key => $error) { |
| 78 |
$errors[$key] = $this->shapeFor($error); |
| 79 |
} |
| 80 |
$this->errors = $errors; |
| 81 |
} else { |
| 82 |
$this->errors = []; |
| 83 |
} |
| 84 |
} |
| 85 |
return $this->errors; |
| 86 |
} |
| 87 |
} |
| 88 |
|