Skip to content

Commit

Permalink
feat: implement get create list experiments no command (#1468)
Browse files Browse the repository at this point in the history
Part of #1417
  • Loading branch information
hvn2k1 authored Jan 24, 2025
1 parent aa09981 commit 9d21e17
Show file tree
Hide file tree
Showing 21 changed files with 3,045 additions and 562 deletions.
284 changes: 284 additions & 0 deletions api-description/web-api.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3394,6 +3394,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 @@ -4856,6 +5080,13 @@ definitions:
type: string
commitHash:
type: string
ExperimentGoalReference:
type: object
properties:
id:
type: string
name:
type: string
FeatureVariationType:
type: string
enum:
Expand All @@ -4878,6 +5109,18 @@ definitions:
- EXPERIMENT
- OPERATION
default: UNKNOWN
ListExperimentsResponseSummary:
type: object
properties:
totalWaitingCount:
type: string
format: int64
totalRunningCount:
type: string
format: int64
totalStoppedCount:
type: string
format: int64
ListFlagTriggersResponseFlagTriggerWithUrl:
type: object
properties:
Expand Down Expand Up @@ -6564,6 +6807,40 @@ 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
- featureId
- startAt
- stopAt
- goalIds
- name
- baseVariationId
experimentCreateExperimentResponse:
type: object
properties:
Expand Down Expand Up @@ -6665,6 +6942,11 @@ definitions:
type: string
archived:
type: boolean
goals:
type: array
items:
type: object
$ref: '#/definitions/ExperimentGoalReference'
experimentExperimentStatus:
type: string
enum:
Expand Down Expand Up @@ -6748,6 +7030,8 @@ definitions:
totalCount:
type: string
format: int64
summary:
$ref: '#/definitions/ListExperimentsResponseSummary'
experimentListGoalsRequestOrderBy:
type: string
enum:
Expand Down
8 changes: 3 additions & 5 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

0 comments on commit 9d21e17

Please sign in to comment.