예약된 쿼리 설명 - Amazon Timestream

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

예약된 쿼리 설명

다음 코드 조각을 사용하여 예약된 쿼리를 설명할 수 있습니다.

Java
public void describeScheduledQueries(String scheduledQueryArn) { System.out.println("Describing Scheduled Query"); try { DescribeScheduledQueryResult describeScheduledQueryResult = queryClient.describeScheduledQuery(new DescribeScheduledQueryRequest().withScheduledQueryArn(scheduledQueryArn)); System.out.println(describeScheduledQueryResult); } catch (ResourceNotFoundException e) { System.out.println("Scheduled Query doesn't exist"); throw e; } catch (Exception e) { System.out.println("Describe Scheduled Query failed: " + e); throw e; } }
Java v2
public void describeScheduledQueries(String scheduledQueryArn) { System.out.println("Describing Scheduled Query"); try { DescribeScheduledQueryResponse describeScheduledQueryResult = queryClient.describeScheduledQuery(DescribeScheduledQueryRequest.builder() .scheduledQueryArn(scheduledQueryArn) .build()); System.out.println(describeScheduledQueryResult); } catch (ResourceNotFoundException e) { System.out.println("Scheduled Query doesn't exist"); throw e; } catch (Exception e) { System.out.println("Describe Scheduled Query failed: " + e); throw e; } }
Go
func (timestreamBuilder TimestreamBuilder) DescribeScheduledQuery(scheduledQueryArn string) error { describeScheduledQueryInput := &timestreamquery.DescribeScheduledQueryInput{ ScheduledQueryArn: aws.String(scheduledQueryArn), } describeScheduledQueryOutput, err := timestreamBuilder.QuerySvc.DescribeScheduledQuery(describeScheduledQueryInput) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case timestreamquery.ErrCodeResourceNotFoundException: fmt.Println(timestreamquery.ErrCodeResourceNotFoundException, aerr.Error()) default: fmt.Printf("Error: %s", err.Error()) } } else { fmt.Printf("Error: %s", aerr.Error()) } return err } else { fmt.Println("DescribeScheduledQuery is successful, below is the output:") fmt.Println(describeScheduledQueryOutput.ScheduledQuery) return nil } }
Python
def describe_scheduled_query(self, scheduled_query_arn): print("\nDescribing Scheduled Query") try: response = self.query_client.describe_scheduled_query(ScheduledQueryArn=scheduled_query_arn) if 'ScheduledQuery' in response: response = response['ScheduledQuery'] for key in response: print("{} :{}".format(key, response[key])) except self.query_client.exceptions.ResourceNotFoundException as err: print("Scheduled Query doesn't exist") raise err except Exception as err: print("Scheduled Query describe failed:", err) raise err
Node.js

다음 조각은 JavaScript V2 스타일에 를 AWS SDK 사용합니다. 이는 Node.js 샘플 Amazon Timestream의 샘플 애플리케이션을 기반으로 LiveAnalytics 합니다 GitHub.

async function describeScheduledQuery(scheduledQueryArn) { console.log("Describing Scheduled Query"); var params = { ScheduledQueryArn: scheduledQueryArn } try { const data = await queryClient.describeScheduledQuery(params).promise(); console.log(data.ScheduledQuery); } catch (err) { console.log("Describe Scheduled Query failed: ", err); throw err; } }
.NET
private async Task DescribeScheduledQuery(string scheduledQueryArn) { try { Console.WriteLine("Describing Scheduled Query"); DescribeScheduledQueryResponse response = await _amazonTimestreamQuery.DescribeScheduledQueryAsync( new DescribeScheduledQueryRequest() { ScheduledQueryArn = scheduledQueryArn }); Console.WriteLine($"{JsonConvert.SerializeObject(response.ScheduledQuery)}"); } catch (ResourceNotFoundException e) { Console.WriteLine($"Scheduled Query doesn't exist: {e}"); throw; } catch (Exception e) { Console.WriteLine($"Describe Scheduled Query failed: {e}"); throw; } }