getQueueUrl method
The GetQueueUrl API returns the URL of an existing Amazon SQS
queue. This is useful when you know the queue's name but need to retrieve
its URL for further operations.
To access a queue owned by another Amazon Web Services account, use the
QueueOwnerAWSAccountId parameter to specify the account ID of
the queue's owner. Note that the queue owner must grant you the necessary
permissions to access the queue. For more information about accessing
shared queues, see the AddPermission API or Allow
developers to write messages to a shared queue in the Amazon SQS
Developer Guide.
May throw InvalidAddress.
May throw InvalidSecurity.
May throw QueueDoesNotExist.
May throw RequestThrottled.
May throw UnsupportedOperation.
Parameter queueName :
(Required) The name of the queue for which you want to fetch the URL. The
name can be up to 80 characters long and can include alphanumeric
characters, hyphens (-), and underscores (_). Queue URLs and names are
case-sensitive.
Parameter queueOwnerAWSAccountId :
(Optional) The Amazon Web Services account ID of the account that created
the queue. This is only required when you are attempting to access a queue
owned by another Amazon Web Services account.
Implementation
Future<GetQueueUrlResult> getQueueUrl({
required String queueName,
String? queueOwnerAWSAccountId,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'AmazonSQS.GetQueueUrl'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'QueueName': queueName,
if (queueOwnerAWSAccountId != null)
'QueueOwnerAWSAccountId': queueOwnerAWSAccountId,
},
);
return GetQueueUrlResult.fromJson(jsonResponse.body);
}