Use ListOperations with an Amazon SDK or CLI - Amazon Route 53
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Use ListOperations with an Amazon SDK or CLI

The following code examples show how to use ListOperations.

Action examples are code excerpts from larger programs and must be run in context. You can see this action in context in the following code example:

.NET
Amazon SDK for .NET
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the Amazon Code Examples Repository.

/// <summary> /// List operations for the account that are submitted after a specified date. /// </summary> /// <returns>A collection of operation summary records.</returns> public async Task<List<OperationSummary>> ListOperations(DateTime submittedSince) { var results = new List<OperationSummary>(); var paginateOperations = _amazonRoute53Domains.Paginators.ListOperations( new ListOperationsRequest() { SubmittedSince = submittedSince }); // Get the entire list using the paginator. await foreach (var operations in paginateOperations.Operations) { results.Add(operations); } return results; }
  • For API details, see ListOperations in Amazon SDK for .NET API Reference.

CLI
Amazon CLI

To list the status of operations that return an operation ID

Some domain registration operations run asynchronously and return a response before they finish. These operations return an operation ID that you can use to get the current status. The following list-operations command lists summary information, including the status, about the current domain-registration operations.

This command runs only in the us-east-1 Region. If your default region is set to us-east-1, you can omit the region parameter.

aws route53domains list-operations --region us-east-1

Output:

{ "Operations": [ { "OperationId": "aab9822f-1da0-4bf3-8a15-fd4e0example", "Status": "SUCCESSFUL", "Type": "DOMAIN_LOCK", "SubmittedDate": 1455321739.986 }, { "OperationId": "c24379ed-76be-42f8-bdad-9379bexample", "Status": "SUCCESSFUL", "Type": "UPDATE_NAMESERVER", "SubmittedDate": 1468960475.109 }, { "OperationId": "f47e1297-ef9e-4c2b-ae1e-a5fcbexample", "Status": "SUCCESSFUL", "Type": "RENEW_DOMAIN", "SubmittedDate": 1473561835.943 }, { "OperationId": "75584f23-b15f-459e-aed7-dc6f5example", "Status": "SUCCESSFUL", "Type": "UPDATE_DOMAIN_CONTACT", "SubmittedDate": 1547501003.41 } ] }

The output includes all the operations that return an operation ID and that you have performed on all the domains that you have ever registered using the current Amazon account. If you want to get only the operations that you submitted after a specified date, you can include the submitted-since parameter and specify a date in Unix format and Coordinated Universal Time (UTC). The following command gets the status of all operations that were submitted after 12:00 am UTC on January 1, 2020.

aws route53domains list-operations \ --submitted-since 1577836800
  • For API details, see ListOperations in Amazon CLI Command Reference.

Java
SDK for Java 2.x
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the Amazon Code Examples Repository.

public static void listOperations(Route53DomainsClient route53DomainsClient) { try { Date currentDate = new Date(); LocalDateTime localDateTime = currentDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); ZoneOffset zoneOffset = ZoneOffset.of("+01:00"); localDateTime = localDateTime.minusYears(1); Instant myTime = localDateTime.toInstant(zoneOffset); ListOperationsRequest operationsRequest = ListOperationsRequest.builder() .submittedSince(myTime) .build(); ListOperationsIterable listRes = route53DomainsClient.listOperationsPaginator(operationsRequest); listRes.stream() .flatMap(r -> r.operations().stream()) .forEach(content -> System.out.println(" Operation Id: " + content.operationId() + " Status: " + content.statusAsString() + " Date: " + content.submittedDate())); } catch (Route53Exception e) { System.err.println(e.getMessage()); System.exit(1); } }
  • For API details, see ListOperations in Amazon SDK for Java 2.x API Reference.

Kotlin
SDK for Kotlin
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the Amazon Code Examples Repository.

suspend fun listOperations() { val currentDate = Date() var localDateTime = currentDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime() val zoneOffset = ZoneOffset.of("+01:00") localDateTime = localDateTime.minusYears(1) val myTime: java.time.Instant? = localDateTime.toInstant(zoneOffset) val time2: Instant? = myTime?.let { Instant(it) } val operationsRequest = ListOperationsRequest { submittedSince = time2 } Route53DomainsClient { region = "us-east-1" }.use { route53DomainsClient -> route53DomainsClient .listOperationsPaginated(operationsRequest) .transform { it.operations?.forEach { obj -> emit(obj) } } .collect { content -> println("Operation Id: ${content.operationId}") println("Status: ${content.status}") println("Date: ${content.submittedDate}") } } }
  • For API details, see ListOperations in Amazon SDK for Kotlin API reference.

For a complete list of Amazon SDK developer guides and code examples, see Using Route 53 with an Amazon SDK. This topic also includes information about getting started and details about previous SDK versions.