ListAssessmentTemplatesCommand

Lists the assessment templates that correspond to the assessment targets that are specified by the ARNs of the assessment targets.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { InspectorClient, ListAssessmentTemplatesCommand } from "@aws-sdk/client-inspector"; // ES Modules import
// const { InspectorClient, ListAssessmentTemplatesCommand } = require("@aws-sdk/client-inspector"); // CommonJS import
const client = new InspectorClient(config);
const input = { // ListAssessmentTemplatesRequest
  assessmentTargetArns: [ // ListParentArnList
    "STRING_VALUE",
  ],
  filter: { // AssessmentTemplateFilter
    namePattern: "STRING_VALUE",
    durationRange: { // DurationRange
      minSeconds: Number("int"),
      maxSeconds: Number("int"),
    },
    rulesPackageArns: [ // FilterRulesPackageArnList
      "STRING_VALUE",
    ],
  },
  nextToken: "STRING_VALUE",
  maxResults: Number("int"),
};
const command = new ListAssessmentTemplatesCommand(input);
const response = await client.send(command);
// { // ListAssessmentTemplatesResponse
//   assessmentTemplateArns: [ // ListReturnedArnList // required
//     "STRING_VALUE",
//   ],
//   nextToken: "STRING_VALUE",
// };

Example Usage

 Loading code editor

ListAssessmentTemplatesCommand Input

Parameter
Type
Description
assessmentTargetArns
string[] | undefined

A list of ARNs that specifies the assessment targets whose assessment templates you want to list.

filter
AssessmentTemplateFilter | undefined

You can use this parameter to specify a subset of data to be included in the action's response.

For a record to match a filter, all specified filter attributes must match. When multiple values are specified for a filter attribute, any of the values can match.

maxResults
number | undefined

You can use this parameter to indicate the maximum number of items you want in the response. The default value is 10. The maximum value is 500.

nextToken
string | undefined

You can use this parameter when paginating results. Set the value of this parameter to null on your first call to the ListAssessmentTemplates action. Subsequent calls to the action fill nextToken in the request with the value of NextToken from the previous response to continue listing data.

ListAssessmentTemplatesCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
assessmentTemplateArns
Required
string[] | undefined

A list of ARNs that specifies the assessment templates returned by the action.

nextToken
string | undefined

When a response is generated, if there is more data to be listed, this parameter is present in the response and contains the value to use for the nextToken parameter in a subsequent pagination request. If there is no more data to be listed, this parameter is set to null.

Throws

Name
Fault
Details
AccessDeniedException
client

You do not have required permissions to access the requested resource.

InternalException
server

Internal server error.

InvalidInputException
client

The request was rejected because an invalid or out-of-range value was supplied for an input parameter.

NoSuchEntityException
client

The request was rejected because it referenced an entity that does not exist. The error code describes the entity.

InspectorServiceException
Base exception class for all service exceptions from Inspector service.