getRecommendedPolicyV2 method

Future<GetRecommendedPolicyV2Response> getRecommendedPolicyV2({
  1. required String metadataUid,
  2. int? maxResults,
  3. String? nextToken,
})

Retrieves the recommended policy to remediate a Security Hub finding. GetRecommendedPolicyV2 only supports findings for unused permissions.

May throw AccessDeniedException. May throw InternalServerException. May throw InvalidInputException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter metadataUid : The unique identifier (ID) of Security Hub OCSF findings found under the metadata.uid field of the finding.

Parameter maxResults : The maximum number of recommendation steps to return.

Parameter nextToken : The token used to paginate the RecommendationSteps list returned. On your first call to GetRecommendedPolicyV2, omit this parameter or set it to NULL. For subsequent calls, use the NextToken value returned in the previous response to retrieve the next page of results.

Implementation

Future<GetRecommendedPolicyV2Response> getRecommendedPolicyV2({
  required String metadataUid,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final $query = <String, List<String>>{
    if (maxResults != null) 'MaxResults': [maxResults.toString()],
    if (nextToken != null) 'NextToken': [nextToken],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/recommendedPolicyV2/${Uri.encodeComponent(metadataUid)}',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return GetRecommendedPolicyV2Response.fromJson(response);
}