async Task <bool> IsJobCompleted( IJetfireClient client, int configId, string jobUuid, CancellationToken cancellationToken ) { var jobs = await client.TransformConfigRecentJobs(configId, 1000, cancellationToken); var firstJob = jobs.First(); var watchingJob = jobs.Single(x => x.Uuid == jobUuid); if (firstJob.Uuid != jobUuid && !watchingJob.FinishedTime.HasValue) { // If a new job has started since the one we're watching, but our job is still not finished, // the driver it was running on has crashed. throw new JobDeadException(watchingJob); } if (watchingJob.Error != null) { throw new JobFailedException(watchingJob); } return(watchingJob.FinishedTime.HasValue); }
public static Task TransformConfigUpdateSourceApiKey( this IJetfireClient client, int id, string newApiKey, CancellationToken ct = default ) => client.TransformConfigUpdateSourceApiKey(id, new TransformConfigApiKeyUpdate { ApiKey = newApiKey });
public static Task TransformConfigSetIgnoreNullFields( this IJetfireClient client, int id, bool ignoreNullFields, CancellationToken ct = default ) => client.TransformConfigSetIgnoreNullFields(id, new TransformConfigIgnoreNullFieldsOptions { IgnoreNullFields = ignoreNullFields });
public static Task TransformConfigSetPublished( this IJetfireClient client, int id, bool isPublic, CancellationToken ct = default ) => client.TransformConfigSetPublished(id, new TransformConfigPublishOptions { IsPublic = isPublic });
public Deployment( IConsole console, IJetfireClient client, List <TransformConfigRead> existingTransforms ) { this.console = console; this.client = client; this.existingTransforms = existingTransforms; }
public static Task <QueryResponse> Query( this IJetfireClient client, string query, long?resultsLimit = null, long?inferSchemaLimit = null, CancellationToken ct = default ) => client.Query( new QueryRequest { Query = query }, resultsLimit, inferSchemaLimit );
public static async Task <int> ResolveEitherId(int?id, string externalId, IJetfireClient jetfire) { if (id == null && externalId != null) { var transform = await jetfire.TransformConfigByExternalId(externalId, new CancellationToken()); return(transform.Id); } else if (id != null && externalId == null) { return(id.Value); } else { throw new JetfireCliException("Either --id or --external-id must be specified"); } }