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 AWS 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 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 that you want to
create an IPSet for.
Parameter format
:
The format of the file that contains the IPSet.
Parameter location
:
The URI of the file that contains the IPSet. For example:
https://s3.us-west-2.amazonaws.com/my-bucket/my-object-key.
Parameter name
:
The user-friendly name to identify the IPSet.
Allowed characters are alphanumerics, spaces, hyphens (-), and underscores (_).
Parameter clientToken
:
The idempotency token for the create request.
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,
Map<String, String>? tags,
}) async {
ArgumentError.checkNotNull(activate, 'activate');
ArgumentError.checkNotNull(detectorId, 'detectorId');
_s.validateStringLength(
'detectorId',
detectorId,
1,
300,
isRequired: true,
);
ArgumentError.checkNotNull(format, 'format');
ArgumentError.checkNotNull(location, 'location');
_s.validateStringLength(
'location',
location,
1,
300,
isRequired: true,
);
ArgumentError.checkNotNull(name, 'name');
_s.validateStringLength(
'name',
name,
1,
300,
isRequired: true,
);
_s.validateStringLength(
'clientToken',
clientToken,
0,
64,
);
final $payload = <String, dynamic>{
'activate': activate,
'format': format.toValue(),
'location': location,
'name': name,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
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);
}