createIPSet method
Creates a new IPSet, which is called a trusted IP list in the console user interface. An IPSet is a list of IP addresses that are trusted for secure communication with Amazon Web Services infrastructure and applications. GuardDuty doesn't generate findings for IP addresses that are included in IPSets. Only users from the administrator account can use this operation.
May throw AccessDeniedException.
May throw BadRequestException.
May throw InternalServerErrorException.
Parameter activate :
A Boolean value that indicates whether GuardDuty is to start using the
uploaded IPSet.
Parameter detectorId :
The unique ID of the detector of the GuardDuty account for which you want
to create an IPSet.
To find the detectorId in the current Region, see the
Settings page in the GuardDuty console, or run the ListDetectors
API.
Parameter format :
The format of the file that contains the IPSet.
Parameter location :
The URI of the file that contains the IPSet.
Parameter name :
The user-friendly name to identify the IPSet.
Allowed characters are alphanumeric, whitespace, dash (-), and underscores (_).
Parameter clientToken :
The idempotency token for the create request.
Parameter expectedBucketOwner :
The Amazon Web Services account ID that owns the Amazon S3 bucket
specified in the location parameter.
Parameter tags :
The tags to be added to a new IP set resource.
Implementation
Future<CreateIPSetResponse> createIPSet({
required bool activate,
required String detectorId,
required IpSetFormat format,
required String location,
required String name,
String? clientToken,
String? expectedBucketOwner,
Map<String, String>? tags,
}) async {
final $payload = <String, dynamic>{
'activate': activate,
'format': format.value,
'location': location,
'name': name,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (expectedBucketOwner != null)
'expectedBucketOwner': expectedBucketOwner,
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/detector/${Uri.encodeComponent(detectorId)}/ipset',
exceptionFnMap: _exceptionFns,
);
return CreateIPSetResponse.fromJson(response);
}