Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement get create list experiments no command #1468

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
264 changes: 264 additions & 0 deletions api-description/web-api.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3049,6 +3049,230 @@ paths:
$ref: '#/definitions/environmentUpdateProjectRequest'
tags:
- Project
/v1/experiment:
get:
summary: Get
description: Get an experiment.
operationId: web.v1.experiment.get
responses:
"200":
description: A successful response.
schema:
$ref: '#/definitions/experimentGetExperimentResponse'
"400":
description: Returned for bad requests that may have failed validation.
schema:
$ref: '#/definitions/googlerpcStatus'
examples:
application/json:
code: 3
details: []
message: invalid arguments error
"401":
description: Request could not be authenticated (authentication required).
schema:
$ref: '#/definitions/googlerpcStatus'
examples:
application/json:
code: 16
details: []
message: not authenticated
"503":
description: Returned for internal errors.
schema:
$ref: '#/definitions/googlerpcStatus'
examples:
application/json:
code: 13
details: []
message: internal
default:
description: An unexpected error response.
schema:
$ref: '#/definitions/googlerpcStatus'
parameters:
- name: id
in: query
required: false
type: string
- name: environmentId
in: query
required: false
type: string
tags:
- experiment
post:
summary: Create
description: Create an experiment.
operationId: web.v1.experiment.create
responses:
"200":
description: A successful response.
schema:
$ref: '#/definitions/experimentCreateExperimentResponse'
"400":
description: Returned for bad requests that may have failed validation.
schema:
$ref: '#/definitions/googlerpcStatus'
examples:
application/json:
code: 3
details: []
message: invalid arguments error
"401":
description: Request could not be authenticated (authentication required).
schema:
$ref: '#/definitions/googlerpcStatus'
examples:
application/json:
code: 16
details: []
message: not authenticated
"503":
description: Returned for internal errors.
schema:
$ref: '#/definitions/googlerpcStatus'
examples:
application/json:
code: 13
details: []
message: internal
default:
description: An unexpected error response.
schema:
$ref: '#/definitions/googlerpcStatus'
parameters:
- name: body
in: body
required: true
schema:
$ref: '#/definitions/experimentCreateExperimentRequest'
tags:
- experiment
/v1/experiments:
get:
summary: List
description: List experiments.
operationId: web.v1.experiment.list
responses:
"200":
description: A successful response.
schema:
$ref: '#/definitions/experimentListExperimentsResponse'
"400":
description: Returned for bad requests that may have failed validation.
schema:
$ref: '#/definitions/googlerpcStatus'
examples:
application/json:
code: 3
details: []
message: invalid arguments error
"401":
description: Request could not be authenticated (authentication required).
schema:
$ref: '#/definitions/googlerpcStatus'
examples:
application/json:
code: 16
details: []
message: not authenticated
"503":
description: Returned for internal errors.
schema:
$ref: '#/definitions/googlerpcStatus'
examples:
application/json:
code: 13
details: []
message: internal
default:
description: An unexpected error response.
schema:
$ref: '#/definitions/googlerpcStatus'
parameters:
- name: featureId
in: query
required: false
type: string
- name: featureVersion
in: query
required: false
type: integer
format: int32
- name: from
in: query
required: false
type: string
format: int64
- name: to
in: query
required: false
type: string
format: int64
- name: pageSize
in: query
required: false
type: string
format: int64
- name: cursor
in: query
required: false
type: string
- name: status
description: '[deprecated = true];'
in: query
required: false
type: integer
format: int32
- name: maintainer
in: query
required: false
type: string
- name: orderBy
in: query
required: false
type: string
enum:
- DEFAULT
- NAME
- CREATED_AT
- UPDATED_AT
default: DEFAULT
- name: orderDirection
in: query
required: false
type: string
enum:
- ASC
- DESC
default: ASC
- name: searchKeyword
in: query
required: false
type: string
- name: archived
in: query
required: false
type: boolean
- name: statuses
in: query
required: false
type: array
items:
type: string
enum:
- WAITING
- RUNNING
- STOPPED
- FORCE_STOPPED
collectionFormat: multi
- name: environmentId
in: query
required: true
type: string
tags:
- experiment
/v1/goal:
get:
summary: Get
Expand Down Expand Up @@ -4413,6 +4637,13 @@ definitions:
- WriteType_OVERRIDE
- WriteType_PATCH
default: WriteType_UNSPECIFIED
ExperimentGoalReference:
type: object
properties:
id:
type: string
name:
type: string
FeatureVariationType:
type: string
enum:
Expand Down Expand Up @@ -6006,6 +6237,34 @@ definitions:
type: string
baseVariationId:
type: string
experimentCreateExperimentRequest:
type: object
properties:
command:
$ref: '#/definitions/experimentCreateExperimentCommand'
description: deprecated
environmentId:
type: string
featureId:
type: string
startAt:
type: string
format: int64
stopAt:
type: string
format: int64
goalIds:
type: array
items:
type: string
name:
type: string
description:
type: string
baseVariationId:
type: string
required:
- environmentId
experimentCreateExperimentResponse:
type: object
properties:
Expand Down Expand Up @@ -6107,6 +6366,11 @@ definitions:
type: string
archived:
type: boolean
goals:
type: array
items:
type: object
$ref: '#/definitions/ExperimentGoalReference'
experimentExperimentStatus:
type: string
enum:
Expand Down
4 changes: 2 additions & 2 deletions manifests/bucketeer/charts/web/values.yaml

