Skip to content

Commit

Permalink
Update generated code (#1801)
Browse files Browse the repository at this point in the history
update generated code
  • Loading branch information
async-aws-bot authored Nov 16, 2024
1 parent 44cc953 commit ed96857
Show file tree
Hide file tree
Showing 6 changed files with 207 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## NOT RELEASED

### Added

- AWS api-change: This release allows AWS IoT Core users to enrich MQTT messages with propagating attributes, to associate a thing to a connection, and to enable Online Certificate Status Protocol (OCSP) stapling for TLS X.509 server certificates through private endpoints.

### Changed

- use strict comparison `null !==` instead of `!`
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
"dev-master": "2.1-dev"
}
}
}
32 changes: 32 additions & 0 deletions src/Result/ListThingTypesResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
use AsyncAws\Core\Result;
use AsyncAws\Iot\Input\ListThingTypesRequest;
use AsyncAws\Iot\IotClient;
use AsyncAws\Iot\ValueObject\Mqtt5Configuration;
use AsyncAws\Iot\ValueObject\PropagatingAttribute;
use AsyncAws\Iot\ValueObject\ThingTypeDefinition;
use AsyncAws\Iot\ValueObject\ThingTypeMetadata;
use AsyncAws\Iot\ValueObject\ThingTypeProperties;
Expand Down Expand Up @@ -101,6 +103,35 @@ protected function populateResult(Response $response): void
$this->nextToken = isset($data['nextToken']) ? (string) $data['nextToken'] : null;
}

private function populateResultMqtt5Configuration(array $json): Mqtt5Configuration
{
return new Mqtt5Configuration([
'propagatingAttributes' => !isset($json['propagatingAttributes']) ? null : $this->populateResultPropagatingAttributeList($json['propagatingAttributes']),
]);
}

private function populateResultPropagatingAttribute(array $json): PropagatingAttribute
{
return new PropagatingAttribute([
'userPropertyKey' => isset($json['userPropertyKey']) ? (string) $json['userPropertyKey'] : null,
'thingAttribute' => isset($json['thingAttribute']) ? (string) $json['thingAttribute'] : null,
'connectionAttribute' => isset($json['connectionAttribute']) ? (string) $json['connectionAttribute'] : null,
]);
}

/**
* @return PropagatingAttribute[]
*/
private function populateResultPropagatingAttributeList(array $json): array
{
$items = [];
foreach ($json as $item) {
$items[] = $this->populateResultPropagatingAttribute($item);
}

return $items;
}

/**
* @return string[]
*/
Expand Down Expand Up @@ -154,6 +185,7 @@ private function populateResultThingTypeProperties(array $json): ThingTypeProper
return new ThingTypeProperties([
'thingTypeDescription' => isset($json['thingTypeDescription']) ? (string) $json['thingTypeDescription'] : null,
'searchableAttributes' => !isset($json['searchableAttributes']) ? null : $this->populateResultSearchableAttributes($json['searchableAttributes']),
'mqtt5Configuration' => empty($json['mqtt5Configuration']) ? null : $this->populateResultMqtt5Configuration($json['mqtt5Configuration']),
]);
}
}
62 changes: 62 additions & 0 deletions src/ValueObject/Mqtt5Configuration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php

namespace AsyncAws\Iot\ValueObject;

/**
* The configuration to add user-defined properties to enrich MQTT 5 messages.
*/
final class Mqtt5Configuration
{
/**
* An object that represents the propagating thing attributes and the connection attributes.
*
* @var PropagatingAttribute[]|null
*/
private $propagatingAttributes;

/**
* @param array{
* propagatingAttributes?: null|array<PropagatingAttribute|array>,
* } $input
*/
public function __construct(array $input)
{
$this->propagatingAttributes = isset($input['propagatingAttributes']) ? array_map([PropagatingAttribute::class, 'create'], $input['propagatingAttributes']) : null;
}

/**
* @param array{
* propagatingAttributes?: null|array<PropagatingAttribute|array>,
* }|Mqtt5Configuration $input
*/
public static function create($input): self
{
return $input instanceof self ? $input : new self($input);
}

/**
* @return PropagatingAttribute[]
*/
public function getPropagatingAttributes(): array
{
return $this->propagatingAttributes ?? [];
}

/**
* @internal
*/
public function requestBody(): array
{
$payload = [];
if (null !== $v = $this->propagatingAttributes) {
$index = -1;
$payload['propagatingAttributes'] = [];
foreach ($v as $listValue) {
++$index;
$payload['propagatingAttributes'][$index] = $listValue->requestBody();
}
}

return $payload;
}
}
90 changes: 90 additions & 0 deletions src/ValueObject/PropagatingAttribute.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?php

