listResourceRecordSets method
Lists the resource record sets in a specified hosted zone.
ListResourceRecordSets
returns up to 100 resource record sets
at a time in ASCII order, beginning at a position specified by the
name
and type
elements.
Sort order
ListResourceRecordSets
sorts results first by DNS name with
the labels reversed, for example:
com.example.www.
Note the trailing dot, which can change the sort order when the record
name contains characters that appear before .
(decimal 46) in
the ASCII table. These characters include the following: ! " # $ %
& ' ( ) * + , -
When multiple records have the same DNS name,
ListResourceRecordSets
sorts results by the record type.
Specifying where to start listing records
You can use the name and type elements to specify the resource record set that the list begins with:
- If you do not specify Name or Type
- The results begin with the first resource record set that the hosted zone contains.
- If you specify Name but not Type
-
The results begin with the first resource record set in the list whose
name is greater than or equal to
Name
. - If you specify Type but not Name
-
Amazon Route 53 returns the
InvalidInput
error. - If you specify both Name and Type
-
The results begin with the first resource record set in the list whose
name is greater than or equal to
Name
, and whose type is greater than or equal toType
.
This action returns the most current version of the records. This includes
records that are PENDING
, and that are not yet available on
all Route 53 DNS servers.
Changing resource record sets
To ensure that you get an accurate listing of the resource record sets for
a hosted zone at a point in time, do not submit a
ChangeResourceRecordSets
request while you're paging through
the results of a ListResourceRecordSets
request. If you do,
some pages may display results without the latest changes while other
pages display results with the latest changes.
Displaying the next page of results
If a ListResourceRecordSets
command returns more than one
page of results, the value of IsTruncated
is
true
. To display the next page of results, get the values of
NextRecordName
, NextRecordType
, and
NextRecordIdentifier
(if any) from the response. Then submit
another ListResourceRecordSets
request, and specify those
values for StartRecordName
, StartRecordType
, and
StartRecordIdentifier
.
May throw NoSuchHostedZone. May throw InvalidInput.
Parameter hostedZoneId
:
The ID of the hosted zone that contains the resource record sets that you
want to list.
Parameter maxItems
:
(Optional) The maximum number of resource records sets to include in the
response body for this request. If the response includes more than
maxitems
resource record sets, the value of the
IsTruncated
element in the response is true
, and
the values of the NextRecordName
and
NextRecordType
elements in the response identify the first
resource record set in the next group of maxitems
resource
record sets.
Parameter startRecordIdentifier
:
Resource record sets that have a routing policy other than simple:
If results were truncated for a given DNS name and type, specify the value
of NextRecordIdentifier
from the previous response to get the
next resource record set that has the current DNS name and type.
Parameter startRecordName
:
The first name in the lexicographic ordering of resource record sets that
you want to list. If the specified record name doesn't exist, the results
begin with the first resource record set that has a name greater than the
value of name
.
Parameter startRecordType
:
The type of resource record set to begin the record listing from.
Valid values for basic resource record sets: A
|
AAAA
| CAA
| CNAME
|
MX
| NAPTR
| NS
| PTR
| SOA
| SPF
| SRV
|
TXT
Values for weighted, latency, geolocation, and failover resource record
sets: A
| AAAA
| CAA
|
CNAME
| MX
| NAPTR
|
PTR
| SPF
| SRV
| TXT
Values for alias resource record sets:
- API Gateway custom regional API or edge-optimized API: A
- CloudFront distribution: A or AAAA
- Elastic Beanstalk environment that has a regionalized subdomain: A
- Elastic Load Balancing load balancer: A | AAAA
- S3 bucket: A
- VPC interface VPC endpoint: A
- Another resource record set in this hosted zone: The type of the resource record set that the alias references.
type
without specifying
name
returns an InvalidInput
error.
Implementation
Future<ListResourceRecordSetsResponse> listResourceRecordSets({
required String hostedZoneId,
String? maxItems,
String? startRecordIdentifier,
String? startRecordName,
RRType? startRecordType,
}) async {
ArgumentError.checkNotNull(hostedZoneId, 'hostedZoneId');
_s.validateStringLength(
'hostedZoneId',
hostedZoneId,
0,
32,
isRequired: true,
);
_s.validateStringLength(
'startRecordIdentifier',
startRecordIdentifier,
1,
128,
);
_s.validateStringLength(
'startRecordName',
startRecordName,
0,
1024,
);
final $query = <String, List<String>>{
if (maxItems != null) 'maxitems': [maxItems],
if (startRecordIdentifier != null) 'identifier': [startRecordIdentifier],
if (startRecordName != null) 'name': [startRecordName],
if (startRecordType != null) 'type': [startRecordType.toValue()],
};
final $result = await _protocol.send(
method: 'GET',
requestUri:
'/2013-04-01/hostedzone/${Uri.encodeComponent(hostedZoneId)}/rrset',
queryParams: $query,
exceptionFnMap: _exceptionFns,
);
return ListResourceRecordSetsResponse.fromXml($result.body);
}