Die vorliegende Übersetzung wurde maschinell erstellt. Im Falle eines Konflikts oder eines Widerspruchs zwischen dieser übersetzten Fassung und der englischen Fassung (einschließlich infolge von Verzögerungen bei der Übersetzung) ist die englische Fassung maßgeblich.
Geplante Abfrage aktualisieren
Sie können die folgenden Codefragmente verwenden, um eine geplante Abfrage zu aktualisieren.
- Java
-
public void updateScheduledQueries(String scheduledQueryArn) { System.out.println("Updating Scheduled Query"); try { queryClient.updateScheduledQuery(new UpdateScheduledQueryRequest() .withScheduledQueryArn(scheduledQueryArn) .withState(ScheduledQueryState.DISABLED)); System.out.println("Successfully update scheduled query state"); } catch (ResourceNotFoundException e) { System.out.println("Scheduled Query doesn't exist"); throw e; } catch (Exception e) { System.out.println("Execution Scheduled Query failed: " + e); throw e; } }
- Java v2
-
public void updateScheduledQuery(String scheduledQueryArn, ScheduledQueryState state) { System.out.println("Updating Scheduled Query"); try { queryClient.updateScheduledQuery(UpdateScheduledQueryRequest.builder() .scheduledQueryArn(scheduledQueryArn) .state(state) .build()); System.out.println("Successfully update scheduled query state"); } catch (ResourceNotFoundException e) { System.out.println("Scheduled Query doesn't exist"); throw e; } catch (Exception e) { System.out.println("Execution Scheduled Query failed: " + e); throw e; } }
- Go
-
func (timestreamBuilder TimestreamBuilder) UpdateScheduledQuery(scheduledQueryArn string) error { updateScheduledQueryInput := ×treamquery.UpdateScheduledQueryInput{ ScheduledQueryArn: aws.String(scheduledQueryArn), State: aws.String(timestreamquery.ScheduledQueryStateDisabled), } _, err := timestreamBuilder.QuerySvc.UpdateScheduledQuery(updateScheduledQueryInput) 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", aerr.Error()) } } else { fmt.Printf("Error: %s", err.Error()) } return err } else { fmt.Println("UpdateScheduledQuery is successful") return nil } }
- Python
-
def update_scheduled_query(self, scheduled_query_arn, state): print("\nUpdating Scheduled Query") try: self.query_client.update_scheduled_query(ScheduledQueryArn=scheduled_query_arn, State=state) print("Successfully update scheduled query state to", state) except self.query_client.exceptions.ResourceNotFoundException as err: print("Scheduled Query doesn't exist") raise err except Exception as err: print("Scheduled Query deletion failed:", err) raise err
- Node.js
-
Der folgende Codeausschnitt verwendet den AWS SDK for V2-Stil. JavaScript Es basiert auf der Beispielanwendung unter Node.js Beispiel Amazon Timestream für die LiveAnalytics Anwendung auf GitHub
. async function updateScheduledQueries(scheduledQueryArn) { console.log("Updating Scheduled Query"); var params = { ScheduledQueryArn: scheduledQueryArn, State: "DISABLED" } try { await queryClient.updateScheduledQuery(params).promise(); console.log("Successfully update scheduled query state"); } catch (err) { console.log("Update Scheduled Query failed: ", err); throw err; } }
- .NET
-
private async Task UpdateScheduledQuery(string scheduledQueryArn, ScheduledQueryState state) { try { Console.WriteLine("Updating Scheduled Query"); await _amazonTimestreamQuery.UpdateScheduledQueryAsync(new UpdateScheduledQueryRequest() { ScheduledQueryArn = scheduledQueryArn, State = state }); Console.WriteLine("Successfully update scheduled query state"); } catch (ResourceNotFoundException e) { Console.WriteLine($"Scheduled Query doesn't exist: {e}"); throw; } catch (Exception e) { Console.WriteLine($"Update Scheduled Query failed: {e}"); throw; } }
Geplante Abfrage ausführen
Geplante Abfrage löschen