Large diffs are not rendered by default.

33 changes: 17 additions & 16 deletions pkg/experiment/api/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,21 @@ import (
)

var (
statusInternal = gstatus.New(codes.Internal, "experiment: internal")
statusInvalidCursor = gstatus.New(codes.InvalidArgument, "experiment: cursor is invalid")
statusNoCommand = gstatus.New(codes.InvalidArgument, "experiment: must contain at least one command")
statusFeatureIDRequired = gstatus.New(codes.InvalidArgument, "experiment: feature id must be specified")
statusExperimentIDRequired = gstatus.New(codes.InvalidArgument, "experiment: experiment id must be specified")
statusGoalIDRequired = gstatus.New(codes.InvalidArgument, "experiment: goal id must be specified")
statusInvalidGoalID = gstatus.New(codes.InvalidArgument, "experiment: invalid goal id")
statusGoalNameRequired = gstatus.New(codes.InvalidArgument, "experiment: goal name must be specified")
statusPeriodTooLong = gstatus.New(codes.InvalidArgument, "experiment: period too long")
statusInvalidOrderBy = gstatus.New(codes.InvalidArgument, "expriment: order_by is invalid")
statusNotFound = gstatus.New(codes.NotFound, "experiment: not found")
statusGoalNotFound = gstatus.New(codes.NotFound, "experiment: goal not found")
statusFeatureNotFound = gstatus.New(codes.NotFound, "experiment: feature not found")
statusAlreadyExists = gstatus.New(codes.AlreadyExists, "experiment: already exists")
statusUnauthenticated = gstatus.New(codes.Unauthenticated, "experiment: unauthenticated")
statusPermissionDenied = gstatus.New(codes.PermissionDenied, "experiment: permission denied")
statusInternal = gstatus.New(codes.Internal, "experiment: internal")
statusInvalidCursor = gstatus.New(codes.InvalidArgument, "experiment: cursor is invalid")
statusNoCommand = gstatus.New(codes.InvalidArgument, "experiment: must contain at least one command")
statusFeatureIDRequired = gstatus.New(codes.InvalidArgument, "experiment: feature id must be specified")
statusExperimentIDRequired = gstatus.New(codes.InvalidArgument, "experiment: experiment id must be specified")
statusExperimentNameRequired = gstatus.New(codes.InvalidArgument, "experiment: experiment name must be specified")
statusGoalIDRequired = gstatus.New(codes.InvalidArgument, "experiment: goal id must be specified")
statusInvalidGoalID = gstatus.New(codes.InvalidArgument, "experiment: invalid goal id")
statusGoalNameRequired = gstatus.New(codes.InvalidArgument, "experiment: goal name must be specified")
statusPeriodTooLong = gstatus.New(codes.InvalidArgument, "experiment: period too long")
statusInvalidOrderBy = gstatus.New(codes.InvalidArgument, "expriment: order_by is invalid")
statusNotFound = gstatus.New(codes.NotFound, "experiment: not found")
statusGoalNotFound = gstatus.New(codes.NotFound, "experiment: goal not found")
statusFeatureNotFound = gstatus.New(codes.NotFound, "experiment: feature not found")
statusAlreadyExists = gstatus.New(codes.AlreadyExists, "experiment: already exists")
statusUnauthenticated = gstatus.New(codes.Unauthenticated, "experiment: unauthenticated")
statusPermissionDenied = gstatus.New(codes.PermissionDenied, "experiment: permission denied")
)
Loading
Loading