createMonitor method

Future<CreateMonitorOutput> createMonitor({
  1. required List<MonitorLocalResource> localResources,
  2. required String monitorName,
  3. required String scopeArn,
  4. String? clientToken,
  5. List<MonitorRemoteResource>? remoteResources,
  6. Map<String, String>? tags,
})

Create a monitor for specific network flows between local and remote resources, so that you can monitor network performance for one or several of your workloads. For each monitor, Network Flow Monitor publishes detailed end-to-end performance metrics and a network health indicator (NHI) that informs you whether there were Amazon Web Services network issues for one or more of the network flows tracked by a monitor, during a time period that you choose.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter localResources : The local resources to monitor. A local resource in a workload is the location of the host, or hosts, where the Network Flow Monitor agent is installed. For example, if a workload consists of an interaction between a web service and a backend database (for example, Amazon Dynamo DB), the subnet with the EC2 instance that hosts the web service, which also runs the agent, is the local resource.

Be aware that all local resources must belong to the current Region.

Parameter monitorName : The name of the monitor.

Parameter scopeArn : The Amazon Resource Name (ARN) of the scope for the monitor.

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 remoteResources : The remote resources to monitor. A remote resource is the other endpoint in the bi-directional flow of a workload, with a local resource. For example, Amazon Dynamo DB can be a remote resource.

When you specify remote resources, be aware that specific combinations of resources are allowed and others are not, including the following constraints:

  • All remote resources that you specify must all belong to a single Region.
  • If you specify Amazon Web Services services as remote resources, any other remote resources that you specify must be in the current Region.
  • When you specify a remote resource for another Region, you can only specify the Region resource type. You cannot specify a subnet, VPC, or Availability Zone in another Region.
  • If you leave the RemoteResources parameter empty, the monitor will include all network flows that terminate in the current Region.

Parameter tags : The tags for a monitor. You can add a maximum of 200 tags.

Implementation

Future<CreateMonitorOutput> createMonitor({
  required List<MonitorLocalResource> localResources,
  required String monitorName,
  required String scopeArn,
  String? clientToken,
  List<MonitorRemoteResource>? remoteResources,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'localResources': localResources,
    'monitorName': monitorName,
    'scopeArn': scopeArn,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (remoteResources != null) 'remoteResources': remoteResources,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/monitors',
    exceptionFnMap: _exceptionFns,
  );
  return CreateMonitorOutput.fromJson(response);
}