subscribe method

Future<SubscribeResult> subscribe({
  1. required String arn,
  2. required Target target,
  3. String? clientRequestToken,
})

Creates an association between a notification rule and an SNS topic so that the associated target can receive notifications when the events described in the rule are triggered.

May throw ValidationException. May throw ResourceNotFoundException.

Parameter arn : The Amazon Resource Name (ARN) of the notification rule for which you want to create the association.

Parameter clientRequestToken : An enumeration token that, when provided in a request, returns the next batch of the results.

Implementation

Future<SubscribeResult> subscribe({
  required String arn,
  required Target target,
  String? clientRequestToken,
}) async {
  ArgumentError.checkNotNull(arn, 'arn');
  ArgumentError.checkNotNull(target, 'target');
  _s.validateStringLength(
    'clientRequestToken',
    clientRequestToken,
    1,
    256,
  );
  final $payload = <String, dynamic>{
    'Arn': arn,
    'Target': target,
    if (clientRequestToken != null) 'ClientRequestToken': clientRequestToken,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/subscribe',
    exceptionFnMap: _exceptionFns,
  );
  return SubscribeResult.fromJson(response);
}