From 5517ee25d8e6690a1695c7a13895bdb4bf21adf1 Mon Sep 17 00:00:00 2001 From: Oscar Reyes Date: Tue, 21 May 2024 12:03:18 -0600 Subject: [PATCH] feat(cli): enabling environment provisioning (#3859) * feat(cli): enabling environment provisioning * feat(cli): updating service names to match new route --- api/environments.yaml | 134 + api/invites.yaml | 129 + api/members.yaml | 79 + api/openapi.yaml | 213 + api/parameters.yaml | 24 + api/tokens.yaml | 105 + cli/cloud/cmd/run_cmd.go | 6 +- cli/cmd/resources.go | 47 +- cli/openapi/api_api.go | 3872 +++++++++++++---- cli/openapi/model_environment.go | 480 ++ cli/openapi/model_environment_resource.go | 160 + cli/openapi/model_environment_resources.go | 160 + cli/openapi/model_invite.go | 394 ++ cli/openapi/model_invite_environment.go | 178 + cli/openapi/model_invite_resource.go | 160 + cli/openapi/model_invite_resources.go | 160 + cli/openapi/model_role.go | 120 + cli/openapi/model_token.go | 388 ++ cli/openapi/model_tokens.go | 160 + cli/pkg/fileutil/file.go | 1 - cli/pkg/resourcemanager/apply.go | 8 + cli/pkg/resourcemanager/options.go | 23 +- cli/processor/environment.go | 87 + cli/processor/postprocessor.go | 11 + .../preprocessor.go | 2 +- cli/{preprocessor => processor}/test.go | 2 +- cli/{preprocessor => processor}/testsuite.go | 2 +- .../variableset.go | 2 +- 28 files changed, 6116 insertions(+), 991 deletions(-) create mode 100644 api/environments.yaml create mode 100644 api/invites.yaml create mode 100644 api/members.yaml create mode 100644 api/tokens.yaml create mode 100644 cli/openapi/model_environment.go create mode 100644 cli/openapi/model_environment_resource.go create mode 100644 cli/openapi/model_environment_resources.go create mode 100644 cli/openapi/model_invite.go create mode 100644 cli/openapi/model_invite_environment.go create mode 100644 cli/openapi/model_invite_resource.go create mode 100644 cli/openapi/model_invite_resources.go create mode 100644 cli/openapi/model_role.go create mode 100644 cli/openapi/model_token.go create mode 100644 cli/openapi/model_tokens.go create mode 100644 cli/processor/environment.go create mode 100644 cli/processor/postprocessor.go rename cli/{preprocessor => processor}/preprocessor.go (89%) rename cli/{preprocessor => processor}/test.go (99%) rename cli/{preprocessor => processor}/testsuite.go (99%) rename cli/{preprocessor => processor}/variableset.go (98%) diff --git a/api/environments.yaml b/api/environments.yaml new file mode 100644 index 0000000000..3ab4cb1cf8 --- /dev/null +++ b/api/environments.yaml @@ -0,0 +1,134 @@ +openapi: 3.0.1 + +components: + responses: + EnvironmentResource: + description: "successful operation for environment" + content: + application/json: + schema: + $ref: "#/components/schemas/EnvironmentResource" + + Environment: + description: "successful operation for environment" + content: + application/json: + schema: + $ref: "#/components/schemas/Environment" + + EnvironmentResources: + description: "successful operation for environment" + content: + application/json: + schema: + $ref: "#/components/schemas/EnvironmentResources" + + Environments: + description: "successful operation for environment" + content: + application/json: + schema: + $ref: "#/components/schemas/Environments" + + EnvironmentsMe: + description: "successful operation for environment" + content: + application/json: + schema: + $ref: "#/components/schemas/EnvironmentsMe" + + requestBodies: + Environment: + description: environment details body + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/Environment" + + EnvironmentResource: + description: environment resource details body + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/EnvironmentResource" + + schemas: + EnvironmentResources: + type: object + properties: + items: + type: array + items: + $ref: "#/components/schemas/EnvironmentResource" + count: + type: integer + + EnvironmentsMe: + type: object + properties: + elements: + type: array + items: + $ref: "#/components/schemas/Environment" + count: + type: integer + + Environments: + type: object + properties: + items: + type: array + items: + $ref: "#/components/schemas/Environment" + count: + type: integer + + EnvironmentResource: + type: object + properties: + type: + type: string + enum: + - Environment + spec: + $ref: "#/components/schemas/Environment" + + Environment: + type: object + required: + - connected + properties: + id: + type: string + readOnly: true + name: + type: string + description: + type: string + labels: + type: object + additionalProperties: + type: string + createdAt: + type: string + format: date-time + readOnly: true + updatedAt: + type: string + format: date-time + readOnly: true + isLocal: + type: boolean + example: false + userID: + type: string + organizationID: + type: string + description: organizationID + example: "733420bd-7e56-461f-8431-6378759e60ae" + agentApiKey: + type: string + resources: + type: string diff --git a/api/invites.yaml b/api/invites.yaml new file mode 100644 index 0000000000..697a01759a --- /dev/null +++ b/api/invites.yaml @@ -0,0 +1,129 @@ +openapi: 3.0.1 + +components: + responses: + Invites: + description: "successful operation for invites" + content: + application/json: + schema: + $ref: "#/components/schemas/Invites" + + InviteResources: + description: "successful operation for invites" + content: + application/json: + schema: + $ref: "#/components/schemas/InviteResources" + + Invite: + description: "successful operation for invites" + content: + application/json: + schema: + $ref: "#/components/schemas/Invite" + InviteResource: + description: "successful operation for invites" + content: + application/json: + schema: + $ref: "#/components/schemas/InviteResource" + + requestBodies: + Invite: + description: invite details body + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/Invite" + + InviteResource: + description: invite resource details body + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/InviteResource" + + schemas: + InviteResource: + type: object + properties: + type: + type: string + enum: + - Invite + spec: + $ref: "#/components/schemas/Invite" + + Invite: + required: + - id + - to + - role + type: object + properties: + id: + type: string + role: + $ref: "./members.yaml#/components/schemas/Role" + to: + type: string + createdAt: + type: string + format: date-time + sentAt: + type: string + format: date-time + type: + type: string + enum: + - "email" + - "public" + default: email + status: + type: string + enum: + - "pending" + - "accepted" + - "revoked" + default: pending + returnTo: + type: string + environments: + type: array + items: + $ref: "#/components/schemas/InviteEnvironment" + InviteEnvironment: + required: + - id + - role + type: object + properties: + id: + type: string + role: + $ref: "./members.yaml#/components/schemas/Role" + environment: + $ref: "./environments.yaml#/components/schemas/Environment" + + InviteResources: + type: object + properties: + items: + type: array + items: + $ref: "#/components/schemas/InviteResource" + count: + type: integer + + Invites: + type: object + properties: + items: + type: array + items: + $ref: "#/components/schemas/Invite" + count: + type: integer diff --git a/api/members.yaml b/api/members.yaml new file mode 100644 index 0000000000..973fb2dcc2 --- /dev/null +++ b/api/members.yaml @@ -0,0 +1,79 @@ +openapi: 3.0.1 + +components: + responses: + Members: + description: "successful operation for members" + content: + application/json: + schema: + $ref: "#/components/schemas/Members" + Member: + description: "successful operation for members" + content: + application/json: + schema: + $ref: "#/components/schemas/Member" + requestBodies: + MemberRole: + description: member role update body + required: true + content: + application/json: + schema: + type: object + required: + - role + properties: + role: + $ref: "#/components/schemas/Role" + AssignMember: + description: member role update body + required: true + content: + application/json: + schema: + type: object + required: + - role + - id + properties: + role: + $ref: "#/components/schemas/Role" + id: + type: string + schemas: + Role: + type: string + enum: + - owners + - members + - admins + - billers + - engineers + - runners + - agent + Member: + required: + - id + - user + - role + type: object + properties: + id: + type: string + role: + $ref: "#/components/schemas/Role" + user: + $ref: "./users.yaml#/components/schemas/User" + invite: + $ref: "./invites.yaml#/components/schemas/Invite" + Members: + type: object + properties: + elements: + type: array + items: + $ref: "#/components/schemas/Member" + nextToken: + type: string diff --git a/api/openapi.yaml b/api/openapi.yaml index c4146434fd..868fb57156 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -1548,3 +1548,216 @@ paths: description: "Run Group not found" 500: description: "problem getting the Run Group runs" + + /invites: + get: + description: Lists pending invites + parameters: + - $ref: "./parameters.yaml#/components/parameters/take" + - $ref: "./parameters.yaml#/components/parameters/skip" + - $ref: "./parameters.yaml#/components/parameters/query" + - $ref: "./parameters.yaml#/components/parameters/sortDirection" + tags: + - api + summary: Lists all invites + operationId: listInvites + responses: + "200": + $ref: "./invites.yaml#/components/responses/InviteResources" + + post: + description: Creates pending email invite + tags: + - api + summary: Creates a pending invite + operationId: createInvite + requestBody: + $ref: "./invites.yaml#/components/requestBodies/InviteResource" + responses: + "201": + $ref: "./invites.yaml#/components/responses/InviteResource" + + put: + description: Upserts invite + tags: + - api + summary: Upserts a pending invite + operationId: upsertInvite + requestBody: + $ref: "./invites.yaml#/components/requestBodies/InviteResource" + responses: + "201": + $ref: "./invites.yaml#/components/responses/InviteResource" + + /invites/{inviteID}: + parameters: + - $ref: "./parameters.yaml#/components/parameters/inviteID" + get: + description: get invite + tags: + - api + summary: Get invite + operationId: getInvite + responses: + "200": + $ref: "./invites.yaml#/components/responses/InviteResource" + + put: + description: Updates pending email invite + tags: + - api + summary: Updates a pending invite + operationId: updateInvite + requestBody: + $ref: "./invites.yaml#/components/requestBodies/InviteResource" + responses: + "201": + $ref: "./invites.yaml#/components/responses/InviteResource" + + delete: + description: delete pending invite + tags: + - api + summary: Delete pending invite + operationId: deleteInvite + responses: + "201": + $ref: "./invites.yaml#/components/responses/InviteResource" + + /tokens: + get: + description: Lists tokens + parameters: + - $ref: "./parameters.yaml#/components/parameters/take" + - $ref: "./parameters.yaml#/components/parameters/skip" + - $ref: "./parameters.yaml#/components/parameters/query" + - $ref: "./parameters.yaml#/components/parameters/sortDirection" + tags: + - api + summary: Lists all tokens + operationId: listTokens + responses: + "200": + $ref: "./tokens.yaml#/components/responses/Tokens" + + post: + description: Creates a new token + tags: + - api + summary: Creates a new token + operationId: createToken + requestBody: + $ref: "./tokens.yaml#/components/requestBodies/Token" + responses: + "201": + $ref: "./tokens.yaml#/components/responses/Token" + + put: + description: Upserts a new token + tags: + - api + summary: Upserts a new token + operationId: upsertToken + requestBody: + $ref: "./tokens.yaml#/components/requestBodies/Token" + responses: + "201": + $ref: "./tokens.yaml#/components/responses/Token" + + /tokens/{tokenID}: + parameters: + - $ref: "./parameters.yaml#/components/parameters/tokenID" + delete: + description: delete token + tags: + - api + summary: Delete token for environment + operationId: deleteToken + responses: + "201": + $ref: "./tokens.yaml#/components/responses/Token" + + put: + description: update token + tags: + - api + summary: Update token for environment + operationId: updateToken + responses: + "201": + $ref: "./tokens.yaml#/components/responses/Token" + + /environments: + get: + parameters: + - $ref: "./parameters.yaml#/components/parameters/take" + - $ref: "./parameters.yaml#/components/parameters/skip" + - $ref: "./parameters.yaml#/components/parameters/query" + - $ref: "./parameters.yaml#/components/parameters/sortDirection" + tags: + - api + summary: List environments + description: List environments from an organization + operationId: listEnvironments + responses: + "200": + $ref: "./environments.yaml#/components/responses/EnvironmentResources" + + post: + tags: + - api + summary: "Create new environment" + description: "Create test environment" + operationId: createEnvironment + requestBody: + $ref: "./environments.yaml#/components/requestBodies/EnvironmentResource" + responses: + "200": + $ref: "./environments.yaml#/components/responses/Environment" + + put: + tags: + - api + summary: "Upsert new environment" + description: "Upsert test environment" + operationId: upsertEnvironment + requestBody: + $ref: "./environments.yaml#/components/requestBodies/EnvironmentResource" + responses: + "200": + $ref: "./environments.yaml#/components/responses/EnvironmentResource" + + /environments/{environmentID}: + parameters: + - $ref: "./parameters.yaml#/components/parameters/environmentID" + get: + tags: + - api + summary: Get environment by ID + description: Get test environment by ID from CRD in kubernetes cluster + operationId: getEnvironment + responses: + "200": + $ref: "./environments.yaml#/components/responses/EnvironmentResource" + + put: + tags: + - api + summary: "Update environment" + description: "Update environment with given request body" + operationId: updateEnvironment + requestBody: + $ref: "./environments.yaml#/components/requestBodies/EnvironmentResource" + responses: + "200": + $ref: "./environments.yaml#/components/responses/EnvironmentResource" + + delete: + tags: + - api + summary: Delete test environment + description: Deletes a test environment + operationId: deleteEnvironment + responses: + "204": + $ref: "./environments.yaml#/components/responses/EnvironmentResource" diff --git a/api/parameters.yaml b/api/parameters.yaml index 59a1c5bc0f..f16df74b16 100644 --- a/api/parameters.yaml +++ b/api/parameters.yaml @@ -167,3 +167,27 @@ components: description: "IDs for RunGroup" schema: type: string + + inviteID: + in: path + name: inviteID + required: true + description: "ID for invite" + schema: + type: string + + tokenID: + in: path + name: tokenID + required: true + description: "ID for token" + schema: + type: string + + environmentID: + in: path + required: true + name: environmentID + description: "ID for environment" + schema: + type: string diff --git a/api/tokens.yaml b/api/tokens.yaml new file mode 100644 index 0000000000..29886bd23b --- /dev/null +++ b/api/tokens.yaml @@ -0,0 +1,105 @@ +openapi: 3.0.1 + +components: + responses: + Tokens: + description: "successful operation for tokens" + content: + application/json: + schema: + $ref: "#/components/schemas/Tokens" + Token: + description: "successful operation for token" + content: + application/json: + schema: + $ref: "#/components/schemas/Token" + JWT: + description: "successful operation for jwt" + content: + application/json: + schema: + $ref: "#/components/schemas/JWT" + requestBodies: + Token: + description: invite details body + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/Token" + TokenResource: + description: invite resource details body + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/TokenResource" + + schemas: + TokenResource: + type: object + properties: + type: + type: string + enum: + - Token + spec: + $ref: "#/components/schemas/Token" + TokenResources: + type: object + properties: + items: + type: array + items: + $ref: "#/components/schemas/Token" + count: + type: integer + Tokens: + type: object + properties: + items: + type: array + items: + $ref: "#/components/schemas/Token" + count: + type: integer + Token: + type: object + required: + - id + - name + - role + properties: + id: + type: string + name: + type: string + description: token name + example: "my-token" + isRevoked: + type: boolean + role: + $ref: "./members.yaml#/components/schemas/Role" + userID: + type: string + duration: + type: integer + description: token duration in minutes + example: 3600 + issuedAt: + type: string + format: date-time + expiresAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + JWT: + type: object + required: + - jwt + properties: + jwt: + type: string diff --git a/cli/cloud/cmd/run_cmd.go b/cli/cloud/cmd/run_cmd.go index 78fe1e8a40..e06b14da72 100644 --- a/cli/cloud/cmd/run_cmd.go +++ b/cli/cloud/cmd/run_cmd.go @@ -9,7 +9,7 @@ import ( "github.com/kubeshop/tracetest/cli/config" "github.com/kubeshop/tracetest/cli/formatters" "github.com/kubeshop/tracetest/cli/pkg/resourcemanager" - "github.com/kubeshop/tracetest/cli/preprocessor" + "github.com/kubeshop/tracetest/cli/processor" cliRunner "github.com/kubeshop/tracetest/cli/runner" ) @@ -19,7 +19,7 @@ func RunMultipleFiles(ctx context.Context, httpClient *resourcemanager.HTTPClien return cliRunner.ExitCodeGeneralError, fmt.Errorf("you should be authenticated to run multiple files, please run 'tracetest configure'") } - variableSetPreprocessor := preprocessor.VariableSet(cmdutil.GetLogger()) + variableSetPreprocessor := processor.VariableSet(cmdutil.GetLogger()) runGroup := runner.RunGroup(config.GetAPIClient(*cliConfig)) formatter := formatters.MultipleRun[cliRunner.RunResult](func() string { return cliConfig.UI() }, true) @@ -44,7 +44,7 @@ func RunMultipleFiles(ctx context.Context, httpClient *resourcemanager.HTTPClien }, format) } -func GetVariableSetClient(httpClient *resourcemanager.HTTPClient, preprocessor preprocessor.Preprocessor) resourcemanager.Client { +func GetVariableSetClient(httpClient *resourcemanager.HTTPClient, preprocessor processor.Preprocessor) resourcemanager.Client { variableSetClient := resourcemanager.NewClient( httpClient, cmdutil.GetLogger(), "variableset", "variablesets", diff --git a/cli/cmd/resources.go b/cli/cmd/resources.go index 700dadc34c..3816162a33 100644 --- a/cli/cmd/resources.go +++ b/cli/cmd/resources.go @@ -13,7 +13,7 @@ import ( "github.com/kubeshop/tracetest/cli/formatters" "github.com/kubeshop/tracetest/cli/pkg/fileutil" "github.com/kubeshop/tracetest/cli/pkg/resourcemanager" - "github.com/kubeshop/tracetest/cli/preprocessor" + "github.com/kubeshop/tracetest/cli/processor" "github.com/kubeshop/tracetest/cli/runner" ) @@ -39,7 +39,7 @@ var ( var ( httpClient = &resourcemanager.HTTPClient{} - variableSetPreprocessor = preprocessor.VariableSet(cliLogger) + variableSetPreprocessor = processor.VariableSet(cliLogger) variableSetClient = GetVariableSetClient(httpClient, variableSetPreprocessor) pollingProfileClient = resourcemanager.NewClient( @@ -57,7 +57,7 @@ var ( envTokensClient = resourcemanager.NewClient( httpClient, cliLogger, - "token", "environmenttokens", + "token", "tokens", resourcemanager.WithTableConfig(resourcemanager.TableConfig{ Cells: []resourcemanager.TableCellConfig{ {Header: "ID", Path: "spec.id"}, @@ -68,12 +68,12 @@ var ( {Header: "EXPIRES AT", Path: "spec.expiresAt"}, }, }), - resourcemanager.WithResourceType("EnvironmentToken"), + resourcemanager.WithResourceType("Token"), ) orgInvitesClient = resourcemanager.NewClient( httpClient, cliLogger, - "organizationinvite", "invites", + "invite", "invites", resourcemanager.WithTableConfig(resourcemanager.TableConfig{ Cells: []resourcemanager.TableCellConfig{ {Header: "ID", Path: "spec.id"}, @@ -86,6 +86,24 @@ var ( resourcemanager.WithResourceType("Invite"), ) + environmentPostproessor = processor.Environment(cliLogger, func(ctx context.Context, input fileutil.File) (fileutil.File, error) { + client, err := envResources.Get(strings.ToLower(input.Type())) + if err != nil { + return input, fmt.Errorf("cannot get client for resource type '%s': %w", input.Type(), err) + } + + _, err = client.Apply(ctx, input, resourcemanager.Formats.Get(resourcemanager.FormatYAML)) + if err != nil { + return input, fmt.Errorf("cannot apply resource: %w", err) + } + + return input, nil + }, func(ctx context.Context, envID string) error { + cliConfig.EnvironmentID = envID + setupResources() + return nil + }) + environmentClient = resourcemanager.NewClient( httpClient, cliLogger, "environment", "environments", @@ -96,9 +114,10 @@ var ( }, }), resourcemanager.WithResourceType("Environment"), + resourcemanager.WithApplyPostProcessor(environmentPostproessor.Postprocess), ) - testPreprocessor = preprocessor.Test(cliLogger, func(ctx context.Context, input fileutil.File) (fileutil.File, error) { + testPreprocessor = processor.Test(cliLogger, func(ctx context.Context, input fileutil.File) (fileutil.File, error) { updated, err := pollingProfileClient.Apply(ctx, input, resourcemanager.Formats.Get(resourcemanager.FormatYAML)) if err != nil { return input, fmt.Errorf("cannot apply polling profile: %w", err) @@ -142,7 +161,7 @@ var ( resourcemanager.WithApplyPreProcessor(testPreprocessor.Preprocess), ) - testSuitePreprocessor = preprocessor.TestSuite(cliLogger, func(ctx context.Context, input fileutil.File) (fileutil.File, error) { + testSuitePreprocessor = processor.TestSuite(cliLogger, func(ctx context.Context, input fileutil.File) (fileutil.File, error) { updated, err := testClient.Apply(ctx, input, resourcemanager.Formats.Get(resourcemanager.FormatYAML)) if err != nil { return input, fmt.Errorf("cannot apply test: %w", err) @@ -187,7 +206,7 @@ var ( resourcemanager.WithProxyResource("testsuite"), ) - resources = resourcemanager.NewRegistry(). + envResources = resourcemanager.NewRegistry(). Register( resourcemanager.NewClient( httpClient, cliLogger, @@ -285,10 +304,12 @@ var ( ). Register(variableSetClient). Register(testSuiteClient). - Register(testClient). - Register(organizationsClient). - Register(environmentClient). - Register(environmentMeClient). + Register(testClient) + + resources = envResources. + Register(organizationsClient). + Register(environmentClient). + Register(environmentMeClient). // deprecated resources Register(deprecatedTransactionsClient) @@ -371,7 +392,7 @@ func formatItemDate(item *gabs.Container, path string) error { return nil } -func GetVariableSetClient(httpClient *resourcemanager.HTTPClient, preprocessor preprocessor.Preprocessor) resourcemanager.Client { +func GetVariableSetClient(httpClient *resourcemanager.HTTPClient, preprocessor processor.Preprocessor) resourcemanager.Client { variableSetClient := resourcemanager.NewClient( httpClient, cmdutil.GetLogger(), "variableset", "variablesets", diff --git a/cli/openapi/api_api.go b/cli/openapi/api_api.go index 1d4421ab45..aa785ade35 100644 --- a/cli/openapi/api_api.go +++ b/cli/openapi/api_api.go @@ -22,31 +22,32 @@ import ( // ApiApiService ApiApi service type ApiApiService service -type ApiCreateRunGroupRequest struct { - ctx context.Context - ApiService *ApiApiService - runGroup *RunGroup +type ApiCreateEnvironmentRequest struct { + ctx context.Context + ApiService *ApiApiService + environmentResource *EnvironmentResource } -func (r ApiCreateRunGroupRequest) RunGroup(runGroup RunGroup) ApiCreateRunGroupRequest { - r.runGroup = &runGroup +// environment resource details body +func (r ApiCreateEnvironmentRequest) EnvironmentResource(environmentResource EnvironmentResource) ApiCreateEnvironmentRequest { + r.environmentResource = &environmentResource return r } -func (r ApiCreateRunGroupRequest) Execute() (*RunGroup, *http.Response, error) { - return r.ApiService.CreateRunGroupExecute(r) +func (r ApiCreateEnvironmentRequest) Execute() (*Environment, *http.Response, error) { + return r.ApiService.CreateEnvironmentExecute(r) } /* -CreateRunGroup Create a RunGroup +CreateEnvironment Create new environment -Create a RunGroup used on Tracetest +Create test environment @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiCreateRunGroupRequest + @return ApiCreateEnvironmentRequest */ -func (a *ApiApiService) CreateRunGroup(ctx context.Context) ApiCreateRunGroupRequest { - return ApiCreateRunGroupRequest{ +func (a *ApiApiService) CreateEnvironment(ctx context.Context) ApiCreateEnvironmentRequest { + return ApiCreateEnvironmentRequest{ ApiService: a, ctx: ctx, } @@ -54,25 +55,28 @@ func (a *ApiApiService) CreateRunGroup(ctx context.Context) ApiCreateRunGroupReq // Execute executes the request // -// @return RunGroup -func (a *ApiApiService) CreateRunGroupExecute(r ApiCreateRunGroupRequest) (*RunGroup, *http.Response, error) { +// @return Environment +func (a *ApiApiService) CreateEnvironmentExecute(r ApiCreateEnvironmentRequest) (*Environment, *http.Response, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *RunGroup + localVarReturnValue *Environment ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.CreateRunGroup") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.CreateEnvironment") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/rungroups" + localVarPath := localBasePath + "/environments" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.environmentResource == nil { + return localVarReturnValue, nil, reportError("environmentResource is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} @@ -92,7 +96,7 @@ func (a *ApiApiService) CreateRunGroupExecute(r ApiCreateRunGroupRequest) (*RunG localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.runGroup + localVarPostBody = r.environmentResource req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -130,59 +134,64 @@ func (a *ApiApiService) CreateRunGroupExecute(r ApiCreateRunGroupRequest) (*RunG return localVarReturnValue, localVarHTTPResponse, nil } -type ApiDeleteTestRunRequest struct { - ctx context.Context - ApiService *ApiApiService - testId string - runId int32 +type ApiCreateInviteRequest struct { + ctx context.Context + ApiService *ApiApiService + inviteResource *InviteResource } -func (r ApiDeleteTestRunRequest) Execute() (*http.Response, error) { - return r.ApiService.DeleteTestRunExecute(r) +// invite resource details body +func (r ApiCreateInviteRequest) InviteResource(inviteResource InviteResource) ApiCreateInviteRequest { + r.inviteResource = &inviteResource + return r +} + +func (r ApiCreateInviteRequest) Execute() (*InviteResource, *http.Response, error) { + return r.ApiService.CreateInviteExecute(r) } /* -DeleteTestRun delete a test run +CreateInvite Creates a pending invite -delete a test run +Creates pending email invite @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param testId id of the test - @param runId id of the run - @return ApiDeleteTestRunRequest + @return ApiCreateInviteRequest */ -func (a *ApiApiService) DeleteTestRun(ctx context.Context, testId string, runId int32) ApiDeleteTestRunRequest { - return ApiDeleteTestRunRequest{ +func (a *ApiApiService) CreateInvite(ctx context.Context) ApiCreateInviteRequest { + return ApiCreateInviteRequest{ ApiService: a, ctx: ctx, - testId: testId, - runId: runId, } } // Execute executes the request -func (a *ApiApiService) DeleteTestRunExecute(r ApiDeleteTestRunRequest) (*http.Response, error) { +// +// @return InviteResource +func (a *ApiApiService) CreateInviteExecute(r ApiCreateInviteRequest) (*InviteResource, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *InviteResource ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.DeleteTestRun") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.CreateInvite") if err != nil { - return nil, &GenericOpenAPIError{error: err.Error()} + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/tests/{testId}/run/{runId}" - localVarPath = strings.Replace(localVarPath, "{"+"testId"+"}", url.PathEscape(parameterValueToString(r.testId, "testId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"runId"+"}", url.PathEscape(parameterValueToString(r.runId, "runId")), -1) + localVarPath := localBasePath + "/invites" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.inviteResource == nil { + return localVarReturnValue, nil, reportError("inviteResource is required and must be specified") + } // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -191,28 +200,30 @@ func (a *ApiApiService) DeleteTestRunExecute(r ApiDeleteTestRunRequest) (*http.R } // to determine the Accept header - localVarHTTPHeaderAccepts := []string{} + localVarHTTPHeaderAccepts := []string{"application/json"} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.inviteResource req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return nil, err + return localVarReturnValue, nil, err } localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -220,65 +231,75 @@ func (a *ApiApiService) DeleteTestRunExecute(r ApiDeleteTestRunRequest) (*http.R body: localVarBody, error: localVarHTTPResponse.Status, } - return localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - return localVarHTTPResponse, nil + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil } -type ApiDeleteTestSuiteRunRequest struct { - ctx context.Context - ApiService *ApiApiService - testSuiteId string - runId int32 +type ApiCreateRunGroupRequest struct { + ctx context.Context + ApiService *ApiApiService + runGroup *RunGroup } -func (r ApiDeleteTestSuiteRunRequest) Execute() (*http.Response, error) { - return r.ApiService.DeleteTestSuiteRunExecute(r) +func (r ApiCreateRunGroupRequest) RunGroup(runGroup RunGroup) ApiCreateRunGroupRequest { + r.runGroup = &runGroup + return r +} + +func (r ApiCreateRunGroupRequest) Execute() (*RunGroup, *http.Response, error) { + return r.ApiService.CreateRunGroupExecute(r) } /* -DeleteTestSuiteRun Delete a specific run from a particular TestSuite +CreateRunGroup Create a RunGroup -Delete a specific run from a particular TestSuite +Create a RunGroup used on Tracetest @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param testSuiteId id of the TestSuite - @param runId id of the run - @return ApiDeleteTestSuiteRunRequest + @return ApiCreateRunGroupRequest */ -func (a *ApiApiService) DeleteTestSuiteRun(ctx context.Context, testSuiteId string, runId int32) ApiDeleteTestSuiteRunRequest { - return ApiDeleteTestSuiteRunRequest{ - ApiService: a, - ctx: ctx, - testSuiteId: testSuiteId, - runId: runId, +func (a *ApiApiService) CreateRunGroup(ctx context.Context) ApiCreateRunGroupRequest { + return ApiCreateRunGroupRequest{ + ApiService: a, + ctx: ctx, } } // Execute executes the request -func (a *ApiApiService) DeleteTestSuiteRunExecute(r ApiDeleteTestSuiteRunRequest) (*http.Response, error) { +// +// @return RunGroup +func (a *ApiApiService) CreateRunGroupExecute(r ApiCreateRunGroupRequest) (*RunGroup, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RunGroup ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.DeleteTestSuiteRun") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.CreateRunGroup") if err != nil { - return nil, &GenericOpenAPIError{error: err.Error()} + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/testsuites/{testSuiteId}/run/{runId}" - localVarPath = strings.Replace(localVarPath, "{"+"testSuiteId"+"}", url.PathEscape(parameterValueToString(r.testSuiteId, "testSuiteId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"runId"+"}", url.PathEscape(parameterValueToString(r.runId, "runId")), -1) + localVarPath := localBasePath + "/rungroups" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -287,28 +308,30 @@ func (a *ApiApiService) DeleteTestSuiteRunExecute(r ApiDeleteTestSuiteRunRequest } // to determine the Accept header - localVarHTTPHeaderAccepts := []string{} + localVarHTTPHeaderAccepts := []string{"application/json"} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.runGroup req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return nil, err + return localVarReturnValue, nil, err } localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -316,71 +339,76 @@ func (a *ApiApiService) DeleteTestSuiteRunExecute(r ApiDeleteTestSuiteRunRequest body: localVarBody, error: localVarHTTPResponse.Status, } - return localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - return localVarHTTPResponse, nil + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil } -type ApiDryRunAssertionRequest struct { +type ApiCreateTokenRequest struct { ctx context.Context ApiService *ApiApiService - testId string - runId int32 - testSpecs *TestSpecs + token *Token } -func (r ApiDryRunAssertionRequest) TestSpecs(testSpecs TestSpecs) ApiDryRunAssertionRequest { - r.testSpecs = &testSpecs +// invite details body +func (r ApiCreateTokenRequest) Token(token Token) ApiCreateTokenRequest { + r.token = &token return r } -func (r ApiDryRunAssertionRequest) Execute() (*AssertionResults, *http.Response, error) { - return r.ApiService.DryRunAssertionExecute(r) +func (r ApiCreateTokenRequest) Execute() (*Token, *http.Response, error) { + return r.ApiService.CreateTokenExecute(r) } /* -DryRunAssertion run given assertions against the traces from the given run without persisting anything +CreateToken Creates a new token -use this method to test a definition against an actual trace without creating a new version or persisting anything +Creates a new token @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param testId id of the test - @param runId id of the run - @return ApiDryRunAssertionRequest + @return ApiCreateTokenRequest */ -func (a *ApiApiService) DryRunAssertion(ctx context.Context, testId string, runId int32) ApiDryRunAssertionRequest { - return ApiDryRunAssertionRequest{ +func (a *ApiApiService) CreateToken(ctx context.Context) ApiCreateTokenRequest { + return ApiCreateTokenRequest{ ApiService: a, ctx: ctx, - testId: testId, - runId: runId, } } // Execute executes the request // -// @return AssertionResults -func (a *ApiApiService) DryRunAssertionExecute(r ApiDryRunAssertionRequest) (*AssertionResults, *http.Response, error) { +// @return Token +func (a *ApiApiService) CreateTokenExecute(r ApiCreateTokenRequest) (*Token, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPut + localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *AssertionResults + localVarReturnValue *Token ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.DryRunAssertion") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.CreateToken") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/tests/{testId}/run/{runId}/dry-run" - localVarPath = strings.Replace(localVarPath, "{"+"testId"+"}", url.PathEscape(parameterValueToString(r.testId, "testId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"runId"+"}", url.PathEscape(parameterValueToString(r.runId, "runId")), -1) + localVarPath := localBasePath + "/tokens" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.token == nil { + return localVarReturnValue, nil, reportError("token is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} @@ -400,7 +428,7 @@ func (a *ApiApiService) DryRunAssertionExecute(r ApiDryRunAssertionRequest) (*As localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.testSpecs + localVarPostBody = r.token req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -438,55 +466,51 @@ func (a *ApiApiService) DryRunAssertionExecute(r ApiDryRunAssertionRequest) (*As return localVarReturnValue, localVarHTTPResponse, nil } -type ApiExportTestRunRequest struct { - ctx context.Context - ApiService *ApiApiService - testId string - runId int32 +type ApiDeleteEnvironmentRequest struct { + ctx context.Context + ApiService *ApiApiService + environmentID string } -func (r ApiExportTestRunRequest) Execute() (*ExportedTestInformation, *http.Response, error) { - return r.ApiService.ExportTestRunExecute(r) +func (r ApiDeleteEnvironmentRequest) Execute() (*EnvironmentResource, *http.Response, error) { + return r.ApiService.DeleteEnvironmentExecute(r) } /* -ExportTestRun export test and test run information +DeleteEnvironment Delete test environment -export test and test run information for debugging +Deletes a test environment @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param testId id of the test - @param runId id of the run - @return ApiExportTestRunRequest + @param environmentID ID for environment + @return ApiDeleteEnvironmentRequest */ -func (a *ApiApiService) ExportTestRun(ctx context.Context, testId string, runId int32) ApiExportTestRunRequest { - return ApiExportTestRunRequest{ - ApiService: a, - ctx: ctx, - testId: testId, - runId: runId, +func (a *ApiApiService) DeleteEnvironment(ctx context.Context, environmentID string) ApiDeleteEnvironmentRequest { + return ApiDeleteEnvironmentRequest{ + ApiService: a, + ctx: ctx, + environmentID: environmentID, } } // Execute executes the request // -// @return ExportedTestInformation -func (a *ApiApiService) ExportTestRunExecute(r ApiExportTestRunRequest) (*ExportedTestInformation, *http.Response, error) { +// @return EnvironmentResource +func (a *ApiApiService) DeleteEnvironmentExecute(r ApiDeleteEnvironmentRequest) (*EnvironmentResource, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodDelete localVarPostBody interface{} formFiles []formFile - localVarReturnValue *ExportedTestInformation + localVarReturnValue *EnvironmentResource ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.ExportTestRun") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.DeleteEnvironment") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/tests/{testId}/run/{runId}/export" - localVarPath = strings.Replace(localVarPath, "{"+"testId"+"}", url.PathEscape(parameterValueToString(r.testId, "testId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"runId"+"}", url.PathEscape(parameterValueToString(r.runId, "runId")), -1) + localVarPath := localBasePath + "/environments/{environmentID}" + localVarPath = strings.Replace(localVarPath, "{"+"environmentID"+"}", url.PathEscape(parameterValueToString(r.environmentID, "environmentID")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -546,60 +570,58 @@ func (a *ApiApiService) ExportTestRunExecute(r ApiExportTestRunRequest) (*Export return localVarReturnValue, localVarHTTPResponse, nil } -type ApiExpressionResolveRequest struct { - ctx context.Context - ApiService *ApiApiService - resolveRequestInfo *ResolveRequestInfo -} - -func (r ApiExpressionResolveRequest) ResolveRequestInfo(resolveRequestInfo ResolveRequestInfo) ApiExpressionResolveRequest { - r.resolveRequestInfo = &resolveRequestInfo - return r +type ApiDeleteInviteRequest struct { + ctx context.Context + ApiService *ApiApiService + inviteID string } -func (r ApiExpressionResolveRequest) Execute() (*ResolveResponseInfo, *http.Response, error) { - return r.ApiService.ExpressionResolveExecute(r) +func (r ApiDeleteInviteRequest) Execute() (*InviteResource, *http.Response, error) { + return r.ApiService.DeleteInviteExecute(r) } /* -ExpressionResolve resolves an expression and returns the result string +DeleteInvite Delete pending invite -resolves an expression and returns the result string +delete pending invite @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiExpressionResolveRequest + @param inviteID ID for invite + @return ApiDeleteInviteRequest */ -func (a *ApiApiService) ExpressionResolve(ctx context.Context) ApiExpressionResolveRequest { - return ApiExpressionResolveRequest{ +func (a *ApiApiService) DeleteInvite(ctx context.Context, inviteID string) ApiDeleteInviteRequest { + return ApiDeleteInviteRequest{ ApiService: a, ctx: ctx, + inviteID: inviteID, } } // Execute executes the request // -// @return ResolveResponseInfo -func (a *ApiApiService) ExpressionResolveExecute(r ApiExpressionResolveRequest) (*ResolveResponseInfo, *http.Response, error) { +// @return InviteResource +func (a *ApiApiService) DeleteInviteExecute(r ApiDeleteInviteRequest) (*InviteResource, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost + localVarHTTPMethod = http.MethodDelete localVarPostBody interface{} formFiles []formFile - localVarReturnValue *ResolveResponseInfo + localVarReturnValue *InviteResource ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.ExpressionResolve") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.DeleteInvite") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/expressions/resolve" + localVarPath := localBasePath + "/invites/{inviteID}" + localVarPath = strings.Replace(localVarPath, "{"+"inviteID"+"}", url.PathEscape(parameterValueToString(r.inviteID, "inviteID")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -615,8 +637,6 @@ func (a *ApiApiService) ExpressionResolveExecute(r ApiExpressionResolveRequest) if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - // body params - localVarPostBody = r.resolveRequestInfo req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -654,47 +674,1859 @@ func (a *ApiApiService) ExpressionResolveExecute(r ApiExpressionResolveRequest) return localVarReturnValue, localVarHTTPResponse, nil } -type ApiGetOTLPConnectionInformationRequest struct { +type ApiDeleteTestRunRequest struct { ctx context.Context ApiService *ApiApiService + testId string + runId int32 } -func (r ApiGetOTLPConnectionInformationRequest) Execute() (*OTLPTestConnectionResponse, *http.Response, error) { - return r.ApiService.GetOTLPConnectionInformationExecute(r) +func (r ApiDeleteTestRunRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteTestRunExecute(r) } /* -GetOTLPConnectionInformation get information about the OTLP connection +DeleteTestRun delete a test run + +delete a test run + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param testId id of the test + @param runId id of the run + @return ApiDeleteTestRunRequest +*/ +func (a *ApiApiService) DeleteTestRun(ctx context.Context, testId string, runId int32) ApiDeleteTestRunRequest { + return ApiDeleteTestRunRequest{ + ApiService: a, + ctx: ctx, + testId: testId, + runId: runId, + } +} + +// Execute executes the request +func (a *ApiApiService) DeleteTestRunExecute(r ApiDeleteTestRunRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.DeleteTestRun") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/tests/{testId}/run/{runId}" + localVarPath = strings.Replace(localVarPath, "{"+"testId"+"}", url.PathEscape(parameterValueToString(r.testId, "testId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"runId"+"}", url.PathEscape(parameterValueToString(r.runId, "runId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiDeleteTestSuiteRunRequest struct { + ctx context.Context + ApiService *ApiApiService + testSuiteId string + runId int32 +} + +func (r ApiDeleteTestSuiteRunRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteTestSuiteRunExecute(r) +} + +/* +DeleteTestSuiteRun Delete a specific run from a particular TestSuite + +Delete a specific run from a particular TestSuite + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param testSuiteId id of the TestSuite + @param runId id of the run + @return ApiDeleteTestSuiteRunRequest +*/ +func (a *ApiApiService) DeleteTestSuiteRun(ctx context.Context, testSuiteId string, runId int32) ApiDeleteTestSuiteRunRequest { + return ApiDeleteTestSuiteRunRequest{ + ApiService: a, + ctx: ctx, + testSuiteId: testSuiteId, + runId: runId, + } +} + +// Execute executes the request +func (a *ApiApiService) DeleteTestSuiteRunExecute(r ApiDeleteTestSuiteRunRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.DeleteTestSuiteRun") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/testsuites/{testSuiteId}/run/{runId}" + localVarPath = strings.Replace(localVarPath, "{"+"testSuiteId"+"}", url.PathEscape(parameterValueToString(r.testSuiteId, "testSuiteId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"runId"+"}", url.PathEscape(parameterValueToString(r.runId, "runId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiDeleteTokenRequest struct { + ctx context.Context + ApiService *ApiApiService + tokenID string +} + +func (r ApiDeleteTokenRequest) Execute() (*Token, *http.Response, error) { + return r.ApiService.DeleteTokenExecute(r) +} + +/* +DeleteToken Delete token for environment + +delete token + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param tokenID ID for token + @return ApiDeleteTokenRequest +*/ +func (a *ApiApiService) DeleteToken(ctx context.Context, tokenID string) ApiDeleteTokenRequest { + return ApiDeleteTokenRequest{ + ApiService: a, + ctx: ctx, + tokenID: tokenID, + } +} + +// Execute executes the request +// +// @return Token +func (a *ApiApiService) DeleteTokenExecute(r ApiDeleteTokenRequest) (*Token, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Token + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.DeleteToken") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/tokens/{tokenID}" + localVarPath = strings.Replace(localVarPath, "{"+"tokenID"+"}", url.PathEscape(parameterValueToString(r.tokenID, "tokenID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDryRunAssertionRequest struct { + ctx context.Context + ApiService *ApiApiService + testId string + runId int32 + testSpecs *TestSpecs +} + +func (r ApiDryRunAssertionRequest) TestSpecs(testSpecs TestSpecs) ApiDryRunAssertionRequest { + r.testSpecs = &testSpecs + return r +} + +func (r ApiDryRunAssertionRequest) Execute() (*AssertionResults, *http.Response, error) { + return r.ApiService.DryRunAssertionExecute(r) +} + +/* +DryRunAssertion run given assertions against the traces from the given run without persisting anything + +use this method to test a definition against an actual trace without creating a new version or persisting anything + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param testId id of the test + @param runId id of the run + @return ApiDryRunAssertionRequest +*/ +func (a *ApiApiService) DryRunAssertion(ctx context.Context, testId string, runId int32) ApiDryRunAssertionRequest { + return ApiDryRunAssertionRequest{ + ApiService: a, + ctx: ctx, + testId: testId, + runId: runId, + } +} + +// Execute executes the request +// +// @return AssertionResults +func (a *ApiApiService) DryRunAssertionExecute(r ApiDryRunAssertionRequest) (*AssertionResults, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AssertionResults + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.DryRunAssertion") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/tests/{testId}/run/{runId}/dry-run" + localVarPath = strings.Replace(localVarPath, "{"+"testId"+"}", url.PathEscape(parameterValueToString(r.testId, "testId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"runId"+"}", url.PathEscape(parameterValueToString(r.runId, "runId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.testSpecs + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiExportTestRunRequest struct { + ctx context.Context + ApiService *ApiApiService + testId string + runId int32 +} + +func (r ApiExportTestRunRequest) Execute() (*ExportedTestInformation, *http.Response, error) { + return r.ApiService.ExportTestRunExecute(r) +} + +/* +ExportTestRun export test and test run information + +export test and test run information for debugging + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param testId id of the test + @param runId id of the run + @return ApiExportTestRunRequest +*/ +func (a *ApiApiService) ExportTestRun(ctx context.Context, testId string, runId int32) ApiExportTestRunRequest { + return ApiExportTestRunRequest{ + ApiService: a, + ctx: ctx, + testId: testId, + runId: runId, + } +} + +// Execute executes the request +// +// @return ExportedTestInformation +func (a *ApiApiService) ExportTestRunExecute(r ApiExportTestRunRequest) (*ExportedTestInformation, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ExportedTestInformation + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.ExportTestRun") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/tests/{testId}/run/{runId}/export" + localVarPath = strings.Replace(localVarPath, "{"+"testId"+"}", url.PathEscape(parameterValueToString(r.testId, "testId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"runId"+"}", url.PathEscape(parameterValueToString(r.runId, "runId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiExpressionResolveRequest struct { + ctx context.Context + ApiService *ApiApiService + resolveRequestInfo *ResolveRequestInfo +} + +func (r ApiExpressionResolveRequest) ResolveRequestInfo(resolveRequestInfo ResolveRequestInfo) ApiExpressionResolveRequest { + r.resolveRequestInfo = &resolveRequestInfo + return r +} + +func (r ApiExpressionResolveRequest) Execute() (*ResolveResponseInfo, *http.Response, error) { + return r.ApiService.ExpressionResolveExecute(r) +} + +/* +ExpressionResolve resolves an expression and returns the result string + +resolves an expression and returns the result string + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiExpressionResolveRequest +*/ +func (a *ApiApiService) ExpressionResolve(ctx context.Context) ApiExpressionResolveRequest { + return ApiExpressionResolveRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return ResolveResponseInfo +func (a *ApiApiService) ExpressionResolveExecute(r ApiExpressionResolveRequest) (*ResolveResponseInfo, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ResolveResponseInfo + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.ExpressionResolve") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/expressions/resolve" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.resolveRequestInfo + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetEnvironmentRequest struct { + ctx context.Context + ApiService *ApiApiService + environmentID string +} + +func (r ApiGetEnvironmentRequest) Execute() (*EnvironmentResource, *http.Response, error) { + return r.ApiService.GetEnvironmentExecute(r) +} + +/* +GetEnvironment Get environment by ID + +Get test environment by ID from CRD in kubernetes cluster + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param environmentID ID for environment + @return ApiGetEnvironmentRequest +*/ +func (a *ApiApiService) GetEnvironment(ctx context.Context, environmentID string) ApiGetEnvironmentRequest { + return ApiGetEnvironmentRequest{ + ApiService: a, + ctx: ctx, + environmentID: environmentID, + } +} + +// Execute executes the request +// +// @return EnvironmentResource +func (a *ApiApiService) GetEnvironmentExecute(r ApiGetEnvironmentRequest) (*EnvironmentResource, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *EnvironmentResource + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetEnvironment") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/environments/{environmentID}" + localVarPath = strings.Replace(localVarPath, "{"+"environmentID"+"}", url.PathEscape(parameterValueToString(r.environmentID, "environmentID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetInviteRequest struct { + ctx context.Context + ApiService *ApiApiService + inviteID string +} + +func (r ApiGetInviteRequest) Execute() (*InviteResource, *http.Response, error) { + return r.ApiService.GetInviteExecute(r) +} + +/* +GetInvite Get invite + +get invite + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param inviteID ID for invite + @return ApiGetInviteRequest +*/ +func (a *ApiApiService) GetInvite(ctx context.Context, inviteID string) ApiGetInviteRequest { + return ApiGetInviteRequest{ + ApiService: a, + ctx: ctx, + inviteID: inviteID, + } +} + +// Execute executes the request +// +// @return InviteResource +func (a *ApiApiService) GetInviteExecute(r ApiGetInviteRequest) (*InviteResource, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *InviteResource + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetInvite") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/invites/{inviteID}" + localVarPath = strings.Replace(localVarPath, "{"+"inviteID"+"}", url.PathEscape(parameterValueToString(r.inviteID, "inviteID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetOTLPConnectionInformationRequest struct { + ctx context.Context + ApiService *ApiApiService +} + +func (r ApiGetOTLPConnectionInformationRequest) Execute() (*OTLPTestConnectionResponse, *http.Response, error) { + return r.ApiService.GetOTLPConnectionInformationExecute(r) +} + +/* +GetOTLPConnectionInformation get information about the OTLP connection get information about the OTLP connection @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiGetOTLPConnectionInformationRequest + @return ApiGetOTLPConnectionInformationRequest +*/ +func (a *ApiApiService) GetOTLPConnectionInformation(ctx context.Context) ApiGetOTLPConnectionInformationRequest { + return ApiGetOTLPConnectionInformationRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return OTLPTestConnectionResponse +func (a *ApiApiService) GetOTLPConnectionInformationExecute(r ApiGetOTLPConnectionInformationRequest) (*OTLPTestConnectionResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *OTLPTestConnectionResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetOTLPConnectionInformation") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/config/connection/otlp" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetResourcesRequest struct { + ctx context.Context + ApiService *ApiApiService + take *int32 + skip *int32 + query *string + sortBy *string + sortDirection *string +} + +// indicates how many resources can be returned by each page +func (r ApiGetResourcesRequest) Take(take int32) ApiGetResourcesRequest { + r.take = &take + return r +} + +// indicates how many resources will be skipped when paginating +func (r ApiGetResourcesRequest) Skip(skip int32) ApiGetResourcesRequest { + r.skip = &skip + return r +} + +// query to search resources +func (r ApiGetResourcesRequest) Query(query string) ApiGetResourcesRequest { + r.query = &query + return r +} + +// indicates the sort field for the resources +func (r ApiGetResourcesRequest) SortBy(sortBy string) ApiGetResourcesRequest { + r.sortBy = &sortBy + return r +} + +// indicates the sort direction for the resources +func (r ApiGetResourcesRequest) SortDirection(sortDirection string) ApiGetResourcesRequest { + r.sortDirection = &sortDirection + return r +} + +func (r ApiGetResourcesRequest) Execute() ([]Resource, *http.Response, error) { + return r.ApiService.GetResourcesExecute(r) +} + +/* +GetResources Get resources + +get resources + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetResourcesRequest +*/ +func (a *ApiApiService) GetResources(ctx context.Context) ApiGetResourcesRequest { + return ApiGetResourcesRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return []Resource +func (a *ApiApiService) GetResourcesExecute(r ApiGetResourcesRequest) ([]Resource, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []Resource + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetResources") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/resources" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.take != nil { + parameterAddToQuery(localVarQueryParams, "take", r.take, "") + } + if r.skip != nil { + parameterAddToQuery(localVarQueryParams, "skip", r.skip, "") + } + if r.query != nil { + parameterAddToQuery(localVarQueryParams, "query", r.query, "") + } + if r.sortBy != nil { + parameterAddToQuery(localVarQueryParams, "sortBy", r.sortBy, "") + } + if r.sortDirection != nil { + parameterAddToQuery(localVarQueryParams, "sortDirection", r.sortDirection, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetRunGroupRequest struct { + ctx context.Context + ApiService *ApiApiService + runGroupId string +} + +func (r ApiGetRunGroupRequest) Execute() (*RunGroup, *http.Response, error) { + return r.ApiService.GetRunGroupExecute(r) +} + +/* +GetRunGroup Get a run group + +Get a run groups in the system + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param runGroupId ID of an RunGroup + @return ApiGetRunGroupRequest +*/ +func (a *ApiApiService) GetRunGroup(ctx context.Context, runGroupId string) ApiGetRunGroupRequest { + return ApiGetRunGroupRequest{ + ApiService: a, + ctx: ctx, + runGroupId: runGroupId, + } +} + +// Execute executes the request +// +// @return RunGroup +func (a *ApiApiService) GetRunGroupExecute(r ApiGetRunGroupRequest) (*RunGroup, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RunGroup + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetRunGroup") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/rungroups/{runGroupId}" + localVarPath = strings.Replace(localVarPath, "{"+"runGroupId"+"}", url.PathEscape(parameterValueToString(r.runGroupId, "runGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetRunGroupsRequest struct { + ctx context.Context + ApiService *ApiApiService + take *int32 + skip *int32 + status *string + sortBy *string + sortDirection *string +} + +// indicates how many resources can be returned by each page +func (r ApiGetRunGroupsRequest) Take(take int32) ApiGetRunGroupsRequest { + r.take = &take + return r +} + +// indicates how many resources will be skipped when paginating +func (r ApiGetRunGroupsRequest) Skip(skip int32) ApiGetRunGroupsRequest { + r.skip = &skip + return r +} + +// query to search resources by status +func (r ApiGetRunGroupsRequest) Status(status string) ApiGetRunGroupsRequest { + r.status = &status + return r +} + +// indicates the sort field for the resources +func (r ApiGetRunGroupsRequest) SortBy(sortBy string) ApiGetRunGroupsRequest { + r.sortBy = &sortBy + return r +} + +// indicates the sort direction for the resources +func (r ApiGetRunGroupsRequest) SortDirection(sortDirection string) ApiGetRunGroupsRequest { + r.sortDirection = &sortDirection + return r +} + +func (r ApiGetRunGroupsRequest) Execute() (*RunGroupList, *http.Response, error) { + return r.ApiService.GetRunGroupsExecute(r) +} + +/* +GetRunGroups Get all run groups + +Get all the run groups in the system + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetRunGroupsRequest +*/ +func (a *ApiApiService) GetRunGroups(ctx context.Context) ApiGetRunGroupsRequest { + return ApiGetRunGroupsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return RunGroupList +func (a *ApiApiService) GetRunGroupsExecute(r ApiGetRunGroupsRequest) (*RunGroupList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RunGroupList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetRunGroups") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/rungroups" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.take != nil { + parameterAddToQuery(localVarQueryParams, "take", r.take, "") + } + if r.skip != nil { + parameterAddToQuery(localVarQueryParams, "skip", r.skip, "") + } + if r.status != nil { + parameterAddToQuery(localVarQueryParams, "status", r.status, "") + } + if r.sortBy != nil { + parameterAddToQuery(localVarQueryParams, "sortBy", r.sortBy, "") + } + if r.sortDirection != nil { + parameterAddToQuery(localVarQueryParams, "sortDirection", r.sortDirection, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetRunResultJUnitRequest struct { + ctx context.Context + ApiService *ApiApiService + testId string + runId int32 +} + +func (r ApiGetRunResultJUnitRequest) Execute() (string, *http.Response, error) { + return r.ApiService.GetRunResultJUnitExecute(r) +} + +/* +GetRunResultJUnit get test run results in JUnit xml format + +get test run results in JUnit xml format + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param testId id of the test + @param runId id of the run + @return ApiGetRunResultJUnitRequest +*/ +func (a *ApiApiService) GetRunResultJUnit(ctx context.Context, testId string, runId int32) ApiGetRunResultJUnitRequest { + return ApiGetRunResultJUnitRequest{ + ApiService: a, + ctx: ctx, + testId: testId, + runId: runId, + } +} + +// Execute executes the request +// +// @return string +func (a *ApiApiService) GetRunResultJUnitExecute(r ApiGetRunResultJUnitRequest) (string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetRunResultJUnit") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/tests/{testId}/run/{runId}/junit.xml" + localVarPath = strings.Replace(localVarPath, "{"+"testId"+"}", url.PathEscape(parameterValueToString(r.testId, "testId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"runId"+"}", url.PathEscape(parameterValueToString(r.runId, "runId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/xml"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetRunsFromRunGroupRequest struct { + ctx context.Context + ApiService *ApiApiService + take *int32 + skip *int32 + runGroupIds *string +} + +// indicates how many resources can be returned by each page +func (r ApiGetRunsFromRunGroupRequest) Take(take int32) ApiGetRunsFromRunGroupRequest { + r.take = &take + return r +} + +// indicates how many resources will be skipped when paginating +func (r ApiGetRunsFromRunGroupRequest) Skip(skip int32) ApiGetRunsFromRunGroupRequest { + r.skip = &skip + return r +} + +// IDs for RunGroup +func (r ApiGetRunsFromRunGroupRequest) RunGroupIds(runGroupIds string) ApiGetRunsFromRunGroupRequest { + r.runGroupIds = &runGroupIds + return r +} + +func (r ApiGetRunsFromRunGroupRequest) Execute() (*RunGroupRun, *http.Response, error) { + return r.ApiService.GetRunsFromRunGroupExecute(r) +} + +/* +GetRunsFromRunGroup Get all runs from a run group + +Get all runs from a run group + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetRunsFromRunGroupRequest +*/ +func (a *ApiApiService) GetRunsFromRunGroup(ctx context.Context) ApiGetRunsFromRunGroupRequest { + return ApiGetRunsFromRunGroupRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return RunGroupRun +func (a *ApiApiService) GetRunsFromRunGroupExecute(r ApiGetRunsFromRunGroupRequest) (*RunGroupRun, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RunGroupRun + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetRunsFromRunGroup") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/runs" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.take != nil { + parameterAddToQuery(localVarQueryParams, "take", r.take, "") + } + if r.skip != nil { + parameterAddToQuery(localVarQueryParams, "skip", r.skip, "") + } + if r.runGroupIds != nil { + parameterAddToQuery(localVarQueryParams, "runGroupIds", r.runGroupIds, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetTestResultSelectedSpansRequest struct { + ctx context.Context + ApiService *ApiApiService + testId string + runId int32 + query *string +} + +// query to search resources +func (r ApiGetTestResultSelectedSpansRequest) Query(query string) ApiGetTestResultSelectedSpansRequest { + r.query = &query + return r +} + +func (r ApiGetTestResultSelectedSpansRequest) Execute() (*SelectedSpansResult, *http.Response, error) { + return r.ApiService.GetTestResultSelectedSpansExecute(r) +} + +/* +GetTestResultSelectedSpans retrieve spans that will be selected by selector + +get the spans ids that would be selected by a specific selector query + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param testId id of the test + @param runId id of the run + @return ApiGetTestResultSelectedSpansRequest +*/ +func (a *ApiApiService) GetTestResultSelectedSpans(ctx context.Context, testId string, runId int32) ApiGetTestResultSelectedSpansRequest { + return ApiGetTestResultSelectedSpansRequest{ + ApiService: a, + ctx: ctx, + testId: testId, + runId: runId, + } +} + +// Execute executes the request +// +// @return SelectedSpansResult +func (a *ApiApiService) GetTestResultSelectedSpansExecute(r ApiGetTestResultSelectedSpansRequest) (*SelectedSpansResult, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SelectedSpansResult + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetTestResultSelectedSpans") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/tests/{testId}/run/{runId}/select" + localVarPath = strings.Replace(localVarPath, "{"+"testId"+"}", url.PathEscape(parameterValueToString(r.testId, "testId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"runId"+"}", url.PathEscape(parameterValueToString(r.runId, "runId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.query != nil { + parameterAddToQuery(localVarQueryParams, "query", r.query, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetTestRunRequest struct { + ctx context.Context + ApiService *ApiApiService + testId string + runId int32 +} + +func (r ApiGetTestRunRequest) Execute() (*TestRun, *http.Response, error) { + return r.ApiService.GetTestRunExecute(r) +} + +/* +GetTestRun get test Run + +get a particular test Run + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param testId id of the test + @param runId id of the run + @return ApiGetTestRunRequest +*/ +func (a *ApiApiService) GetTestRun(ctx context.Context, testId string, runId int32) ApiGetTestRunRequest { + return ApiGetTestRunRequest{ + ApiService: a, + ctx: ctx, + testId: testId, + runId: runId, + } +} + +// Execute executes the request +// +// @return TestRun +func (a *ApiApiService) GetTestRunExecute(r ApiGetTestRunRequest) (*TestRun, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *TestRun + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetTestRun") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/tests/{testId}/run/{runId}" + localVarPath = strings.Replace(localVarPath, "{"+"testId"+"}", url.PathEscape(parameterValueToString(r.testId, "testId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"runId"+"}", url.PathEscape(parameterValueToString(r.runId, "runId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetTestRunEventsRequest struct { + ctx context.Context + ApiService *ApiApiService + testId string + runId int32 +} + +func (r ApiGetTestRunEventsRequest) Execute() ([]TestRunEvent, *http.Response, error) { + return r.ApiService.GetTestRunEventsExecute(r) +} + +/* +GetTestRunEvents get events from a test run + +get events from a test run + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param testId id of the test + @param runId id of the run + @return ApiGetTestRunEventsRequest */ -func (a *ApiApiService) GetOTLPConnectionInformation(ctx context.Context) ApiGetOTLPConnectionInformationRequest { - return ApiGetOTLPConnectionInformationRequest{ +func (a *ApiApiService) GetTestRunEvents(ctx context.Context, testId string, runId int32) ApiGetTestRunEventsRequest { + return ApiGetTestRunEventsRequest{ ApiService: a, ctx: ctx, + testId: testId, + runId: runId, } } // Execute executes the request // -// @return OTLPTestConnectionResponse -func (a *ApiApiService) GetOTLPConnectionInformationExecute(r ApiGetOTLPConnectionInformationRequest) (*OTLPTestConnectionResponse, *http.Response, error) { +// @return []TestRunEvent +func (a *ApiApiService) GetTestRunEventsExecute(r ApiGetTestRunEventsRequest) ([]TestRunEvent, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *OTLPTestConnectionResponse + localVarReturnValue []TestRunEvent ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetOTLPConnectionInformation") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetTestRunEvents") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/config/connection/otlp" + localVarPath := localBasePath + "/tests/{testId}/run/{runId}/events" + localVarPath = strings.Replace(localVarPath, "{"+"testId"+"}", url.PathEscape(parameterValueToString(r.testId, "testId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"runId"+"}", url.PathEscape(parameterValueToString(r.runId, "runId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -754,82 +2586,65 @@ func (a *ApiApiService) GetOTLPConnectionInformationExecute(r ApiGetOTLPConnecti return localVarReturnValue, localVarHTTPResponse, nil } -type ApiGetResourcesRequest struct { - ctx context.Context - ApiService *ApiApiService - take *int32 - skip *int32 - query *string - sortBy *string - sortDirection *string +type ApiGetTestRunsRequest struct { + ctx context.Context + ApiService *ApiApiService + testId string + take *int32 + skip *int32 } // indicates how many resources can be returned by each page -func (r ApiGetResourcesRequest) Take(take int32) ApiGetResourcesRequest { +func (r ApiGetTestRunsRequest) Take(take int32) ApiGetTestRunsRequest { r.take = &take return r } // indicates how many resources will be skipped when paginating -func (r ApiGetResourcesRequest) Skip(skip int32) ApiGetResourcesRequest { +func (r ApiGetTestRunsRequest) Skip(skip int32) ApiGetTestRunsRequest { r.skip = &skip return r } -// query to search resources -func (r ApiGetResourcesRequest) Query(query string) ApiGetResourcesRequest { - r.query = &query - return r -} - -// indicates the sort field for the resources -func (r ApiGetResourcesRequest) SortBy(sortBy string) ApiGetResourcesRequest { - r.sortBy = &sortBy - return r -} - -// indicates the sort direction for the resources -func (r ApiGetResourcesRequest) SortDirection(sortDirection string) ApiGetResourcesRequest { - r.sortDirection = &sortDirection - return r -} - -func (r ApiGetResourcesRequest) Execute() ([]Resource, *http.Response, error) { - return r.ApiService.GetResourcesExecute(r) +func (r ApiGetTestRunsRequest) Execute() ([]TestRun, *http.Response, error) { + return r.ApiService.GetTestRunsExecute(r) } /* -GetResources Get resources +GetTestRuns get the runs for a test -get resources +get the runs from a particular test @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiGetResourcesRequest + @param testId id of the test + @return ApiGetTestRunsRequest */ -func (a *ApiApiService) GetResources(ctx context.Context) ApiGetResourcesRequest { - return ApiGetResourcesRequest{ +func (a *ApiApiService) GetTestRuns(ctx context.Context, testId string) ApiGetTestRunsRequest { + return ApiGetTestRunsRequest{ ApiService: a, ctx: ctx, + testId: testId, } } // Execute executes the request // -// @return []Resource -func (a *ApiApiService) GetResourcesExecute(r ApiGetResourcesRequest) ([]Resource, *http.Response, error) { +// @return []TestRun +func (a *ApiApiService) GetTestRunsExecute(r ApiGetTestRunsRequest) ([]TestRun, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue []Resource + localVarReturnValue []TestRun ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetResources") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetTestRuns") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/resources" + localVarPath := localBasePath + "/tests/{testId}/run" + localVarPath = strings.Replace(localVarPath, "{"+"testId"+"}", url.PathEscape(parameterValueToString(r.testId, "testId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -841,15 +2656,6 @@ func (a *ApiApiService) GetResourcesExecute(r ApiGetResourcesRequest) ([]Resourc if r.skip != nil { parameterAddToQuery(localVarQueryParams, "skip", r.skip, "") } - if r.query != nil { - parameterAddToQuery(localVarQueryParams, "query", r.query, "") - } - if r.sortBy != nil { - parameterAddToQuery(localVarQueryParams, "sortBy", r.sortBy, "") - } - if r.sortDirection != nil { - parameterAddToQuery(localVarQueryParams, "sortDirection", r.sortDirection, "") - } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -904,51 +2710,51 @@ func (a *ApiApiService) GetResourcesExecute(r ApiGetResourcesRequest) ([]Resourc return localVarReturnValue, localVarHTTPResponse, nil } -type ApiGetRunGroupRequest struct { +type ApiGetTestSpecsRequest struct { ctx context.Context ApiService *ApiApiService - runGroupId string + testId string } -func (r ApiGetRunGroupRequest) Execute() (*RunGroup, *http.Response, error) { - return r.ApiService.GetRunGroupExecute(r) +func (r ApiGetTestSpecsRequest) Execute() ([]TestSpecs, *http.Response, error) { + return r.ApiService.GetTestSpecsExecute(r) } /* -GetRunGroup Get a run group +GetTestSpecs Get definition for a test -Get a run groups in the system +Gets definition for a test @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param runGroupId ID of an RunGroup - @return ApiGetRunGroupRequest + @param testId id of the test + @return ApiGetTestSpecsRequest */ -func (a *ApiApiService) GetRunGroup(ctx context.Context, runGroupId string) ApiGetRunGroupRequest { - return ApiGetRunGroupRequest{ +func (a *ApiApiService) GetTestSpecs(ctx context.Context, testId string) ApiGetTestSpecsRequest { + return ApiGetTestSpecsRequest{ ApiService: a, ctx: ctx, - runGroupId: runGroupId, + testId: testId, } } // Execute executes the request // -// @return RunGroup -func (a *ApiApiService) GetRunGroupExecute(r ApiGetRunGroupRequest) (*RunGroup, *http.Response, error) { +// @return []TestSpecs +func (a *ApiApiService) GetTestSpecsExecute(r ApiGetTestSpecsRequest) ([]TestSpecs, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *RunGroup + localVarReturnValue []TestSpecs ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetRunGroup") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetTestSpecs") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/rungroups/{runGroupId}" - localVarPath = strings.Replace(localVarPath, "{"+"runGroupId"+"}", url.PathEscape(parameterValueToString(r.runGroupId, "runGroupId")), -1) + localVarPath := localBasePath + "/tests/{testId}/definition" + localVarPath = strings.Replace(localVarPath, "{"+"testId"+"}", url.PathEscape(parameterValueToString(r.testId, "testId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1008,82 +2814,173 @@ func (a *ApiApiService) GetRunGroupExecute(r ApiGetRunGroupRequest) (*RunGroup, return localVarReturnValue, localVarHTTPResponse, nil } -type ApiGetRunGroupsRequest struct { - ctx context.Context - ApiService *ApiApiService - take *int32 - skip *int32 - status *string - sortBy *string - sortDirection *string +type ApiGetTestSuiteRunRequest struct { + ctx context.Context + ApiService *ApiApiService + testSuiteId string + runId int32 } -// indicates how many resources can be returned by each page -func (r ApiGetRunGroupsRequest) Take(take int32) ApiGetRunGroupsRequest { - r.take = &take - return r +func (r ApiGetTestSuiteRunRequest) Execute() (*TestSuiteRun, *http.Response, error) { + return r.ApiService.GetTestSuiteRunExecute(r) } -// indicates how many resources will be skipped when paginating -func (r ApiGetRunGroupsRequest) Skip(skip int32) ApiGetRunGroupsRequest { - r.skip = &skip - return r +/* +GetTestSuiteRun Get a specific run from a particular TestSuite + +Get a specific run from a particular TestSuite + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param testSuiteId id of the TestSuite + @param runId id of the run + @return ApiGetTestSuiteRunRequest +*/ +func (a *ApiApiService) GetTestSuiteRun(ctx context.Context, testSuiteId string, runId int32) ApiGetTestSuiteRunRequest { + return ApiGetTestSuiteRunRequest{ + ApiService: a, + ctx: ctx, + testSuiteId: testSuiteId, + runId: runId, + } } -// query to search resources by status -func (r ApiGetRunGroupsRequest) Status(status string) ApiGetRunGroupsRequest { - r.status = &status - return r +// Execute executes the request +// +// @return TestSuiteRun +func (a *ApiApiService) GetTestSuiteRunExecute(r ApiGetTestSuiteRunRequest) (*TestSuiteRun, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *TestSuiteRun + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetTestSuiteRun") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/testsuites/{testSuiteId}/run/{runId}" + localVarPath = strings.Replace(localVarPath, "{"+"testSuiteId"+"}", url.PathEscape(parameterValueToString(r.testSuiteId, "testSuiteId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"runId"+"}", url.PathEscape(parameterValueToString(r.runId, "runId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetTestSuiteRunsRequest struct { + ctx context.Context + ApiService *ApiApiService + testSuiteId string + take *int32 + skip *int32 } -// indicates the sort field for the resources -func (r ApiGetRunGroupsRequest) SortBy(sortBy string) ApiGetRunGroupsRequest { - r.sortBy = &sortBy +// indicates how many resources can be returned by each page +func (r ApiGetTestSuiteRunsRequest) Take(take int32) ApiGetTestSuiteRunsRequest { + r.take = &take return r } -// indicates the sort direction for the resources -func (r ApiGetRunGroupsRequest) SortDirection(sortDirection string) ApiGetRunGroupsRequest { - r.sortDirection = &sortDirection +// indicates how many resources will be skipped when paginating +func (r ApiGetTestSuiteRunsRequest) Skip(skip int32) ApiGetTestSuiteRunsRequest { + r.skip = &skip return r } -func (r ApiGetRunGroupsRequest) Execute() (*RunGroupList, *http.Response, error) { - return r.ApiService.GetRunGroupsExecute(r) +func (r ApiGetTestSuiteRunsRequest) Execute() ([]TestSuiteRun, *http.Response, error) { + return r.ApiService.GetTestSuiteRunsExecute(r) } /* -GetRunGroups Get all run groups +GetTestSuiteRuns Get all runs from a particular TestSuite -Get all the run groups in the system +Get all runs from a particular TestSuite @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiGetRunGroupsRequest + @param testSuiteId id of the TestSuite + @return ApiGetTestSuiteRunsRequest */ -func (a *ApiApiService) GetRunGroups(ctx context.Context) ApiGetRunGroupsRequest { - return ApiGetRunGroupsRequest{ - ApiService: a, - ctx: ctx, +func (a *ApiApiService) GetTestSuiteRuns(ctx context.Context, testSuiteId string) ApiGetTestSuiteRunsRequest { + return ApiGetTestSuiteRunsRequest{ + ApiService: a, + ctx: ctx, + testSuiteId: testSuiteId, } } // Execute executes the request // -// @return RunGroupList -func (a *ApiApiService) GetRunGroupsExecute(r ApiGetRunGroupsRequest) (*RunGroupList, *http.Response, error) { +// @return []TestSuiteRun +func (a *ApiApiService) GetTestSuiteRunsExecute(r ApiGetTestSuiteRunsRequest) ([]TestSuiteRun, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *RunGroupList + localVarReturnValue []TestSuiteRun ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetRunGroups") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetTestSuiteRuns") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/rungroups" + localVarPath := localBasePath + "/testsuites/{testSuiteId}/run" + localVarPath = strings.Replace(localVarPath, "{"+"testSuiteId"+"}", url.PathEscape(parameterValueToString(r.testSuiteId, "testSuiteId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1095,15 +2992,6 @@ func (a *ApiApiService) GetRunGroupsExecute(r ApiGetRunGroupsRequest) (*RunGroup if r.skip != nil { parameterAddToQuery(localVarQueryParams, "skip", r.skip, "") } - if r.status != nil { - parameterAddToQuery(localVarQueryParams, "status", r.status, "") - } - if r.sortBy != nil { - parameterAddToQuery(localVarQueryParams, "sortBy", r.sortBy, "") - } - if r.sortDirection != nil { - parameterAddToQuery(localVarQueryParams, "sortDirection", r.sortDirection, "") - } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1158,55 +3046,55 @@ func (a *ApiApiService) GetRunGroupsExecute(r ApiGetRunGroupsRequest) (*RunGroup return localVarReturnValue, localVarHTTPResponse, nil } -type ApiGetRunResultJUnitRequest struct { - ctx context.Context - ApiService *ApiApiService - testId string - runId int32 +type ApiGetTestSuiteVersionRequest struct { + ctx context.Context + ApiService *ApiApiService + testSuiteId string + version int32 } -func (r ApiGetRunResultJUnitRequest) Execute() (string, *http.Response, error) { - return r.ApiService.GetRunResultJUnitExecute(r) +func (r ApiGetTestSuiteVersionRequest) Execute() (*TestSuite, *http.Response, error) { + return r.ApiService.GetTestSuiteVersionExecute(r) } /* -GetRunResultJUnit get test run results in JUnit xml format +GetTestSuiteVersion get a TestSuite specific version -get test run results in JUnit xml format +get a TestSuite specific version @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param testId id of the test - @param runId id of the run - @return ApiGetRunResultJUnitRequest + @param testSuiteId id of the TestSuite + @param version version of the test + @return ApiGetTestSuiteVersionRequest */ -func (a *ApiApiService) GetRunResultJUnit(ctx context.Context, testId string, runId int32) ApiGetRunResultJUnitRequest { - return ApiGetRunResultJUnitRequest{ - ApiService: a, - ctx: ctx, - testId: testId, - runId: runId, +func (a *ApiApiService) GetTestSuiteVersion(ctx context.Context, testSuiteId string, version int32) ApiGetTestSuiteVersionRequest { + return ApiGetTestSuiteVersionRequest{ + ApiService: a, + ctx: ctx, + testSuiteId: testSuiteId, + version: version, } } // Execute executes the request // -// @return string -func (a *ApiApiService) GetRunResultJUnitExecute(r ApiGetRunResultJUnitRequest) (string, *http.Response, error) { +// @return TestSuite +func (a *ApiApiService) GetTestSuiteVersionExecute(r ApiGetTestSuiteVersionRequest) (*TestSuite, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue string + localVarReturnValue *TestSuite ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetRunResultJUnit") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetTestSuiteVersion") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/tests/{testId}/run/{runId}/junit.xml" - localVarPath = strings.Replace(localVarPath, "{"+"testId"+"}", url.PathEscape(parameterValueToString(r.testId, "testId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"runId"+"}", url.PathEscape(parameterValueToString(r.runId, "runId")), -1) + localVarPath := localBasePath + "/testsuites/{testSuiteId}/version/{version}" + localVarPath = strings.Replace(localVarPath, "{"+"testSuiteId"+"}", url.PathEscape(parameterValueToString(r.testSuiteId, "testSuiteId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"version"+"}", url.PathEscape(parameterValueToString(r.version, "version")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1222,7 +3110,7 @@ func (a *ApiApiService) GetRunResultJUnitExecute(r ApiGetRunResultJUnitRequest) } // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/xml"} + localVarHTTPHeaderAccepts := []string{"application/json"} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) @@ -1266,82 +3154,60 @@ func (a *ApiApiService) GetRunResultJUnitExecute(r ApiGetRunResultJUnitRequest) return localVarReturnValue, localVarHTTPResponse, nil } -type ApiGetRunsFromRunGroupRequest struct { - ctx context.Context - ApiService *ApiApiService - take *int32 - skip *int32 - runGroupIds *string -} - -// indicates how many resources can be returned by each page -func (r ApiGetRunsFromRunGroupRequest) Take(take int32) ApiGetRunsFromRunGroupRequest { - r.take = &take - return r -} - -// indicates how many resources will be skipped when paginating -func (r ApiGetRunsFromRunGroupRequest) Skip(skip int32) ApiGetRunsFromRunGroupRequest { - r.skip = &skip - return r -} - -// IDs for RunGroup -func (r ApiGetRunsFromRunGroupRequest) RunGroupIds(runGroupIds string) ApiGetRunsFromRunGroupRequest { - r.runGroupIds = &runGroupIds - return r +type ApiGetTestVersionRequest struct { + ctx context.Context + ApiService *ApiApiService + testId string + version int32 } -func (r ApiGetRunsFromRunGroupRequest) Execute() (*RunGroupRun, *http.Response, error) { - return r.ApiService.GetRunsFromRunGroupExecute(r) +func (r ApiGetTestVersionRequest) Execute() (*Test, *http.Response, error) { + return r.ApiService.GetTestVersionExecute(r) } /* -GetRunsFromRunGroup Get all runs from a run group +GetTestVersion get a test specific version -Get all runs from a run group +get a test specific version @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiGetRunsFromRunGroupRequest + @param testId id of the test + @param version version of the test + @return ApiGetTestVersionRequest */ -func (a *ApiApiService) GetRunsFromRunGroup(ctx context.Context) ApiGetRunsFromRunGroupRequest { - return ApiGetRunsFromRunGroupRequest{ +func (a *ApiApiService) GetTestVersion(ctx context.Context, testId string, version int32) ApiGetTestVersionRequest { + return ApiGetTestVersionRequest{ ApiService: a, ctx: ctx, + testId: testId, + version: version, } } // Execute executes the request // -// @return RunGroupRun -func (a *ApiApiService) GetRunsFromRunGroupExecute(r ApiGetRunsFromRunGroupRequest) (*RunGroupRun, *http.Response, error) { +// @return Test +func (a *ApiApiService) GetTestVersionExecute(r ApiGetTestVersionRequest) (*Test, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *RunGroupRun + localVarReturnValue *Test ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetRunsFromRunGroup") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetTestVersion") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/runs" + localVarPath := localBasePath + "/tests/{testId}/version/{version}" + localVarPath = strings.Replace(localVarPath, "{"+"testId"+"}", url.PathEscape(parameterValueToString(r.testId, "testId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"version"+"}", url.PathEscape(parameterValueToString(r.version, "version")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if r.take != nil { - parameterAddToQuery(localVarQueryParams, "take", r.take, "") - } - if r.skip != nil { - parameterAddToQuery(localVarQueryParams, "skip", r.skip, "") - } - if r.runGroupIds != nil { - parameterAddToQuery(localVarQueryParams, "runGroupIds", r.runGroupIds, "") - } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1396,70 +3262,56 @@ func (a *ApiApiService) GetRunsFromRunGroupExecute(r ApiGetRunsFromRunGroupReque return localVarReturnValue, localVarHTTPResponse, nil } -type ApiGetTestResultSelectedSpansRequest struct { - ctx context.Context - ApiService *ApiApiService - testId string - runId int32 - query *string -} - -// query to search resources -func (r ApiGetTestResultSelectedSpansRequest) Query(query string) ApiGetTestResultSelectedSpansRequest { - r.query = &query - return r +type ApiGetVersionRequest struct { + ctx context.Context + ApiService *ApiApiService + fileExtension string } -func (r ApiGetTestResultSelectedSpansRequest) Execute() (*SelectedSpansResult, *http.Response, error) { - return r.ApiService.GetTestResultSelectedSpansExecute(r) +func (r ApiGetVersionRequest) Execute() (*Version, *http.Response, error) { + return r.ApiService.GetVersionExecute(r) } /* -GetTestResultSelectedSpans retrieve spans that will be selected by selector +GetVersion Get the version of the API -get the spans ids that would be selected by a specific selector query +Get the version of the API @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param testId id of the test - @param runId id of the run - @return ApiGetTestResultSelectedSpansRequest + @param fileExtension + @return ApiGetVersionRequest */ -func (a *ApiApiService) GetTestResultSelectedSpans(ctx context.Context, testId string, runId int32) ApiGetTestResultSelectedSpansRequest { - return ApiGetTestResultSelectedSpansRequest{ - ApiService: a, - ctx: ctx, - testId: testId, - runId: runId, +func (a *ApiApiService) GetVersion(ctx context.Context, fileExtension string) ApiGetVersionRequest { + return ApiGetVersionRequest{ + ApiService: a, + ctx: ctx, + fileExtension: fileExtension, } } // Execute executes the request // -// @return SelectedSpansResult -func (a *ApiApiService) GetTestResultSelectedSpansExecute(r ApiGetTestResultSelectedSpansRequest) (*SelectedSpansResult, *http.Response, error) { +// @return Version +func (a *ApiApiService) GetVersionExecute(r ApiGetVersionRequest) (*Version, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *SelectedSpansResult + localVarReturnValue *Version ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetTestResultSelectedSpans") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetVersion") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/tests/{testId}/run/{runId}/select" - localVarPath = strings.Replace(localVarPath, "{"+"testId"+"}", url.PathEscape(parameterValueToString(r.testId, "testId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"runId"+"}", url.PathEscape(parameterValueToString(r.runId, "runId")), -1) + localVarPath := localBasePath + "/version.{fileExtension}" + localVarPath = strings.Replace(localVarPath, "{"+"fileExtension"+"}", url.PathEscape(parameterValueToString(r.fileExtension, "fileExtension")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if r.query != nil { - parameterAddToQuery(localVarQueryParams, "query", r.query, "") - } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1514,55 +3366,47 @@ func (a *ApiApiService) GetTestResultSelectedSpansExecute(r ApiGetTestResultSele return localVarReturnValue, localVarHTTPResponse, nil } -type ApiGetTestRunRequest struct { +type ApiGetWizardRequest struct { ctx context.Context ApiService *ApiApiService - testId string - runId int32 } -func (r ApiGetTestRunRequest) Execute() (*TestRun, *http.Response, error) { - return r.ApiService.GetTestRunExecute(r) +func (r ApiGetWizardRequest) Execute() (*Wizard, *http.Response, error) { + return r.ApiService.GetWizardExecute(r) } /* -GetTestRun get test Run +GetWizard Get a specific wizard -get a particular test Run +Get the configured Wizard, showing the state of each step. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param testId id of the test - @param runId id of the run - @return ApiGetTestRunRequest + @return ApiGetWizardRequest */ -func (a *ApiApiService) GetTestRun(ctx context.Context, testId string, runId int32) ApiGetTestRunRequest { - return ApiGetTestRunRequest{ +func (a *ApiApiService) GetWizard(ctx context.Context) ApiGetWizardRequest { + return ApiGetWizardRequest{ ApiService: a, ctx: ctx, - testId: testId, - runId: runId, } } // Execute executes the request // -// @return TestRun -func (a *ApiApiService) GetTestRunExecute(r ApiGetTestRunRequest) (*TestRun, *http.Response, error) { +// @return Wizard +func (a *ApiApiService) GetWizardExecute(r ApiGetWizardRequest) (*Wizard, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *TestRun + localVarReturnValue *Wizard ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetTestRun") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetWizard") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/tests/{testId}/run/{runId}" - localVarPath = strings.Replace(localVarPath, "{"+"testId"+"}", url.PathEscape(parameterValueToString(r.testId, "testId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"runId"+"}", url.PathEscape(parameterValueToString(r.runId, "runId")), -1) + localVarPath := localBasePath + "/wizard" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1622,62 +3466,60 @@ func (a *ApiApiService) GetTestRunExecute(r ApiGetTestRunRequest) (*TestRun, *ht return localVarReturnValue, localVarHTTPResponse, nil } -type ApiGetTestRunEventsRequest struct { - ctx context.Context - ApiService *ApiApiService - testId string - runId int32 +type ApiImportTestRunRequest struct { + ctx context.Context + ApiService *ApiApiService + exportedTestInformation *ExportedTestInformation } -func (r ApiGetTestRunEventsRequest) Execute() ([]TestRunEvent, *http.Response, error) { - return r.ApiService.GetTestRunEventsExecute(r) +func (r ApiImportTestRunRequest) ExportedTestInformation(exportedTestInformation ExportedTestInformation) ApiImportTestRunRequest { + r.exportedTestInformation = &exportedTestInformation + return r +} + +func (r ApiImportTestRunRequest) Execute() (*ExportedTestInformation, *http.Response, error) { + return r.ApiService.ImportTestRunExecute(r) } /* -GetTestRunEvents get events from a test run +ImportTestRun import test and test run information -get events from a test run +import test and test run information for debugging @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param testId id of the test - @param runId id of the run - @return ApiGetTestRunEventsRequest + @return ApiImportTestRunRequest */ -func (a *ApiApiService) GetTestRunEvents(ctx context.Context, testId string, runId int32) ApiGetTestRunEventsRequest { - return ApiGetTestRunEventsRequest{ +func (a *ApiApiService) ImportTestRun(ctx context.Context) ApiImportTestRunRequest { + return ApiImportTestRunRequest{ ApiService: a, ctx: ctx, - testId: testId, - runId: runId, } } // Execute executes the request // -// @return []TestRunEvent -func (a *ApiApiService) GetTestRunEventsExecute(r ApiGetTestRunEventsRequest) ([]TestRunEvent, *http.Response, error) { +// @return ExportedTestInformation +func (a *ApiApiService) ImportTestRunExecute(r ApiImportTestRunRequest) (*ExportedTestInformation, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue []TestRunEvent + localVarReturnValue *ExportedTestInformation ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetTestRunEvents") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.ImportTestRun") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/tests/{testId}/run/{runId}/events" - localVarPath = strings.Replace(localVarPath, "{"+"testId"+"}", url.PathEscape(parameterValueToString(r.testId, "testId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"runId"+"}", url.PathEscape(parameterValueToString(r.runId, "runId")), -1) + localVarPath := localBasePath + "/tests/import" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -1693,6 +3535,8 @@ func (a *ApiApiService) GetTestRunEventsExecute(r ApiGetTestRunEventsRequest) ([ if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.exportedTestInformation req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -1730,65 +3574,75 @@ func (a *ApiApiService) GetTestRunEventsExecute(r ApiGetTestRunEventsRequest) ([ return localVarReturnValue, localVarHTTPResponse, nil } -type ApiGetTestRunsRequest struct { - ctx context.Context - ApiService *ApiApiService - testId string - take *int32 - skip *int32 +type ApiListEnvironmentsRequest struct { + ctx context.Context + ApiService *ApiApiService + take *int32 + skip *int32 + query *string + sortDirection *string } // indicates how many resources can be returned by each page -func (r ApiGetTestRunsRequest) Take(take int32) ApiGetTestRunsRequest { +func (r ApiListEnvironmentsRequest) Take(take int32) ApiListEnvironmentsRequest { r.take = &take return r } // indicates how many resources will be skipped when paginating -func (r ApiGetTestRunsRequest) Skip(skip int32) ApiGetTestRunsRequest { +func (r ApiListEnvironmentsRequest) Skip(skip int32) ApiListEnvironmentsRequest { r.skip = &skip return r } -func (r ApiGetTestRunsRequest) Execute() ([]TestRun, *http.Response, error) { - return r.ApiService.GetTestRunsExecute(r) +// query to search resources +func (r ApiListEnvironmentsRequest) Query(query string) ApiListEnvironmentsRequest { + r.query = &query + return r +} + +// indicates the sort direction for the resources +func (r ApiListEnvironmentsRequest) SortDirection(sortDirection string) ApiListEnvironmentsRequest { + r.sortDirection = &sortDirection + return r +} + +func (r ApiListEnvironmentsRequest) Execute() (*EnvironmentResources, *http.Response, error) { + return r.ApiService.ListEnvironmentsExecute(r) } /* -GetTestRuns get the runs for a test +ListEnvironments List environments -get the runs from a particular test +List environments from an organization @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param testId id of the test - @return ApiGetTestRunsRequest + @return ApiListEnvironmentsRequest */ -func (a *ApiApiService) GetTestRuns(ctx context.Context, testId string) ApiGetTestRunsRequest { - return ApiGetTestRunsRequest{ +func (a *ApiApiService) ListEnvironments(ctx context.Context) ApiListEnvironmentsRequest { + return ApiListEnvironmentsRequest{ ApiService: a, ctx: ctx, - testId: testId, } } // Execute executes the request // -// @return []TestRun -func (a *ApiApiService) GetTestRunsExecute(r ApiGetTestRunsRequest) ([]TestRun, *http.Response, error) { +// @return EnvironmentResources +func (a *ApiApiService) ListEnvironmentsExecute(r ApiListEnvironmentsRequest) (*EnvironmentResources, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue []TestRun + localVarReturnValue *EnvironmentResources ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetTestRuns") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.ListEnvironments") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/tests/{testId}/run" - localVarPath = strings.Replace(localVarPath, "{"+"testId"+"}", url.PathEscape(parameterValueToString(r.testId, "testId")), -1) + localVarPath := localBasePath + "/environments" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1800,6 +3654,12 @@ func (a *ApiApiService) GetTestRunsExecute(r ApiGetTestRunsRequest) ([]TestRun, if r.skip != nil { parameterAddToQuery(localVarQueryParams, "skip", r.skip, "") } + if r.query != nil { + parameterAddToQuery(localVarQueryParams, "query", r.query, "") + } + if r.sortDirection != nil { + parameterAddToQuery(localVarQueryParams, "sortDirection", r.sortDirection, "") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1854,56 +3714,92 @@ func (a *ApiApiService) GetTestRunsExecute(r ApiGetTestRunsRequest) ([]TestRun, return localVarReturnValue, localVarHTTPResponse, nil } -type ApiGetTestSpecsRequest struct { - ctx context.Context - ApiService *ApiApiService - testId string +type ApiListInvitesRequest struct { + ctx context.Context + ApiService *ApiApiService + take *int32 + skip *int32 + query *string + sortDirection *string } -func (r ApiGetTestSpecsRequest) Execute() ([]TestSpecs, *http.Response, error) { - return r.ApiService.GetTestSpecsExecute(r) +// indicates how many resources can be returned by each page +func (r ApiListInvitesRequest) Take(take int32) ApiListInvitesRequest { + r.take = &take + return r +} + +// indicates how many resources will be skipped when paginating +func (r ApiListInvitesRequest) Skip(skip int32) ApiListInvitesRequest { + r.skip = &skip + return r +} + +// query to search resources +func (r ApiListInvitesRequest) Query(query string) ApiListInvitesRequest { + r.query = &query + return r +} + +// indicates the sort direction for the resources +func (r ApiListInvitesRequest) SortDirection(sortDirection string) ApiListInvitesRequest { + r.sortDirection = &sortDirection + return r +} + +func (r ApiListInvitesRequest) Execute() (*InviteResources, *http.Response, error) { + return r.ApiService.ListInvitesExecute(r) } /* -GetTestSpecs Get definition for a test +ListInvites Lists all invites -Gets definition for a test +Lists pending invites @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param testId id of the test - @return ApiGetTestSpecsRequest + @return ApiListInvitesRequest */ -func (a *ApiApiService) GetTestSpecs(ctx context.Context, testId string) ApiGetTestSpecsRequest { - return ApiGetTestSpecsRequest{ +func (a *ApiApiService) ListInvites(ctx context.Context) ApiListInvitesRequest { + return ApiListInvitesRequest{ ApiService: a, ctx: ctx, - testId: testId, } } // Execute executes the request // -// @return []TestSpecs -func (a *ApiApiService) GetTestSpecsExecute(r ApiGetTestSpecsRequest) ([]TestSpecs, *http.Response, error) { +// @return InviteResources +func (a *ApiApiService) ListInvitesExecute(r ApiListInvitesRequest) (*InviteResources, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue []TestSpecs + localVarReturnValue *InviteResources ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetTestSpecs") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.ListInvites") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/tests/{testId}/definition" - localVarPath = strings.Replace(localVarPath, "{"+"testId"+"}", url.PathEscape(parameterValueToString(r.testId, "testId")), -1) + localVarPath := localBasePath + "/invites" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.take != nil { + parameterAddToQuery(localVarQueryParams, "take", r.take, "") + } + if r.skip != nil { + parameterAddToQuery(localVarQueryParams, "skip", r.skip, "") + } + if r.query != nil { + parameterAddToQuery(localVarQueryParams, "query", r.query, "") + } + if r.sortDirection != nil { + parameterAddToQuery(localVarQueryParams, "sortDirection", r.sortDirection, "") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1958,60 +3854,92 @@ func (a *ApiApiService) GetTestSpecsExecute(r ApiGetTestSpecsRequest) ([]TestSpe return localVarReturnValue, localVarHTTPResponse, nil } -type ApiGetTestSuiteRunRequest struct { - ctx context.Context - ApiService *ApiApiService - testSuiteId string - runId int32 +type ApiListTokensRequest struct { + ctx context.Context + ApiService *ApiApiService + take *int32 + skip *int32 + query *string + sortDirection *string } -func (r ApiGetTestSuiteRunRequest) Execute() (*TestSuiteRun, *http.Response, error) { - return r.ApiService.GetTestSuiteRunExecute(r) +// indicates how many resources can be returned by each page +func (r ApiListTokensRequest) Take(take int32) ApiListTokensRequest { + r.take = &take + return r +} + +// indicates how many resources will be skipped when paginating +func (r ApiListTokensRequest) Skip(skip int32) ApiListTokensRequest { + r.skip = &skip + return r +} + +// query to search resources +func (r ApiListTokensRequest) Query(query string) ApiListTokensRequest { + r.query = &query + return r +} + +// indicates the sort direction for the resources +func (r ApiListTokensRequest) SortDirection(sortDirection string) ApiListTokensRequest { + r.sortDirection = &sortDirection + return r +} + +func (r ApiListTokensRequest) Execute() (*Tokens, *http.Response, error) { + return r.ApiService.ListTokensExecute(r) } /* -GetTestSuiteRun Get a specific run from a particular TestSuite +ListTokens Lists all tokens -Get a specific run from a particular TestSuite +Lists tokens @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param testSuiteId id of the TestSuite - @param runId id of the run - @return ApiGetTestSuiteRunRequest + @return ApiListTokensRequest */ -func (a *ApiApiService) GetTestSuiteRun(ctx context.Context, testSuiteId string, runId int32) ApiGetTestSuiteRunRequest { - return ApiGetTestSuiteRunRequest{ - ApiService: a, - ctx: ctx, - testSuiteId: testSuiteId, - runId: runId, +func (a *ApiApiService) ListTokens(ctx context.Context) ApiListTokensRequest { + return ApiListTokensRequest{ + ApiService: a, + ctx: ctx, } } // Execute executes the request // -// @return TestSuiteRun -func (a *ApiApiService) GetTestSuiteRunExecute(r ApiGetTestSuiteRunRequest) (*TestSuiteRun, *http.Response, error) { +// @return Tokens +func (a *ApiApiService) ListTokensExecute(r ApiListTokensRequest) (*Tokens, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *TestSuiteRun + localVarReturnValue *Tokens ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetTestSuiteRun") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.ListTokens") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/testsuites/{testSuiteId}/run/{runId}" - localVarPath = strings.Replace(localVarPath, "{"+"testSuiteId"+"}", url.PathEscape(parameterValueToString(r.testSuiteId, "testSuiteId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"runId"+"}", url.PathEscape(parameterValueToString(r.runId, "runId")), -1) + localVarPath := localBasePath + "/tokens" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.take != nil { + parameterAddToQuery(localVarQueryParams, "take", r.take, "") + } + if r.skip != nil { + parameterAddToQuery(localVarQueryParams, "skip", r.skip, "") + } + if r.query != nil { + parameterAddToQuery(localVarQueryParams, "query", r.query, "") + } + if r.sortDirection != nil { + parameterAddToQuery(localVarQueryParams, "sortDirection", r.sortDirection, "") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -2066,76 +3994,60 @@ func (a *ApiApiService) GetTestSuiteRunExecute(r ApiGetTestSuiteRunRequest) (*Te return localVarReturnValue, localVarHTTPResponse, nil } -type ApiGetTestSuiteRunsRequest struct { - ctx context.Context - ApiService *ApiApiService - testSuiteId string - take *int32 - skip *int32 -} - -// indicates how many resources can be returned by each page -func (r ApiGetTestSuiteRunsRequest) Take(take int32) ApiGetTestSuiteRunsRequest { - r.take = &take - return r -} - -// indicates how many resources will be skipped when paginating -func (r ApiGetTestSuiteRunsRequest) Skip(skip int32) ApiGetTestSuiteRunsRequest { - r.skip = &skip - return r +type ApiRerunTestRunRequest struct { + ctx context.Context + ApiService *ApiApiService + testId string + runId int32 } -func (r ApiGetTestSuiteRunsRequest) Execute() ([]TestSuiteRun, *http.Response, error) { - return r.ApiService.GetTestSuiteRunsExecute(r) +func (r ApiRerunTestRunRequest) Execute() (*TestRun, *http.Response, error) { + return r.ApiService.RerunTestRunExecute(r) } /* -GetTestSuiteRuns Get all runs from a particular TestSuite +RerunTestRun rerun a test run -Get all runs from a particular TestSuite +rerun a test run @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param testSuiteId id of the TestSuite - @return ApiGetTestSuiteRunsRequest + @param testId id of the test + @param runId id of the run + @return ApiRerunTestRunRequest */ -func (a *ApiApiService) GetTestSuiteRuns(ctx context.Context, testSuiteId string) ApiGetTestSuiteRunsRequest { - return ApiGetTestSuiteRunsRequest{ - ApiService: a, - ctx: ctx, - testSuiteId: testSuiteId, +func (a *ApiApiService) RerunTestRun(ctx context.Context, testId string, runId int32) ApiRerunTestRunRequest { + return ApiRerunTestRunRequest{ + ApiService: a, + ctx: ctx, + testId: testId, + runId: runId, } } // Execute executes the request // -// @return []TestSuiteRun -func (a *ApiApiService) GetTestSuiteRunsExecute(r ApiGetTestSuiteRunsRequest) ([]TestSuiteRun, *http.Response, error) { +// @return TestRun +func (a *ApiApiService) RerunTestRunExecute(r ApiRerunTestRunRequest) (*TestRun, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue []TestSuiteRun + localVarReturnValue *TestRun ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetTestSuiteRuns") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.RerunTestRun") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/testsuites/{testSuiteId}/run" - localVarPath = strings.Replace(localVarPath, "{"+"testSuiteId"+"}", url.PathEscape(parameterValueToString(r.testSuiteId, "testSuiteId")), -1) + localVarPath := localBasePath + "/tests/{testId}/run/{runId}/rerun" + localVarPath = strings.Replace(localVarPath, "{"+"testId"+"}", url.PathEscape(parameterValueToString(r.testId, "testId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"runId"+"}", url.PathEscape(parameterValueToString(r.runId, "runId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if r.take != nil { - parameterAddToQuery(localVarQueryParams, "take", r.take, "") - } - if r.skip != nil { - parameterAddToQuery(localVarQueryParams, "skip", r.skip, "") - } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -2190,55 +4102,44 @@ func (a *ApiApiService) GetTestSuiteRunsExecute(r ApiGetTestSuiteRunsRequest) ([ return localVarReturnValue, localVarHTTPResponse, nil } -type ApiGetTestSuiteVersionRequest struct { - ctx context.Context - ApiService *ApiApiService - testSuiteId string - version int32 +type ApiResetOTLPConnectionInformationRequest struct { + ctx context.Context + ApiService *ApiApiService } -func (r ApiGetTestSuiteVersionRequest) Execute() (*TestSuite, *http.Response, error) { - return r.ApiService.GetTestSuiteVersionExecute(r) +func (r ApiResetOTLPConnectionInformationRequest) Execute() (*http.Response, error) { + return r.ApiService.ResetOTLPConnectionInformationExecute(r) } /* -GetTestSuiteVersion get a TestSuite specific version +ResetOTLPConnectionInformation reset the OTLP connection span count -get a TestSuite specific version +reset the OTLP connection span count @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param testSuiteId id of the TestSuite - @param version version of the test - @return ApiGetTestSuiteVersionRequest + @return ApiResetOTLPConnectionInformationRequest */ -func (a *ApiApiService) GetTestSuiteVersion(ctx context.Context, testSuiteId string, version int32) ApiGetTestSuiteVersionRequest { - return ApiGetTestSuiteVersionRequest{ - ApiService: a, - ctx: ctx, - testSuiteId: testSuiteId, - version: version, +func (a *ApiApiService) ResetOTLPConnectionInformation(ctx context.Context) ApiResetOTLPConnectionInformationRequest { + return ApiResetOTLPConnectionInformationRequest{ + ApiService: a, + ctx: ctx, } } // Execute executes the request -// -// @return TestSuite -func (a *ApiApiService) GetTestSuiteVersionExecute(r ApiGetTestSuiteVersionRequest) (*TestSuite, *http.Response, error) { +func (a *ApiApiService) ResetOTLPConnectionInformationExecute(r ApiResetOTLPConnectionInformationRequest) (*http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *TestSuite + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetTestSuiteVersion") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.ResetOTLPConnectionInformation") if err != nil { - return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + return nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/testsuites/{testSuiteId}/version/{version}" - localVarPath = strings.Replace(localVarPath, "{"+"testSuiteId"+"}", url.PathEscape(parameterValueToString(r.testSuiteId, "testSuiteId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"version"+"}", url.PathEscape(parameterValueToString(r.version, "version")), -1) + localVarPath := localBasePath + "/config/connection/otlp/reset" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -2254,7 +4155,7 @@ func (a *ApiApiService) GetTestSuiteVersionExecute(r ApiGetTestSuiteVersionReque } // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} + localVarHTTPHeaderAccepts := []string{} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) @@ -2263,19 +4164,19 @@ func (a *ApiApiService) GetTestSuiteVersionExecute(r ApiGetTestSuiteVersionReque } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return localVarReturnValue, nil, err + return nil, err } localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err + return localVarHTTPResponse, err } localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return localVarReturnValue, localVarHTTPResponse, err + return localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -2283,77 +4184,70 @@ func (a *ApiApiService) GetTestSuiteVersionExecute(r ApiGetTestSuiteVersionReque body: localVarBody, error: localVarHTTPResponse.Status, } - return localVarReturnValue, localVarHTTPResponse, newErr + return localVarHTTPResponse, newErr } - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } + return localVarHTTPResponse, nil +} - return localVarReturnValue, localVarHTTPResponse, nil +type ApiRunTestRequest struct { + ctx context.Context + ApiService *ApiApiService + testId string + runInformation *RunInformation } -type ApiGetTestVersionRequest struct { - ctx context.Context - ApiService *ApiApiService - testId string - version int32 +func (r ApiRunTestRequest) RunInformation(runInformation RunInformation) ApiRunTestRequest { + r.runInformation = &runInformation + return r } -func (r ApiGetTestVersionRequest) Execute() (*Test, *http.Response, error) { - return r.ApiService.GetTestVersionExecute(r) +func (r ApiRunTestRequest) Execute() (*TestRun, *http.Response, error) { + return r.ApiService.RunTestExecute(r) } /* -GetTestVersion get a test specific version +RunTest run test -get a test specific version +run a particular test @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param testId id of the test - @param version version of the test - @return ApiGetTestVersionRequest + @return ApiRunTestRequest */ -func (a *ApiApiService) GetTestVersion(ctx context.Context, testId string, version int32) ApiGetTestVersionRequest { - return ApiGetTestVersionRequest{ +func (a *ApiApiService) RunTest(ctx context.Context, testId string) ApiRunTestRequest { + return ApiRunTestRequest{ ApiService: a, ctx: ctx, testId: testId, - version: version, } } // Execute executes the request // -// @return Test -func (a *ApiApiService) GetTestVersionExecute(r ApiGetTestVersionRequest) (*Test, *http.Response, error) { +// @return TestRun +func (a *ApiApiService) RunTestExecute(r ApiRunTestRequest) (*TestRun, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Test + localVarReturnValue *TestRun ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetTestVersion") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.RunTest") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/tests/{testId}/version/{version}" + localVarPath := localBasePath + "/tests/{testId}/run" localVarPath = strings.Replace(localVarPath, "{"+"testId"+"}", url.PathEscape(parameterValueToString(r.testId, "testId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"version"+"}", url.PathEscape(parameterValueToString(r.version, "version")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -2369,6 +4263,8 @@ func (a *ApiApiService) GetTestVersionExecute(r ApiGetTestVersionRequest) (*Test if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.runInformation req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -2391,6 +4287,16 @@ func (a *ApiApiService) GetTestVersionExecute(r ApiGetTestVersionRequest) (*Test body: localVarBody, error: localVarHTTPResponse.Status, } + if localVarHTTPResponse.StatusCode == 422 { + var v MissingVariablesError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2406,58 +4312,64 @@ func (a *ApiApiService) GetTestVersionExecute(r ApiGetTestVersionRequest) (*Test return localVarReturnValue, localVarHTTPResponse, nil } -type ApiGetVersionRequest struct { - ctx context.Context - ApiService *ApiApiService - fileExtension string +type ApiRunTestSuiteRequest struct { + ctx context.Context + ApiService *ApiApiService + testSuiteId string + runInformation *RunInformation } -func (r ApiGetVersionRequest) Execute() (*Version, *http.Response, error) { - return r.ApiService.GetVersionExecute(r) +func (r ApiRunTestSuiteRequest) RunInformation(runInformation RunInformation) ApiRunTestSuiteRequest { + r.runInformation = &runInformation + return r +} + +func (r ApiRunTestSuiteRequest) Execute() (*TestSuiteRun, *http.Response, error) { + return r.ApiService.RunTestSuiteExecute(r) } /* -GetVersion Get the version of the API +RunTestSuite run TestSuite -Get the version of the API +run a particular TestSuite @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param fileExtension - @return ApiGetVersionRequest + @param testSuiteId id of the TestSuite + @return ApiRunTestSuiteRequest */ -func (a *ApiApiService) GetVersion(ctx context.Context, fileExtension string) ApiGetVersionRequest { - return ApiGetVersionRequest{ - ApiService: a, - ctx: ctx, - fileExtension: fileExtension, +func (a *ApiApiService) RunTestSuite(ctx context.Context, testSuiteId string) ApiRunTestSuiteRequest { + return ApiRunTestSuiteRequest{ + ApiService: a, + ctx: ctx, + testSuiteId: testSuiteId, } } // Execute executes the request // -// @return Version -func (a *ApiApiService) GetVersionExecute(r ApiGetVersionRequest) (*Version, *http.Response, error) { +// @return TestSuiteRun +func (a *ApiApiService) RunTestSuiteExecute(r ApiRunTestSuiteRequest) (*TestSuiteRun, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Version + localVarReturnValue *TestSuiteRun ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetVersion") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.RunTestSuite") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/version.{fileExtension}" - localVarPath = strings.Replace(localVarPath, "{"+"fileExtension"+"}", url.PathEscape(parameterValueToString(r.fileExtension, "fileExtension")), -1) + localVarPath := localBasePath + "/testsuites/{testSuiteId}/run" + localVarPath = strings.Replace(localVarPath, "{"+"testSuiteId"+"}", url.PathEscape(parameterValueToString(r.testSuiteId, "testSuiteId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -2473,6 +4385,8 @@ func (a *ApiApiService) GetVersionExecute(r ApiGetVersionRequest) (*Version, *ht if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.runInformation req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -2510,54 +4424,68 @@ func (a *ApiApiService) GetVersionExecute(r ApiGetVersionRequest) (*Version, *ht return localVarReturnValue, localVarHTTPResponse, nil } -type ApiGetWizardRequest struct { - ctx context.Context - ApiService *ApiApiService +type ApiSearchSpansRequest struct { + ctx context.Context + ApiService *ApiApiService + testId string + runId int32 + searchSpansRequest *SearchSpansRequest } -func (r ApiGetWizardRequest) Execute() (*Wizard, *http.Response, error) { - return r.ApiService.GetWizardExecute(r) +func (r ApiSearchSpansRequest) SearchSpansRequest(searchSpansRequest SearchSpansRequest) ApiSearchSpansRequest { + r.searchSpansRequest = &searchSpansRequest + return r +} + +func (r ApiSearchSpansRequest) Execute() (*SearchSpansResult, *http.Response, error) { + return r.ApiService.SearchSpansExecute(r) } /* -GetWizard Get a specific wizard +SearchSpans get spans fileter by query -Get the configured Wizard, showing the state of each step. +get spans fileter by query @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiGetWizardRequest + @param testId id of the test + @param runId id of the run + @return ApiSearchSpansRequest */ -func (a *ApiApiService) GetWizard(ctx context.Context) ApiGetWizardRequest { - return ApiGetWizardRequest{ +func (a *ApiApiService) SearchSpans(ctx context.Context, testId string, runId int32) ApiSearchSpansRequest { + return ApiSearchSpansRequest{ ApiService: a, ctx: ctx, + testId: testId, + runId: runId, } } // Execute executes the request // -// @return Wizard -func (a *ApiApiService) GetWizardExecute(r ApiGetWizardRequest) (*Wizard, *http.Response, error) { +// @return SearchSpansResult +func (a *ApiApiService) SearchSpansExecute(r ApiSearchSpansRequest) (*SearchSpansResult, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Wizard + localVarReturnValue *SearchSpansResult ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.GetWizard") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.SearchSpans") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/wizard" + localVarPath := localBasePath + "/tests/{testId}/run/{runId}/search-spans" + localVarPath = strings.Replace(localVarPath, "{"+"testId"+"}", url.PathEscape(parameterValueToString(r.testId, "testId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"runId"+"}", url.PathEscape(parameterValueToString(r.runId, "runId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -2573,6 +4501,8 @@ func (a *ApiApiService) GetWizardExecute(r ApiGetWizardRequest) (*Wizard, *http. if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.searchSpansRequest req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -2610,60 +4540,59 @@ func (a *ApiApiService) GetWizardExecute(r ApiGetWizardRequest) (*Wizard, *http. return localVarReturnValue, localVarHTTPResponse, nil } -type ApiImportTestRunRequest struct { - ctx context.Context - ApiService *ApiApiService - exportedTestInformation *ExportedTestInformation -} - -func (r ApiImportTestRunRequest) ExportedTestInformation(exportedTestInformation ExportedTestInformation) ApiImportTestRunRequest { - r.exportedTestInformation = &exportedTestInformation - return r +type ApiSkipTraceCollectionRequest struct { + ctx context.Context + ApiService *ApiApiService + testId string + runId int32 } -func (r ApiImportTestRunRequest) Execute() (*ExportedTestInformation, *http.Response, error) { - return r.ApiService.ImportTestRunExecute(r) +func (r ApiSkipTraceCollectionRequest) Execute() (*http.Response, error) { + return r.ApiService.SkipTraceCollectionExecute(r) } /* -ImportTestRun import test and test run information +SkipTraceCollection skips the trace collection of a test run -import test and test run information for debugging +skips the trace collection of a test run @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiImportTestRunRequest + @param testId id of the test + @param runId id of the run + @return ApiSkipTraceCollectionRequest */ -func (a *ApiApiService) ImportTestRun(ctx context.Context) ApiImportTestRunRequest { - return ApiImportTestRunRequest{ +func (a *ApiApiService) SkipTraceCollection(ctx context.Context, testId string, runId int32) ApiSkipTraceCollectionRequest { + return ApiSkipTraceCollectionRequest{ ApiService: a, ctx: ctx, + testId: testId, + runId: runId, } } // Execute executes the request -// -// @return ExportedTestInformation -func (a *ApiApiService) ImportTestRunExecute(r ApiImportTestRunRequest) (*ExportedTestInformation, *http.Response, error) { +func (a *ApiApiService) SkipTraceCollectionExecute(r ApiSkipTraceCollectionRequest) (*http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *ExportedTestInformation + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.ImportTestRun") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.SkipTraceCollection") if err != nil { - return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + return nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/tests/import" + localVarPath := localBasePath + "/tests/{testId}/run/{runId}/skipPolling" + localVarPath = strings.Replace(localVarPath, "{"+"testId"+"}", url.PathEscape(parameterValueToString(r.testId, "testId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"runId"+"}", url.PathEscape(parameterValueToString(r.runId, "runId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -2672,30 +4601,28 @@ func (a *ApiApiService) ImportTestRunExecute(r ApiImportTestRunRequest) (*Export } // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} + localVarHTTPHeaderAccepts := []string{} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - // body params - localVarPostBody = r.exportedTestInformation req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return localVarReturnValue, nil, err + return nil, err } localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err + return localVarHTTPResponse, err } localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return localVarReturnValue, localVarHTTPResponse, err + return localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -2703,44 +4630,35 @@ func (a *ApiApiService) ImportTestRunExecute(r ApiImportTestRunRequest) (*Export body: localVarBody, error: localVarHTTPResponse.Status, } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr + return localVarHTTPResponse, newErr } - return localVarReturnValue, localVarHTTPResponse, nil + return localVarHTTPResponse, nil } -type ApiRerunTestRunRequest struct { +type ApiStopTestRunRequest struct { ctx context.Context ApiService *ApiApiService testId string runId int32 } -func (r ApiRerunTestRunRequest) Execute() (*TestRun, *http.Response, error) { - return r.ApiService.RerunTestRunExecute(r) +func (r ApiStopTestRunRequest) Execute() (*http.Response, error) { + return r.ApiService.StopTestRunExecute(r) } /* -RerunTestRun rerun a test run +StopTestRun stops the execution of a test run -rerun a test run +stops the execution of a test run @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param testId id of the test @param runId id of the run - @return ApiRerunTestRunRequest + @return ApiStopTestRunRequest */ -func (a *ApiApiService) RerunTestRun(ctx context.Context, testId string, runId int32) ApiRerunTestRunRequest { - return ApiRerunTestRunRequest{ +func (a *ApiApiService) StopTestRun(ctx context.Context, testId string, runId int32) ApiStopTestRunRequest { + return ApiStopTestRunRequest{ ApiService: a, ctx: ctx, testId: testId, @@ -2749,22 +4667,19 @@ func (a *ApiApiService) RerunTestRun(ctx context.Context, testId string, runId i } // Execute executes the request -// -// @return TestRun -func (a *ApiApiService) RerunTestRunExecute(r ApiRerunTestRunRequest) (*TestRun, *http.Response, error) { +func (a *ApiApiService) StopTestRunExecute(r ApiStopTestRunRequest) (*http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *TestRun + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.RerunTestRun") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.StopTestRun") if err != nil { - return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + return nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/tests/{testId}/run/{runId}/rerun" + localVarPath := localBasePath + "/tests/{testId}/run/{runId}/stop" localVarPath = strings.Replace(localVarPath, "{"+"testId"+"}", url.PathEscape(parameterValueToString(r.testId, "testId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"runId"+"}", url.PathEscape(parameterValueToString(r.runId, "runId")), -1) @@ -2782,7 +4697,7 @@ func (a *ApiApiService) RerunTestRunExecute(r ApiRerunTestRunRequest) (*TestRun, } // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} + localVarHTTPHeaderAccepts := []string{} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) @@ -2791,19 +4706,19 @@ func (a *ApiApiService) RerunTestRunExecute(r ApiRerunTestRunRequest) (*TestRun, } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return localVarReturnValue, nil, err + return nil, err } localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err + return localVarHTTPResponse, err } localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return localVarReturnValue, localVarHTTPResponse, err + return localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -2811,66 +4726,66 @@ func (a *ApiApiService) RerunTestRunExecute(r ApiRerunTestRunRequest) (*TestRun, body: localVarBody, error: localVarHTTPResponse.Status, } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr + return localVarHTTPResponse, newErr } - return localVarReturnValue, localVarHTTPResponse, nil + return localVarHTTPResponse, nil } -type ApiResetOTLPConnectionInformationRequest struct { +type ApiTestConnectionRequest struct { ctx context.Context ApiService *ApiApiService + dataStore *DataStore } -func (r ApiResetOTLPConnectionInformationRequest) Execute() (*http.Response, error) { - return r.ApiService.ResetOTLPConnectionInformationExecute(r) +func (r ApiTestConnectionRequest) DataStore(dataStore DataStore) ApiTestConnectionRequest { + r.dataStore = &dataStore + return r +} + +func (r ApiTestConnectionRequest) Execute() (*TestConnectionResponse, *http.Response, error) { + return r.ApiService.TestConnectionExecute(r) } /* -ResetOTLPConnectionInformation reset the OTLP connection span count +TestConnection Tests the config data store/exporter connection -reset the OTLP connection span count +Tests the config data store/exporter connection @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiResetOTLPConnectionInformationRequest + @return ApiTestConnectionRequest */ -func (a *ApiApiService) ResetOTLPConnectionInformation(ctx context.Context) ApiResetOTLPConnectionInformationRequest { - return ApiResetOTLPConnectionInformationRequest{ +func (a *ApiApiService) TestConnection(ctx context.Context) ApiTestConnectionRequest { + return ApiTestConnectionRequest{ ApiService: a, ctx: ctx, } } // Execute executes the request -func (a *ApiApiService) ResetOTLPConnectionInformationExecute(r ApiResetOTLPConnectionInformationRequest) (*http.Response, error) { +// +// @return TestConnectionResponse +func (a *ApiApiService) TestConnectionExecute(r ApiTestConnectionRequest) (*TestConnectionResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *TestConnectionResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.ResetOTLPConnectionInformation") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.TestConnection") if err != nil { - return nil, &GenericOpenAPIError{error: err.Error()} + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/config/connection/otlp/reset" + localVarPath := localBasePath + "/config/connection" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"text/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -2879,28 +4794,30 @@ func (a *ApiApiService) ResetOTLPConnectionInformationExecute(r ApiResetOTLPConn } // to determine the Accept header - localVarHTTPHeaderAccepts := []string{} + localVarHTTPHeaderAccepts := []string{"application/json"} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.dataStore req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return nil, err + return localVarReturnValue, nil, err } localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -2908,67 +4825,80 @@ func (a *ApiApiService) ResetOTLPConnectionInformationExecute(r ApiResetOTLPConn body: localVarBody, error: localVarHTTPResponse.Status, } - return localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - return localVarHTTPResponse, nil + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil } -type ApiRunTestRequest struct { - ctx context.Context - ApiService *ApiApiService - testId string - runInformation *RunInformation +type ApiUpdateEnvironmentRequest struct { + ctx context.Context + ApiService *ApiApiService + environmentID string + environmentResource *EnvironmentResource } -func (r ApiRunTestRequest) RunInformation(runInformation RunInformation) ApiRunTestRequest { - r.runInformation = &runInformation +// environment resource details body +func (r ApiUpdateEnvironmentRequest) EnvironmentResource(environmentResource EnvironmentResource) ApiUpdateEnvironmentRequest { + r.environmentResource = &environmentResource return r } -func (r ApiRunTestRequest) Execute() (*TestRun, *http.Response, error) { - return r.ApiService.RunTestExecute(r) +func (r ApiUpdateEnvironmentRequest) Execute() (*EnvironmentResource, *http.Response, error) { + return r.ApiService.UpdateEnvironmentExecute(r) } /* -RunTest run test +UpdateEnvironment Update environment -run a particular test +Update environment with given request body @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param testId id of the test - @return ApiRunTestRequest + @param environmentID ID for environment + @return ApiUpdateEnvironmentRequest */ -func (a *ApiApiService) RunTest(ctx context.Context, testId string) ApiRunTestRequest { - return ApiRunTestRequest{ - ApiService: a, - ctx: ctx, - testId: testId, +func (a *ApiApiService) UpdateEnvironment(ctx context.Context, environmentID string) ApiUpdateEnvironmentRequest { + return ApiUpdateEnvironmentRequest{ + ApiService: a, + ctx: ctx, + environmentID: environmentID, } } // Execute executes the request // -// @return TestRun -func (a *ApiApiService) RunTestExecute(r ApiRunTestRequest) (*TestRun, *http.Response, error) { +// @return EnvironmentResource +func (a *ApiApiService) UpdateEnvironmentExecute(r ApiUpdateEnvironmentRequest) (*EnvironmentResource, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost + localVarHTTPMethod = http.MethodPut localVarPostBody interface{} formFiles []formFile - localVarReturnValue *TestRun + localVarReturnValue *EnvironmentResource ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.RunTest") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.UpdateEnvironment") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/tests/{testId}/run" - localVarPath = strings.Replace(localVarPath, "{"+"testId"+"}", url.PathEscape(parameterValueToString(r.testId, "testId")), -1) + localVarPath := localBasePath + "/environments/{environmentID}" + localVarPath = strings.Replace(localVarPath, "{"+"environmentID"+"}", url.PathEscape(parameterValueToString(r.environmentID, "environmentID")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.environmentResource == nil { + return localVarReturnValue, nil, reportError("environmentResource is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} @@ -2988,7 +4918,7 @@ func (a *ApiApiService) RunTestExecute(r ApiRunTestRequest) (*TestRun, *http.Res localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.runInformation + localVarPostBody = r.environmentResource req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -3011,16 +4941,6 @@ func (a *ApiApiService) RunTestExecute(r ApiRunTestRequest) (*TestRun, *http.Res body: localVarBody, error: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 422 { - var v MissingVariablesError - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v - } return localVarReturnValue, localVarHTTPResponse, newErr } @@ -3036,61 +4956,65 @@ func (a *ApiApiService) RunTestExecute(r ApiRunTestRequest) (*TestRun, *http.Res return localVarReturnValue, localVarHTTPResponse, nil } -type ApiRunTestSuiteRequest struct { +type ApiUpdateInviteRequest struct { ctx context.Context ApiService *ApiApiService - testSuiteId string - runInformation *RunInformation + inviteID string + inviteResource *InviteResource } -func (r ApiRunTestSuiteRequest) RunInformation(runInformation RunInformation) ApiRunTestSuiteRequest { - r.runInformation = &runInformation +// invite resource details body +func (r ApiUpdateInviteRequest) InviteResource(inviteResource InviteResource) ApiUpdateInviteRequest { + r.inviteResource = &inviteResource return r } -func (r ApiRunTestSuiteRequest) Execute() (*TestSuiteRun, *http.Response, error) { - return r.ApiService.RunTestSuiteExecute(r) +func (r ApiUpdateInviteRequest) Execute() (*InviteResource, *http.Response, error) { + return r.ApiService.UpdateInviteExecute(r) } /* -RunTestSuite run TestSuite +UpdateInvite Updates a pending invite -run a particular TestSuite +Updates pending email invite @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param testSuiteId id of the TestSuite - @return ApiRunTestSuiteRequest + @param inviteID ID for invite + @return ApiUpdateInviteRequest */ -func (a *ApiApiService) RunTestSuite(ctx context.Context, testSuiteId string) ApiRunTestSuiteRequest { - return ApiRunTestSuiteRequest{ - ApiService: a, - ctx: ctx, - testSuiteId: testSuiteId, +func (a *ApiApiService) UpdateInvite(ctx context.Context, inviteID string) ApiUpdateInviteRequest { + return ApiUpdateInviteRequest{ + ApiService: a, + ctx: ctx, + inviteID: inviteID, } } // Execute executes the request // -// @return TestSuiteRun -func (a *ApiApiService) RunTestSuiteExecute(r ApiRunTestSuiteRequest) (*TestSuiteRun, *http.Response, error) { +// @return InviteResource +func (a *ApiApiService) UpdateInviteExecute(r ApiUpdateInviteRequest) (*InviteResource, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost + localVarHTTPMethod = http.MethodPut localVarPostBody interface{} formFiles []formFile - localVarReturnValue *TestSuiteRun + localVarReturnValue *InviteResource ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.RunTestSuite") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.UpdateInvite") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/testsuites/{testSuiteId}/run" - localVarPath = strings.Replace(localVarPath, "{"+"testSuiteId"+"}", url.PathEscape(parameterValueToString(r.testSuiteId, "testSuiteId")), -1) + localVarPath := localBasePath + "/invites/{inviteID}" + localVarPath = strings.Replace(localVarPath, "{"+"inviteID"+"}", url.PathEscape(parameterValueToString(r.inviteID, "inviteID")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.inviteResource == nil { + return localVarReturnValue, nil, reportError("inviteResource is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} @@ -3110,7 +5034,7 @@ func (a *ApiApiService) RunTestSuiteExecute(r ApiRunTestSuiteRequest) (*TestSuit localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.runInformation + localVarPostBody = r.inviteResource req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -3148,35 +5072,35 @@ func (a *ApiApiService) RunTestSuiteExecute(r ApiRunTestSuiteRequest) (*TestSuit return localVarReturnValue, localVarHTTPResponse, nil } -type ApiSearchSpansRequest struct { - ctx context.Context - ApiService *ApiApiService - testId string - runId int32 - searchSpansRequest *SearchSpansRequest +type ApiUpdateTestRunRequest struct { + ctx context.Context + ApiService *ApiApiService + testId string + runId int32 + testRun *TestRun } -func (r ApiSearchSpansRequest) SearchSpansRequest(searchSpansRequest SearchSpansRequest) ApiSearchSpansRequest { - r.searchSpansRequest = &searchSpansRequest +func (r ApiUpdateTestRunRequest) TestRun(testRun TestRun) ApiUpdateTestRunRequest { + r.testRun = &testRun return r } -func (r ApiSearchSpansRequest) Execute() (*SearchSpansResult, *http.Response, error) { - return r.ApiService.SearchSpansExecute(r) +func (r ApiUpdateTestRunRequest) Execute() (*TestRun, *http.Response, error) { + return r.ApiService.UpdateTestRunExecute(r) } /* -SearchSpans get spans fileter by query +UpdateTestRun update a test run -get spans fileter by query +update a test run @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param testId id of the test @param runId id of the run - @return ApiSearchSpansRequest + @return ApiUpdateTestRunRequest */ -func (a *ApiApiService) SearchSpans(ctx context.Context, testId string, runId int32) ApiSearchSpansRequest { - return ApiSearchSpansRequest{ +func (a *ApiApiService) UpdateTestRun(ctx context.Context, testId string, runId int32) ApiUpdateTestRunRequest { + return ApiUpdateTestRunRequest{ ApiService: a, ctx: ctx, testId: testId, @@ -3186,21 +5110,21 @@ func (a *ApiApiService) SearchSpans(ctx context.Context, testId string, runId in // Execute executes the request // -// @return SearchSpansResult -func (a *ApiApiService) SearchSpansExecute(r ApiSearchSpansRequest) (*SearchSpansResult, *http.Response, error) { +// @return TestRun +func (a *ApiApiService) UpdateTestRunExecute(r ApiUpdateTestRunRequest) (*TestRun, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost + localVarHTTPMethod = http.MethodPatch localVarPostBody interface{} formFiles []formFile - localVarReturnValue *SearchSpansResult + localVarReturnValue *TestRun ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.SearchSpans") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.UpdateTestRun") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/tests/{testId}/run/{runId}/search-spans" + localVarPath := localBasePath + "/tests/{testId}/run/{runId}" localVarPath = strings.Replace(localVarPath, "{"+"testId"+"}", url.PathEscape(parameterValueToString(r.testId, "testId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"runId"+"}", url.PathEscape(parameterValueToString(r.runId, "runId")), -1) @@ -3226,7 +5150,7 @@ func (a *ApiApiService) SearchSpansExecute(r ApiSearchSpansRequest) (*SearchSpan localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.searchSpansRequest + localVarPostBody = r.testRun req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -3264,52 +5188,51 @@ func (a *ApiApiService) SearchSpansExecute(r ApiSearchSpansRequest) (*SearchSpan return localVarReturnValue, localVarHTTPResponse, nil } -type ApiSkipTraceCollectionRequest struct { +type ApiUpdateTokenRequest struct { ctx context.Context ApiService *ApiApiService - testId string - runId int32 + tokenID string } -func (r ApiSkipTraceCollectionRequest) Execute() (*http.Response, error) { - return r.ApiService.SkipTraceCollectionExecute(r) +func (r ApiUpdateTokenRequest) Execute() (*Token, *http.Response, error) { + return r.ApiService.UpdateTokenExecute(r) } /* -SkipTraceCollection skips the trace collection of a test run +UpdateToken Update token for environment -skips the trace collection of a test run +update token @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param testId id of the test - @param runId id of the run - @return ApiSkipTraceCollectionRequest + @param tokenID ID for token + @return ApiUpdateTokenRequest */ -func (a *ApiApiService) SkipTraceCollection(ctx context.Context, testId string, runId int32) ApiSkipTraceCollectionRequest { - return ApiSkipTraceCollectionRequest{ +func (a *ApiApiService) UpdateToken(ctx context.Context, tokenID string) ApiUpdateTokenRequest { + return ApiUpdateTokenRequest{ ApiService: a, ctx: ctx, - testId: testId, - runId: runId, + tokenID: tokenID, } } // Execute executes the request -func (a *ApiApiService) SkipTraceCollectionExecute(r ApiSkipTraceCollectionRequest) (*http.Response, error) { +// +// @return Token +func (a *ApiApiService) UpdateTokenExecute(r ApiUpdateTokenRequest) (*Token, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Token ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.SkipTraceCollection") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.UpdateToken") if err != nil { - return nil, &GenericOpenAPIError{error: err.Error()} + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/tests/{testId}/run/{runId}/skipPolling" - localVarPath = strings.Replace(localVarPath, "{"+"testId"+"}", url.PathEscape(parameterValueToString(r.testId, "testId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"runId"+"}", url.PathEscape(parameterValueToString(r.runId, "runId")), -1) + localVarPath := localBasePath + "/tokens/{tokenID}" + localVarPath = strings.Replace(localVarPath, "{"+"tokenID"+"}", url.PathEscape(parameterValueToString(r.tokenID, "tokenID")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -3325,7 +5248,7 @@ func (a *ApiApiService) SkipTraceCollectionExecute(r ApiSkipTraceCollectionReque } // to determine the Accept header - localVarHTTPHeaderAccepts := []string{} + localVarHTTPHeaderAccepts := []string{"application/json"} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) @@ -3334,19 +5257,19 @@ func (a *ApiApiService) SkipTraceCollectionExecute(r ApiSkipTraceCollectionReque } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return nil, err + return localVarReturnValue, nil, err } localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -3354,65 +5277,75 @@ func (a *ApiApiService) SkipTraceCollectionExecute(r ApiSkipTraceCollectionReque body: localVarBody, error: localVarHTTPResponse.Status, } - return localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - return localVarHTTPResponse, nil + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil } -type ApiStopTestRunRequest struct { +type ApiUpdateWizardRequest struct { ctx context.Context ApiService *ApiApiService - testId string - runId int32 + wizard *Wizard } -func (r ApiStopTestRunRequest) Execute() (*http.Response, error) { - return r.ApiService.StopTestRunExecute(r) +func (r ApiUpdateWizardRequest) Wizard(wizard Wizard) ApiUpdateWizardRequest { + r.wizard = &wizard + return r +} + +func (r ApiUpdateWizardRequest) Execute() (*Wizard, *http.Response, error) { + return r.ApiService.UpdateWizardExecute(r) } /* -StopTestRun stops the execution of a test run +UpdateWizard Update a Wizard -stops the execution of a test run +Update a Wizard used on Tracetest @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param testId id of the test - @param runId id of the run - @return ApiStopTestRunRequest + @return ApiUpdateWizardRequest */ -func (a *ApiApiService) StopTestRun(ctx context.Context, testId string, runId int32) ApiStopTestRunRequest { - return ApiStopTestRunRequest{ +func (a *ApiApiService) UpdateWizard(ctx context.Context) ApiUpdateWizardRequest { + return ApiUpdateWizardRequest{ ApiService: a, ctx: ctx, - testId: testId, - runId: runId, } } // Execute executes the request -func (a *ApiApiService) StopTestRunExecute(r ApiStopTestRunRequest) (*http.Response, error) { +// +// @return Wizard +func (a *ApiApiService) UpdateWizardExecute(r ApiUpdateWizardRequest) (*Wizard, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Wizard ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.StopTestRun") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.UpdateWizard") if err != nil { - return nil, &GenericOpenAPIError{error: err.Error()} + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/tests/{testId}/run/{runId}/stop" - localVarPath = strings.Replace(localVarPath, "{"+"testId"+"}", url.PathEscape(parameterValueToString(r.testId, "testId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"runId"+"}", url.PathEscape(parameterValueToString(r.runId, "runId")), -1) + localVarPath := localBasePath + "/wizard" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -3421,28 +5354,30 @@ func (a *ApiApiService) StopTestRunExecute(r ApiStopTestRunRequest) (*http.Respo } // to determine the Accept header - localVarHTTPHeaderAccepts := []string{} + localVarHTTPHeaderAccepts := []string{"application/json"} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.wizard req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return nil, err + return localVarReturnValue, nil, err } localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -3450,37 +5385,47 @@ func (a *ApiApiService) StopTestRunExecute(r ApiStopTestRunRequest) (*http.Respo body: localVarBody, error: localVarHTTPResponse.Status, } - return localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - return localVarHTTPResponse, nil + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil } -type ApiTestConnectionRequest struct { - ctx context.Context - ApiService *ApiApiService - dataStore *DataStore +type ApiUpsertEnvironmentRequest struct { + ctx context.Context + ApiService *ApiApiService + environmentResource *EnvironmentResource } -func (r ApiTestConnectionRequest) DataStore(dataStore DataStore) ApiTestConnectionRequest { - r.dataStore = &dataStore +// environment resource details body +func (r ApiUpsertEnvironmentRequest) EnvironmentResource(environmentResource EnvironmentResource) ApiUpsertEnvironmentRequest { + r.environmentResource = &environmentResource return r } -func (r ApiTestConnectionRequest) Execute() (*TestConnectionResponse, *http.Response, error) { - return r.ApiService.TestConnectionExecute(r) +func (r ApiUpsertEnvironmentRequest) Execute() (*EnvironmentResource, *http.Response, error) { + return r.ApiService.UpsertEnvironmentExecute(r) } /* -TestConnection Tests the config data store/exporter connection +UpsertEnvironment Upsert new environment -Tests the config data store/exporter connection +Upsert test environment @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiTestConnectionRequest + @return ApiUpsertEnvironmentRequest */ -func (a *ApiApiService) TestConnection(ctx context.Context) ApiTestConnectionRequest { - return ApiTestConnectionRequest{ +func (a *ApiApiService) UpsertEnvironment(ctx context.Context) ApiUpsertEnvironmentRequest { + return ApiUpsertEnvironmentRequest{ ApiService: a, ctx: ctx, } @@ -3488,28 +5433,31 @@ func (a *ApiApiService) TestConnection(ctx context.Context) ApiTestConnectionReq // Execute executes the request // -// @return TestConnectionResponse -func (a *ApiApiService) TestConnectionExecute(r ApiTestConnectionRequest) (*TestConnectionResponse, *http.Response, error) { +// @return EnvironmentResource +func (a *ApiApiService) UpsertEnvironmentExecute(r ApiUpsertEnvironmentRequest) (*EnvironmentResource, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost + localVarHTTPMethod = http.MethodPut localVarPostBody interface{} formFiles []formFile - localVarReturnValue *TestConnectionResponse + localVarReturnValue *EnvironmentResource ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.TestConnection") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.UpsertEnvironment") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/config/connection" + localVarPath := localBasePath + "/environments" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.environmentResource == nil { + return localVarReturnValue, nil, reportError("environmentResource is required and must be specified") + } // to determine the Content-Type header - localVarHTTPContentTypes := []string{"text/json"} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -3526,7 +5474,7 @@ func (a *ApiApiService) TestConnectionExecute(r ApiTestConnectionRequest) (*Test localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.dataStore + localVarPostBody = r.environmentResource req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -3564,65 +5512,61 @@ func (a *ApiApiService) TestConnectionExecute(r ApiTestConnectionRequest) (*Test return localVarReturnValue, localVarHTTPResponse, nil } -type ApiUpdateTestRunRequest struct { - ctx context.Context - ApiService *ApiApiService - testId string - runId int32 - testRun *TestRun +type ApiUpsertInviteRequest struct { + ctx context.Context + ApiService *ApiApiService + inviteResource *InviteResource } -func (r ApiUpdateTestRunRequest) TestRun(testRun TestRun) ApiUpdateTestRunRequest { - r.testRun = &testRun +// invite resource details body +func (r ApiUpsertInviteRequest) InviteResource(inviteResource InviteResource) ApiUpsertInviteRequest { + r.inviteResource = &inviteResource return r } -func (r ApiUpdateTestRunRequest) Execute() (*TestRun, *http.Response, error) { - return r.ApiService.UpdateTestRunExecute(r) +func (r ApiUpsertInviteRequest) Execute() (*InviteResource, *http.Response, error) { + return r.ApiService.UpsertInviteExecute(r) } /* -UpdateTestRun update a test run +UpsertInvite Upserts a pending invite -update a test run +Upserts invite @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param testId id of the test - @param runId id of the run - @return ApiUpdateTestRunRequest + @return ApiUpsertInviteRequest */ -func (a *ApiApiService) UpdateTestRun(ctx context.Context, testId string, runId int32) ApiUpdateTestRunRequest { - return ApiUpdateTestRunRequest{ +func (a *ApiApiService) UpsertInvite(ctx context.Context) ApiUpsertInviteRequest { + return ApiUpsertInviteRequest{ ApiService: a, ctx: ctx, - testId: testId, - runId: runId, } } // Execute executes the request // -// @return TestRun -func (a *ApiApiService) UpdateTestRunExecute(r ApiUpdateTestRunRequest) (*TestRun, *http.Response, error) { +// @return InviteResource +func (a *ApiApiService) UpsertInviteExecute(r ApiUpsertInviteRequest) (*InviteResource, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPatch + localVarHTTPMethod = http.MethodPut localVarPostBody interface{} formFiles []formFile - localVarReturnValue *TestRun + localVarReturnValue *InviteResource ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.UpdateTestRun") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.UpsertInvite") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/tests/{testId}/run/{runId}" - localVarPath = strings.Replace(localVarPath, "{"+"testId"+"}", url.PathEscape(parameterValueToString(r.testId, "testId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"runId"+"}", url.PathEscape(parameterValueToString(r.runId, "runId")), -1) + localVarPath := localBasePath + "/invites" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.inviteResource == nil { + return localVarReturnValue, nil, reportError("inviteResource is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} @@ -3642,7 +5586,7 @@ func (a *ApiApiService) UpdateTestRunExecute(r ApiUpdateTestRunRequest) (*TestRu localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.testRun + localVarPostBody = r.inviteResource req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -3680,31 +5624,32 @@ func (a *ApiApiService) UpdateTestRunExecute(r ApiUpdateTestRunRequest) (*TestRu return localVarReturnValue, localVarHTTPResponse, nil } -type ApiUpdateWizardRequest struct { +type ApiUpsertTokenRequest struct { ctx context.Context ApiService *ApiApiService - wizard *Wizard + token *Token } -func (r ApiUpdateWizardRequest) Wizard(wizard Wizard) ApiUpdateWizardRequest { - r.wizard = &wizard +// invite details body +func (r ApiUpsertTokenRequest) Token(token Token) ApiUpsertTokenRequest { + r.token = &token return r } -func (r ApiUpdateWizardRequest) Execute() (*Wizard, *http.Response, error) { - return r.ApiService.UpdateWizardExecute(r) +func (r ApiUpsertTokenRequest) Execute() (*Token, *http.Response, error) { + return r.ApiService.UpsertTokenExecute(r) } /* -UpdateWizard Update a Wizard +UpsertToken Upserts a new token -Update a Wizard used on Tracetest +Upserts a new token @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiUpdateWizardRequest + @return ApiUpsertTokenRequest */ -func (a *ApiApiService) UpdateWizard(ctx context.Context) ApiUpdateWizardRequest { - return ApiUpdateWizardRequest{ +func (a *ApiApiService) UpsertToken(ctx context.Context) ApiUpsertTokenRequest { + return ApiUpsertTokenRequest{ ApiService: a, ctx: ctx, } @@ -3712,25 +5657,28 @@ func (a *ApiApiService) UpdateWizard(ctx context.Context) ApiUpdateWizardRequest // Execute executes the request // -// @return Wizard -func (a *ApiApiService) UpdateWizardExecute(r ApiUpdateWizardRequest) (*Wizard, *http.Response, error) { +// @return Token +func (a *ApiApiService) UpsertTokenExecute(r ApiUpsertTokenRequest) (*Token, *http.Response, error) { var ( localVarHTTPMethod = http.MethodPut localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Wizard + localVarReturnValue *Token ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.UpdateWizard") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiApiService.UpsertToken") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/wizard" + localVarPath := localBasePath + "/tokens" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.token == nil { + return localVarReturnValue, nil, reportError("token is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} @@ -3750,7 +5698,7 @@ func (a *ApiApiService) UpdateWizardExecute(r ApiUpdateWizardRequest) (*Wizard, localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.wizard + localVarPostBody = r.token req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err diff --git a/cli/openapi/model_environment.go b/cli/openapi/model_environment.go new file mode 100644 index 0000000000..6c957a62c0 --- /dev/null +++ b/cli/openapi/model_environment.go @@ -0,0 +1,480 @@ +/* +TraceTest + +OpenAPI definition for TraceTest endpoint and resources + +API version: 0.2.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "time" +) + +// checks if the Environment type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Environment{} + +// Environment struct for Environment +type Environment struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + Labels *map[string]string `json:"labels,omitempty"` + CreatedAt *time.Time `json:"createdAt,omitempty"` + UpdatedAt *time.Time `json:"updatedAt,omitempty"` + IsLocal *bool `json:"isLocal,omitempty"` + UserID *string `json:"userID,omitempty"` + // organizationID + OrganizationID *string `json:"organizationID,omitempty"` + AgentApiKey *string `json:"agentApiKey,omitempty"` + Resources *string `json:"resources,omitempty"` +} + +// NewEnvironment instantiates a new Environment object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewEnvironment() *Environment { + this := Environment{} + return &this +} + +// NewEnvironmentWithDefaults instantiates a new Environment object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewEnvironmentWithDefaults() *Environment { + this := Environment{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Environment) GetId() string { + if o == nil || isNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Environment) GetIdOk() (*string, bool) { + if o == nil || isNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Environment) HasId() bool { + if o != nil && !isNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Environment) SetId(v string) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Environment) GetName() string { + if o == nil || isNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Environment) GetNameOk() (*string, bool) { + if o == nil || isNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Environment) HasName() bool { + if o != nil && !isNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Environment) SetName(v string) { + o.Name = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *Environment) GetDescription() string { + if o == nil || isNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Environment) GetDescriptionOk() (*string, bool) { + if o == nil || isNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *Environment) HasDescription() bool { + if o != nil && !isNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *Environment) SetDescription(v string) { + o.Description = &v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Environment) GetLabels() map[string]string { + if o == nil || isNil(o.Labels) { + var ret map[string]string + return ret + } + return *o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Environment) GetLabelsOk() (*map[string]string, bool) { + if o == nil || isNil(o.Labels) { + return nil, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *Environment) HasLabels() bool { + if o != nil && !isNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *Environment) SetLabels(v map[string]string) { + o.Labels = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Environment) GetCreatedAt() time.Time { + if o == nil || isNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Environment) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || isNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Environment) HasCreatedAt() bool { + if o != nil && !isNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Environment) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Environment) GetUpdatedAt() time.Time { + if o == nil || isNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Environment) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || isNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Environment) HasUpdatedAt() bool { + if o != nil && !isNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Environment) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +// GetIsLocal returns the IsLocal field value if set, zero value otherwise. +func (o *Environment) GetIsLocal() bool { + if o == nil || isNil(o.IsLocal) { + var ret bool + return ret + } + return *o.IsLocal +} + +// GetIsLocalOk returns a tuple with the IsLocal field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Environment) GetIsLocalOk() (*bool, bool) { + if o == nil || isNil(o.IsLocal) { + return nil, false + } + return o.IsLocal, true +} + +// HasIsLocal returns a boolean if a field has been set. +func (o *Environment) HasIsLocal() bool { + if o != nil && !isNil(o.IsLocal) { + return true + } + + return false +} + +// SetIsLocal gets a reference to the given bool and assigns it to the IsLocal field. +func (o *Environment) SetIsLocal(v bool) { + o.IsLocal = &v +} + +// GetUserID returns the UserID field value if set, zero value otherwise. +func (o *Environment) GetUserID() string { + if o == nil || isNil(o.UserID) { + var ret string + return ret + } + return *o.UserID +} + +// GetUserIDOk returns a tuple with the UserID field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Environment) GetUserIDOk() (*string, bool) { + if o == nil || isNil(o.UserID) { + return nil, false + } + return o.UserID, true +} + +// HasUserID returns a boolean if a field has been set. +func (o *Environment) HasUserID() bool { + if o != nil && !isNil(o.UserID) { + return true + } + + return false +} + +// SetUserID gets a reference to the given string and assigns it to the UserID field. +func (o *Environment) SetUserID(v string) { + o.UserID = &v +} + +// GetOrganizationID returns the OrganizationID field value if set, zero value otherwise. +func (o *Environment) GetOrganizationID() string { + if o == nil || isNil(o.OrganizationID) { + var ret string + return ret + } + return *o.OrganizationID +} + +// GetOrganizationIDOk returns a tuple with the OrganizationID field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Environment) GetOrganizationIDOk() (*string, bool) { + if o == nil || isNil(o.OrganizationID) { + return nil, false + } + return o.OrganizationID, true +} + +// HasOrganizationID returns a boolean if a field has been set. +func (o *Environment) HasOrganizationID() bool { + if o != nil && !isNil(o.OrganizationID) { + return true + } + + return false +} + +// SetOrganizationID gets a reference to the given string and assigns it to the OrganizationID field. +func (o *Environment) SetOrganizationID(v string) { + o.OrganizationID = &v +} + +// GetAgentApiKey returns the AgentApiKey field value if set, zero value otherwise. +func (o *Environment) GetAgentApiKey() string { + if o == nil || isNil(o.AgentApiKey) { + var ret string + return ret + } + return *o.AgentApiKey +} + +// GetAgentApiKeyOk returns a tuple with the AgentApiKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Environment) GetAgentApiKeyOk() (*string, bool) { + if o == nil || isNil(o.AgentApiKey) { + return nil, false + } + return o.AgentApiKey, true +} + +// HasAgentApiKey returns a boolean if a field has been set. +func (o *Environment) HasAgentApiKey() bool { + if o != nil && !isNil(o.AgentApiKey) { + return true + } + + return false +} + +// SetAgentApiKey gets a reference to the given string and assigns it to the AgentApiKey field. +func (o *Environment) SetAgentApiKey(v string) { + o.AgentApiKey = &v +} + +// GetResources returns the Resources field value if set, zero value otherwise. +func (o *Environment) GetResources() string { + if o == nil || isNil(o.Resources) { + var ret string + return ret + } + return *o.Resources +} + +// GetResourcesOk returns a tuple with the Resources field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Environment) GetResourcesOk() (*string, bool) { + if o == nil || isNil(o.Resources) { + return nil, false + } + return o.Resources, true +} + +// HasResources returns a boolean if a field has been set. +func (o *Environment) HasResources() bool { + if o != nil && !isNil(o.Resources) { + return true + } + + return false +} + +// SetResources gets a reference to the given string and assigns it to the Resources field. +func (o *Environment) SetResources(v string) { + o.Resources = &v +} + +func (o Environment) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Environment) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + // skip: id is readOnly + if !isNil(o.Name) { + toSerialize["name"] = o.Name + } + if !isNil(o.Description) { + toSerialize["description"] = o.Description + } + if !isNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + // skip: createdAt is readOnly + // skip: updatedAt is readOnly + if !isNil(o.IsLocal) { + toSerialize["isLocal"] = o.IsLocal + } + if !isNil(o.UserID) { + toSerialize["userID"] = o.UserID + } + if !isNil(o.OrganizationID) { + toSerialize["organizationID"] = o.OrganizationID + } + if !isNil(o.AgentApiKey) { + toSerialize["agentApiKey"] = o.AgentApiKey + } + if !isNil(o.Resources) { + toSerialize["resources"] = o.Resources + } + return toSerialize, nil +} + +type NullableEnvironment struct { + value *Environment + isSet bool +} + +func (v NullableEnvironment) Get() *Environment { + return v.value +} + +func (v *NullableEnvironment) Set(val *Environment) { + v.value = val + v.isSet = true +} + +func (v NullableEnvironment) IsSet() bool { + return v.isSet +} + +func (v *NullableEnvironment) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEnvironment(val *Environment) *NullableEnvironment { + return &NullableEnvironment{value: val, isSet: true} +} + +func (v NullableEnvironment) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEnvironment) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/cli/openapi/model_environment_resource.go b/cli/openapi/model_environment_resource.go new file mode 100644 index 0000000000..42244de211 --- /dev/null +++ b/cli/openapi/model_environment_resource.go @@ -0,0 +1,160 @@ +/* +TraceTest + +OpenAPI definition for TraceTest endpoint and resources + +API version: 0.2.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the EnvironmentResource type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &EnvironmentResource{} + +// EnvironmentResource struct for EnvironmentResource +type EnvironmentResource struct { + Type *string `json:"type,omitempty"` + Spec *Environment `json:"spec,omitempty"` +} + +// NewEnvironmentResource instantiates a new EnvironmentResource object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewEnvironmentResource() *EnvironmentResource { + this := EnvironmentResource{} + return &this +} + +// NewEnvironmentResourceWithDefaults instantiates a new EnvironmentResource object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewEnvironmentResourceWithDefaults() *EnvironmentResource { + this := EnvironmentResource{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *EnvironmentResource) GetType() string { + if o == nil || isNil(o.Type) { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EnvironmentResource) GetTypeOk() (*string, bool) { + if o == nil || isNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *EnvironmentResource) HasType() bool { + if o != nil && !isNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *EnvironmentResource) SetType(v string) { + o.Type = &v +} + +// GetSpec returns the Spec field value if set, zero value otherwise. +func (o *EnvironmentResource) GetSpec() Environment { + if o == nil || isNil(o.Spec) { + var ret Environment + return ret + } + return *o.Spec +} + +// GetSpecOk returns a tuple with the Spec field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EnvironmentResource) GetSpecOk() (*Environment, bool) { + if o == nil || isNil(o.Spec) { + return nil, false + } + return o.Spec, true +} + +// HasSpec returns a boolean if a field has been set. +func (o *EnvironmentResource) HasSpec() bool { + if o != nil && !isNil(o.Spec) { + return true + } + + return false +} + +// SetSpec gets a reference to the given Environment and assigns it to the Spec field. +func (o *EnvironmentResource) SetSpec(v Environment) { + o.Spec = &v +} + +func (o EnvironmentResource) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o EnvironmentResource) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !isNil(o.Type) { + toSerialize["type"] = o.Type + } + if !isNil(o.Spec) { + toSerialize["spec"] = o.Spec + } + return toSerialize, nil +} + +type NullableEnvironmentResource struct { + value *EnvironmentResource + isSet bool +} + +func (v NullableEnvironmentResource) Get() *EnvironmentResource { + return v.value +} + +func (v *NullableEnvironmentResource) Set(val *EnvironmentResource) { + v.value = val + v.isSet = true +} + +func (v NullableEnvironmentResource) IsSet() bool { + return v.isSet +} + +func (v *NullableEnvironmentResource) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEnvironmentResource(val *EnvironmentResource) *NullableEnvironmentResource { + return &NullableEnvironmentResource{value: val, isSet: true} +} + +func (v NullableEnvironmentResource) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEnvironmentResource) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/cli/openapi/model_environment_resources.go b/cli/openapi/model_environment_resources.go new file mode 100644 index 0000000000..b7da9c391a --- /dev/null +++ b/cli/openapi/model_environment_resources.go @@ -0,0 +1,160 @@ +/* +TraceTest + +OpenAPI definition for TraceTest endpoint and resources + +API version: 0.2.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the EnvironmentResources type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &EnvironmentResources{} + +// EnvironmentResources struct for EnvironmentResources +type EnvironmentResources struct { + Items []EnvironmentResource `json:"items,omitempty"` + Count *int32 `json:"count,omitempty"` +} + +// NewEnvironmentResources instantiates a new EnvironmentResources object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewEnvironmentResources() *EnvironmentResources { + this := EnvironmentResources{} + return &this +} + +// NewEnvironmentResourcesWithDefaults instantiates a new EnvironmentResources object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewEnvironmentResourcesWithDefaults() *EnvironmentResources { + this := EnvironmentResources{} + return &this +} + +// GetItems returns the Items field value if set, zero value otherwise. +func (o *EnvironmentResources) GetItems() []EnvironmentResource { + if o == nil || isNil(o.Items) { + var ret []EnvironmentResource + return ret + } + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EnvironmentResources) GetItemsOk() ([]EnvironmentResource, bool) { + if o == nil || isNil(o.Items) { + return nil, false + } + return o.Items, true +} + +// HasItems returns a boolean if a field has been set. +func (o *EnvironmentResources) HasItems() bool { + if o != nil && !isNil(o.Items) { + return true + } + + return false +} + +// SetItems gets a reference to the given []EnvironmentResource and assigns it to the Items field. +func (o *EnvironmentResources) SetItems(v []EnvironmentResource) { + o.Items = v +} + +// GetCount returns the Count field value if set, zero value otherwise. +func (o *EnvironmentResources) GetCount() int32 { + if o == nil || isNil(o.Count) { + var ret int32 + return ret + } + return *o.Count +} + +// GetCountOk returns a tuple with the Count field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EnvironmentResources) GetCountOk() (*int32, bool) { + if o == nil || isNil(o.Count) { + return nil, false + } + return o.Count, true +} + +// HasCount returns a boolean if a field has been set. +func (o *EnvironmentResources) HasCount() bool { + if o != nil && !isNil(o.Count) { + return true + } + + return false +} + +// SetCount gets a reference to the given int32 and assigns it to the Count field. +func (o *EnvironmentResources) SetCount(v int32) { + o.Count = &v +} + +func (o EnvironmentResources) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o EnvironmentResources) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !isNil(o.Items) { + toSerialize["items"] = o.Items + } + if !isNil(o.Count) { + toSerialize["count"] = o.Count + } + return toSerialize, nil +} + +type NullableEnvironmentResources struct { + value *EnvironmentResources + isSet bool +} + +func (v NullableEnvironmentResources) Get() *EnvironmentResources { + return v.value +} + +func (v *NullableEnvironmentResources) Set(val *EnvironmentResources) { + v.value = val + v.isSet = true +} + +func (v NullableEnvironmentResources) IsSet() bool { + return v.isSet +} + +func (v *NullableEnvironmentResources) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEnvironmentResources(val *EnvironmentResources) *NullableEnvironmentResources { + return &NullableEnvironmentResources{value: val, isSet: true} +} + +func (v NullableEnvironmentResources) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEnvironmentResources) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/cli/openapi/model_invite.go b/cli/openapi/model_invite.go new file mode 100644 index 0000000000..2d12b6d786 --- /dev/null +++ b/cli/openapi/model_invite.go @@ -0,0 +1,394 @@ +/* +TraceTest + +OpenAPI definition for TraceTest endpoint and resources + +API version: 0.2.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "time" +) + +// checks if the Invite type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Invite{} + +// Invite struct for Invite +type Invite struct { + Id string `json:"id"` + Role Role `json:"role"` + To string `json:"to"` + CreatedAt *time.Time `json:"createdAt,omitempty"` + SentAt *time.Time `json:"sentAt,omitempty"` + Type *string `json:"type,omitempty"` + Status *string `json:"status,omitempty"` + ReturnTo *string `json:"returnTo,omitempty"` + Environments []InviteEnvironment `json:"environments,omitempty"` +} + +// NewInvite instantiates a new Invite object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInvite(id string, role Role, to string) *Invite { + this := Invite{} + this.Id = id + this.Role = role + this.To = to + var type_ string = "email" + this.Type = &type_ + var status string = "pending" + this.Status = &status + return &this +} + +// NewInviteWithDefaults instantiates a new Invite object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInviteWithDefaults() *Invite { + this := Invite{} + var type_ string = "email" + this.Type = &type_ + var status string = "pending" + this.Status = &status + return &this +} + +// GetId returns the Id field value +func (o *Invite) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *Invite) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *Invite) SetId(v string) { + o.Id = v +} + +// GetRole returns the Role field value +func (o *Invite) GetRole() Role { + if o == nil { + var ret Role + return ret + } + + return o.Role +} + +// GetRoleOk returns a tuple with the Role field value +// and a boolean to check if the value has been set. +func (o *Invite) GetRoleOk() (*Role, bool) { + if o == nil { + return nil, false + } + return &o.Role, true +} + +// SetRole sets field value +func (o *Invite) SetRole(v Role) { + o.Role = v +} + +// GetTo returns the To field value +func (o *Invite) GetTo() string { + if o == nil { + var ret string + return ret + } + + return o.To +} + +// GetToOk returns a tuple with the To field value +// and a boolean to check if the value has been set. +func (o *Invite) GetToOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.To, true +} + +// SetTo sets field value +func (o *Invite) SetTo(v string) { + o.To = v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Invite) GetCreatedAt() time.Time { + if o == nil || isNil(o.CreatedAt) { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invite) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || isNil(o.CreatedAt) { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Invite) HasCreatedAt() bool { + if o != nil && !isNil(o.CreatedAt) { + return true + } + + return false +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Invite) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetSentAt returns the SentAt field value if set, zero value otherwise. +func (o *Invite) GetSentAt() time.Time { + if o == nil || isNil(o.SentAt) { + var ret time.Time + return ret + } + return *o.SentAt +} + +// GetSentAtOk returns a tuple with the SentAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invite) GetSentAtOk() (*time.Time, bool) { + if o == nil || isNil(o.SentAt) { + return nil, false + } + return o.SentAt, true +} + +// HasSentAt returns a boolean if a field has been set. +func (o *Invite) HasSentAt() bool { + if o != nil && !isNil(o.SentAt) { + return true + } + + return false +} + +// SetSentAt gets a reference to the given time.Time and assigns it to the SentAt field. +func (o *Invite) SetSentAt(v time.Time) { + o.SentAt = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *Invite) GetType() string { + if o == nil || isNil(o.Type) { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invite) GetTypeOk() (*string, bool) { + if o == nil || isNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *Invite) HasType() bool { + if o != nil && !isNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *Invite) SetType(v string) { + o.Type = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *Invite) GetStatus() string { + if o == nil || isNil(o.Status) { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invite) GetStatusOk() (*string, bool) { + if o == nil || isNil(o.Status) { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *Invite) HasStatus() bool { + if o != nil && !isNil(o.Status) { + return true + } + + return false +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *Invite) SetStatus(v string) { + o.Status = &v +} + +// GetReturnTo returns the ReturnTo field value if set, zero value otherwise. +func (o *Invite) GetReturnTo() string { + if o == nil || isNil(o.ReturnTo) { + var ret string + return ret + } + return *o.ReturnTo +} + +// GetReturnToOk returns a tuple with the ReturnTo field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invite) GetReturnToOk() (*string, bool) { + if o == nil || isNil(o.ReturnTo) { + return nil, false + } + return o.ReturnTo, true +} + +// HasReturnTo returns a boolean if a field has been set. +func (o *Invite) HasReturnTo() bool { + if o != nil && !isNil(o.ReturnTo) { + return true + } + + return false +} + +// SetReturnTo gets a reference to the given string and assigns it to the ReturnTo field. +func (o *Invite) SetReturnTo(v string) { + o.ReturnTo = &v +} + +// GetEnvironments returns the Environments field value if set, zero value otherwise. +func (o *Invite) GetEnvironments() []InviteEnvironment { + if o == nil || isNil(o.Environments) { + var ret []InviteEnvironment + return ret + } + return o.Environments +} + +// GetEnvironmentsOk returns a tuple with the Environments field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Invite) GetEnvironmentsOk() ([]InviteEnvironment, bool) { + if o == nil || isNil(o.Environments) { + return nil, false + } + return o.Environments, true +} + +// HasEnvironments returns a boolean if a field has been set. +func (o *Invite) HasEnvironments() bool { + if o != nil && !isNil(o.Environments) { + return true + } + + return false +} + +// SetEnvironments gets a reference to the given []InviteEnvironment and assigns it to the Environments field. +func (o *Invite) SetEnvironments(v []InviteEnvironment) { + o.Environments = v +} + +func (o Invite) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Invite) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["role"] = o.Role + toSerialize["to"] = o.To + if !isNil(o.CreatedAt) { + toSerialize["createdAt"] = o.CreatedAt + } + if !isNil(o.SentAt) { + toSerialize["sentAt"] = o.SentAt + } + if !isNil(o.Type) { + toSerialize["type"] = o.Type + } + if !isNil(o.Status) { + toSerialize["status"] = o.Status + } + if !isNil(o.ReturnTo) { + toSerialize["returnTo"] = o.ReturnTo + } + if !isNil(o.Environments) { + toSerialize["environments"] = o.Environments + } + return toSerialize, nil +} + +type NullableInvite struct { + value *Invite + isSet bool +} + +func (v NullableInvite) Get() *Invite { + return v.value +} + +func (v *NullableInvite) Set(val *Invite) { + v.value = val + v.isSet = true +} + +func (v NullableInvite) IsSet() bool { + return v.isSet +} + +func (v *NullableInvite) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInvite(val *Invite) *NullableInvite { + return &NullableInvite{value: val, isSet: true} +} + +func (v NullableInvite) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInvite) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/cli/openapi/model_invite_environment.go b/cli/openapi/model_invite_environment.go new file mode 100644 index 0000000000..43dc411d65 --- /dev/null +++ b/cli/openapi/model_invite_environment.go @@ -0,0 +1,178 @@ +/* +TraceTest + +OpenAPI definition for TraceTest endpoint and resources + +API version: 0.2.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the InviteEnvironment type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InviteEnvironment{} + +// InviteEnvironment struct for InviteEnvironment +type InviteEnvironment struct { + Id string `json:"id"` + Role Role `json:"role"` + Environment *Environment `json:"environment,omitempty"` +} + +// NewInviteEnvironment instantiates a new InviteEnvironment object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInviteEnvironment(id string, role Role) *InviteEnvironment { + this := InviteEnvironment{} + this.Id = id + this.Role = role + return &this +} + +// NewInviteEnvironmentWithDefaults instantiates a new InviteEnvironment object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInviteEnvironmentWithDefaults() *InviteEnvironment { + this := InviteEnvironment{} + return &this +} + +// GetId returns the Id field value +func (o *InviteEnvironment) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *InviteEnvironment) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *InviteEnvironment) SetId(v string) { + o.Id = v +} + +// GetRole returns the Role field value +func (o *InviteEnvironment) GetRole() Role { + if o == nil { + var ret Role + return ret + } + + return o.Role +} + +// GetRoleOk returns a tuple with the Role field value +// and a boolean to check if the value has been set. +func (o *InviteEnvironment) GetRoleOk() (*Role, bool) { + if o == nil { + return nil, false + } + return &o.Role, true +} + +// SetRole sets field value +func (o *InviteEnvironment) SetRole(v Role) { + o.Role = v +} + +// GetEnvironment returns the Environment field value if set, zero value otherwise. +func (o *InviteEnvironment) GetEnvironment() Environment { + if o == nil || isNil(o.Environment) { + var ret Environment + return ret + } + return *o.Environment +} + +// GetEnvironmentOk returns a tuple with the Environment field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InviteEnvironment) GetEnvironmentOk() (*Environment, bool) { + if o == nil || isNil(o.Environment) { + return nil, false + } + return o.Environment, true +} + +// HasEnvironment returns a boolean if a field has been set. +func (o *InviteEnvironment) HasEnvironment() bool { + if o != nil && !isNil(o.Environment) { + return true + } + + return false +} + +// SetEnvironment gets a reference to the given Environment and assigns it to the Environment field. +func (o *InviteEnvironment) SetEnvironment(v Environment) { + o.Environment = &v +} + +func (o InviteEnvironment) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InviteEnvironment) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["role"] = o.Role + if !isNil(o.Environment) { + toSerialize["environment"] = o.Environment + } + return toSerialize, nil +} + +type NullableInviteEnvironment struct { + value *InviteEnvironment + isSet bool +} + +func (v NullableInviteEnvironment) Get() *InviteEnvironment { + return v.value +} + +func (v *NullableInviteEnvironment) Set(val *InviteEnvironment) { + v.value = val + v.isSet = true +} + +func (v NullableInviteEnvironment) IsSet() bool { + return v.isSet +} + +func (v *NullableInviteEnvironment) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInviteEnvironment(val *InviteEnvironment) *NullableInviteEnvironment { + return &NullableInviteEnvironment{value: val, isSet: true} +} + +func (v NullableInviteEnvironment) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInviteEnvironment) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/cli/openapi/model_invite_resource.go b/cli/openapi/model_invite_resource.go new file mode 100644 index 0000000000..bafc8f4648 --- /dev/null +++ b/cli/openapi/model_invite_resource.go @@ -0,0 +1,160 @@ +/* +TraceTest + +OpenAPI definition for TraceTest endpoint and resources + +API version: 0.2.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the InviteResource type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InviteResource{} + +// InviteResource struct for InviteResource +type InviteResource struct { + Type *string `json:"type,omitempty"` + Spec *Invite `json:"spec,omitempty"` +} + +// NewInviteResource instantiates a new InviteResource object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInviteResource() *InviteResource { + this := InviteResource{} + return &this +} + +// NewInviteResourceWithDefaults instantiates a new InviteResource object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInviteResourceWithDefaults() *InviteResource { + this := InviteResource{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *InviteResource) GetType() string { + if o == nil || isNil(o.Type) { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InviteResource) GetTypeOk() (*string, bool) { + if o == nil || isNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *InviteResource) HasType() bool { + if o != nil && !isNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *InviteResource) SetType(v string) { + o.Type = &v +} + +// GetSpec returns the Spec field value if set, zero value otherwise. +func (o *InviteResource) GetSpec() Invite { + if o == nil || isNil(o.Spec) { + var ret Invite + return ret + } + return *o.Spec +} + +// GetSpecOk returns a tuple with the Spec field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InviteResource) GetSpecOk() (*Invite, bool) { + if o == nil || isNil(o.Spec) { + return nil, false + } + return o.Spec, true +} + +// HasSpec returns a boolean if a field has been set. +func (o *InviteResource) HasSpec() bool { + if o != nil && !isNil(o.Spec) { + return true + } + + return false +} + +// SetSpec gets a reference to the given Invite and assigns it to the Spec field. +func (o *InviteResource) SetSpec(v Invite) { + o.Spec = &v +} + +func (o InviteResource) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InviteResource) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !isNil(o.Type) { + toSerialize["type"] = o.Type + } + if !isNil(o.Spec) { + toSerialize["spec"] = o.Spec + } + return toSerialize, nil +} + +type NullableInviteResource struct { + value *InviteResource + isSet bool +} + +func (v NullableInviteResource) Get() *InviteResource { + return v.value +} + +func (v *NullableInviteResource) Set(val *InviteResource) { + v.value = val + v.isSet = true +} + +func (v NullableInviteResource) IsSet() bool { + return v.isSet +} + +func (v *NullableInviteResource) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInviteResource(val *InviteResource) *NullableInviteResource { + return &NullableInviteResource{value: val, isSet: true} +} + +func (v NullableInviteResource) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInviteResource) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/cli/openapi/model_invite_resources.go b/cli/openapi/model_invite_resources.go new file mode 100644 index 0000000000..289b409d53 --- /dev/null +++ b/cli/openapi/model_invite_resources.go @@ -0,0 +1,160 @@ +/* +TraceTest + +OpenAPI definition for TraceTest endpoint and resources + +API version: 0.2.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the InviteResources type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InviteResources{} + +// InviteResources struct for InviteResources +type InviteResources struct { + Items []InviteResource `json:"items,omitempty"` + Count *int32 `json:"count,omitempty"` +} + +// NewInviteResources instantiates a new InviteResources object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInviteResources() *InviteResources { + this := InviteResources{} + return &this +} + +// NewInviteResourcesWithDefaults instantiates a new InviteResources object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInviteResourcesWithDefaults() *InviteResources { + this := InviteResources{} + return &this +} + +// GetItems returns the Items field value if set, zero value otherwise. +func (o *InviteResources) GetItems() []InviteResource { + if o == nil || isNil(o.Items) { + var ret []InviteResource + return ret + } + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InviteResources) GetItemsOk() ([]InviteResource, bool) { + if o == nil || isNil(o.Items) { + return nil, false + } + return o.Items, true +} + +// HasItems returns a boolean if a field has been set. +func (o *InviteResources) HasItems() bool { + if o != nil && !isNil(o.Items) { + return true + } + + return false +} + +// SetItems gets a reference to the given []InviteResource and assigns it to the Items field. +func (o *InviteResources) SetItems(v []InviteResource) { + o.Items = v +} + +// GetCount returns the Count field value if set, zero value otherwise. +func (o *InviteResources) GetCount() int32 { + if o == nil || isNil(o.Count) { + var ret int32 + return ret + } + return *o.Count +} + +// GetCountOk returns a tuple with the Count field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InviteResources) GetCountOk() (*int32, bool) { + if o == nil || isNil(o.Count) { + return nil, false + } + return o.Count, true +} + +// HasCount returns a boolean if a field has been set. +func (o *InviteResources) HasCount() bool { + if o != nil && !isNil(o.Count) { + return true + } + + return false +} + +// SetCount gets a reference to the given int32 and assigns it to the Count field. +func (o *InviteResources) SetCount(v int32) { + o.Count = &v +} + +func (o InviteResources) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InviteResources) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !isNil(o.Items) { + toSerialize["items"] = o.Items + } + if !isNil(o.Count) { + toSerialize["count"] = o.Count + } + return toSerialize, nil +} + +type NullableInviteResources struct { + value *InviteResources + isSet bool +} + +func (v NullableInviteResources) Get() *InviteResources { + return v.value +} + +func (v *NullableInviteResources) Set(val *InviteResources) { + v.value = val + v.isSet = true +} + +func (v NullableInviteResources) IsSet() bool { + return v.isSet +} + +func (v *NullableInviteResources) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInviteResources(val *InviteResources) *NullableInviteResources { + return &NullableInviteResources{value: val, isSet: true} +} + +func (v NullableInviteResources) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInviteResources) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/cli/openapi/model_role.go b/cli/openapi/model_role.go new file mode 100644 index 0000000000..d53fe3bdb8 --- /dev/null +++ b/cli/openapi/model_role.go @@ -0,0 +1,120 @@ +/* +TraceTest + +OpenAPI definition for TraceTest endpoint and resources + +API version: 0.2.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// Role the model 'Role' +type Role string + +// List of Role +const ( + OWNERS Role = "owners" + MEMBERS Role = "members" + ADMINS Role = "admins" + BILLERS Role = "billers" + ENGINEERS Role = "engineers" + RUNNERS Role = "runners" + AGENT Role = "agent" +) + +// All allowed values of Role enum +var AllowedRoleEnumValues = []Role{ + "owners", + "members", + "admins", + "billers", + "engineers", + "runners", + "agent", +} + +func (v *Role) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := Role(value) + for _, existing := range AllowedRoleEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Role", value) +} + +// NewRoleFromValue returns a pointer to a valid Role +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewRoleFromValue(v string) (*Role, error) { + ev := Role(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for Role: valid values are %v", v, AllowedRoleEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v Role) IsValid() bool { + for _, existing := range AllowedRoleEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to Role value +func (v Role) Ptr() *Role { + return &v +} + +type NullableRole struct { + value *Role + isSet bool +} + +func (v NullableRole) Get() *Role { + return v.value +} + +func (v *NullableRole) Set(val *Role) { + v.value = val + v.isSet = true +} + +func (v NullableRole) IsSet() bool { + return v.isSet +} + +func (v *NullableRole) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRole(val *Role) *NullableRole { + return &NullableRole{value: val, isSet: true} +} + +func (v NullableRole) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRole) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/cli/openapi/model_token.go b/cli/openapi/model_token.go new file mode 100644 index 0000000000..442333708d --- /dev/null +++ b/cli/openapi/model_token.go @@ -0,0 +1,388 @@ +/* +TraceTest + +OpenAPI definition for TraceTest endpoint and resources + +API version: 0.2.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "time" +) + +// checks if the Token type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Token{} + +// Token struct for Token +type Token struct { + Id string `json:"id"` + // token name + Name string `json:"name"` + IsRevoked *bool `json:"isRevoked,omitempty"` + Role Role `json:"role"` + UserID *string `json:"userID,omitempty"` + // token duration in minutes + Duration *int32 `json:"duration,omitempty"` + IssuedAt *time.Time `json:"issuedAt,omitempty"` + ExpiresAt *time.Time `json:"expiresAt,omitempty"` + UpdatedAt *time.Time `json:"updatedAt,omitempty"` +} + +// NewToken instantiates a new Token object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewToken(id string, name string, role Role) *Token { + this := Token{} + this.Id = id + this.Name = name + this.Role = role + return &this +} + +// NewTokenWithDefaults instantiates a new Token object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTokenWithDefaults() *Token { + this := Token{} + return &this +} + +// GetId returns the Id field value +func (o *Token) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *Token) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *Token) SetId(v string) { + o.Id = v +} + +// GetName returns the Name field value +func (o *Token) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *Token) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *Token) SetName(v string) { + o.Name = v +} + +// GetIsRevoked returns the IsRevoked field value if set, zero value otherwise. +func (o *Token) GetIsRevoked() bool { + if o == nil || isNil(o.IsRevoked) { + var ret bool + return ret + } + return *o.IsRevoked +} + +// GetIsRevokedOk returns a tuple with the IsRevoked field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Token) GetIsRevokedOk() (*bool, bool) { + if o == nil || isNil(o.IsRevoked) { + return nil, false + } + return o.IsRevoked, true +} + +// HasIsRevoked returns a boolean if a field has been set. +func (o *Token) HasIsRevoked() bool { + if o != nil && !isNil(o.IsRevoked) { + return true + } + + return false +} + +// SetIsRevoked gets a reference to the given bool and assigns it to the IsRevoked field. +func (o *Token) SetIsRevoked(v bool) { + o.IsRevoked = &v +} + +// GetRole returns the Role field value +func (o *Token) GetRole() Role { + if o == nil { + var ret Role + return ret + } + + return o.Role +} + +// GetRoleOk returns a tuple with the Role field value +// and a boolean to check if the value has been set. +func (o *Token) GetRoleOk() (*Role, bool) { + if o == nil { + return nil, false + } + return &o.Role, true +} + +// SetRole sets field value +func (o *Token) SetRole(v Role) { + o.Role = v +} + +// GetUserID returns the UserID field value if set, zero value otherwise. +func (o *Token) GetUserID() string { + if o == nil || isNil(o.UserID) { + var ret string + return ret + } + return *o.UserID +} + +// GetUserIDOk returns a tuple with the UserID field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Token) GetUserIDOk() (*string, bool) { + if o == nil || isNil(o.UserID) { + return nil, false + } + return o.UserID, true +} + +// HasUserID returns a boolean if a field has been set. +func (o *Token) HasUserID() bool { + if o != nil && !isNil(o.UserID) { + return true + } + + return false +} + +// SetUserID gets a reference to the given string and assigns it to the UserID field. +func (o *Token) SetUserID(v string) { + o.UserID = &v +} + +// GetDuration returns the Duration field value if set, zero value otherwise. +func (o *Token) GetDuration() int32 { + if o == nil || isNil(o.Duration) { + var ret int32 + return ret + } + return *o.Duration +} + +// GetDurationOk returns a tuple with the Duration field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Token) GetDurationOk() (*int32, bool) { + if o == nil || isNil(o.Duration) { + return nil, false + } + return o.Duration, true +} + +// HasDuration returns a boolean if a field has been set. +func (o *Token) HasDuration() bool { + if o != nil && !isNil(o.Duration) { + return true + } + + return false +} + +// SetDuration gets a reference to the given int32 and assigns it to the Duration field. +func (o *Token) SetDuration(v int32) { + o.Duration = &v +} + +// GetIssuedAt returns the IssuedAt field value if set, zero value otherwise. +func (o *Token) GetIssuedAt() time.Time { + if o == nil || isNil(o.IssuedAt) { + var ret time.Time + return ret + } + return *o.IssuedAt +} + +// GetIssuedAtOk returns a tuple with the IssuedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Token) GetIssuedAtOk() (*time.Time, bool) { + if o == nil || isNil(o.IssuedAt) { + return nil, false + } + return o.IssuedAt, true +} + +// HasIssuedAt returns a boolean if a field has been set. +func (o *Token) HasIssuedAt() bool { + if o != nil && !isNil(o.IssuedAt) { + return true + } + + return false +} + +// SetIssuedAt gets a reference to the given time.Time and assigns it to the IssuedAt field. +func (o *Token) SetIssuedAt(v time.Time) { + o.IssuedAt = &v +} + +// GetExpiresAt returns the ExpiresAt field value if set, zero value otherwise. +func (o *Token) GetExpiresAt() time.Time { + if o == nil || isNil(o.ExpiresAt) { + var ret time.Time + return ret + } + return *o.ExpiresAt +} + +// GetExpiresAtOk returns a tuple with the ExpiresAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Token) GetExpiresAtOk() (*time.Time, bool) { + if o == nil || isNil(o.ExpiresAt) { + return nil, false + } + return o.ExpiresAt, true +} + +// HasExpiresAt returns a boolean if a field has been set. +func (o *Token) HasExpiresAt() bool { + if o != nil && !isNil(o.ExpiresAt) { + return true + } + + return false +} + +// SetExpiresAt gets a reference to the given time.Time and assigns it to the ExpiresAt field. +func (o *Token) SetExpiresAt(v time.Time) { + o.ExpiresAt = &v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Token) GetUpdatedAt() time.Time { + if o == nil || isNil(o.UpdatedAt) { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Token) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || isNil(o.UpdatedAt) { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Token) HasUpdatedAt() bool { + if o != nil && !isNil(o.UpdatedAt) { + return true + } + + return false +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Token) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +func (o Token) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Token) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["name"] = o.Name + if !isNil(o.IsRevoked) { + toSerialize["isRevoked"] = o.IsRevoked + } + toSerialize["role"] = o.Role + if !isNil(o.UserID) { + toSerialize["userID"] = o.UserID + } + if !isNil(o.Duration) { + toSerialize["duration"] = o.Duration + } + if !isNil(o.IssuedAt) { + toSerialize["issuedAt"] = o.IssuedAt + } + if !isNil(o.ExpiresAt) { + toSerialize["expiresAt"] = o.ExpiresAt + } + if !isNil(o.UpdatedAt) { + toSerialize["updatedAt"] = o.UpdatedAt + } + return toSerialize, nil +} + +type NullableToken struct { + value *Token + isSet bool +} + +func (v NullableToken) Get() *Token { + return v.value +} + +func (v *NullableToken) Set(val *Token) { + v.value = val + v.isSet = true +} + +func (v NullableToken) IsSet() bool { + return v.isSet +} + +func (v *NullableToken) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableToken(val *Token) *NullableToken { + return &NullableToken{value: val, isSet: true} +} + +func (v NullableToken) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableToken) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/cli/openapi/model_tokens.go b/cli/openapi/model_tokens.go new file mode 100644 index 0000000000..422c813b62 --- /dev/null +++ b/cli/openapi/model_tokens.go @@ -0,0 +1,160 @@ +/* +TraceTest + +OpenAPI definition for TraceTest endpoint and resources + +API version: 0.2.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the Tokens type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Tokens{} + +// Tokens struct for Tokens +type Tokens struct { + Items []Token `json:"items,omitempty"` + Count *int32 `json:"count,omitempty"` +} + +// NewTokens instantiates a new Tokens object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTokens() *Tokens { + this := Tokens{} + return &this +} + +// NewTokensWithDefaults instantiates a new Tokens object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTokensWithDefaults() *Tokens { + this := Tokens{} + return &this +} + +// GetItems returns the Items field value if set, zero value otherwise. +func (o *Tokens) GetItems() []Token { + if o == nil || isNil(o.Items) { + var ret []Token + return ret + } + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Tokens) GetItemsOk() ([]Token, bool) { + if o == nil || isNil(o.Items) { + return nil, false + } + return o.Items, true +} + +// HasItems returns a boolean if a field has been set. +func (o *Tokens) HasItems() bool { + if o != nil && !isNil(o.Items) { + return true + } + + return false +} + +// SetItems gets a reference to the given []Token and assigns it to the Items field. +func (o *Tokens) SetItems(v []Token) { + o.Items = v +} + +// GetCount returns the Count field value if set, zero value otherwise. +func (o *Tokens) GetCount() int32 { + if o == nil || isNil(o.Count) { + var ret int32 + return ret + } + return *o.Count +} + +// GetCountOk returns a tuple with the Count field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Tokens) GetCountOk() (*int32, bool) { + if o == nil || isNil(o.Count) { + return nil, false + } + return o.Count, true +} + +// HasCount returns a boolean if a field has been set. +func (o *Tokens) HasCount() bool { + if o != nil && !isNil(o.Count) { + return true + } + + return false +} + +// SetCount gets a reference to the given int32 and assigns it to the Count field. +func (o *Tokens) SetCount(v int32) { + o.Count = &v +} + +func (o Tokens) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Tokens) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !isNil(o.Items) { + toSerialize["items"] = o.Items + } + if !isNil(o.Count) { + toSerialize["count"] = o.Count + } + return toSerialize, nil +} + +type NullableTokens struct { + value *Tokens + isSet bool +} + +func (v NullableTokens) Get() *Tokens { + return v.value +} + +func (v *NullableTokens) Set(val *Tokens) { + v.value = val + v.isSet = true +} + +func (v NullableTokens) IsSet() bool { + return v.isSet +} + +func (v *NullableTokens) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTokens(val *Tokens) *NullableTokens { + return &NullableTokens{value: val, isSet: true} +} + +func (v NullableTokens) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTokens) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/cli/pkg/fileutil/file.go b/cli/pkg/fileutil/file.go index 7cb77611ca..e49b2b5daf 100644 --- a/cli/pkg/fileutil/file.go +++ b/cli/pkg/fileutil/file.go @@ -21,7 +21,6 @@ func IsDir(path string) bool { if err != nil { return false } - return file.IsDir() } diff --git a/cli/pkg/resourcemanager/apply.go b/cli/pkg/resourcemanager/apply.go index c8772b0bc2..84b3f634c7 100644 --- a/cli/pkg/resourcemanager/apply.go +++ b/cli/pkg/resourcemanager/apply.go @@ -165,5 +165,13 @@ func (c Client) Apply(ctx context.Context, inputFile fileutil.File, requestedFor } } + if c.options.applyPostProcessor != nil { + var err error + _, err = c.options.applyPostProcessor(ctx, originalInputFile) + if err != nil { + return "", fmt.Errorf("cannot postprocess Apply request: %w", err) + } + } + return requestedFormat.Format(string(body), c.options.tableConfig, c.options.listPath) } diff --git a/cli/pkg/resourcemanager/options.go b/cli/pkg/resourcemanager/options.go index 0d4f1f3827..0b3aee548c 100644 --- a/cli/pkg/resourcemanager/options.go +++ b/cli/pkg/resourcemanager/options.go @@ -1,14 +1,15 @@ package resourcemanager type options struct { - applyPreProcessor applyPreProcessorFn - prefixGetterFn prefixGetterFn - tableConfig TableConfig - listPath string - deleteSuccessMsg string - resourceType string - deprecatedAlias string - proxyResource string + applyPreProcessor applyPreProcessorFn + applyPostProcessor applyPreProcessorFn + prefixGetterFn prefixGetterFn + tableConfig TableConfig + listPath string + deleteSuccessMsg string + resourceType string + deprecatedAlias string + proxyResource string } type option func(*options) @@ -19,6 +20,12 @@ func WithApplyPreProcessor(preProcessor applyPreProcessorFn) option { } } +func WithApplyPostProcessor(postProcessor applyPreProcessorFn) option { + return func(o *options) { + o.applyPostProcessor = postProcessor + } +} + func WithPrefixGetter(prefixGetterFn prefixGetterFn) option { return func(o *options) { o.prefixGetterFn = prefixGetterFn diff --git a/cli/processor/environment.go b/cli/processor/environment.go new file mode 100644 index 0000000000..abc451c74f --- /dev/null +++ b/cli/processor/environment.go @@ -0,0 +1,87 @@ +package processor + +import ( + "context" + "fmt" + + "github.com/goccy/go-yaml" + "github.com/kubeshop/tracetest/cli/cmdutil" + "github.com/kubeshop/tracetest/cli/openapi" + "github.com/kubeshop/tracetest/cli/pkg/fileutil" + "go.uber.org/zap" +) + +type applyFn func(ctx context.Context, resource fileutil.File) (fileutil.File, error) +type updateEnvFn func(ctx context.Context, envID string) error + +type environment struct { + logger *zap.Logger + applyFn applyFn + updateEnvFn updateEnvFn +} + +func Environment(logger *zap.Logger, applyFn applyFn, updateEnvFn updateEnvFn) environment { + return environment{logger: cmdutil.GetLogger(), applyFn: applyFn, updateEnvFn: updateEnvFn} +} + +func (e environment) Postprocess(ctx context.Context, input fileutil.File) (fileutil.File, error) { + var env openapi.EnvironmentResource + err := yaml.Unmarshal(input.Contents(), &env) + if err != nil { + e.logger.Error("error parsing test suite", zap.String("content", string(input.Contents())), zap.Error(err)) + return input, fmt.Errorf("could not unmarshal test suite yaml: %w", err) + } + + if env.GetSpec().Id != nil { + err = e.updateEnvFn(ctx, *env.GetSpec().Id) + if err != nil { + return input, fmt.Errorf("could not update environment: %w", err) + } + } + + if env.GetSpec().Resources != nil { + err = e.mapResources(ctx, input, *env.GetSpec().Resources) + if err != nil { + return input, fmt.Errorf("could not map environment resources: %w", err) + } + } + + marshalled, err := yaml.Marshal(env) + if err != nil { + return input, fmt.Errorf("could not marshal environment yaml: %w", err) + } + + return fileutil.New(input.AbsPath(), marshalled), nil +} + +func (e environment) mapResources(ctx context.Context, input fileutil.File, resources string) error { + // resources + if !fileutil.LooksLikeRelativeFilePath(resources) { + return nil + } + + files := fileutil.ReadDirFileNames(resources) + + for _, fileName := range files { + if fileutil.IsDir(fileName) { + err := e.mapResources(ctx, input, fileName) + if err != nil { + return fmt.Errorf("cannot map resources: %w", err) + } + + continue + } + + resource, err := fileutil.Read(fileName) + if err != nil { + return fmt.Errorf("cannot read resource file: %w", err) + } + + _, err = e.applyFn(ctx, resource) + if err != nil { + return fmt.Errorf("cannot apply resource: %w", err) + } + } + + return nil +} diff --git a/cli/processor/postprocessor.go b/cli/processor/postprocessor.go new file mode 100644 index 0000000000..4400c8bfb6 --- /dev/null +++ b/cli/processor/postprocessor.go @@ -0,0 +1,11 @@ +package processor + +import ( + "context" + + "github.com/kubeshop/tracetest/cli/pkg/fileutil" +) + +type Postprocessor interface { + Postprocess(ctx context.Context, input fileutil.File) error +} diff --git a/cli/preprocessor/preprocessor.go b/cli/processor/preprocessor.go similarity index 89% rename from cli/preprocessor/preprocessor.go rename to cli/processor/preprocessor.go index eb2b89751a..7ec4928b0b 100644 --- a/cli/preprocessor/preprocessor.go +++ b/cli/processor/preprocessor.go @@ -1,4 +1,4 @@ -package preprocessor +package processor import ( "context" diff --git a/cli/preprocessor/test.go b/cli/processor/test.go similarity index 99% rename from cli/preprocessor/test.go rename to cli/processor/test.go index 23001ae58a..968fb044cc 100644 --- a/cli/preprocessor/test.go +++ b/cli/processor/test.go @@ -1,4 +1,4 @@ -package preprocessor +package processor import ( "context" diff --git a/cli/preprocessor/testsuite.go b/cli/processor/testsuite.go similarity index 99% rename from cli/preprocessor/testsuite.go rename to cli/processor/testsuite.go index 5d495a9328..5c1b0c14ad 100644 --- a/cli/preprocessor/testsuite.go +++ b/cli/processor/testsuite.go @@ -1,4 +1,4 @@ -package preprocessor +package processor import ( "context" diff --git a/cli/preprocessor/variableset.go b/cli/processor/variableset.go similarity index 98% rename from cli/preprocessor/variableset.go rename to cli/processor/variableset.go index cd2e03371b..6cc593e26d 100644 --- a/cli/preprocessor/variableset.go +++ b/cli/processor/variableset.go @@ -1,4 +1,4 @@ -package preprocessor +package processor import ( "context"