createResourceGroup method

Future<CreateResourceGroupResponse> createResourceGroup({
  1. required List<ResourceGroupTag> resourceGroupTags,
})

Creates a resource group using the specified set of tags (key and value pairs) that are used to select the EC2 instances to be included in an Amazon Inspector assessment target. The created resource group is then used to create an Amazon Inspector assessment target. For more information, see CreateAssessmentTarget.

May throw InternalException. May throw InvalidInputException. May throw LimitExceededException. May throw AccessDeniedException. May throw ServiceTemporarilyUnavailableException.

Parameter resourceGroupTags : A collection of keys and an array of possible values, '[{"key":"key1","values":"Value1","Value2"},{"key":"Key2","values":"Value3"}]'.

For example,'[{"key":"Name","values":"TestEC2Instance"}]'.

Implementation

Future<CreateResourceGroupResponse> createResourceGroup({
  required List<ResourceGroupTag> resourceGroupTags,
}) async {
  ArgumentError.checkNotNull(resourceGroupTags, 'resourceGroupTags');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'InspectorService.CreateResourceGroup'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'resourceGroupTags': resourceGroupTags,
    },
  );

  return CreateResourceGroupResponse.fromJson(jsonResponse.body);
}