Skip to content

Commit

Permalink
feat: environments as resources (#2415)
Browse files Browse the repository at this point in the history
* remove old environment endpoints

* implement environments as a resource

* fix build after rebase

* fix encoding

* fix test

* registering environent resource routes (#2435)

* feature(frontend): enabling environments as resources (#2437)

* remove old environment endpoints

* implement environments as a resource

* fix build after rebase

* fix encoding

* fix test

* registering environent resource routes (#2435)

* feature(frontend): enabling environments as resources

* feature(frontend): fixing unit tests

---------

Co-authored-by: Matheus Nogueira <matheus.nogueira2008@gmail.com>
Co-authored-by: Sebastian Choren <sebastian.choren@gmail.com>

* add instrumentation to resource manager

* Update map conversion logic

* fix cli tests

* fix rebase

* fix span name

* fix tests

* remove broken middleware config

* fix generated file

* chore(docs): updating docs

* feature(cli): enabling environments as resources (#2446)

* remove old environment endpoints

* feature(frontend): enabling environments as resources (#2437)

* remove old environment endpoints

* implement environments as a resource

* fix build after rebase

* fix encoding

* fix test

* registering environent resource routes (#2435)

* feature(frontend): enabling environments as resources

* feature(frontend): fixing unit tests

---------

Co-authored-by: Matheus Nogueira <matheus.nogueira2008@gmail.com>
Co-authored-by: Sebastian Choren <sebastian.choren@gmail.com>

* fixing unit tests

* feature(cli): enabling environments as resources

* fixing environments tracetest testing with tracetest

* fixing environments tracetest testing with tracetest

* fixing environments tracetest testing with tracetest

* remove old environment endpoints

* implement environments as a resource

* fix build after rebase

* fix encoding

* registering environent resource routes (#2435)

* feature(frontend): enabling environments as resources (#2437)

* remove old environment endpoints

* implement environments as a resource

* fix build after rebase

* fix encoding

* fix test

* registering environent resource routes (#2435)

* feature(frontend): enabling environments as resources

* feature(frontend): fixing unit tests

---------

Co-authored-by: Matheus Nogueira <matheus.nogueira2008@gmail.com>
Co-authored-by: Sebastian Choren <sebastian.choren@gmail.com>

* fix rebase

* fixing unit tests

* fixing environments tracetest testing with tracetest

* fixing environments tracetest testing with tracetest

* fix rebase

* fix test run with env

* fix bad rebase

---------

Co-authored-by: Matheus Nogueira <matheus.nogueira2008@gmail.com>
Co-authored-by: Sebastian Choren <sebastian.choren@gmail.com>

* fix instrumentation

* fix span name

* Apply suggestions from code review

Co-authored-by: Daniel Baptista Dias <danielbdias@users.noreply.github.com>

* remove empty line

---------

Co-authored-by: Sebastian Choren <sebastian.choren@gmail.com>
Co-authored-by: Oscar Reyes <oscar-rreyes1@hotmail.com>
Co-authored-by: Daniel Dias <danielbpdias@gmail.com>
Co-authored-by: Daniel Baptista Dias <danielbdias@users.noreply.github.com>
  • Loading branch information
5 people committed May 2, 2023
1 parent 7a93164 commit d953437
Show file tree
Hide file tree
Showing 59 changed files with 2,823 additions and 1,847 deletions.
11 changes: 11 additions & 0 deletions api/environments.yaml
Expand Up @@ -2,6 +2,17 @@ openapi: 3.0.0

components:
schemas:
EnvironmentResource:
type: object
description: "Represents an environment structured into the Resources format."
properties:
type:
type: string
description: "Represents the type of this resource. It should always be set as 'Environment'."
enum:
- Environment
spec:
$ref: "#/components/schemas/Environment"
Environment:
type: object
properties:
Expand Down
271 changes: 140 additions & 131 deletions api/openapi.yaml
Expand Up @@ -643,136 +643,6 @@ paths:
items:
$ref: "./testEvents.yaml#/components/schemas/TestRunEvent"

# Environments
/environments:
get:
tags:
- api
summary: "Get Environments"
description: "Get Environments"
operationId: getEnvironments
parameters:
- $ref: "./parameters.yaml#/components/parameters/take"
- $ref: "./parameters.yaml#/components/parameters/skip"
- $ref: "./parameters.yaml#/components/parameters/query"
- $ref: "./parameters.yaml#/components/parameters/sortBy"
- $ref: "./parameters.yaml#/components/parameters/sortDirection"
responses:
200:
description: successful operation
headers:
X-Total-Count:
schema:
type: integer
description: Total records count
content:
application/json:
schema:
type: array
items:
$ref: "./environments.yaml#/components/schemas/Environment"
500:
description: "problem with getting environments"
post:
tags:
- api
summary: "Create new environment"
description: "Create new environment action"
operationId: createEnvironment
requestBody:
content:
application/json:
schema:
$ref: "./environments.yaml#/components/schemas/Environment"
responses:
200:
description: successful operation
content:
application/json:
schema:
$ref: "./environments.yaml#/components/schemas/Environment"
400:
description: "trying to create a environment with an already existing ID"
/environments/{environmentId}:
get:
tags:
- api
parameters:
- in: path
name: environmentId
schema:
type: string
required: true
summary: "get environment"
description: "get environment"
operationId: getEnvironment
responses:
200:
description: successful operation
content:
application/json:
schema:
$ref: "./environments.yaml#/components/schemas/Environment"
500:
description: "problem with getting a environment"
put:
tags:
- api
parameters:
- in: path
name: environmentId
schema:
type: string
required: true
summary: "update environment"
description: "update environment action"
operationId: updateEnvironment
requestBody:
content:
application/json:
schema:
$ref: "./environments.yaml#/components/schemas/Environment"
responses:
204:
description: successful operation
500:
description: "problem with updating environment"
delete:
tags:
- api
parameters:
- in: path
name: environmentId
schema:
type: string
required: true
summary: "delete a environment"
description: "delete a environment"
operationId: deleteEnvironment
responses:
"204":
description: OK
/environments/{environmentId}/definition.yaml:
get:
tags:
- api
parameters:
- in: path
name: environmentId
schema:
type: string
required: true
summary: Get the environment definition as an YAML file
description: Get the environment as an YAML file
operationId: getEnvironmentDefinitionFile
responses:
200:
description: OK
content:
application/yaml:
schema:
type: string

# Expressions
/expressions/resolve:
post:
Expand Down Expand Up @@ -1139,8 +1009,147 @@ paths:
summary: "Delete a Data Store"
description: "Delete a Data Store"
operationId: deleteDataStore
responses:
"204":
description: OK

# Environments
/environments:
get:
tags:
- resource-api
summary: "List environments"
description: "List environments available in Tracetest."
operationId: listEnvironments
parameters:
- $ref: "./parameters.yaml#/components/parameters/take"
- $ref: "./parameters.yaml#/components/parameters/skip"
- $ref: "./parameters.yaml#/components/parameters/switchableResourceSortBy"
- $ref: "./parameters.yaml#/components/parameters/sortDirection"
responses:
200:
description: successful operation
content:
application/json:
schema:
type: object
properties:
count:
type: integer
items:
type: array
items:
$ref: "./environments.yaml#/components/schemas/EnvironmentResource"
text/yaml:
schema:
type: object
properties:
count:
type: integer
items:
type: array
items:
$ref: "./environments.yaml#/components/schemas/EnvironmentResource"
400:
description: "invalid query for environments, some data was sent in incorrect format."
500:
description: "problem listing environments"
post:
tags:
- resource-api
summary: "Create an environment"
description: "Create an environment that can be used by tests and transactions"
operationId: createEnvironment
requestBody:
content:
application/json:
schema:
$ref: "./environments.yaml#/components/schemas/EnvironmentResource"
text/yaml:
schema:
$ref: "./environments.yaml#/components/schemas/EnvironmentResource"
responses:
201:
description: successful operation
content:
application/json:
schema:
$ref: "./environments.yaml#/components/schemas/EnvironmentResource"
text/yaml:
schema:
$ref: "./environments.yaml#/components/schemas/EnvironmentResource"
500:
description: "problem creating an environment"

/environments/{environmentId}:
get:
tags:
- resource-api
parameters:
- $ref: "./parameters.yaml#/components/parameters/environmentId"
summary: "Get a specific environment"
description: "Get one environment by its id"
operationId: getEnvironment
responses:
200:
description: successful operation
content:
application/json:
schema:
$ref: "./environments.yaml#/components/schemas/EnvironmentResource"
text/yaml:
schema:
$ref: "./environments.yaml#/components/schemas/EnvironmentResource"
404:
description: "environment not found"
500:
description: "problem getting an environment"
put:
tags:
- resource-api
parameters:
- $ref: "./parameters.yaml#/components/parameters/environmentId"
summary: "Update an environment"
description: "Update an environment used on Tracetest"
operationId: updateEnvironment
requestBody:
content:
application/json:
schema:
$ref: "./environments.yaml#/components/schemas/EnvironmentResource"
text/yaml:
schema:
$ref: "./environments.yaml#/components/schemas/EnvironmentResource"
responses:
200:
description: successful operation
content:
application/json:
schema:
$ref: "./environments.yaml#/components/schemas/EnvironmentResource"
text/yaml:
schema:
$ref: "./environments.yaml#/components/schemas/EnvironmentResource"
400:
description: "invalid environment, some data was sent in incorrect format."
404:
description: "environment not found"
500:
description: "problem updating an environment"
delete:
tags:
- resource-api
parameters:
- $ref: "./parameters.yaml#/components/parameters/environmentId"
summary: "Delete an environment"
description: "Delete an environment from Tracetest"
operationId: deleteEnvironment
responses:
204:
description: successful operation
400:
description: "invalid environment, some data was sent in incorrect format."
404:
description: "environment not found"
500:
description: "problem with data store deletion"
description: "problem deleting an environment"
8 changes: 8 additions & 0 deletions api/parameters.yaml
Expand Up @@ -125,3 +125,11 @@ components:
description: "ID of a datastore used on Tracetest to configure how to fetch traces in a test"
schema:
type: string

environmentId:
in: path
name: environmentId
required: true
description: "ID of an environment used on Tracetest to inject values into tests and transactions"
schema:
type: string
73 changes: 0 additions & 73 deletions cli/actions/apply_environment_action.go

This file was deleted.

0 comments on commit d953437

Please sign in to comment.