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.
Parameters:
-
queue_name
(String)
–
(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.
-
queue_owner_aws_account_id
(Optional[String], default:
None
)
–
(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.
Raises:
-
InvalidAddress
–
The specified ID is invalid.
-
InvalidSecurity
–
The request was not made over HTTPS or did not use SigV4 for signing.
-
QueueDoesNotExist
–
Ensure that the QueueUrl is correct and that the queue has not been deleted.
-
RequestThrottled
–
The request was denied due to request throttling.
-
Exceeds the permitted request rate for the queue or for the recipient of the request.
-
Ensure that the request rate is within the Amazon SQS limits for sending messages. For more information, see Amazon SQS quotas in the Amazon SQS Developer Guide.
-
UnsupportedOperation
–
Error code 400. Unsupported operation.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_sqs/_services/async_sqs.py
| async def get_queue_url(
self,
queue_name: "capo_sqs.types.string.String",
*,
config_overrides: Optional[AsyncSQSClientConfig] = None,
queue_owner_aws_account_id: Optional["capo_sqs.types.string.String"] = None,
) -> "capo_sqs.types.get_queue_url_result.GetQueueUrlResult":
"""<p>The <code>GetQueueUrl</code> 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.</p> <p>To access a queue owned by another Amazon Web Services account, use the <code>QueueOwnerAWSAccountId</code> 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 <code> <a>AddPermission</a> </code> API or <a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-writing-an-sqs-policy.html#write-messages-to-shared-queue">Allow developers to write messages to a shared queue</a> in the <i>Amazon SQS Developer Guide</i>. </p>
Args:
queue_name: <p>(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.</p>
queue_owner_aws_account_id: <p>(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.</p>
Raises:
capo_sqs.errors.invalid_address.InvalidAddress: <p>The specified ID is invalid.</p>
capo_sqs.errors.invalid_security.InvalidSecurity: <p>The request was not made over HTTPS or did not use SigV4 for signing.</p>
capo_sqs.errors.queue_does_not_exist.QueueDoesNotExist: <p>Ensure that the <code>QueueUrl</code> is correct and that the queue has not been deleted.</p>
capo_sqs.errors.request_throttled.RequestThrottled: <p>The request was denied due to request throttling.</p> <ul> <li> <p>Exceeds the permitted request rate for the queue or for the recipient of the request.</p> </li> <li> <p>Ensure that the request rate is within the Amazon SQS limits for sending messages. For more information, see <a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-quotas.html#quotas-requests">Amazon SQS quotas</a> in the <i>Amazon SQS Developer Guide</i>.</p> </li> </ul>
capo_sqs.errors.unsupported_operation.UnsupportedOperation: <p>Error code 400. Unsupported operation.</p>
capo_sqs.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_sqs.types.get_queue_url_request.GetQueueUrlRequest]",
) -> AsyncOperationResponse[
"capo_sqs.types.get_queue_url_result.GetQueueUrlResult"
]:
import capo_sqs._operations.amazon_sqs.get_queue_url
(
output,
http_response,
) = await capo_sqs._operations.amazon_sqs.get_queue_url.async_get_queue_url(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("GetQueueUrl")
)
input_: capo_sqs.types.get_queue_url_request.GetQueueUrlRequest = {
"queue_name": queue_name
}
if queue_owner_aws_account_id is not None:
input_["queue_owner_aws_account_id"] = queue_owner_aws_account_id
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|