Skip to content

Commit

Permalink
feat(client-iot): GA release the ability to enable/disable IoT Fleet …
Browse files Browse the repository at this point in the history
…Indexing for Device Defender and Named Shadow information, and search them through IoT Fleet Indexing APIs. This includes Named Shadow Selection as a part of the UpdateIndexingConfiguration API.
  • Loading branch information
awstools committed Jul 20, 2022
1 parent 559d71c commit 358a73e
Show file tree
Hide file tree
Showing 7 changed files with 139 additions and 25 deletions.
3 changes: 2 additions & 1 deletion clients/client-iot/src/IoT.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1331,7 +1331,8 @@ export class IoT extends IoTClient {
* <p>Attaches the specified policy to the specified principal (certificate or other
* credential).</p>
* <p>
* <b>Note:</b> This action is deprecated. Please use <a>AttachPolicy</a> instead.</p>
* <b>Note:</b> This action is deprecated and works as
* expected for backward compatibility, but we won't add enhancements. Use <a>AttachPolicy</a> instead.</p>
* <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">AttachPrincipalPolicy</a> action.</p>
*/
public attachPrincipalPolicy(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export interface AttachPrincipalPolicyCommandOutput extends __MetadataBearer {}
* <p>Attaches the specified policy to the specified principal (certificate or other
* credential).</p>
* <p>
* <b>Note:</b> This action is deprecated. Please use <a>AttachPolicy</a> instead.</p>
* <b>Note:</b> This action is deprecated and works as
* expected for backward compatibility, but we won't add enhancements. Use <a>AttachPolicy</a> instead.</p>
* <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">AttachPrincipalPolicy</a> action.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import {
} from "@aws-sdk/types";

import { IoTClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../IoTClient";
import { ListThingGroupsForThingRequest, ListThingGroupsForThingResponse } from "../models/models_1";
import { ListThingGroupsForThingRequest } from "../models/models_1";
import { ListThingGroupsForThingResponse } from "../models/models_2";
import {
deserializeAws_restJson1ListThingGroupsForThingCommand,
serializeAws_restJson1ListThingGroupsForThingCommand,
Expand Down
52 changes: 31 additions & 21 deletions clients/client-iot/src/models/models_1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4181,6 +4181,30 @@ export enum DeviceDefenderIndexingMode {
VIOLATIONS = "VIOLATIONS",
}

/**
* <p>Provides additional filters for specific data sources. Named shadow is the only data source that currently supports and requires a filter.
* To add named shadows to your fleet indexing configuration, set <code>namedShadowIndexingMode</code> to be <code>ON</code> and
* specify your shadow names in <code>filter</code>.</p>
*/
export interface IndexingFilter {
/**
* <p>The shadow names that you select to index. The default maximum number of shadow names for indexing is 10. To increase
* the limit, see <a href="https://docs.aws.amazon.com/general/latest/gr/iot_device_management.html#fleet-indexing-limits">Amazon Web Services IoT Device Management
* Quotas</a> in the <i>Amazon Web Services General Reference</i>.
* </p>
*/
namedShadowNames?: string[];
}

export namespace IndexingFilter {
/**
* @internal
*/
export const filterSensitiveLog = (obj: IndexingFilter): any => ({
...obj,
});
}

export enum NamedShadowIndexingMode {
OFF = "OFF",
ON = "ON",
Expand Down Expand Up @@ -4277,6 +4301,13 @@ export interface ThingIndexingConfiguration {
* <p>Contains custom field names and their data type.</p>
*/
customFields?: Field[];

/**
* <p>Provides additional filters for specific data sources. Named shadow is the only data source that currently supports and requires a filter.
* To add named shadows to your fleet indexing configuration, set <code>namedShadowIndexingMode</code> to be <code>ON</code> and
* specify your shadow names in <code>filter</code>.</p>
*/
filter?: IndexingFilter;
}

export namespace ThingIndexingConfiguration {
Expand Down Expand Up @@ -8395,24 +8426,3 @@ export namespace ListThingGroupsForThingRequest {
...obj,
});
}

export interface ListThingGroupsForThingResponse {
/**
* <p>The thing groups.</p>
*/
thingGroups?: GroupNameAndArn[];

/**
* <p>The token to use to get the next set of results, or <b>null</b> if there are no additional results.</p>
*/
nextToken?: string;
}

export namespace ListThingGroupsForThingResponse {
/**
* @internal
*/
export const filterSensitiveLog = (obj: ListThingGroupsForThingResponse): any => ({
...obj,
});
}
22 changes: 22 additions & 0 deletions clients/client-iot/src/models/models_2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import {
Configuration,
DetectMitigationActionsTaskTarget,
DomainConfigurationStatus,
GroupNameAndArn,
LogTargetType,
RegistrationConfig,
Status,
Expand All @@ -58,6 +59,27 @@ import {
ViolationEventOccurrenceRange,
} from "./models_1";

export interface ListThingGroupsForThingResponse {
/**
* <p>The thing groups.</p>
*/
thingGroups?: GroupNameAndArn[];

/**
* <p>The token to use to get the next set of results, or <b>null</b> if there are no additional results.</p>
*/
nextToken?: string;
}

export namespace ListThingGroupsForThingResponse {
/**
* @internal
*/
export const filterSensitiveLog = (obj: ListThingGroupsForThingResponse): any => ({
...obj,
});
}

/**
* <p>The input for the ListThingPrincipal operation.</p>
*/
Expand Down
43 changes: 43 additions & 0 deletions clients/client-iot/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,7 @@ import {
Field,
FleetMetricNameAndArn,
GroupNameAndArn,
IndexingFilter,
InternalServerException,
Job,
JobExecution,
Expand Down Expand Up @@ -24326,6 +24327,14 @@ const serializeAws_restJson1HttpUrlDestinationConfiguration = (
};
};

const serializeAws_restJson1IndexingFilter = (input: IndexingFilter, context: __SerdeContext): any => {
return {
...(input.namedShadowNames != null && {
namedShadowNames: serializeAws_restJson1NamedShadowNamesFilter(input.namedShadowNames, context),
}),
};
};

const serializeAws_restJson1IotAnalyticsAction = (input: IotAnalyticsAction, context: __SerdeContext): any => {
return {
...(input.batchMode != null && { batchMode: input.batchMode }),
Expand Down Expand Up @@ -24523,6 +24532,17 @@ const serializeAws_restJson1MqttContext = (input: MqttContext, context: __SerdeC
};
};

const serializeAws_restJson1NamedShadowNamesFilter = (input: string[], context: __SerdeContext): any => {
return input
.filter((e: any) => e != null)
.map((entry) => {
if (entry === null) {
return null as any;
}
return entry;
});
};

const serializeAws_restJson1NumberList = (input: number[], context: __SerdeContext): any => {
return input
.filter((e: any) => e != null)
Expand Down Expand Up @@ -25095,6 +25115,7 @@ const serializeAws_restJson1ThingIndexingConfiguration = (
return {
...(input.customFields != null && { customFields: serializeAws_restJson1Fields(input.customFields, context) }),
...(input.deviceDefenderIndexingMode != null && { deviceDefenderIndexingMode: input.deviceDefenderIndexingMode }),
...(input.filter != null && { filter: serializeAws_restJson1IndexingFilter(input.filter, context) }),
...(input.managedFields != null && { managedFields: serializeAws_restJson1Fields(input.managedFields, context) }),
...(input.namedShadowIndexingMode != null && { namedShadowIndexingMode: input.namedShadowIndexingMode }),
...(input.thingConnectivityIndexingMode != null && {
Expand Down Expand Up @@ -26777,6 +26798,15 @@ const deserializeAws_restJson1ImplicitDeny = (output: any, context: __SerdeConte
} as any;
};

const deserializeAws_restJson1IndexingFilter = (output: any, context: __SerdeContext): IndexingFilter => {
return {
namedShadowNames:
output.namedShadowNames != null
? deserializeAws_restJson1NamedShadowNamesFilter(output.namedShadowNames, context)
: undefined,
} as any;
};

const deserializeAws_restJson1IndexNamesList = (output: any, context: __SerdeContext): string[] => {
const retVal = (output || [])
.filter((e: any) => e != null)
Expand Down Expand Up @@ -27353,6 +27383,18 @@ const deserializeAws_restJson1MitigationActionParams = (
} as any;
};

const deserializeAws_restJson1NamedShadowNamesFilter = (output: any, context: __SerdeContext): string[] => {
const retVal = (output || [])
.filter((e: any) => e != null)
.map((entry: any) => {
if (entry === null) {
return null as any;
}
return __expectString(entry) as any;
});
return retVal;
};

const deserializeAws_restJson1NonCompliantResource = (output: any, context: __SerdeContext): NonCompliantResource => {
return {
additionalInfo:
Expand Down Expand Up @@ -28581,6 +28623,7 @@ const deserializeAws_restJson1ThingIndexingConfiguration = (
customFields:
output.customFields != null ? deserializeAws_restJson1Fields(output.customFields, context) : undefined,
deviceDefenderIndexingMode: __expectString(output.deviceDefenderIndexingMode),
filter: output.filter != null ? deserializeAws_restJson1IndexingFilter(output.filter, context) : undefined,
managedFields:
output.managedFields != null ? deserializeAws_restJson1Fields(output.managedFields, context) : undefined,
namedShadowIndexingMode: __expectString(output.namedShadowIndexingMode),
Expand Down
38 changes: 37 additions & 1 deletion codegen/sdk-codegen/aws-models/iot.json
Original file line number Diff line number Diff line change
Expand Up @@ -1802,7 +1802,7 @@
],
"traits": {
"smithy.api#deprecated": {},
"smithy.api#documentation": "<p>Attaches the specified policy to the specified principal (certificate or other\n credential).</p>\n <p>\n <b>Note:</b> This action is deprecated. Please use <a>AttachPolicy</a> instead.</p>\n <p>Requires permission to access the <a href=\"https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions\">AttachPrincipalPolicy</a> action.</p>",
"smithy.api#documentation": "<p>Attaches the specified policy to the specified principal (certificate or other\n credential).</p>\n <p>\n <b>Note:</b> This action is deprecated and works as\n expected for backward compatibility, but we won't add enhancements. Use <a>AttachPolicy</a> instead.</p>\n <p>Requires permission to access the <a href=\"https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions\">AttachPrincipalPolicy</a> action.</p>",
"smithy.api#http": {
"method": "PUT",
"uri": "/principal-policies/{policyName}",
Expand Down Expand Up @@ -15615,6 +15615,20 @@
]
}
},
"com.amazonaws.iot#IndexingFilter": {
"type": "structure",
"members": {
"namedShadowNames": {
"target": "com.amazonaws.iot#NamedShadowNamesFilter",
"traits": {
"smithy.api#documentation": "<p>The shadow names that you select to index. The default maximum number of shadow names for indexing is 10. To increase \n the limit, see <a href=\"https://docs.aws.amazon.com/general/latest/gr/iot_device_management.html#fleet-indexing-limits\">Amazon Web Services IoT Device Management \n Quotas</a> in the <i>Amazon Web Services General Reference</i>.\n </p>"
}
}
},
"traits": {
"smithy.api#documentation": "<p>Provides additional filters for specific data sources. Named shadow is the only data source that currently supports and requires a filter.\n To add named shadows to your fleet indexing configuration, set <code>namedShadowIndexingMode</code> to be <code>ON</code> and \n specify your shadow names in <code>filter</code>.</p>"
}
},
"com.amazonaws.iot#InlineDocument": {
"type": "string"
},
Expand Down Expand Up @@ -22385,6 +22399,12 @@
]
}
},
"com.amazonaws.iot#NamedShadowNamesFilter": {
"type": "list",
"member": {
"target": "com.amazonaws.iot#ShadowName"
}
},
"com.amazonaws.iot#NamespaceId": {
"type": "string",
"traits": {
Expand Down Expand Up @@ -25598,6 +25618,16 @@
}
}
},
"com.amazonaws.iot#ShadowName": {
"type": "string",
"traits": {
"smithy.api#length": {
"min": 1,
"max": 64
},
"smithy.api#pattern": "^[a-zA-Z0-9:_-]+$"
}
},
"com.amazonaws.iot#SigV4Authorization": {
"type": "structure",
"members": {
Expand Down Expand Up @@ -27474,6 +27504,12 @@
"traits": {
"smithy.api#documentation": "<p>Contains custom field names and their data type.</p>"
}
},
"filter": {
"target": "com.amazonaws.iot#IndexingFilter",
"traits": {
"smithy.api#documentation": "<p>Provides additional filters for specific data sources. Named shadow is the only data source that currently supports and requires a filter.\n To add named shadows to your fleet indexing configuration, set <code>namedShadowIndexingMode</code> to be <code>ON</code> and \n specify your shadow names in <code>filter</code>.</p>"
}
}
},
"traits": {
Expand Down

0 comments on commit 358a73e

Please sign in to comment.