createScope method
In Network Flow Monitor, you specify a scope for the service to generate metrics for. By using the scope, Network Flow Monitor can generate a topology of all the resources to measure performance metrics for. When you create a scope, you enable permissions for Network Flow Monitor.
A scope is a Region-account pair or multiple Region-account pairs. Network Flow Monitor uses your scope to determine all the resources (the topology) where Network Flow Monitor will gather network flow performance metrics for you. To provide performance metrics, Network Flow Monitor uses the data that is sent by the Network Flow Monitor agents you install on the resources.
To define the Region-account pairs for your scope, the Network Flow Monitor API uses the following constucts, which allow for future flexibility in defining scopes:
- Targets, which are arrays of targetResources.
- Target resources, which are Region-targetIdentifier pairs.
- Target identifiers, made up of a targetID (currently always an account ID) and a targetType (currently always an account).
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter targets :
The targets to define the scope to be monitored. A target is an array of
targetResources, which are currently Region-account pairs, defined by
targetResource constructs.
Parameter clientToken :
A unique, case-sensitive string of up to 64 ASCII characters that you
specify to make an idempotent API request. Don't reuse the same client
token for other API requests.
Parameter tags :
The tags for a scope. You can add a maximum of 200 tags.
Implementation
Future<CreateScopeOutput> createScope({
required List<TargetResource> targets,
String? clientToken,
Map<String, String>? tags,
}) async {
final $payload = <String, dynamic>{
'targets': targets,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/scopes',
exceptionFnMap: _exceptionFns,
);
return CreateScopeOutput.fromJson(response);
}