namespace AsyncAws\Iot\ValueObject;

/**
* An object that represents the connection attribute, thing attribute, and the user property key.
*/
final class PropagatingAttribute
{
/**
* The key of the user property key-value pair.
*
* @var string|null
*/
private $userPropertyKey;

/**
* The user-defined thing attribute that is propagating for MQTT 5 message enrichment.
*
* @var string|null
*/
private $thingAttribute;

/**
* The attribute associated with the connection between a device and Amazon Web Services IoT Core.
*
* @var string|null
*/
private $connectionAttribute;

/**
* @param array{
* userPropertyKey?: null|string,
* thingAttribute?: null|string,
* connectionAttribute?: null|string,
* } $input
*/
public function __construct(array $input)
{
$this->userPropertyKey = $input['userPropertyKey'] ?? null;
$this->thingAttribute = $input['thingAttribute'] ?? null;
$this->connectionAttribute = $input['connectionAttribute'] ?? null;
}

/**
* @param array{
* userPropertyKey?: null|string,
* thingAttribute?: null|string,
* connectionAttribute?: null|string,
* }|PropagatingAttribute $input
*/
public static function create($input): self
{
return $input instanceof self ? $input : new self($input);
}

public function getConnectionAttribute(): ?string
{
return $this->connectionAttribute;
}

public function getThingAttribute(): ?string
{
return $this->thingAttribute;
}

public function getUserPropertyKey(): ?string
{
return $this->userPropertyKey;
}

/**
* @internal
*/
public function requestBody(): array
{
$payload = [];
if (null !== $v = $this->userPropertyKey) {
$payload['userPropertyKey'] = $v;
}
if (null !== $v = $this->thingAttribute) {
$payload['thingAttribute'] = $v;
}
if (null !== $v = $this->connectionAttribute) {
$payload['connectionAttribute'] = $v;
}

return $payload;
}
}
18 changes: 18 additions & 0 deletions src/ValueObject/ThingTypeProperties.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,44 @@ final class ThingTypeProperties
*/
private $searchableAttributes;

/**
* The configuration to add user-defined properties to enrich MQTT 5 messages.
*
* @var Mqtt5Configuration|null
*/
private $mqtt5Configuration;

/**
* @param array{
* thingTypeDescription?: null|string,
* searchableAttributes?: null|string[],
* mqtt5Configuration?: null|Mqtt5Configuration|array,
* } $input
*/
public function __construct(array $input)
{
$this->thingTypeDescription = $input['thingTypeDescription'] ?? null;
$this->searchableAttributes = $input['searchableAttributes'] ?? null;
$this->mqtt5Configuration = isset($input['mqtt5Configuration']) ? Mqtt5Configuration::create($input['mqtt5Configuration']) : null;
}

/**
* @param array{
* thingTypeDescription?: null|string,
* searchableAttributes?: null|string[],
* mqtt5Configuration?: null|Mqtt5Configuration|array,
* }|ThingTypeProperties $input
*/
public static function create($input): self
{
return $input instanceof self ? $input : new self($input);
}

public function getMqtt5Configuration(): ?Mqtt5Configuration
{
return $this->mqtt5Configuration;
}

/**
* @return string[]
*/
Expand Down Expand Up @@ -75,6 +90,9 @@ public function requestBody(): array
$payload['searchableAttributes'][$index] = $listValue;
}
}
if (null !== $v = $this->mqtt5Configuration) {
$payload['mqtt5Configuration'] = $v->requestBody();
}

return $payload;
}
Expand Down

0 comments on commit ed96857

Please sign in to comment.