Eliminar consulta programada - Amazon Timestream

Las traducciones son generadas a través de traducción automática. En caso de conflicto entre la traducción y la version original de inglés, prevalecerá la version en inglés.

Eliminar consulta programada

Puede usar los siguientes fragmentos de código para eliminar una consulta programada.

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

En el siguiente fragmento se utiliza el estilo for V2. AWS SDK JavaScript Se basa en la aplicación de ejemplo de Node.js, ejemplo de Amazon Timestream LiveAnalytics para su aplicación en. 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; } }