Hapus kueri terjadwal - Amazon Timestream

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

Hapus kueri terjadwal

Anda dapat menggunakan cuplikan kode berikut untuk menghapus kueri terjadwal.

Java
public void deleteScheduledQuery(String scheduledQueryArn) { System.out.println("Deleting Scheduled Query"); try { queryClient.deleteScheduledQuery(new DeleteScheduledQueryRequest().withScheduledQueryArn(scheduledQueryArn)); System.out.println("Successfully deleted scheduled query"); } catch (Exception e) { System.out.println("Scheduled Query deletion failed: " + e); } }
Java v2
public void deleteScheduledQuery(String scheduledQueryArn) { System.out.println("Deleting Scheduled Query"); try { queryClient.deleteScheduledQuery(DeleteScheduledQueryRequest.builder() .scheduledQueryArn(scheduledQueryArn).build()); System.out.println("Successfully deleted scheduled query"); } catch (Exception e) { System.out.println("Scheduled Query deletion failed: " + e); } }
Go
func (timestreamBuilder TimestreamBuilder) DeleteScheduledQuery(scheduledQueryArn string) error { deleteScheduledQueryInput := &timestreamquery.DeleteScheduledQueryInput{ ScheduledQueryArn: aws.String(scheduledQueryArn), } _, err := timestreamBuilder.QuerySvc.DeleteScheduledQuery(deleteScheduledQueryInput) if err != nil { fmt.Println("Error:") if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case timestreamquery.ErrCodeResourceNotFoundException: fmt.Println(timestreamquery.ErrCodeResourceNotFoundException, aerr.Error()) default: fmt.Printf("Error: %s", aerr.Error()) } } else { fmt.Printf("Error: %s", err.Error()) } return err } else { fmt.Println("DeleteScheduledQuery is successful") return nil } }
Python
def delete_scheduled_query(self, scheduled_query_arn): print("\nDeleting Scheduled Query") try: self.query_client.delete_scheduled_query(ScheduledQueryArn=scheduled_query_arn) print("Successfully deleted scheduled query :", scheduled_query_arn) except Exception as err: print("Scheduled Query deletion failed:", err) raise err
Node.js

Cuplikan berikut menggunakan gaya AWS SDK for JavaScript V2. Hal ini didasarkan pada contoh aplikasi di Node.js sampel Amazon Timestream untuk LiveAnalytics aplikasi pada. GitHub

async function deleteScheduleQuery(scheduledQueryArn) { console.log("Deleting Scheduled Query"); const params = { ScheduledQueryArn: scheduledQueryArn } try { await queryClient.deleteScheduledQuery(params).promise(); console.log("Successfully deleted scheduled query"); } catch (err) { console.log("Scheduled Query deletion failed: ", err); } }
.NET
private async Task DeleteScheduledQuery(string scheduledQueryArn) { try { Console.WriteLine("Deleting Scheduled Query"); await _amazonTimestreamQuery.DeleteScheduledQueryAsync(new DeleteScheduledQueryRequest() { ScheduledQueryArn = scheduledQueryArn }); Console.WriteLine($"Successfully deleted scheduled query : {scheduledQueryArn}"); } catch (Exception e) { Console.WriteLine($"Scheduled Query deletion failed: {e}"); throw; } }