Skip to content

Commit

Permalink
feat(client-iot): This release add new api listRelatedResourcesForAud…
Browse files Browse the repository at this point in the history
…itFinding and new member type IssuerCertificates for Iot device device defender Audit.
  • Loading branch information
awstools committed Nov 11, 2022
1 parent de55f7e commit ef24039
Show file tree
Hide file tree
Showing 13 changed files with 900 additions and 301 deletions.
83 changes: 78 additions & 5 deletions clients/client-iot/src/IoT.ts
Expand Up @@ -795,6 +795,11 @@ import {
ListProvisioningTemplateVersionsCommandInput,
ListProvisioningTemplateVersionsCommandOutput,
} from "./commands/ListProvisioningTemplateVersionsCommand";
import {
ListRelatedResourcesForAuditFindingCommand,
ListRelatedResourcesForAuditFindingCommandInput,
ListRelatedResourcesForAuditFindingCommandOutput,
} from "./commands/ListRelatedResourcesForAuditFindingCommand";
import {
ListRoleAliasesCommand,
ListRoleAliasesCommandInput,
Expand Down Expand Up @@ -6766,6 +6771,74 @@ export class IoT extends IoTClient {
}
}

/**
* <p>The related resources of an Audit finding.
* The following resources can be returned from calling this API:</p>
* <ul>
* <li>
* <p>DEVICE_CERTIFICATE</p>
* </li>
* <li>
* <p>CA_CERTIFICATE</p>
* </li>
* <li>
* <p>IOT_POLICY</p>
* </li>
* <li>
* <p>COGNITO_IDENTITY_POOL</p>
* </li>
* <li>
* <p>CLIENT_ID</p>
* </li>
* <li>
* <p>ACCOUNT_SETTINGS</p>
* </li>
* <li>
* <p>ROLE_ALIAS</p>
* </li>
* <li>
* <p>IAM_ROLE</p>
* </li>
* <li>
* <p>ISSUER_CERTIFICATE</p>
* </li>
* </ul>
* <note>
* <p>This API is similar to DescribeAuditFinding's <a href="https://docs.aws.amazon.com/iot/latest/apireference/API_DescribeAuditFinding.html">RelatedResources</a>
* but provides pagination and is not limited to 10 resources.
* When calling <a href="https://docs.aws.amazon.com/iot/latest/apireference/API_DescribeAuditFinding.html">DescribeAuditFinding</a> for the intermediate CA revoked for
* active device certificates check, RelatedResources will not be populated. You must use this API, ListRelatedResourcesForAuditFinding, to list the certificates.</p>
* </note>
*/
public listRelatedResourcesForAuditFinding(
args: ListRelatedResourcesForAuditFindingCommandInput,
options?: __HttpHandlerOptions
): Promise<ListRelatedResourcesForAuditFindingCommandOutput>;
public listRelatedResourcesForAuditFinding(
args: ListRelatedResourcesForAuditFindingCommandInput,
cb: (err: any, data?: ListRelatedResourcesForAuditFindingCommandOutput) => void
): void;
public listRelatedResourcesForAuditFinding(
args: ListRelatedResourcesForAuditFindingCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: ListRelatedResourcesForAuditFindingCommandOutput) => void
): void;
public listRelatedResourcesForAuditFinding(
args: ListRelatedResourcesForAuditFindingCommandInput,
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: ListRelatedResourcesForAuditFindingCommandOutput) => void),
cb?: (err: any, data?: ListRelatedResourcesForAuditFindingCommandOutput) => void
): Promise<ListRelatedResourcesForAuditFindingCommandOutput> | void {
const command = new ListRelatedResourcesForAuditFindingCommand(args);
if (typeof optionsOrCb === "function") {
this.send(command, optionsOrCb);
} else if (typeof cb === "function") {
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
this.send(command, optionsOrCb || {}, cb);
} else {
return this.send(command, optionsOrCb);
}
}

