翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。
スケジュールされたクエリを一覧表示する
次のコードスニペットを使用して、スケジュールされたクエリを一覧表示できます。
- Java
-
public void listScheduledQueries() { System.out.println("Listing Scheduled Query"); try { String nextToken = null; List<String> scheduledQueries = new ArrayList<>(); do { ListScheduledQueriesResult listScheduledQueriesResult = queryClient.listScheduledQueries(new ListScheduledQueriesRequest() .withNextToken(nextToken).withMaxResults(10)); List<ScheduledQuery> scheduledQueryList = listScheduledQueriesResult.getScheduledQueries(); printScheduledQuery(scheduledQueryList); nextToken = listScheduledQueriesResult.getNextToken(); } while (nextToken != null); } catch (Exception e) { System.out.println("List Scheduled Query failed: " + e); throw e; } } public void printScheduledQuery(List<ScheduledQuery> scheduledQueryList) { for (ScheduledQuery scheduledQuery: scheduledQueryList) { System.out.println(scheduledQuery.getArn()); } }
- Java v2
-
public void listScheduledQueries() { System.out.println("Listing Scheduled Query"); try { String nextToken = null; do { ListScheduledQueriesResponse listScheduledQueriesResult = queryClient.listScheduledQueries(ListScheduledQueriesRequest.builder() .nextToken(nextToken).maxResults(10) .build()); List<ScheduledQuery> scheduledQueryList = listScheduledQueriesResult.scheduledQueries(); printScheduledQuery(scheduledQueryList); nextToken = listScheduledQueriesResult.nextToken(); } while (nextToken != null); } catch (Exception e) { System.out.println("List Scheduled Query failed: " + e); throw e; } } public void printScheduledQuery(List<ScheduledQuery> scheduledQueryList) { for (ScheduledQuery scheduledQuery: scheduledQueryList) { System.out.println(scheduledQuery.arn()); } }
- Go
-
func (timestreamBuilder TimestreamBuilder) ListScheduledQueries() ([]*timestreamquery.ScheduledQuery, error) { var nextToken *string = nil var scheduledQueries []*timestreamquery.ScheduledQuery for ok := true; ok; ok = nextToken != nil { listScheduledQueriesInput := ×treamquery.ListScheduledQueriesInput{ MaxResults: aws.Int64(15), } if nextToken != nil { listScheduledQueriesInput.NextToken = aws.String(*nextToken) } listScheduledQueriesOutput, err := timestreamBuilder.QuerySvc.ListScheduledQueries(listScheduledQueriesInput) if err != nil { fmt.Printf("Error: %s", err.Error()) return nil, err } scheduledQueries = append(scheduledQueries, listScheduledQueriesOutput.ScheduledQueries...) nextToken = listScheduledQueriesOutput.NextToken } return scheduledQueries, nil }
- Python
-
def list_scheduled_queries(self): print("\nListing Scheduled Queries") try: response = self.query_client.list_scheduled_queries(MaxResults=10) self.print_scheduled_queries(response['ScheduledQueries']) next_token = response.get('NextToken', None) while next_token: response = self.query_client.list_scheduled_queries(NextToken=next_token, MaxResults=10) self.print_scheduled_queries(response['ScheduledQueries']) next_token = response.get('NextToken', None) except Exception as err: print("List scheduled queries failed:", err) raise err @staticmethod def print_scheduled_queries(scheduled_queries): for scheduled_query in scheduled_queries: print(scheduled_query['Arn'])
- Node.js
-
次のスニペットは JavaScript V2 スタイルに AWS SDKを使用します。これは、Node.js のサンプルアプリケーションに基づいており、 の LiveAnalytics アプリケーション用の Amazon Timestream サンプルです GitHub
。 async function listScheduledQueries() { console.log("Listing Scheduled Query"); try { var nextToken = null; do { var params = { MaxResults: 10, NextToken: nextToken } var data = await queryClient.listScheduledQueries(params).promise(); var scheduledQueryList = data.ScheduledQueries; printScheduledQuery(scheduledQueryList); nextToken = data.NextToken; } while (nextToken != null); } catch (err) { console.log("List Scheduled Query failed: ", err); throw err; } } async function printScheduledQuery(scheduledQueryList) { scheduledQueryList.forEach(element => console.log(element.Arn)); }
- .NET
-
private async Task ListScheduledQueries() { try { Console.WriteLine("Listing Scheduled Query"); string nextToken; do { ListScheduledQueriesResponse response = await _amazonTimestreamQuery.ListScheduledQueriesAsync(new ListScheduledQueriesRequest()); foreach (var scheduledQuery in response.ScheduledQueries) { Console.WriteLine($"{scheduledQuery.Arn}"); } nextToken = response.NextToken; } while (nextToken != null); } catch (Exception e) { Console.WriteLine($"List Scheduled Query failed: {e}"); throw; } }
スケジュールされたクエリを作成する
スケジュールされたクエリを記述する