예제 #1
0
        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);
        }
예제 #2
0
 public static Task TransformConfigUpdateSourceApiKey(
     this IJetfireClient client,
     int id,
     string newApiKey,
     CancellationToken ct = default
     ) => client.TransformConfigUpdateSourceApiKey(id, new TransformConfigApiKeyUpdate {
     ApiKey = newApiKey
 });
예제 #3
0
 public static Task TransformConfigSetIgnoreNullFields(
     this IJetfireClient client,
     int id,
     bool ignoreNullFields,
     CancellationToken ct = default
     ) => client.TransformConfigSetIgnoreNullFields(id, new TransformConfigIgnoreNullFieldsOptions {
     IgnoreNullFields = ignoreNullFields
 });
예제 #4
0
 public static Task TransformConfigSetPublished(
     this IJetfireClient client,
     int id,
     bool isPublic,
     CancellationToken ct = default
     ) => client.TransformConfigSetPublished(id, new TransformConfigPublishOptions {
     IsPublic = isPublic
 });
예제 #5
0
 public Deployment(
     IConsole console,
     IJetfireClient client,
     List <TransformConfigRead> existingTransforms
     )
 {
     this.console            = console;
     this.client             = client;
     this.existingTransforms = existingTransforms;
 }
예제 #6
0
 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
     );
예제 #7
0
        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");
            }
        }