Documentation
¶
Index ¶
- Variables
- func CacheExpires(r *http.Response) time.Time
- type APIClient
- type APIKey
- type APIResponse
- type BasicAuth
- type Configuration
- type Constraint
- type ConstraintApiService
- func (a *ConstraintApiService) CreateConstraint(ctx context.Context, flagID int64, segmentID int64, ...) (Constraint, *http.Response, error)
- func (a *ConstraintApiService) DeleteConstraint(ctx context.Context, flagID int64, segmentID int64, constraintID int64) (*http.Response, error)
- func (a *ConstraintApiService) FindConstraints(ctx context.Context, flagID int64, segmentID int64) ([]Constraint, *http.Response, error)
- func (a *ConstraintApiService) PutConstraint(ctx context.Context, flagID int64, segmentID int64, constraintID int64, ...) (Constraint, *http.Response, error)
- type CreateConstraintRequest
- type CreateFlagRequest
- type CreateSegmentRequest
- type CreateVariantRequest
- type Distribution
- type DistributionApiService
- type EvalContext
- type EvalDebugLog
- type EvalResult
- type EvaluationApiService
- type EvaluationBatchRequest
- type EvaluationBatchResponse
- type EvaluationEntity
- type ExportApiService
- type FindFlagsOpts
- type Flag
- type FlagApiService
- func (a *FlagApiService) CreateFlag(ctx context.Context, body CreateFlagRequest) (Flag, *http.Response, error)
- func (a *FlagApiService) DeleteFlag(ctx context.Context, flagID int64) (*http.Response, error)
- func (a *FlagApiService) FindFlags(ctx context.Context, localVarOptionals *FindFlagsOpts) ([]Flag, *http.Response, error)
- func (a *FlagApiService) GetFlag(ctx context.Context, flagID int64) (Flag, *http.Response, error)
- func (a *FlagApiService) GetFlagEntityTypes(ctx context.Context) ([]string, *http.Response, error)
- func (a *FlagApiService) GetFlagSnapshots(ctx context.Context, flagID int64) ([]FlagSnapshot, *http.Response, error)
- func (a *FlagApiService) PutFlag(ctx context.Context, flagID int64, body PutFlagRequest) (Flag, *http.Response, error)
- func (a *FlagApiService) SetFlagEnabled(ctx context.Context, flagID int64, body SetFlagEnabledRequest) (Flag, *http.Response, error)
- type FlagSnapshot
- type GenericSwaggerError
- type Health
- type HealthApiService
- type ModelError
- type PutDistributionsRequest
- type PutFlagRequest
- type PutSegmentReorderRequest
- type PutSegmentRequest
- type PutVariantRequest
- type Segment
- type SegmentApiService
- func (a *SegmentApiService) CreateSegment(ctx context.Context, flagID int64, body CreateSegmentRequest) (Segment, *http.Response, error)
- func (a *SegmentApiService) DeleteSegment(ctx context.Context, flagID int64, segmentID int64) (*http.Response, error)
- func (a *SegmentApiService) FindSegments(ctx context.Context, flagID int64) ([]Segment, *http.Response, error)
- func (a *SegmentApiService) PutSegment(ctx context.Context, flagID int64, segmentID int64, body PutSegmentRequest) (Segment, *http.Response, error)
- func (a *SegmentApiService) PutSegmentsReorder(ctx context.Context, flagID int64, body PutSegmentReorderRequest) (*http.Response, error)
- type SegmentDebugLog
- type SetFlagEnabledRequest
- type Variant
- type VariantApiService
- func (a *VariantApiService) CreateVariant(ctx context.Context, flagID int64, body CreateVariantRequest) (Variant, *http.Response, error)
- func (a *VariantApiService) DeleteVariant(ctx context.Context, flagID int64, variantID int64) (*http.Response, error)
- func (a *VariantApiService) FindVariants(ctx context.Context, flagID int64) ([]Variant, *http.Response, error)
- func (a *VariantApiService) PutVariant(ctx context.Context, flagID int64, variantID int64, body PutVariantRequest) (Variant, *http.Response, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ContextOAuth2 takes a oauth2.TokenSource as authentication for the request. ContextOAuth2 = contextKey("token") // ContextBasicAuth takes BasicAuth as authentication for the request. ContextBasicAuth = contextKey("basic") // ContextAccessToken takes a string oauth2 access token as authentication for the request. ContextAccessToken = contextKey("accesstoken") // ContextAPIKey takes an APIKey as authentication for the request ContextAPIKey = contextKey("apikey") )
Functions ¶
Types ¶
type APIClient ¶
type APIClient struct { ConstraintApi *ConstraintApiService DistributionApi *DistributionApiService EvaluationApi *EvaluationApiService ExportApi *ExportApiService FlagApi *FlagApiService HealthApi *HealthApiService SegmentApi *SegmentApiService VariantApi *VariantApiService // contains filtered or unexported fields }
APIClient manages communication with the Flagr API v1.1.4 In most cases there should be only one, shared, APIClient.
func NewAPIClient ¶
func NewAPIClient(cfg *Configuration) *APIClient
NewAPIClient creates a new API client. Requires a userAgent string describing your application. optionally a custom http.Client to allow for advanced features such as caching.
func (*APIClient) ChangeBasePath ¶
Change base path to allow switching to mocks
type APIKey ¶
APIKey provides API key based authentication to a request passed via context using ContextAPIKey
type APIResponse ¶
type APIResponse struct { *http.Response `json:"-"` Message string `json:"message,omitempty"` // Operation is the name of the swagger operation. Operation string `json:"operation,omitempty"` // RequestURL is the request URL. This value is always available, even if the // embedded *http.Response is nil. RequestURL string `json:"url,omitempty"` // Method is the HTTP method used for the request. This value is always // available, even if the embedded *http.Response is nil. Method string `json:"method,omitempty"` // Payload holds the contents of the response body (which may be nil or empty). // This is provided here as the raw response.Body() reader will have already // been drained. Payload []byte `json:"-"` }
func NewAPIResponse ¶
func NewAPIResponse(r *http.Response) *APIResponse
func NewAPIResponseWithError ¶
func NewAPIResponseWithError(errorMessage string) *APIResponse
type BasicAuth ¶
type BasicAuth struct { UserName string `json:"userName,omitempty"` Password string `json:"password,omitempty"` }
BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth
type Configuration ¶
type Configuration struct { BasePath string `json:"basePath,omitempty"` Host string `json:"host,omitempty"` Scheme string `json:"scheme,omitempty"` DefaultHeader map[string]string `json:"defaultHeader,omitempty"` UserAgent string `json:"userAgent,omitempty"` HTTPClient *http.Client }
func NewConfiguration ¶
func NewConfiguration() *Configuration
func (*Configuration) AddDefaultHeader ¶
func (c *Configuration) AddDefaultHeader(key string, value string)
type Constraint ¶
type ConstraintApiService ¶
type ConstraintApiService service
func (*ConstraintApiService) CreateConstraint ¶
func (a *ConstraintApiService) CreateConstraint(ctx context.Context, flagID int64, segmentID int64, body CreateConstraintRequest) (Constraint, *http.Response, error)
ConstraintApiService
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param flagID numeric ID of the flag
- @param segmentID numeric ID of the segment
- @param body create a constraint
@return Constraint
func (*ConstraintApiService) DeleteConstraint ¶
func (a *ConstraintApiService) DeleteConstraint(ctx context.Context, flagID int64, segmentID int64, constraintID int64) (*http.Response, error)
ConstraintApiService
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param flagID numeric ID of the flag
- @param segmentID numeric ID of the segment
- @param constraintID numeric ID of the constraint
func (*ConstraintApiService) FindConstraints ¶
func (a *ConstraintApiService) FindConstraints(ctx context.Context, flagID int64, segmentID int64) ([]Constraint, *http.Response, error)
ConstraintApiService
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param flagID numeric ID of the flag
- @param segmentID numeric ID of the segment
@return []Constraint
func (*ConstraintApiService) PutConstraint ¶
func (a *ConstraintApiService) PutConstraint(ctx context.Context, flagID int64, segmentID int64, constraintID int64, body CreateConstraintRequest) (Constraint, *http.Response, error)
ConstraintApiService
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param flagID numeric ID of the flag
- @param segmentID numeric ID of the segment
- @param constraintID numeric ID of the constraint
- @param body create a constraint
@return Constraint
type CreateConstraintRequest ¶
type CreateFlagRequest ¶
type CreateSegmentRequest ¶
type CreateVariantRequest ¶
type CreateVariantRequest struct { Key string `json:"key"` Attachment *interface{} `json:"attachment,omitempty"` }
type Distribution ¶
type DistributionApiService ¶
type DistributionApiService service
func (*DistributionApiService) FindDistributions ¶
func (a *DistributionApiService) FindDistributions(ctx context.Context, flagID int64, segmentID int64) ([]Distribution, *http.Response, error)
DistributionApiService
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param flagID numeric ID of the flag
- @param segmentID numeric ID of the segment
@return []Distribution
func (*DistributionApiService) PutDistributions ¶
func (a *DistributionApiService) PutDistributions(ctx context.Context, flagID int64, segmentID int64, body PutDistributionsRequest) ([]Distribution, *http.Response, error)
DistributionApiService replace the distribution with the new setting
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param flagID numeric ID of the flag
- @param segmentID numeric ID of the segment
- @param body array of distributions
@return []Distribution
type EvalContext ¶
type EvalContext struct { // entityID is used to deterministically at random to evaluate the flag result. If it's empty, flagr will randomly generate one. EntityID string `json:"entityID,omitempty"` EntityType string `json:"entityType,omitempty"` EntityContext *interface{} `json:"entityContext,omitempty"` EnableDebug bool `json:"enableDebug,omitempty"` // flagID FlagID int64 `json:"flagID,omitempty"` // flagKey. flagID or flagKey will resolve to the same flag. Either works. FlagKey string `json:"flagKey,omitempty"` }
type EvalDebugLog ¶
type EvalDebugLog struct { SegmentDebugLogs []SegmentDebugLog `json:"segmentDebugLogs,omitempty"` Msg string `json:"msg,omitempty"` }
type EvalResult ¶
type EvalResult struct { FlagID int64 `json:"flagID,omitempty"` FlagKey string `json:"flagKey,omitempty"` FlagSnapshotID int64 `json:"flagSnapshotID,omitempty"` SegmentID int64 `json:"segmentID,omitempty"` VariantID int64 `json:"variantID,omitempty"` VariantKey string `json:"variantKey,omitempty"` VariantAttachment *interface{} `json:"variantAttachment,omitempty"` EvalContext *EvalContext `json:"evalContext,omitempty"` Timestamp string `json:"timestamp,omitempty"` EvalDebugLog *EvalDebugLog `json:"evalDebugLog,omitempty"` }
type EvaluationApiService ¶
type EvaluationApiService service
func (*EvaluationApiService) PostEvaluation ¶
func (a *EvaluationApiService) PostEvaluation(ctx context.Context, body EvalContext) (EvalResult, *http.Response, error)
EvaluationApiService
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param body evalution context
@return EvalResult
func (*EvaluationApiService) PostEvaluationBatch ¶
func (a *EvaluationApiService) PostEvaluationBatch(ctx context.Context, body EvaluationBatchRequest) (EvaluationBatchResponse, *http.Response, error)
EvaluationApiService
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param body evalution batch request
@return EvaluationBatchResponse
type EvaluationBatchRequest ¶
type EvaluationBatchRequest struct { Entities []EvaluationEntity `json:"entities"` EnableDebug bool `json:"enableDebug,omitempty"` // flagIDs FlagIDs []int64 `json:"flagIDs,omitempty"` // flagKeys. Either flagIDs or flagKeys works. If pass in both, Flagr may return duplicate results. FlagKeys []string `json:"flagKeys,omitempty"` }
type EvaluationBatchResponse ¶
type EvaluationBatchResponse struct {
EvaluationResults []EvalResult `json:"evaluationResults"`
}
type EvaluationEntity ¶
type ExportApiService ¶
type ExportApiService service
func (*ExportApiService) GetExportEvalCacheJSON ¶
func (a *ExportApiService) GetExportEvalCacheJSON(ctx context.Context) (interface{}, *http.Response, error)
ExportApiService Export JSON format of the eval cache dump
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return interface{}
func (*ExportApiService) GetExportSqlite ¶
ExportApiService Export sqlite3 format of the db dump, which is converted from the main database.
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return *os.File
type FindFlagsOpts ¶
type Flag ¶
type Flag struct { Id int64 `json:"id,omitempty"` // unique key representation of the flag Key string `json:"key,omitempty"` Description string `json:"description"` Enabled bool `json:"enabled"` Segments []Segment `json:"segments,omitempty"` Variants []Variant `json:"variants,omitempty"` // enabled data records will get data logging in the metrics pipeline, for example, kafka. DataRecordsEnabled bool `json:"dataRecordsEnabled"` // it will override the entityType in the evaluation logs if it's not empty EntityType string `json:"entityType,omitempty"` // flag usage details in markdown format Notes string `json:"notes,omitempty"` CreatedBy string `json:"createdBy,omitempty"` UpdatedBy string `json:"updatedBy,omitempty"` UpdatedAt time.Time `json:"updatedAt,omitempty"` }
type FlagApiService ¶
type FlagApiService service
func (*FlagApiService) CreateFlag ¶
func (a *FlagApiService) CreateFlag(ctx context.Context, body CreateFlagRequest) (Flag, *http.Response, error)
FlagApiService
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param body create a flag
@return Flag
func (*FlagApiService) DeleteFlag ¶
FlagApiService
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param flagID numeric ID of the flag
func (*FlagApiService) FindFlags ¶
func (a *FlagApiService) FindFlags(ctx context.Context, localVarOptionals *FindFlagsOpts) ([]Flag, *http.Response, error)
func (*FlagApiService) GetFlag ¶
FlagApiService
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param flagID numeric ID of the flag to get
@return Flag
func (*FlagApiService) GetFlagEntityTypes ¶
FlagApiService
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return []string
func (*FlagApiService) GetFlagSnapshots ¶
func (a *FlagApiService) GetFlagSnapshots(ctx context.Context, flagID int64) ([]FlagSnapshot, *http.Response, error)
FlagApiService
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param flagID numeric ID of the flag to get
@return []FlagSnapshot
func (*FlagApiService) PutFlag ¶
func (a *FlagApiService) PutFlag(ctx context.Context, flagID int64, body PutFlagRequest) (Flag, *http.Response, error)
FlagApiService
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param flagID numeric ID of the flag to get
- @param body update a flag
@return Flag
func (*FlagApiService) SetFlagEnabled ¶
func (a *FlagApiService) SetFlagEnabled(ctx context.Context, flagID int64, body SetFlagEnabledRequest) (Flag, *http.Response, error)
FlagApiService
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param flagID numeric ID of the flag to get
- @param body set flag enabled state
@return Flag
type FlagSnapshot ¶
type GenericSwaggerError ¶
type GenericSwaggerError struct {
// contains filtered or unexported fields
}
GenericSwaggerError Provides access to the body, error and model on returned errors.
func (GenericSwaggerError) Body ¶
func (e GenericSwaggerError) Body() []byte
Body returns the raw bytes of the response
func (GenericSwaggerError) Error ¶
func (e GenericSwaggerError) Error() string
Error returns non-empty string if there was an error.
func (GenericSwaggerError) Model ¶
func (e GenericSwaggerError) Model() interface{}
Model returns the unpacked model of the error
type HealthApiService ¶
type HealthApiService service
type ModelError ¶
type ModelError struct {
Message string `json:"message"`
}
type PutDistributionsRequest ¶
type PutDistributionsRequest struct {
Distributions []Distribution `json:"distributions"`
}
type PutFlagRequest ¶
type PutFlagRequest struct { Description string `json:"description,omitempty"` // enabled data records will get data logging in the metrics pipeline, for example, kafka. DataRecordsEnabled bool `json:"dataRecordsEnabled,omitempty"` // it will overwrite entityType into evaluation logs if it's not empty EntityType string `json:"entityType,omitempty"` Enabled bool `json:"enabled,omitempty"` Key string `json:"key,omitempty"` Notes string `json:"notes,omitempty"` }
type PutSegmentReorderRequest ¶
type PutSegmentReorderRequest struct {
SegmentIDs []int64 `json:"segmentIDs"`
}
type PutSegmentRequest ¶
type PutVariantRequest ¶
type PutVariantRequest struct { Key string `json:"key"` Attachment *interface{} `json:"attachment,omitempty"` }
type Segment ¶
type Segment struct { Id int64 `json:"id,omitempty"` Description string `json:"description"` Constraints []Constraint `json:"constraints,omitempty"` Distributions []Distribution `json:"distributions,omitempty"` Rank int64 `json:"rank"` RolloutPercent int64 `json:"rolloutPercent"` }
type SegmentApiService ¶
type SegmentApiService service
func (*SegmentApiService) CreateSegment ¶
func (a *SegmentApiService) CreateSegment(ctx context.Context, flagID int64, body CreateSegmentRequest) (Segment, *http.Response, error)
SegmentApiService
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param flagID numeric ID of the flag to get
- @param body create a segment under a flag
@return Segment
func (*SegmentApiService) DeleteSegment ¶
func (a *SegmentApiService) DeleteSegment(ctx context.Context, flagID int64, segmentID int64) (*http.Response, error)
SegmentApiService
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param flagID numeric ID of the flag
- @param segmentID numeric ID of the segment
func (*SegmentApiService) FindSegments ¶
func (a *SegmentApiService) FindSegments(ctx context.Context, flagID int64) ([]Segment, *http.Response, error)
SegmentApiService
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param flagID numeric ID of the flag to get
@return []Segment
func (*SegmentApiService) PutSegment ¶
func (a *SegmentApiService) PutSegment(ctx context.Context, flagID int64, segmentID int64, body PutSegmentRequest) (Segment, *http.Response, error)
SegmentApiService
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param flagID numeric ID of the flag
- @param segmentID numeric ID of the segment
- @param body update a segment
@return Segment
func (*SegmentApiService) PutSegmentsReorder ¶
func (a *SegmentApiService) PutSegmentsReorder(ctx context.Context, flagID int64, body PutSegmentReorderRequest) (*http.Response, error)
SegmentApiService
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param flagID numeric ID of the flag
- @param body reorder segments
type SegmentDebugLog ¶
type SetFlagEnabledRequest ¶
type SetFlagEnabledRequest struct {
Enabled bool `json:"enabled"`
}
type VariantApiService ¶
type VariantApiService service
func (*VariantApiService) CreateVariant ¶
func (a *VariantApiService) CreateVariant(ctx context.Context, flagID int64, body CreateVariantRequest) (Variant, *http.Response, error)
VariantApiService
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param flagID numeric ID of the flag
- @param body create a variant
@return Variant
func (*VariantApiService) DeleteVariant ¶
func (a *VariantApiService) DeleteVariant(ctx context.Context, flagID int64, variantID int64) (*http.Response, error)
VariantApiService
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param flagID numeric ID of the flag
- @param variantID numeric ID of the variant
func (*VariantApiService) FindVariants ¶
func (a *VariantApiService) FindVariants(ctx context.Context, flagID int64) ([]Variant, *http.Response, error)
VariantApiService
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param flagID numeric ID of the flag
@return []Variant
func (*VariantApiService) PutVariant ¶
func (a *VariantApiService) PutVariant(ctx context.Context, flagID int64, variantID int64, body PutVariantRequest) (Variant, *http.Response, error)
VariantApiService
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param flagID numeric ID of the flag
- @param variantID numeric ID of the variant
- @param body update a variant
@return Variant
Source Files
¶
- api_constraint.go
- api_distribution.go
- api_evaluation.go
- api_export.go
- api_flag.go
- api_health.go
- api_segment.go
- api_variant.go
- client.go
- configuration.go
- model_constraint.go
- model_create_constraint_request.go
- model_create_flag_request.go
- model_create_segment_request.go
- model_create_variant_request.go
- model_distribution.go
- model_error.go
- model_eval_context.go
- model_eval_debug_log.go
- model_eval_result.go
- model_evaluation_batch_request.go
- model_evaluation_batch_response.go
- model_evaluation_entity.go
- model_flag.go
- model_flag_snapshot.go
- model_health.go
- model_put_distributions_request.go
- model_put_flag_request.go
- model_put_segment_reorder_request.go
- model_put_segment_request.go
- model_put_variant_request.go
- model_segment.go
- model_segment_debug_log.go
- model_set_flag_enabled_request.go
- model_variant.go
- response.go