From 35e83b0593dad47b9575570d5725cbf863b500b1 Mon Sep 17 00:00:00 2001 From: Andrew Schlackman <72105194+sei-aschlackman@users.noreply.github.com> Date: Thu, 3 Jun 2021 09:55:27 -0400 Subject: [PATCH] set type on number inputs and updated generated code (#175) * set type on number inputs and updated generated code * Add missing document markings Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- ...enario-template-edit-dialog.component.html | 2 +- ...scenario-template-edit-dialog.component.ts | 2 +- .../tasks/task-edit/task-edit.component.html | 20 +- .../data/scenario/scenario-data.service.ts | 2 +- .../steamfitter.api/.openapi-generator/FILES | 5 + .../steamfitter.api/api/scenario.service.ts | 48 +++-- .../api/scenarioTemplate.service.ts | 25 +-- .../steamfitter.api/api/task.service.ts | 172 ++++++++++++++++-- .../model/gradedExecutionInfo.ts | 25 +++ .../generated/steamfitter.api/model/models.ts | 5 + .../model/scenarioCloneOptions.ts | 24 +++ .../steamfitter.api/model/scenarioForm.ts | 34 ++++ .../model/scenarioTemplateForm.ts | 27 +++ .../steamfitter.api/model/taskAction.ts | 9 +- .../steamfitter.api/model/taskForm.ts | 47 +++++ 15 files changed, 384 insertions(+), 63 deletions(-) create mode 100644 src/app/generated/steamfitter.api/model/gradedExecutionInfo.ts create mode 100644 src/app/generated/steamfitter.api/model/scenarioCloneOptions.ts create mode 100644 src/app/generated/steamfitter.api/model/scenarioForm.ts create mode 100644 src/app/generated/steamfitter.api/model/scenarioTemplateForm.ts create mode 100644 src/app/generated/steamfitter.api/model/taskForm.ts diff --git a/src/app/components/scenario-templates/scenario-template-edit-dialog/scenario-template-edit-dialog.component.html b/src/app/components/scenario-templates/scenario-template-edit-dialog/scenario-template-edit-dialog.component.html index de0859d9..23aaf90e 100644 --- a/src/app/components/scenario-templates/scenario-template-edit-dialog/scenario-template-edit-dialog.component.html +++ b/src/app/components/scenario-templates/scenario-template-edit-dialog/scenario-template-edit-dialog.component.html @@ -64,9 +64,9 @@ Scoring Delay / Iteration / Expiration @@ -205,9 +205,9 @@

Delay / Iteration / Expiration

diff --git a/src/app/data/scenario/scenario-data.service.ts b/src/app/data/scenario/scenario-data.service.ts index 9ab16dc2..5158f6b5 100644 --- a/src/app/data/scenario/scenario-data.service.ts +++ b/src/app/data/scenario/scenario-data.service.ts @@ -289,7 +289,7 @@ export class ScenarioDataService { createScenarioFromScenarioTemplate(scenarioTemplateId: string) { this.scenarioStore.setLoading(true); this.scenarioService - .createScenarioFromScenarioTemplate(scenarioTemplateId) + .createScenarioFromScenarioTemplate(scenarioTemplateId, {}) .pipe( tap(() => { this.scenarioStore.setLoading(false); diff --git a/src/app/generated/steamfitter.api/.openapi-generator/FILES b/src/app/generated/steamfitter.api/.openapi-generator/FILES index 5e5ac5e5..8f3c3476 100644 --- a/src/app/generated/steamfitter.api/.openapi-generator/FILES +++ b/src/app/generated/steamfitter.api/.openapi-generator/FILES @@ -23,6 +23,7 @@ model/consoleConnectionInfo.ts model/directoryInfo.ts model/fileAttributes.ts model/fileInfo.ts +model/gradedExecutionInfo.ts model/healthStatus.ts model/localUser.ts model/models.ts @@ -33,11 +34,15 @@ model/permission.ts model/problemDetails.ts model/result.ts model/scenario.ts +model/scenarioCloneOptions.ts +model/scenarioForm.ts model/scenarioStatus.ts model/scenarioTemplate.ts +model/scenarioTemplateForm.ts model/sshPort.ts model/task.ts model/taskAction.ts +model/taskForm.ts model/taskIterationTermination.ts model/taskStatus.ts model/taskTrigger.ts diff --git a/src/app/generated/steamfitter.api/api/scenario.service.ts b/src/app/generated/steamfitter.api/api/scenario.service.ts index 6f4d7d41..4ba76059 100644 --- a/src/app/generated/steamfitter.api/api/scenario.service.ts +++ b/src/app/generated/steamfitter.api/api/scenario.service.ts @@ -24,6 +24,8 @@ import { Observable } from 'rxjs'; import { ProblemDetails } from '../model/models'; import { Scenario } from '../model/models'; +import { ScenarioCloneOptions } from '../model/models'; +import { ScenarioForm } from '../model/models'; import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; @@ -273,14 +275,14 @@ export class ScenarioService { /** * Creates a new Scenario * Creates a new Scenario with the attributes specified <para /> Accessible only to a SuperUser or an Administrator - * @param scenario The data to create the Scenario with + * @param scenarioForm The data to create the Scenario with * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public createScenario(scenario?: Scenario, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable; - public createScenario(scenario?: Scenario, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>; - public createScenario(scenario?: Scenario, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>; - public createScenario(scenario?: Scenario, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable { + public createScenario(scenarioForm?: ScenarioForm, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable; + public createScenario(scenarioForm?: ScenarioForm, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>; + public createScenario(scenarioForm?: ScenarioForm, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>; + public createScenario(scenarioForm?: ScenarioForm, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable { let headers = this.defaultHeaders; @@ -323,7 +325,7 @@ export class ScenarioService { } return this.httpClient.post(`${this.configuration.basePath}/api/scenarios`, - scenario, + scenarioForm, { responseType: responseType, withCredentials: this.configuration.withCredentials, @@ -338,13 +340,14 @@ export class ScenarioService { * Creates a new Scenario from a ScenarioTemplate * Creates a new Scenario from the specified ScenarioTemplate <para /> Accessible only to a SuperUser or an Administrator * @param id The ScenarioTemplate ID to create the Scenario with + * @param scenarioCloneOptions * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public createScenarioFromScenarioTemplate(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable; - public createScenarioFromScenarioTemplate(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>; - public createScenarioFromScenarioTemplate(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>; - public createScenarioFromScenarioTemplate(id: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable { + public createScenarioFromScenarioTemplate(id: string, scenarioCloneOptions?: ScenarioCloneOptions, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable; + public createScenarioFromScenarioTemplate(id: string, scenarioCloneOptions?: ScenarioCloneOptions, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>; + public createScenarioFromScenarioTemplate(id: string, scenarioCloneOptions?: ScenarioCloneOptions, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>; + public createScenarioFromScenarioTemplate(id: string, scenarioCloneOptions?: ScenarioCloneOptions, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable { if (id === null || id === undefined) { throw new Error('Required parameter id was null or undefined when calling createScenarioFromScenarioTemplate.'); } @@ -373,13 +376,24 @@ export class ScenarioService { } + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json', + 'text/json', + 'application/_*+json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + headers = headers.set('Content-Type', httpContentTypeSelected); + } + let responseType: 'text' | 'json' = 'json'; if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { responseType = 'text'; } return this.httpClient.post(`${this.configuration.basePath}/api/scenariotemplates/${encodeURIComponent(String(id))}/scenarios`, - null, + scenarioCloneOptions, { responseType: responseType, withCredentials: this.configuration.withCredentials, @@ -827,14 +841,14 @@ export class ScenarioService { * Updates a Scenario * Updates an Scenario with the attributes specified <para /> Accessible only to a SuperUser or a User on an Admin Team within the specified Scenario * @param id The Id of the Exericse to update - * @param scenario The updated Scenario values + * @param scenarioForm The updated Scenario values * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public updateScenario(id: string, scenario?: Scenario, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable; - public updateScenario(id: string, scenario?: Scenario, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>; - public updateScenario(id: string, scenario?: Scenario, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>; - public updateScenario(id: string, scenario?: Scenario, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable { + public updateScenario(id: string, scenarioForm?: ScenarioForm, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable; + public updateScenario(id: string, scenarioForm?: ScenarioForm, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>; + public updateScenario(id: string, scenarioForm?: ScenarioForm, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>; + public updateScenario(id: string, scenarioForm?: ScenarioForm, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable { if (id === null || id === undefined) { throw new Error('Required parameter id was null or undefined when calling updateScenario.'); } @@ -880,7 +894,7 @@ export class ScenarioService { } return this.httpClient.put(`${this.configuration.basePath}/api/scenarios/${encodeURIComponent(String(id))}`, - scenario, + scenarioForm, { responseType: responseType, withCredentials: this.configuration.withCredentials, diff --git a/src/app/generated/steamfitter.api/api/scenarioTemplate.service.ts b/src/app/generated/steamfitter.api/api/scenarioTemplate.service.ts index c1410a38..e969e8d6 100644 --- a/src/app/generated/steamfitter.api/api/scenarioTemplate.service.ts +++ b/src/app/generated/steamfitter.api/api/scenarioTemplate.service.ts @@ -24,6 +24,7 @@ import { Observable } from 'rxjs'; import { ProblemDetails } from '../model/models'; import { ScenarioTemplate } from '../model/models'; +import { ScenarioTemplateForm } from '../model/models'; import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; @@ -149,14 +150,14 @@ export class ScenarioTemplateService { /** * Creates a new ScenarioTemplate * Creates a new ScenarioTemplate with the attributes specified <para /> Accessible only to a SuperUser or an Administrator - * @param scenarioTemplate The data to create the ScenarioTemplate with + * @param scenarioTemplateForm The data to create the ScenarioTemplate with * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public createScenarioTemplate(scenarioTemplate?: ScenarioTemplate, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable; - public createScenarioTemplate(scenarioTemplate?: ScenarioTemplate, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>; - public createScenarioTemplate(scenarioTemplate?: ScenarioTemplate, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>; - public createScenarioTemplate(scenarioTemplate?: ScenarioTemplate, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable { + public createScenarioTemplate(scenarioTemplateForm?: ScenarioTemplateForm, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable; + public createScenarioTemplate(scenarioTemplateForm?: ScenarioTemplateForm, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>; + public createScenarioTemplate(scenarioTemplateForm?: ScenarioTemplateForm, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>; + public createScenarioTemplate(scenarioTemplateForm?: ScenarioTemplateForm, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable { let headers = this.defaultHeaders; @@ -199,7 +200,7 @@ export class ScenarioTemplateService { } return this.httpClient.post(`${this.configuration.basePath}/api/scenariotemplates`, - scenarioTemplate, + scenarioTemplateForm, { responseType: responseType, withCredentials: this.configuration.withCredentials, @@ -373,14 +374,14 @@ export class ScenarioTemplateService { * Updates an ScenarioTemplate * Updates an ScenarioTemplate with the attributes specified <para /> Accessible only to a SuperUser or a User on an Admin Team within the specified ScenarioTemplate * @param id The Id of the Exericse to update - * @param scenarioTemplate The updated ScenarioTemplate values + * @param scenarioTemplateForm The updated ScenarioTemplate values * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public updateScenarioTemplate(id: string, scenarioTemplate?: ScenarioTemplate, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable; - public updateScenarioTemplate(id: string, scenarioTemplate?: ScenarioTemplate, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>; - public updateScenarioTemplate(id: string, scenarioTemplate?: ScenarioTemplate, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>; - public updateScenarioTemplate(id: string, scenarioTemplate?: ScenarioTemplate, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable { + public updateScenarioTemplate(id: string, scenarioTemplateForm?: ScenarioTemplateForm, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable; + public updateScenarioTemplate(id: string, scenarioTemplateForm?: ScenarioTemplateForm, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>; + public updateScenarioTemplate(id: string, scenarioTemplateForm?: ScenarioTemplateForm, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>; + public updateScenarioTemplate(id: string, scenarioTemplateForm?: ScenarioTemplateForm, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable { if (id === null || id === undefined) { throw new Error('Required parameter id was null or undefined when calling updateScenarioTemplate.'); } @@ -426,7 +427,7 @@ export class ScenarioTemplateService { } return this.httpClient.put(`${this.configuration.basePath}/api/scenariotemplates/${encodeURIComponent(String(id))}`, - scenarioTemplate, + scenarioTemplateForm, { responseType: responseType, withCredentials: this.configuration.withCredentials, diff --git a/src/app/generated/steamfitter.api/api/task.service.ts b/src/app/generated/steamfitter.api/api/task.service.ts index 5f6fac0a..a1e94248 100644 --- a/src/app/generated/steamfitter.api/api/task.service.ts +++ b/src/app/generated/steamfitter.api/api/task.service.ts @@ -22,10 +22,12 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; +import { GradedExecutionInfo } from '../model/models'; import { NewLocation } from '../model/models'; import { ProblemDetails } from '../model/models'; import { Result } from '../model/models'; import { Task } from '../model/models'; +import { TaskForm } from '../model/models'; import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; @@ -163,14 +165,14 @@ export class TaskService { /** * Creates a new Task and executes it * Creates a new Task with the attributes specified and executes it <para /> Accessible only to a SuperUser or an Administrator - * @param task The data to create the Task with + * @param taskForm The data to create the Task with * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public createAndExecuteTask(task?: Task, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>; - public createAndExecuteTask(task?: Task, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>>; - public createAndExecuteTask(task?: Task, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>>; - public createAndExecuteTask(task?: Task, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable { + public createAndExecuteTask(taskForm?: TaskForm, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>; + public createAndExecuteTask(taskForm?: TaskForm, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>>; + public createAndExecuteTask(taskForm?: TaskForm, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>>; + public createAndExecuteTask(taskForm?: TaskForm, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable { let headers = this.defaultHeaders; @@ -213,7 +215,7 @@ export class TaskService { } return this.httpClient.post>(`${this.configuration.basePath}/api/tasks/execute`, - task, + taskForm, { responseType: responseType, withCredentials: this.configuration.withCredentials, @@ -227,14 +229,14 @@ export class TaskService { /** * Creates a new Task * Creates a new Task with the attributes specified <para /> Accessible only to a SuperUser or an Administrator - * @param task The data to create the Task with + * @param taskForm The data to create the Task with * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public createTask(task?: Task, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable; - public createTask(task?: Task, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>; - public createTask(task?: Task, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>; - public createTask(task?: Task, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable { + public createTask(taskForm?: TaskForm, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable; + public createTask(taskForm?: TaskForm, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>; + public createTask(taskForm?: TaskForm, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>; + public createTask(taskForm?: TaskForm, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable { let headers = this.defaultHeaders; @@ -277,7 +279,7 @@ export class TaskService { } return this.httpClient.post(`${this.configuration.basePath}/api/tasks`, - task, + taskForm, { responseType: responseType, withCredentials: this.configuration.withCredentials, @@ -409,9 +411,73 @@ export class TaskService { ); } + /** + * Executes a specific Task by id and substitutes GuestFileContent for file upload tasks. + * Executes the Task with the id specified after substituting file content, if provided. <para /> Accessible to an authenticated user. The task will fail, if the user does not have access to the targeted VMs. + * @param gradedExecutionInfo The scenario ID, start task name and task substitutions to make + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public executeForGrade(gradedExecutionInfo?: GradedExecutionInfo, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>; + public executeForGrade(gradedExecutionInfo?: GradedExecutionInfo, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>>; + public executeForGrade(gradedExecutionInfo?: GradedExecutionInfo, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>>; + public executeForGrade(gradedExecutionInfo?: GradedExecutionInfo, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable { + + let headers = this.defaultHeaders; + + let credential: string | undefined; + // authentication (oauth2) required + credential = this.configuration.lookupCredential('oauth2'); + if (credential) { + headers = headers.set('Authorization', 'Bearer ' + credential); + } + + let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; + if (httpHeaderAcceptSelected === undefined) { + // to determine the Accept header + const httpHeaderAccepts: string[] = [ + 'text/plain', + 'application/json', + 'text/json' + ]; + httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); + } + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json', + 'text/json', + 'application/_*+json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + headers = headers.set('Content-Type', httpContentTypeSelected); + } + + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + + return this.httpClient.post>(`${this.configuration.basePath}/api/tasks/execute/graded`, + gradedExecutionInfo, + { + responseType: responseType, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); + } + /** * Executes a specific Task by id - * Executes the Task with the id specified <para /> Accessible to a SuperUser or administrator + * Executes the Task with the id specified * @param id The id of the STT.Task * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. @@ -465,6 +531,74 @@ export class TaskService { ); } + /** + * Executes a specific Task by id and makes substitutions in task parameters + * Executes the Task with the id specified and makes substitutions in task parameters + * @param id The id of the STT.Task + * @param requestBody The task substitutions to make + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public executeTaskWithSubstitutions(id: string, requestBody?: { [key: string]: string; }, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>; + public executeTaskWithSubstitutions(id: string, requestBody?: { [key: string]: string; }, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>>; + public executeTaskWithSubstitutions(id: string, requestBody?: { [key: string]: string; }, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>>; + public executeTaskWithSubstitutions(id: string, requestBody?: { [key: string]: string; }, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling executeTaskWithSubstitutions.'); + } + + let headers = this.defaultHeaders; + + let credential: string | undefined; + // authentication (oauth2) required + credential = this.configuration.lookupCredential('oauth2'); + if (credential) { + headers = headers.set('Authorization', 'Bearer ' + credential); + } + + let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; + if (httpHeaderAcceptSelected === undefined) { + // to determine the Accept header + const httpHeaderAccepts: string[] = [ + 'text/plain', + 'application/json', + 'text/json' + ]; + httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); + } + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json', + 'text/json', + 'application/_*+json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + headers = headers.set('Content-Type', httpContentTypeSelected); + } + + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + + return this.httpClient.post>(`${this.configuration.basePath}/api/tasks/${encodeURIComponent(String(id))}/execute/substitutions`, + requestBody, + { + responseType: responseType, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); + } + /** * Gets all possible Task commands * Returns a list of all of the Task commands. @@ -1075,14 +1209,14 @@ export class TaskService { * Updates a Task * Updates a Task with the attributes specified <para /> Accessible only to a SuperUser or a User on an Admin Team within the specified Task * @param id The Id of the Exericse to update - * @param task The updated Task values + * @param taskForm The updated Task values * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public updateTask(id: string, task?: Task, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable; - public updateTask(id: string, task?: Task, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>; - public updateTask(id: string, task?: Task, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>; - public updateTask(id: string, task?: Task, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable { + public updateTask(id: string, taskForm?: TaskForm, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable; + public updateTask(id: string, taskForm?: TaskForm, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>; + public updateTask(id: string, taskForm?: TaskForm, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable>; + public updateTask(id: string, taskForm?: TaskForm, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json'}): Observable { if (id === null || id === undefined) { throw new Error('Required parameter id was null or undefined when calling updateTask.'); } @@ -1128,7 +1262,7 @@ export class TaskService { } return this.httpClient.put(`${this.configuration.basePath}/api/tasks/${encodeURIComponent(String(id))}`, - task, + taskForm, { responseType: responseType, withCredentials: this.configuration.withCredentials, diff --git a/src/app/generated/steamfitter.api/model/gradedExecutionInfo.ts b/src/app/generated/steamfitter.api/model/gradedExecutionInfo.ts new file mode 100644 index 00000000..2e399a97 --- /dev/null +++ b/src/app/generated/steamfitter.api/model/gradedExecutionInfo.ts @@ -0,0 +1,25 @@ +/* +Copyright 2021 Carnegie Mellon University. All Rights Reserved. + Released under a MIT (SEI)-style license. See LICENSE.md in the project root for license information. +*/ + +/** + * Steamfitter API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface GradedExecutionInfo { + scenarioId?: string; + startTaskName?: string | null; + gradedTaskName?: string | null; + taskSubstitutions?: { [key: string]: string; } | null; +} + diff --git a/src/app/generated/steamfitter.api/model/models.ts b/src/app/generated/steamfitter.api/model/models.ts index 8e62ebc3..116d6db2 100644 --- a/src/app/generated/steamfitter.api/model/models.ts +++ b/src/app/generated/steamfitter.api/model/models.ts @@ -8,6 +8,7 @@ export * from './consoleConnectionInfo'; export * from './directoryInfo'; export * from './fileAttributes'; export * from './fileInfo'; +export * from './gradedExecutionInfo'; export * from './healthStatus'; export * from './localUser'; export * from './monitoredTool'; @@ -17,11 +18,15 @@ export * from './permission'; export * from './problemDetails'; export * from './result'; export * from './scenario'; +export * from './scenarioCloneOptions'; +export * from './scenarioForm'; export * from './scenarioStatus'; export * from './scenarioTemplate'; +export * from './scenarioTemplateForm'; export * from './sshPort'; export * from './task'; export * from './taskAction'; +export * from './taskForm'; export * from './taskIterationTermination'; export * from './taskStatus'; export * from './taskTrigger'; diff --git a/src/app/generated/steamfitter.api/model/scenarioCloneOptions.ts b/src/app/generated/steamfitter.api/model/scenarioCloneOptions.ts new file mode 100644 index 00000000..93374478 --- /dev/null +++ b/src/app/generated/steamfitter.api/model/scenarioCloneOptions.ts @@ -0,0 +1,24 @@ +/* +Copyright 2021 Carnegie Mellon University. All Rights Reserved. + Released under a MIT (SEI)-style license. See LICENSE.md in the project root for license information. +*/ + +/** + * Steamfitter API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface ScenarioCloneOptions { + nameSuffix?: string | null; + viewId?: string | null; + userIds?: Array | null; +} + diff --git a/src/app/generated/steamfitter.api/model/scenarioForm.ts b/src/app/generated/steamfitter.api/model/scenarioForm.ts new file mode 100644 index 00000000..fe0150e8 --- /dev/null +++ b/src/app/generated/steamfitter.api/model/scenarioForm.ts @@ -0,0 +1,34 @@ +/* +Copyright 2021 Carnegie Mellon University. All Rights Reserved. + Released under a MIT (SEI)-style license. See LICENSE.md in the project root for license information. +*/ + +/** + * Steamfitter API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { ScenarioStatus } from './scenarioStatus'; +import { VmCredential } from './vmCredential'; + + +export interface ScenarioForm { + name?: string | null; + description?: string | null; + startDate?: Date; + endDate?: Date; + status?: ScenarioStatus; + onDemand?: boolean; + scenarioTemplateId?: string | null; + viewId?: string | null; + view?: string | null; + defaultVmCredentialId?: string | null; + vmCredentials?: Array | null; +} + diff --git a/src/app/generated/steamfitter.api/model/scenarioTemplateForm.ts b/src/app/generated/steamfitter.api/model/scenarioTemplateForm.ts new file mode 100644 index 00000000..becb5c76 --- /dev/null +++ b/src/app/generated/steamfitter.api/model/scenarioTemplateForm.ts @@ -0,0 +1,27 @@ +/* +Copyright 2021 Carnegie Mellon University. All Rights Reserved. + Released under a MIT (SEI)-style license. See LICENSE.md in the project root for license information. +*/ + +/** + * Steamfitter API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { VmCredential } from './vmCredential'; + + +export interface ScenarioTemplateForm { + name?: string | null; + description?: string | null; + durationHours?: number | null; + defaultVmCredentialId?: string | null; + vmCredentials?: Array | null; +} + diff --git a/src/app/generated/steamfitter.api/model/taskAction.ts b/src/app/generated/steamfitter.api/model/taskAction.ts index d3bf8d6f..2176d328 100644 --- a/src/app/generated/steamfitter.api/model/taskAction.ts +++ b/src/app/generated/steamfitter.api/model/taskAction.ts @@ -16,9 +16,13 @@ Copyright 2021 Carnegie Mellon University. All Rights Reserved. */ -export type TaskAction = 'guest_process_run' | 'guest_file_read' | 'guest_file_write' | 'vm_hw_power_off' | 'vm_hw_power_on' | 'vm_create_from_template' | 'vm_hw_remove' | 'guest_process_run_fast' | 'guest_file_upload_content'; +export type TaskAction = 'http_get' | 'http_post' | 'http_put' | 'http_delete' | 'guest_process_run' | 'guest_file_read' | 'guest_file_write' | 'vm_hw_power_off' | 'vm_hw_power_on' | 'vm_create_from_template' | 'vm_hw_remove' | 'guest_process_run_fast' | 'guest_file_upload_content' | 'send_email'; export const TaskAction = { + HttpGet: 'http_get' as TaskAction, + HttpPost: 'http_post' as TaskAction, + HttpPut: 'http_put' as TaskAction, + HttpDelete: 'http_delete' as TaskAction, GuestProcessRun: 'guest_process_run' as TaskAction, GuestFileRead: 'guest_file_read' as TaskAction, GuestFileWrite: 'guest_file_write' as TaskAction, @@ -27,6 +31,7 @@ export const TaskAction = { VmCreateFromTemplate: 'vm_create_from_template' as TaskAction, VmHwRemove: 'vm_hw_remove' as TaskAction, GuestProcessRunFast: 'guest_process_run_fast' as TaskAction, - GuestFileUploadContent: 'guest_file_upload_content' as TaskAction + GuestFileUploadContent: 'guest_file_upload_content' as TaskAction, + SendEmail: 'send_email' as TaskAction }; diff --git a/src/app/generated/steamfitter.api/model/taskForm.ts b/src/app/generated/steamfitter.api/model/taskForm.ts new file mode 100644 index 00000000..d049fb99 --- /dev/null +++ b/src/app/generated/steamfitter.api/model/taskForm.ts @@ -0,0 +1,47 @@ +/* +Copyright 2021 Carnegie Mellon University. All Rights Reserved. + Released under a MIT (SEI)-style license. See LICENSE.md in the project root for license information. +*/ + +/** + * Steamfitter API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { TaskIterationTermination } from './taskIterationTermination'; +import { TaskTrigger } from './taskTrigger'; +import { TaskAction } from './taskAction'; + + +export interface TaskForm { + name?: string | null; + description?: string | null; + scenarioTemplateId?: string | null; + scenarioId?: string | null; + userId?: string | null; + action?: TaskAction; + vmMask?: string | null; + vmList?: Array | null; + apiUrl?: string | null; + actionParameters?: { [key: string]: string; } | null; + expectedOutput?: string | null; + expirationSeconds?: number; + delaySeconds?: number; + intervalSeconds?: number; + iterations?: number; + iterationTermination?: TaskIterationTermination; + currentIteration?: number; + triggerTaskId?: string | null; + triggerCondition?: TaskTrigger; + score?: number; + userExecutable?: boolean; + repeatable?: boolean; + executable?: boolean; +} +