/**
* <p>Lists the role aliases registered in your account.</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">ListRoleAliases</a> action.</p>
Expand Down Expand Up @@ -7197,11 +7270,11 @@ export class IoT extends IoTClient {
}

/**
* <p>Lists your things. Use the <b>attributeName</b> and
* <b>attributeValue</b> parameters to filter your things.
* For example, calling <code>ListThings</code> with attributeName=Color and
* attributeValue=Red retrieves all things in the registry that contain an attribute
* <b>Color</b> with the value <b>Red</b>. </p>
* <p>Lists your things. Use the <b>attributeName</b> and <b>attributeValue</b> parameters to filter your things. For example,
* calling <code>ListThings</code> with attributeName=Color and attributeValue=Red
* retrieves all things in the registry that contain an attribute <b>Color</b> with the value <b>Red</b>. For more
* information, see <a href="https://docs.aws.amazon.com/iot/latest/developerguide/thing-registry.html#list-things">List Things</a> from the <i>Amazon Web Services IoT Core Developer
* Guide</i>.</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">ListThings</a> action.</p>
*
* <note>
Expand Down
6 changes: 6 additions & 0 deletions clients/client-iot/src/IoTClient.ts
Expand Up @@ -489,6 +489,10 @@ import {
ListProvisioningTemplateVersionsCommandInput,
ListProvisioningTemplateVersionsCommandOutput,
} from "./commands/ListProvisioningTemplateVersionsCommand";
import {
ListRelatedResourcesForAuditFindingCommandInput,
ListRelatedResourcesForAuditFindingCommandOutput,
} from "./commands/ListRelatedResourcesForAuditFindingCommand";
import { ListRoleAliasesCommandInput, ListRoleAliasesCommandOutput } from "./commands/ListRoleAliasesCommand";
import {
ListScheduledAuditsCommandInput,
Expand Down Expand Up @@ -873,6 +877,7 @@ export type ServiceInputTypes =
| ListPrincipalThingsCommandInput
| ListProvisioningTemplateVersionsCommandInput
| ListProvisioningTemplatesCommandInput
| ListRelatedResourcesForAuditFindingCommandInput
| ListRoleAliasesCommandInput
| ListScheduledAuditsCommandInput
| ListSecurityProfilesCommandInput
Expand Down Expand Up @@ -1112,6 +1117,7 @@ export type ServiceOutputTypes =
| ListPrincipalThingsCommandOutput
| ListProvisioningTemplateVersionsCommandOutput
| ListProvisioningTemplatesCommandOutput
| ListRelatedResourcesForAuditFindingCommandOutput
| ListRoleAliasesCommandOutput
| ListScheduledAuditsCommandOutput
| ListSecurityProfilesCommandOutput
Expand Down
Expand Up @@ -14,8 +14,12 @@ import {
} from "@aws-sdk/types";

import { IoTClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../IoTClient";
import { DeleteRegistrationCodeRequest, DeleteRegistrationCodeRequestFilterSensitiveLog } from "../models/models_0";
import { DeleteRegistrationCodeResponse, DeleteRegistrationCodeResponseFilterSensitiveLog } from "../models/models_1";
import {
DeleteRegistrationCodeRequest,
DeleteRegistrationCodeRequestFilterSensitiveLog,
DeleteRegistrationCodeResponse,
DeleteRegistrationCodeResponseFilterSensitiveLog,
} from "../models/models_1";
import {
deserializeAws_restJson1DeleteRegistrationCodeCommand,
serializeAws_restJson1DeleteRegistrationCodeCommand,
Expand Down
@@ -0,0 +1,158 @@
// smithy-typescript generated code
import { EndpointParameterInstructions, getEndpointPlugin } from "@aws-sdk/middleware-endpoint";
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
import { Command as $Command } from "@aws-sdk/smithy-client";
import {
FinalizeHandlerArguments,
Handler,
HandlerExecutionContext,
HttpHandlerOptions as __HttpHandlerOptions,
MetadataBearer as __MetadataBearer,
MiddlewareStack,
SerdeContext as __SerdeContext,
} from "@aws-sdk/types";

import { IoTClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../IoTClient";
import {
ListRelatedResourcesForAuditFindingRequest,
ListRelatedResourcesForAuditFindingRequestFilterSensitiveLog,
ListRelatedResourcesForAuditFindingResponse,
ListRelatedResourcesForAuditFindingResponseFilterSensitiveLog,
} from "../models/models_1";
import {
deserializeAws_restJson1ListRelatedResourcesForAuditFindingCommand,
serializeAws_restJson1ListRelatedResourcesForAuditFindingCommand,
} from "../protocols/Aws_restJson1";

export interface ListRelatedResourcesForAuditFindingCommandInput extends ListRelatedResourcesForAuditFindingRequest {}
export interface ListRelatedResourcesForAuditFindingCommandOutput
extends ListRelatedResourcesForAuditFindingResponse,
__MetadataBearer {}

/**
* <p>The related resources of an Audit finding.
* The following resources can be returned from calling this API:</p>
* <ul>
* <li>
* <p>DEVICE_CERTIFICATE</p>
* </li>
* <li>
* <p>CA_CERTIFICATE</p>
* </li>
* <li>
* <p>IOT_POLICY</p>
* </li>
* <li>
* <p>COGNITO_IDENTITY_POOL</p>
* </li>
* <li>
* <p>CLIENT_ID</p>
* </li>
* <li>
* <p>ACCOUNT_SETTINGS</p>
* </li>
* <li>
* <p>ROLE_ALIAS</p>
* </li>
* <li>
* <p>IAM_ROLE</p>
* </li>
* <li>
* <p>ISSUER_CERTIFICATE</p>
* </li>
* </ul>
* <note>
* <p>This API is similar to DescribeAuditFinding's <a href="https://docs.aws.amazon.com/iot/latest/apireference/API_DescribeAuditFinding.html">RelatedResources</a>
* but provides pagination and is not limited to 10 resources.
* When calling <a href="https://docs.aws.amazon.com/iot/latest/apireference/API_DescribeAuditFinding.html">DescribeAuditFinding</a> for the intermediate CA revoked for
* active device certificates check, RelatedResources will not be populated. You must use this API, ListRelatedResourcesForAuditFinding, to list the certificates.</p>
* </note>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { IoTClient, ListRelatedResourcesForAuditFindingCommand } from "@aws-sdk/client-iot"; // ES Modules import
* // const { IoTClient, ListRelatedResourcesForAuditFindingCommand } = require("@aws-sdk/client-iot"); // CommonJS import
* const client = new IoTClient(config);
* const command = new ListRelatedResourcesForAuditFindingCommand(input);
* const response = await client.send(command);
* ```
*
* @see {@link ListRelatedResourcesForAuditFindingCommandInput} for command's `input` shape.
* @see {@link ListRelatedResourcesForAuditFindingCommandOutput} for command's `response` shape.
* @see {@link IoTClientResolvedConfig | config} for IoTClient's `config` shape.
*
*/
export class ListRelatedResourcesForAuditFindingCommand extends $Command<
ListRelatedResourcesForAuditFindingCommandInput,
ListRelatedResourcesForAuditFindingCommandOutput,
IoTClientResolvedConfig
> {
// Start section: command_properties
// End section: command_properties

public static getEndpointParameterInstructions(): EndpointParameterInstructions {
return {
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
Endpoint: { type: "builtInParams", name: "endpoint" },
Region: { type: "builtInParams", name: "region" },
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
};
}

constructor(readonly input: ListRelatedResourcesForAuditFindingCommandInput) {
// Start section: command_constructor
super();
// End section: command_constructor
}

/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: IoTClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<ListRelatedResourcesForAuditFindingCommandInput, ListRelatedResourcesForAuditFindingCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
this.middlewareStack.use(
getEndpointPlugin(configuration, ListRelatedResourcesForAuditFindingCommand.getEndpointParameterInstructions())
);

const stack = clientStack.concat(this.middlewareStack);

const { logger } = configuration;
const clientName = "IoTClient";
const commandName = "ListRelatedResourcesForAuditFindingCommand";
const handlerExecutionContext: HandlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog: ListRelatedResourcesForAuditFindingRequestFilterSensitiveLog,
outputFilterSensitiveLog: ListRelatedResourcesForAuditFindingResponseFilterSensitiveLog,
};
const { requestHandler } = configuration;
return stack.resolve(
(request: FinalizeHandlerArguments<any>) =>
requestHandler.handle(request.request as __HttpRequest, options || {}),
handlerExecutionContext
);
}

