Les traductions sont fournies par des outils de traduction automatique. En cas de conflit entre le contenu d'une traduction et celui de la version originale en anglais, la version anglaise prévaudra.
Supprimer la requête planifiée
Vous pouvez utiliser les extraits de code suivants pour supprimer une requête planifiée.
- 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 := ×treamquery.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
-
L'extrait suivant utilise le style AWS SDK for JavaScript V2. Il est basé sur l'exemple d'application disponible sur Node.js, un exemple d'Amazon Timestream LiveAnalytics
pour une application sur. 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; } }
Mettre à jour la requête planifiée
Utilisation du chargement par lots