confirmSubscription method
Verifies an endpoint owner's intent to receive messages by validating the
token sent to the endpoint by an earlier Subscribe
action. If
the token is valid, the action creates a new subscription and returns its
Amazon Resource Name (ARN). This call requires an AWS signature only when
the AuthenticateOnUnsubscribe
flag is set to "true".
May throw SubscriptionLimitExceededException. May throw InvalidParameterException. May throw NotFoundException. May throw InternalErrorException. May throw AuthorizationErrorException. May throw FilterPolicyLimitExceededException.
Parameter token
:
Short-lived token sent to an endpoint during the Subscribe
action.
Parameter topicArn
:
The ARN of the topic for which you wish to confirm a subscription.
Parameter authenticateOnUnsubscribe
:
Disallows unauthenticated unsubscribes of the subscription. If the value
of this parameter is true
and the request has an AWS
signature, then only the topic owner and the subscription owner can
unsubscribe the endpoint. The unsubscribe action requires AWS
authentication.
Implementation
Future<ConfirmSubscriptionResponse> confirmSubscription({
required String token,
required String topicArn,
String? authenticateOnUnsubscribe,
}) async {
ArgumentError.checkNotNull(token, 'token');
ArgumentError.checkNotNull(topicArn, 'topicArn');
final $request = <String, dynamic>{};
$request['Token'] = token;
$request['TopicArn'] = topicArn;
authenticateOnUnsubscribe
?.also((arg) => $request['AuthenticateOnUnsubscribe'] = arg);
final $result = await _protocol.send(
$request,
action: 'ConfirmSubscription',
version: '2010-03-31',
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
shape: shapes['ConfirmSubscriptionInput'],
shapes: shapes,
resultWrapper: 'ConfirmSubscriptionResult',
);
return ConfirmSubscriptionResponse.fromXml($result);
}