private serialize(
input: ListRelatedResourcesForAuditFindingCommandInput,
context: __SerdeContext
): Promise<__HttpRequest> {
return serializeAws_restJson1ListRelatedResourcesForAuditFindingCommand(input, context);
}

private deserialize(
output: __HttpResponse,
context: __SerdeContext
): Promise<ListRelatedResourcesForAuditFindingCommandOutput> {
return deserializeAws_restJson1ListRelatedResourcesForAuditFindingCommand(output, context);
}

// Start section: command_body_extra
// End section: command_body_extra
}
Expand Up @@ -14,12 +14,8 @@ import {
} from "@aws-sdk/types";

import { IoTClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../IoTClient";
import {
ListTargetsForPolicyRequest,
ListTargetsForPolicyRequestFilterSensitiveLog,
ListTargetsForPolicyResponse,
ListTargetsForPolicyResponseFilterSensitiveLog,
} from "../models/models_1";
import { ListTargetsForPolicyRequest, ListTargetsForPolicyRequestFilterSensitiveLog } from "../models/models_1";
import { ListTargetsForPolicyResponse, ListTargetsForPolicyResponseFilterSensitiveLog } from "../models/models_2";
import {
deserializeAws_restJson1ListTargetsForPolicyCommand,
serializeAws_restJson1ListTargetsForPolicyCommand,
Expand Down
Expand Up @@ -19,7 +19,7 @@ import {
ListTargetsForSecurityProfileRequestFilterSensitiveLog,
ListTargetsForSecurityProfileResponse,
ListTargetsForSecurityProfileResponseFilterSensitiveLog,
} from "../models/models_1";
} from "../models/models_2";
import {
deserializeAws_restJson1ListTargetsForSecurityProfileCommand,
serializeAws_restJson1ListTargetsForSecurityProfileCommand,
Expand Down
10 changes: 5 additions & 5 deletions clients/client-iot/src/commands/ListThingsCommand.ts
Expand Up @@ -29,11 +29,11 @@ export interface ListThingsCommandInput extends ListThingsRequest {}
export interface ListThingsCommandOutput extends ListThingsResponse, __MetadataBearer {}

/**
* <p>Lists your things. Use the <b>attributeName</b> and
* <b>attributeValue</b> parameters to filter your things.
* For example, calling <code>ListThings</code> with attributeName=Color and
* attributeValue=Red retrieves all things in the registry that contain an attribute
* <b>Color</b> with the value <b>Red</b>. </p>
* <p>Lists your things. Use the <b>attributeName</b> and <b>attributeValue</b> parameters to filter your things. For example,
* calling <code>ListThings</code> with attributeName=Color and attributeValue=Red
* retrieves all things in the registry that contain an attribute <b>Color</b> with the value <b>Red</b>. For more
* information, see <a href="https://docs.aws.amazon.com/iot/latest/developerguide/thing-registry.html#list-things">List Things</a> from the <i>Amazon Web Services IoT Core Developer
* Guide</i>.</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">ListThings</a> action.</p>
*
* <note>
Expand Down
1 change: 1 addition & 0 deletions clients/client-iot/src/commands/index.ts
Expand Up @@ -165,6 +165,7 @@ export * from "./ListPrincipalPoliciesCommand";
export * from "./ListPrincipalThingsCommand";
export * from "./ListProvisioningTemplateVersionsCommand";
export * from "./ListProvisioningTemplatesCommand";
export * from "./ListRelatedResourcesForAuditFindingCommand";
export * from "./ListRoleAliasesCommand";
export * from "./ListScheduledAuditsCommand";
export * from "./ListSecurityProfilesCommand";
Expand Down

0 comments on commit ef24039

Please sign in to comment.