From ae7f308196a861a909bdd96555ca234c5f48cf7b Mon Sep 17 00:00:00 2001 From: zhuojie Date: Tue, 19 Mar 2019 17:40:35 -0700 Subject: [PATCH] Bump swagger version --- .swagger-codegen/VERSION | 2 +- README.md | 9 +- docs/CreateFlagRequest.md | 1 + docs/Distribution.md | 1 - docs/EvalContext.md | 7 +- docs/EvalResult.md | 15 +- docs/EvaluationBatchRequest.md | 3 +- docs/EvaluationEntity.md | 4 +- docs/ExportApi.md | 52 +++++ docs/Flag.md | 5 + docs/FlagApi.md | 64 +++++- docs/HealthApi.md | 51 +++++ docs/PutFlagRequest.md | 5 +- docs/PutVariantRequest.md | 2 +- flagr/__init__.py | 6 +- flagr/api/__init__.py | 2 + flagr/api/constraint_api.py | 4 +- flagr/api/distribution_api.py | 4 +- flagr/api/evaluation_api.py | 4 +- flagr/api/export_api.py | 125 ++++++++++++ flagr/api/flag_api.py | 123 +++++++++++- flagr/api/health_api.py | 125 ++++++++++++ flagr/api/segment_api.py | 4 +- flagr/api/variant_api.py | 4 +- flagr/api_client.py | 8 +- flagr/configuration.py | 8 +- flagr/models/__init__.py | 4 +- flagr/models/constraint.py | 4 +- flagr/models/create_constraint_request.py | 4 +- flagr/models/create_flag_request.py | 38 +++- flagr/models/create_segment_request.py | 4 +- flagr/models/create_variant_request.py | 4 +- flagr/models/distribution.py | 34 +--- flagr/models/error.py | 4 +- flagr/models/eval_context.py | 61 ++++-- flagr/models/eval_debug_log.py | 4 +- flagr/models/eval_result.py | 77 +++---- flagr/models/evaluation_batch_request.py | 45 ++++- flagr/models/evaluation_batch_response.py | 4 +- flagr/models/evaluation_entity.py | 18 +- flagr/models/flag.py | 146 +++++++++++++- flagr/models/flag_snapshot.py | 4 +- flagr/models/put_distributions_request.py | 4 +- flagr/models/put_flag_request.py | 95 ++++++++- flagr/models/put_segment_reorder_request.py | 4 +- flagr/models/put_segment_request.py | 4 +- flagr/models/put_variant_request.py | 9 +- flagr/models/segment.py | 4 +- flagr/models/segment_debug_log.py | 4 +- flagr/models/set_flag_enabled_request.py | 4 +- flagr/models/variant.py | 4 +- flagr/rest.py | 4 +- setup.py | 8 +- swagger.yaml | 211 +++++++++++++++----- swagger_py.json | 2 +- test/test_export_api.py | 40 ++++ test/test_health_api.py | 40 ++++ tox.ini | 4 +- 58 files changed, 1270 insertions(+), 264 deletions(-) create mode 100644 docs/ExportApi.md create mode 100644 docs/HealthApi.md create mode 100644 flagr/api/export_api.py create mode 100644 flagr/api/health_api.py create mode 100644 test/test_export_api.py create mode 100644 test/test_health_api.py diff --git a/.swagger-codegen/VERSION b/.swagger-codegen/VERSION index f9f7450..855ff95 100644 --- a/.swagger-codegen/VERSION +++ b/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.0-SNAPSHOT \ No newline at end of file +2.4.0-SNAPSHOT \ No newline at end of file diff --git a/README.md b/README.md index 212d4fb..708664d 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ # flagr -Flagr is a feature flagging, A/B testing and dynamic configuration microservice +Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: -- API version: 1.0.0 -- Package version: 0.1.0 +- API version: 1.1.0 +- Package version: 1.1.0 - Build package: io.swagger.codegen.languages.PythonClientCodegen ## Requirements. @@ -78,13 +78,16 @@ Class | Method | HTTP request | Description *DistributionApi* | [**put_distributions**](docs/DistributionApi.md#put_distributions) | **PUT** /flags/{flagID}/segments/{segmentID}/distributions | *EvaluationApi* | [**post_evaluation**](docs/EvaluationApi.md#post_evaluation) | **POST** /evaluation | *EvaluationApi* | [**post_evaluation_batch**](docs/EvaluationApi.md#post_evaluation_batch) | **POST** /evaluation/batch | +*ExportApi* | [**get_export_sq_lite**](docs/ExportApi.md#get_export_sq_lite) | **GET** /export/sqlite | *FlagApi* | [**create_flag**](docs/FlagApi.md#create_flag) | **POST** /flags | *FlagApi* | [**delete_flag**](docs/FlagApi.md#delete_flag) | **DELETE** /flags/{flagID} | *FlagApi* | [**find_flags**](docs/FlagApi.md#find_flags) | **GET** /flags | *FlagApi* | [**get_flag**](docs/FlagApi.md#get_flag) | **GET** /flags/{flagID} | +*FlagApi* | [**get_flag_entity_types**](docs/FlagApi.md#get_flag_entity_types) | **GET** /flags/entity_types | *FlagApi* | [**get_flag_snapshots**](docs/FlagApi.md#get_flag_snapshots) | **GET** /flags/{flagID}/snapshots | *FlagApi* | [**put_flag**](docs/FlagApi.md#put_flag) | **PUT** /flags/{flagID} | *FlagApi* | [**set_flag_enabled**](docs/FlagApi.md#set_flag_enabled) | **PUT** /flags/{flagID}/enabled | +*HealthApi* | [**get_health**](docs/HealthApi.md#get_health) | **GET** /health | *SegmentApi* | [**create_segment**](docs/SegmentApi.md#create_segment) | **POST** /flags/{flagID}/segments | *SegmentApi* | [**delete_segment**](docs/SegmentApi.md#delete_segment) | **DELETE** /flags/{flagID}/segments/{segmentID} | *SegmentApi* | [**find_segments**](docs/SegmentApi.md#find_segments) | **GET** /flags/{flagID}/segments | diff --git a/docs/CreateFlagRequest.md b/docs/CreateFlagRequest.md index 92f26ec..b6d6892 100644 --- a/docs/CreateFlagRequest.md +++ b/docs/CreateFlagRequest.md @@ -4,6 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **description** | **str** | | +**key** | **str** | unique key representation of the flag | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/Distribution.md b/docs/Distribution.md index e149c90..ff2aa99 100644 --- a/docs/Distribution.md +++ b/docs/Distribution.md @@ -5,7 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **int** | | [optional] **percent** | **int** | | -**bitmap** | **str** | | [optional] **variant_key** | **str** | | **variant_id** | **int** | | diff --git a/docs/EvalContext.md b/docs/EvalContext.md index 744082e..0d73b6e 100644 --- a/docs/EvalContext.md +++ b/docs/EvalContext.md @@ -3,11 +3,12 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**entity_id** | **str** | | -**entity_type** | **str** | | +**entity_id** | **str** | entityID is used to deterministically at random to evaluate the flag result. If it's empty, flagr will randomly generate one. | [optional] +**entity_type** | **str** | | [optional] **entity_context** | **object** | | [optional] **enable_debug** | **bool** | | [optional] -**flag_id** | **int** | | +**flag_id** | **int** | flagID | [optional] +**flag_key** | **str** | flagKey. flagID or flagKey will resolve to the same flag. Either works. | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/EvalResult.md b/docs/EvalResult.md index 559dd33..39830df 100644 --- a/docs/EvalResult.md +++ b/docs/EvalResult.md @@ -3,14 +3,15 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**flag_id** | **int** | | +**flag_id** | **int** | | [optional] +**flag_key** | **str** | | [optional] **flag_snapshot_id** | **int** | | [optional] -**segment_id** | **int** | | -**variant_id** | **int** | | -**variant_key** | **str** | | -**variant_attachment** | **object** | | -**eval_context** | [**EvalContext**](EvalContext.md) | | -**timestamp** | **str** | | +**segment_id** | **int** | | [optional] +**variant_id** | **int** | | [optional] +**variant_key** | **str** | | [optional] +**variant_attachment** | **object** | | [optional] +**eval_context** | [**EvalContext**](EvalContext.md) | | [optional] +**timestamp** | **str** | | [optional] **eval_debug_log** | [**EvalDebugLog**](EvalDebugLog.md) | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/EvaluationBatchRequest.md b/docs/EvaluationBatchRequest.md index 60f4f24..44a7b70 100644 --- a/docs/EvaluationBatchRequest.md +++ b/docs/EvaluationBatchRequest.md @@ -5,7 +5,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **entities** | [**list[EvaluationEntity]**](EvaluationEntity.md) | | **enable_debug** | **bool** | | [optional] -**flag_i_ds** | **list[int]** | | +**flag_i_ds** | **list[int]** | flagIDs | [optional] +**flag_keys** | **list[str]** | flagKeys. Either flagIDs or flagKeys works. If pass in both, Flagr may return duplicate results. | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/EvaluationEntity.md b/docs/EvaluationEntity.md index 62850ba..255862d 100644 --- a/docs/EvaluationEntity.md +++ b/docs/EvaluationEntity.md @@ -3,8 +3,8 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**entity_id** | **str** | | -**entity_type** | **str** | | +**entity_id** | **str** | | [optional] +**entity_type** | **str** | | [optional] **entity_context** | **object** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/ExportApi.md b/docs/ExportApi.md new file mode 100644 index 0000000..f3179fe --- /dev/null +++ b/docs/ExportApi.md @@ -0,0 +1,52 @@ +# flagr.ExportApi + +All URIs are relative to *http://localhost/api/v1* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_export_sq_lite**](ExportApi.md#get_export_sq_lite) | **GET** /export/sqlite | + + +# **get_export_sq_lite** +> file get_export_sq_lite() + + + +Export sqlite3 format of the db dump, which is converted from the main database. + +### Example +```python +from __future__ import print_function +import time +import flagr +from flagr.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = flagr.ExportApi() + +try: + api_response = api_instance.get_export_sq_lite() + pprint(api_response) +except ApiException as e: + print("Exception when calling ExportApi->get_export_sq_lite: %s\n" % e) +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**file**](file.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/octet-stream + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/Flag.md b/docs/Flag.md index 317560a..3e77765 100644 --- a/docs/Flag.md +++ b/docs/Flag.md @@ -4,11 +4,16 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **int** | | [optional] +**key** | **str** | unique key representation of the flag | [optional] **description** | **str** | | **enabled** | **bool** | | **segments** | [**list[Segment]**](Segment.md) | | [optional] **variants** | [**list[Variant]**](Variant.md) | | [optional] **data_records_enabled** | **bool** | enabled data records will get data logging in the metrics pipeline, for example, kafka. | +**entity_type** | **str** | it will override the entityType in the evaluation logs if it's not empty | [optional] +**created_by** | **str** | | [optional] +**updated_by** | **str** | | [optional] +**updated_at** | **datetime** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/FlagApi.md b/docs/FlagApi.md index 7fbd7dd..3e14625 100644 --- a/docs/FlagApi.md +++ b/docs/FlagApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**delete_flag**](FlagApi.md#delete_flag) | **DELETE** /flags/{flagID} | [**find_flags**](FlagApi.md#find_flags) | **GET** /flags | [**get_flag**](FlagApi.md#get_flag) | **GET** /flags/{flagID} | +[**get_flag_entity_types**](FlagApi.md#get_flag_entity_types) | **GET** /flags/entity_types | [**get_flag_snapshots**](FlagApi.md#get_flag_snapshots) | **GET** /flags/{flagID}/snapshots | [**put_flag**](FlagApi.md#put_flag) | **PUT** /flags/{flagID} | [**set_flag_enabled**](FlagApi.md#set_flag_enabled) | **PUT** /flags/{flagID}/enabled | @@ -103,7 +104,7 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **find_flags** -> list[Flag] find_flags() +> list[Flag] find_flags(limit=limit, enabled=enabled, description=description, description_like=description_like, key=key, offset=offset, preload=preload) @@ -117,16 +118,32 @@ from pprint import pprint # create an instance of the API class api_instance = flagr.FlagApi() +limit = 789 # int | the numbers of flags to return (optional) +enabled = true # bool | return flags having given enabled status (optional) +description = 'description_example' # str | return flags exactly matching given description (optional) +description_like = 'description_like_example' # str | return flags partially matching given description (optional) +key = 'key_example' # str | return flags matching given key (optional) +offset = 789 # int | return flags given the offset, it should usually set together with limit (optional) +preload = true # bool | return flags with preloaded segments and variants (optional) try: - api_response = api_instance.find_flags() + api_response = api_instance.find_flags(limit=limit, enabled=enabled, description=description, description_like=description_like, key=key, offset=offset, preload=preload) pprint(api_response) except ApiException as e: print("Exception when calling FlagApi->find_flags: %s\n" % e) ``` ### Parameters -This endpoint does not need any parameter. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int**| the numbers of flags to return | [optional] + **enabled** | **bool**| return flags having given enabled status | [optional] + **description** | **str**| return flags exactly matching given description | [optional] + **description_like** | **str**| return flags partially matching given description | [optional] + **key** | **str**| return flags matching given key | [optional] + **offset** | **int**| return flags given the offset, it should usually set together with limit | [optional] + **preload** | **bool**| return flags with preloaded segments and variants | [optional] ### Return type @@ -188,6 +205,47 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **get_flag_entity_types** +> list[str] get_flag_entity_types() + + + +### Example +```python +from __future__ import print_function +import time +import flagr +from flagr.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = flagr.FlagApi() + +try: + api_response = api_instance.get_flag_entity_types() + pprint(api_response) +except ApiException as e: + print("Exception when calling FlagApi->get_flag_entity_types: %s\n" % e) +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**list[str]** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **get_flag_snapshots** > list[FlagSnapshot] get_flag_snapshots(flag_id) diff --git a/docs/HealthApi.md b/docs/HealthApi.md new file mode 100644 index 0000000..80f7a91 --- /dev/null +++ b/docs/HealthApi.md @@ -0,0 +1,51 @@ +# flagr.HealthApi + +All URIs are relative to *http://localhost/api/v1* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_health**](HealthApi.md#get_health) | **GET** /health | + + +# **get_health** +> get_health() + + + +Check if Flagr is healthy + +### Example +```python +from __future__ import print_function +import time +import flagr +from flagr.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = flagr.HealthApi() + +try: + api_instance.get_health() +except ApiException as e: + print("Exception when calling HealthApi->get_health: %s\n" % e) +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/PutFlagRequest.md b/docs/PutFlagRequest.md index 1ce884f..f729928 100644 --- a/docs/PutFlagRequest.md +++ b/docs/PutFlagRequest.md @@ -3,8 +3,11 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**description** | **str** | | +**description** | **str** | | [optional] **data_records_enabled** | **bool** | enabled data records will get data logging in the metrics pipeline, for example, kafka. | [optional] +**entity_type** | **str** | it will overwrite entityType into evaluation logs if it's not empty | [optional] +**enabled** | **bool** | | [optional] +**key** | **str** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/PutVariantRequest.md b/docs/PutVariantRequest.md index 1d1539d..b101ae8 100644 --- a/docs/PutVariantRequest.md +++ b/docs/PutVariantRequest.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **key** | **str** | | -**attachment** | **object** | | +**attachment** | **object** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/flagr/__init__.py b/flagr/__init__.py index b187689..81ebb0c 100644 --- a/flagr/__init__.py +++ b/flagr/__init__.py @@ -5,9 +5,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -19,7 +19,9 @@ from flagr.api.constraint_api import ConstraintApi from flagr.api.distribution_api import DistributionApi from flagr.api.evaluation_api import EvaluationApi +from flagr.api.export_api import ExportApi from flagr.api.flag_api import FlagApi +from flagr.api.health_api import HealthApi from flagr.api.segment_api import SegmentApi from flagr.api.variant_api import VariantApi diff --git a/flagr/api/__init__.py b/flagr/api/__init__.py index 683f179..36f89d9 100644 --- a/flagr/api/__init__.py +++ b/flagr/api/__init__.py @@ -6,6 +6,8 @@ from flagr.api.constraint_api import ConstraintApi from flagr.api.distribution_api import DistributionApi from flagr.api.evaluation_api import EvaluationApi +from flagr.api.export_api import ExportApi from flagr.api.flag_api import FlagApi +from flagr.api.health_api import HealthApi from flagr.api.segment_api import SegmentApi from flagr.api.variant_api import VariantApi diff --git a/flagr/api/constraint_api.py b/flagr/api/constraint_api.py index bbb1c51..ddb9706 100644 --- a/flagr/api/constraint_api.py +++ b/flagr/api/constraint_api.py @@ -3,9 +3,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/flagr/api/distribution_api.py b/flagr/api/distribution_api.py index 6a6e970..f4bbc88 100644 --- a/flagr/api/distribution_api.py +++ b/flagr/api/distribution_api.py @@ -3,9 +3,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/flagr/api/evaluation_api.py b/flagr/api/evaluation_api.py index 237a52c..1b79bb9 100644 --- a/flagr/api/evaluation_api.py +++ b/flagr/api/evaluation_api.py @@ -3,9 +3,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/flagr/api/export_api.py b/flagr/api/export_api.py new file mode 100644 index 0000000..8d33062 --- /dev/null +++ b/flagr/api/export_api.py @@ -0,0 +1,125 @@ +# coding: utf-8 + +""" + Flagr + + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 + + OpenAPI spec version: 1.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from flagr.api_client import ApiClient + + +class ExportApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_export_sq_lite(self, **kwargs): # noqa: E501 + """get_export_sq_lite # noqa: E501 + + Export sqlite3 format of the db dump, which is converted from the main database. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_export_sq_lite(async=True) + >>> result = thread.get() + + :param async bool + :return: file + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.get_export_sq_lite_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_export_sq_lite_with_http_info(**kwargs) # noqa: E501 + return data + + def get_export_sq_lite_with_http_info(self, **kwargs): # noqa: E501 + """get_export_sq_lite # noqa: E501 + + Export sqlite3 format of the db dump, which is converted from the main database. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_export_sq_lite_with_http_info(async=True) + >>> result = thread.get() + + :param async bool + :return: file + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_export_sq_lite" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/octet-stream']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/export/sqlite', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='file', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/flagr/api/flag_api.py b/flagr/api/flag_api.py index 4bc2df3..b3f50f6 100644 --- a/flagr/api/flag_api.py +++ b/flagr/api/flag_api.py @@ -3,9 +3,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -238,6 +238,13 @@ def find_flags(self, **kwargs): # noqa: E501 >>> result = thread.get() :param async bool + :param int limit: the numbers of flags to return + :param bool enabled: return flags having given enabled status + :param str description: return flags exactly matching given description + :param str description_like: return flags partially matching given description + :param str key: return flags matching given key + :param int offset: return flags given the offset, it should usually set together with limit + :param bool preload: return flags with preloaded segments and variants :return: list[Flag] If the method is called asynchronously, returns the request thread. @@ -258,12 +265,19 @@ def find_flags_with_http_info(self, **kwargs): # noqa: E501 >>> result = thread.get() :param async bool + :param int limit: the numbers of flags to return + :param bool enabled: return flags having given enabled status + :param str description: return flags exactly matching given description + :param str description_like: return flags partially matching given description + :param str key: return flags matching given key + :param int offset: return flags given the offset, it should usually set together with limit + :param bool preload: return flags with preloaded segments and variants :return: list[Flag] If the method is called asynchronously, returns the request thread. """ - all_params = [] # noqa: E501 + all_params = ['limit', 'enabled', 'description', 'description_like', 'key', 'offset', 'preload'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -284,6 +298,20 @@ def find_flags_with_http_info(self, **kwargs): # noqa: E501 path_params = {} query_params = [] + if 'limit' in params: + query_params.append(('limit', params['limit'])) # noqa: E501 + if 'enabled' in params: + query_params.append(('enabled', params['enabled'])) # noqa: E501 + if 'description' in params: + query_params.append(('description', params['description'])) # noqa: E501 + if 'description_like' in params: + query_params.append(('description_like', params['description_like'])) # noqa: E501 + if 'key' in params: + query_params.append(('key', params['key'])) # noqa: E501 + if 'offset' in params: + query_params.append(('offset', params['offset'])) # noqa: E501 + if 'preload' in params: + query_params.append(('preload', params['preload'])) # noqa: E501 header_params = {} @@ -417,6 +445,95 @@ def get_flag_with_http_info(self, flag_id, **kwargs): # noqa: E501 _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) + def get_flag_entity_types(self, **kwargs): # noqa: E501 + """get_flag_entity_types # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_flag_entity_types(async=True) + >>> result = thread.get() + + :param async bool + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.get_flag_entity_types_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_flag_entity_types_with_http_info(**kwargs) # noqa: E501 + return data + + def get_flag_entity_types_with_http_info(self, **kwargs): # noqa: E501 + """get_flag_entity_types # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_flag_entity_types_with_http_info(async=True) + >>> result = thread.get() + + :param async bool + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_flag_entity_types" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/flags/entity_types', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[str]', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + def get_flag_snapshots(self, flag_id, **kwargs): # noqa: E501 """get_flag_snapshots # noqa: E501 diff --git a/flagr/api/health_api.py b/flagr/api/health_api.py new file mode 100644 index 0000000..93298e4 --- /dev/null +++ b/flagr/api/health_api.py @@ -0,0 +1,125 @@ +# coding: utf-8 + +""" + Flagr + + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 + + OpenAPI spec version: 1.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from flagr.api_client import ApiClient + + +class HealthApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_health(self, **kwargs): # noqa: E501 + """get_health # noqa: E501 + + Check if Flagr is healthy # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_health(async=True) + >>> result = thread.get() + + :param async bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.get_health_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_health_with_http_info(**kwargs) # noqa: E501 + return data + + def get_health_with_http_info(self, **kwargs): # noqa: E501 + """get_health # noqa: E501 + + Check if Flagr is healthy # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.get_health_with_http_info(async=True) + >>> result = thread.get() + + :param async bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_health" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/health', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/flagr/api/segment_api.py b/flagr/api/segment_api.py index f7c956a..1540c97 100644 --- a/flagr/api/segment_api.py +++ b/flagr/api/segment_api.py @@ -3,9 +3,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/flagr/api/variant_api.py b/flagr/api/variant_api.py index 9d438f3..5ffb972 100644 --- a/flagr/api/variant_api.py +++ b/flagr/api/variant_api.py @@ -3,9 +3,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/flagr/api_client.py b/flagr/api_client.py index eaaf310..02467f6 100644 --- a/flagr/api_client.py +++ b/flagr/api_client.py @@ -2,9 +2,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -73,7 +73,7 @@ def __init__(self, configuration=None, header_name=None, header_value=None, self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'Swagger-Codegen/0.1.0/python' + self.user_agent = 'Swagger-Codegen/1.1.0/python' def __del__(self): self.pool.close() @@ -541,7 +541,7 @@ def __deserialize_primitive(self, data, klass): try: return klass(data) except UnicodeEncodeError: - return six.u(data) + return six.text_type(data) except TypeError: return data diff --git a/flagr/configuration.py b/flagr/configuration.py index 72c8442..7ce0c0c 100644 --- a/flagr/configuration.py +++ b/flagr/configuration.py @@ -3,9 +3,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -235,6 +235,6 @@ def to_debug_report(self): return "Python SDK Debug Report:\n"\ "OS: {env}\n"\ "Python Version: {pyversion}\n"\ - "Version of the API: 1.0.0\n"\ - "SDK Package Version: 0.1.0".\ + "Version of the API: 1.1.0\n"\ + "SDK Package Version: 1.1.0".\ format(env=sys.platform, pyversion=sys.version) diff --git a/flagr/models/__init__.py b/flagr/models/__init__.py index ad5a9cf..8955a1f 100644 --- a/flagr/models/__init__.py +++ b/flagr/models/__init__.py @@ -4,9 +4,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/flagr/models/constraint.py b/flagr/models/constraint.py index 65ec1c0..d5fe173 100644 --- a/flagr/models/constraint.py +++ b/flagr/models/constraint.py @@ -3,9 +3,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/flagr/models/create_constraint_request.py b/flagr/models/create_constraint_request.py index 3c93c26..506fc5f 100644 --- a/flagr/models/create_constraint_request.py +++ b/flagr/models/create_constraint_request.py @@ -3,9 +3,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/flagr/models/create_flag_request.py b/flagr/models/create_flag_request.py index efac274..5a1e592 100644 --- a/flagr/models/create_flag_request.py +++ b/flagr/models/create_flag_request.py @@ -3,9 +3,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -31,20 +31,25 @@ class CreateFlagRequest(object): and the value is json key in definition. """ swagger_types = { - 'description': 'str' + 'description': 'str', + 'key': 'str' } attribute_map = { - 'description': 'description' + 'description': 'description', + 'key': 'key' } - def __init__(self, description=None): # noqa: E501 + def __init__(self, description=None, key=None): # noqa: E501 """CreateFlagRequest - a model defined in Swagger""" # noqa: E501 self._description = None + self._key = None self.discriminator = None self.description = description + if key is not None: + self.key = key @property def description(self): @@ -71,6 +76,29 @@ def description(self, description): self._description = description + @property + def key(self): + """Gets the key of this CreateFlagRequest. # noqa: E501 + + unique key representation of the flag # noqa: E501 + + :return: The key of this CreateFlagRequest. # noqa: E501 + :rtype: str + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this CreateFlagRequest. + + unique key representation of the flag # noqa: E501 + + :param key: The key of this CreateFlagRequest. # noqa: E501 + :type: str + """ + + self._key = key + def to_dict(self): """Returns the model properties as a dict""" result = {} diff --git a/flagr/models/create_segment_request.py b/flagr/models/create_segment_request.py index bf71275..03f3657 100644 --- a/flagr/models/create_segment_request.py +++ b/flagr/models/create_segment_request.py @@ -3,9 +3,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/flagr/models/create_variant_request.py b/flagr/models/create_variant_request.py index 997706f..903f06f 100644 --- a/flagr/models/create_variant_request.py +++ b/flagr/models/create_variant_request.py @@ -3,9 +3,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/flagr/models/distribution.py b/flagr/models/distribution.py index 3fb604d..89a18e1 100644 --- a/flagr/models/distribution.py +++ b/flagr/models/distribution.py @@ -3,9 +3,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -33,7 +33,6 @@ class Distribution(object): swagger_types = { 'id': 'int', 'percent': 'int', - 'bitmap': 'str', 'variant_key': 'str', 'variant_id': 'int' } @@ -41,17 +40,15 @@ class Distribution(object): attribute_map = { 'id': 'id', 'percent': 'percent', - 'bitmap': 'bitmap', 'variant_key': 'variantKey', 'variant_id': 'variantID' } - def __init__(self, id=None, percent=None, bitmap=None, variant_key=None, variant_id=None): # noqa: E501 + def __init__(self, id=None, percent=None, variant_key=None, variant_id=None): # noqa: E501 """Distribution - a model defined in Swagger""" # noqa: E501 self._id = None self._percent = None - self._bitmap = None self._variant_key = None self._variant_id = None self.discriminator = None @@ -59,8 +56,6 @@ def __init__(self, id=None, percent=None, bitmap=None, variant_key=None, variant if id is not None: self.id = id self.percent = percent - if bitmap is not None: - self.bitmap = bitmap self.variant_key = variant_key self.variant_id = variant_id @@ -114,29 +109,6 @@ def percent(self, percent): self._percent = percent - @property - def bitmap(self): - """Gets the bitmap of this Distribution. # noqa: E501 - - - :return: The bitmap of this Distribution. # noqa: E501 - :rtype: str - """ - return self._bitmap - - @bitmap.setter - def bitmap(self, bitmap): - """Sets the bitmap of this Distribution. - - - :param bitmap: The bitmap of this Distribution. # noqa: E501 - :type: str - """ - if bitmap is not None and len(bitmap) < 1: - raise ValueError("Invalid value for `bitmap`, length must be greater than or equal to `1`") # noqa: E501 - - self._bitmap = bitmap - @property def variant_key(self): """Gets the variant_key of this Distribution. # noqa: E501 diff --git a/flagr/models/error.py b/flagr/models/error.py index d3a10f2..4b5c7eb 100644 --- a/flagr/models/error.py +++ b/flagr/models/error.py @@ -3,9 +3,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/flagr/models/eval_context.py b/flagr/models/eval_context.py index fd681e2..69086c5 100644 --- a/flagr/models/eval_context.py +++ b/flagr/models/eval_context.py @@ -3,9 +3,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -35,7 +35,8 @@ class EvalContext(object): 'entity_type': 'str', 'entity_context': 'object', 'enable_debug': 'bool', - 'flag_id': 'int' + 'flag_id': 'int', + 'flag_key': 'str' } attribute_map = { @@ -43,10 +44,11 @@ class EvalContext(object): 'entity_type': 'entityType', 'entity_context': 'entityContext', 'enable_debug': 'enableDebug', - 'flag_id': 'flagID' + 'flag_id': 'flagID', + 'flag_key': 'flagKey' } - def __init__(self, entity_id=None, entity_type=None, entity_context=None, enable_debug=None, flag_id=None): # noqa: E501 + def __init__(self, entity_id=None, entity_type=None, entity_context=None, enable_debug=None, flag_id=None, flag_key=None): # noqa: E501 """EvalContext - a model defined in Swagger""" # noqa: E501 self._entity_id = None @@ -54,20 +56,27 @@ def __init__(self, entity_id=None, entity_type=None, entity_context=None, enable self._entity_context = None self._enable_debug = None self._flag_id = None + self._flag_key = None self.discriminator = None - self.entity_id = entity_id - self.entity_type = entity_type + if entity_id is not None: + self.entity_id = entity_id + if entity_type is not None: + self.entity_type = entity_type if entity_context is not None: self.entity_context = entity_context if enable_debug is not None: self.enable_debug = enable_debug - self.flag_id = flag_id + if flag_id is not None: + self.flag_id = flag_id + if flag_key is not None: + self.flag_key = flag_key @property def entity_id(self): """Gets the entity_id of this EvalContext. # noqa: E501 + entityID is used to deterministically at random to evaluate the flag result. If it's empty, flagr will randomly generate one. # noqa: E501 :return: The entity_id of this EvalContext. # noqa: E501 :rtype: str @@ -78,14 +87,11 @@ def entity_id(self): def entity_id(self, entity_id): """Sets the entity_id of this EvalContext. + entityID is used to deterministically at random to evaluate the flag result. If it's empty, flagr will randomly generate one. # noqa: E501 :param entity_id: The entity_id of this EvalContext. # noqa: E501 :type: str """ - if entity_id is None: - raise ValueError("Invalid value for `entity_id`, must not be `None`") # noqa: E501 - if entity_id is not None and len(entity_id) < 1: - raise ValueError("Invalid value for `entity_id`, length must be greater than or equal to `1`") # noqa: E501 self._entity_id = entity_id @@ -107,10 +113,6 @@ def entity_type(self, entity_type): :param entity_type: The entity_type of this EvalContext. # noqa: E501 :type: str """ - if entity_type is None: - raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 - if entity_type is not None and len(entity_type) < 1: - raise ValueError("Invalid value for `entity_type`, length must be greater than or equal to `1`") # noqa: E501 self._entity_type = entity_type @@ -160,6 +162,7 @@ def enable_debug(self, enable_debug): def flag_id(self): """Gets the flag_id of this EvalContext. # noqa: E501 + flagID # noqa: E501 :return: The flag_id of this EvalContext. # noqa: E501 :rtype: int @@ -170,17 +173,39 @@ def flag_id(self): def flag_id(self, flag_id): """Sets the flag_id of this EvalContext. + flagID # noqa: E501 :param flag_id: The flag_id of this EvalContext. # noqa: E501 :type: int """ - if flag_id is None: - raise ValueError("Invalid value for `flag_id`, must not be `None`") # noqa: E501 if flag_id is not None and flag_id < 1: # noqa: E501 raise ValueError("Invalid value for `flag_id`, must be a value greater than or equal to `1`") # noqa: E501 self._flag_id = flag_id + @property + def flag_key(self): + """Gets the flag_key of this EvalContext. # noqa: E501 + + flagKey. flagID or flagKey will resolve to the same flag. Either works. # noqa: E501 + + :return: The flag_key of this EvalContext. # noqa: E501 + :rtype: str + """ + return self._flag_key + + @flag_key.setter + def flag_key(self, flag_key): + """Sets the flag_key of this EvalContext. + + flagKey. flagID or flagKey will resolve to the same flag. Either works. # noqa: E501 + + :param flag_key: The flag_key of this EvalContext. # noqa: E501 + :type: str + """ + + self._flag_key = flag_key + def to_dict(self): """Returns the model properties as a dict""" result = {} diff --git a/flagr/models/eval_debug_log.py b/flagr/models/eval_debug_log.py index 784c4bd..81b888c 100644 --- a/flagr/models/eval_debug_log.py +++ b/flagr/models/eval_debug_log.py @@ -3,9 +3,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/flagr/models/eval_result.py b/flagr/models/eval_result.py index f3e1f72..88e8d22 100644 --- a/flagr/models/eval_result.py +++ b/flagr/models/eval_result.py @@ -3,9 +3,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -35,6 +35,7 @@ class EvalResult(object): """ swagger_types = { 'flag_id': 'int', + 'flag_key': 'str', 'flag_snapshot_id': 'int', 'segment_id': 'int', 'variant_id': 'int', @@ -47,6 +48,7 @@ class EvalResult(object): attribute_map = { 'flag_id': 'flagID', + 'flag_key': 'flagKey', 'flag_snapshot_id': 'flagSnapshotID', 'segment_id': 'segmentID', 'variant_id': 'variantID', @@ -57,10 +59,11 @@ class EvalResult(object): 'eval_debug_log': 'evalDebugLog' } - def __init__(self, flag_id=None, flag_snapshot_id=None, segment_id=None, variant_id=None, variant_key=None, variant_attachment=None, eval_context=None, timestamp=None, eval_debug_log=None): # noqa: E501 + def __init__(self, flag_id=None, flag_key=None, flag_snapshot_id=None, segment_id=None, variant_id=None, variant_key=None, variant_attachment=None, eval_context=None, timestamp=None, eval_debug_log=None): # noqa: E501 """EvalResult - a model defined in Swagger""" # noqa: E501 self._flag_id = None + self._flag_key = None self._flag_snapshot_id = None self._segment_id = None self._variant_id = None @@ -71,15 +74,24 @@ def __init__(self, flag_id=None, flag_snapshot_id=None, segment_id=None, variant self._eval_debug_log = None self.discriminator = None - self.flag_id = flag_id + if flag_id is not None: + self.flag_id = flag_id + if flag_key is not None: + self.flag_key = flag_key if flag_snapshot_id is not None: self.flag_snapshot_id = flag_snapshot_id - self.segment_id = segment_id - self.variant_id = variant_id - self.variant_key = variant_key - self.variant_attachment = variant_attachment - self.eval_context = eval_context - self.timestamp = timestamp + if segment_id is not None: + self.segment_id = segment_id + if variant_id is not None: + self.variant_id = variant_id + if variant_key is not None: + self.variant_key = variant_key + if variant_attachment is not None: + self.variant_attachment = variant_attachment + if eval_context is not None: + self.eval_context = eval_context + if timestamp is not None: + self.timestamp = timestamp if eval_debug_log is not None: self.eval_debug_log = eval_debug_log @@ -101,13 +113,30 @@ def flag_id(self, flag_id): :param flag_id: The flag_id of this EvalResult. # noqa: E501 :type: int """ - if flag_id is None: - raise ValueError("Invalid value for `flag_id`, must not be `None`") # noqa: E501 - if flag_id is not None and flag_id < 1: # noqa: E501 - raise ValueError("Invalid value for `flag_id`, must be a value greater than or equal to `1`") # noqa: E501 self._flag_id = flag_id + @property + def flag_key(self): + """Gets the flag_key of this EvalResult. # noqa: E501 + + + :return: The flag_key of this EvalResult. # noqa: E501 + :rtype: str + """ + return self._flag_key + + @flag_key.setter + def flag_key(self, flag_key): + """Sets the flag_key of this EvalResult. + + + :param flag_key: The flag_key of this EvalResult. # noqa: E501 + :type: str + """ + + self._flag_key = flag_key + @property def flag_snapshot_id(self): """Gets the flag_snapshot_id of this EvalResult. # noqa: E501 @@ -147,10 +176,6 @@ def segment_id(self, segment_id): :param segment_id: The segment_id of this EvalResult. # noqa: E501 :type: int """ - if segment_id is None: - raise ValueError("Invalid value for `segment_id`, must not be `None`") # noqa: E501 - if segment_id is not None and segment_id < 1: # noqa: E501 - raise ValueError("Invalid value for `segment_id`, must be a value greater than or equal to `1`") # noqa: E501 self._segment_id = segment_id @@ -172,10 +197,6 @@ def variant_id(self, variant_id): :param variant_id: The variant_id of this EvalResult. # noqa: E501 :type: int """ - if variant_id is None: - raise ValueError("Invalid value for `variant_id`, must not be `None`") # noqa: E501 - if variant_id is not None and variant_id < 1: # noqa: E501 - raise ValueError("Invalid value for `variant_id`, must be a value greater than or equal to `1`") # noqa: E501 self._variant_id = variant_id @@ -197,10 +218,6 @@ def variant_key(self, variant_key): :param variant_key: The variant_key of this EvalResult. # noqa: E501 :type: str """ - if variant_key is None: - raise ValueError("Invalid value for `variant_key`, must not be `None`") # noqa: E501 - if variant_key is not None and len(variant_key) < 1: - raise ValueError("Invalid value for `variant_key`, length must be greater than or equal to `1`") # noqa: E501 self._variant_key = variant_key @@ -222,8 +239,6 @@ def variant_attachment(self, variant_attachment): :param variant_attachment: The variant_attachment of this EvalResult. # noqa: E501 :type: object """ - if variant_attachment is None: - raise ValueError("Invalid value for `variant_attachment`, must not be `None`") # noqa: E501 self._variant_attachment = variant_attachment @@ -245,8 +260,6 @@ def eval_context(self, eval_context): :param eval_context: The eval_context of this EvalResult. # noqa: E501 :type: EvalContext """ - if eval_context is None: - raise ValueError("Invalid value for `eval_context`, must not be `None`") # noqa: E501 self._eval_context = eval_context @@ -268,10 +281,6 @@ def timestamp(self, timestamp): :param timestamp: The timestamp of this EvalResult. # noqa: E501 :type: str """ - if timestamp is None: - raise ValueError("Invalid value for `timestamp`, must not be `None`") # noqa: E501 - if timestamp is not None and len(timestamp) < 1: - raise ValueError("Invalid value for `timestamp`, length must be greater than or equal to `1`") # noqa: E501 self._timestamp = timestamp diff --git a/flagr/models/evaluation_batch_request.py b/flagr/models/evaluation_batch_request.py index 76a8ab0..b8d8bc2 100644 --- a/flagr/models/evaluation_batch_request.py +++ b/flagr/models/evaluation_batch_request.py @@ -3,9 +3,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -35,27 +35,33 @@ class EvaluationBatchRequest(object): swagger_types = { 'entities': 'list[EvaluationEntity]', 'enable_debug': 'bool', - 'flag_i_ds': 'list[int]' + 'flag_i_ds': 'list[int]', + 'flag_keys': 'list[str]' } attribute_map = { 'entities': 'entities', 'enable_debug': 'enableDebug', - 'flag_i_ds': 'flagIDs' + 'flag_i_ds': 'flagIDs', + 'flag_keys': 'flagKeys' } - def __init__(self, entities=None, enable_debug=None, flag_i_ds=None): # noqa: E501 + def __init__(self, entities=None, enable_debug=None, flag_i_ds=None, flag_keys=None): # noqa: E501 """EvaluationBatchRequest - a model defined in Swagger""" # noqa: E501 self._entities = None self._enable_debug = None self._flag_i_ds = None + self._flag_keys = None self.discriminator = None self.entities = entities if enable_debug is not None: self.enable_debug = enable_debug - self.flag_i_ds = flag_i_ds + if flag_i_ds is not None: + self.flag_i_ds = flag_i_ds + if flag_keys is not None: + self.flag_keys = flag_keys @property def entities(self): @@ -105,6 +111,7 @@ def enable_debug(self, enable_debug): def flag_i_ds(self): """Gets the flag_i_ds of this EvaluationBatchRequest. # noqa: E501 + flagIDs # noqa: E501 :return: The flag_i_ds of this EvaluationBatchRequest. # noqa: E501 :rtype: list[int] @@ -115,15 +122,37 @@ def flag_i_ds(self): def flag_i_ds(self, flag_i_ds): """Sets the flag_i_ds of this EvaluationBatchRequest. + flagIDs # noqa: E501 :param flag_i_ds: The flag_i_ds of this EvaluationBatchRequest. # noqa: E501 :type: list[int] """ - if flag_i_ds is None: - raise ValueError("Invalid value for `flag_i_ds`, must not be `None`") # noqa: E501 self._flag_i_ds = flag_i_ds + @property + def flag_keys(self): + """Gets the flag_keys of this EvaluationBatchRequest. # noqa: E501 + + flagKeys. Either flagIDs or flagKeys works. If pass in both, Flagr may return duplicate results. # noqa: E501 + + :return: The flag_keys of this EvaluationBatchRequest. # noqa: E501 + :rtype: list[str] + """ + return self._flag_keys + + @flag_keys.setter + def flag_keys(self, flag_keys): + """Sets the flag_keys of this EvaluationBatchRequest. + + flagKeys. Either flagIDs or flagKeys works. If pass in both, Flagr may return duplicate results. # noqa: E501 + + :param flag_keys: The flag_keys of this EvaluationBatchRequest. # noqa: E501 + :type: list[str] + """ + + self._flag_keys = flag_keys + def to_dict(self): """Returns the model properties as a dict""" result = {} diff --git a/flagr/models/evaluation_batch_response.py b/flagr/models/evaluation_batch_response.py index 684d9d6..dd21c80 100644 --- a/flagr/models/evaluation_batch_response.py +++ b/flagr/models/evaluation_batch_response.py @@ -3,9 +3,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/flagr/models/evaluation_entity.py b/flagr/models/evaluation_entity.py index 9c48d8f..38310e1 100644 --- a/flagr/models/evaluation_entity.py +++ b/flagr/models/evaluation_entity.py @@ -3,9 +3,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -50,8 +50,10 @@ def __init__(self, entity_id=None, entity_type=None, entity_context=None): # no self._entity_context = None self.discriminator = None - self.entity_id = entity_id - self.entity_type = entity_type + if entity_id is not None: + self.entity_id = entity_id + if entity_type is not None: + self.entity_type = entity_type if entity_context is not None: self.entity_context = entity_context @@ -73,10 +75,6 @@ def entity_id(self, entity_id): :param entity_id: The entity_id of this EvaluationEntity. # noqa: E501 :type: str """ - if entity_id is None: - raise ValueError("Invalid value for `entity_id`, must not be `None`") # noqa: E501 - if entity_id is not None and len(entity_id) < 1: - raise ValueError("Invalid value for `entity_id`, length must be greater than or equal to `1`") # noqa: E501 self._entity_id = entity_id @@ -98,10 +96,6 @@ def entity_type(self, entity_type): :param entity_type: The entity_type of this EvaluationEntity. # noqa: E501 :type: str """ - if entity_type is None: - raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 - if entity_type is not None and len(entity_type) < 1: - raise ValueError("Invalid value for `entity_type`, length must be greater than or equal to `1`") # noqa: E501 self._entity_type = entity_type diff --git a/flagr/models/flag.py b/flagr/models/flag.py index e6525d0..a27db75 100644 --- a/flagr/models/flag.py +++ b/flagr/models/flag.py @@ -3,9 +3,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -35,35 +35,52 @@ class Flag(object): """ swagger_types = { 'id': 'int', + 'key': 'str', 'description': 'str', 'enabled': 'bool', 'segments': 'list[Segment]', 'variants': 'list[Variant]', - 'data_records_enabled': 'bool' + 'data_records_enabled': 'bool', + 'entity_type': 'str', + 'created_by': 'str', + 'updated_by': 'str', + 'updated_at': 'datetime' } attribute_map = { 'id': 'id', + 'key': 'key', 'description': 'description', 'enabled': 'enabled', 'segments': 'segments', 'variants': 'variants', - 'data_records_enabled': 'dataRecordsEnabled' + 'data_records_enabled': 'dataRecordsEnabled', + 'entity_type': 'entityType', + 'created_by': 'createdBy', + 'updated_by': 'updatedBy', + 'updated_at': 'updatedAt' } - def __init__(self, id=None, description=None, enabled=None, segments=None, variants=None, data_records_enabled=None): # noqa: E501 + def __init__(self, id=None, key=None, description=None, enabled=None, segments=None, variants=None, data_records_enabled=None, entity_type=None, created_by=None, updated_by=None, updated_at=None): # noqa: E501 """Flag - a model defined in Swagger""" # noqa: E501 self._id = None + self._key = None self._description = None self._enabled = None self._segments = None self._variants = None self._data_records_enabled = None + self._entity_type = None + self._created_by = None + self._updated_by = None + self._updated_at = None self.discriminator = None if id is not None: self.id = id + if key is not None: + self.key = key self.description = description self.enabled = enabled if segments is not None: @@ -71,6 +88,14 @@ def __init__(self, id=None, description=None, enabled=None, segments=None, varia if variants is not None: self.variants = variants self.data_records_enabled = data_records_enabled + if entity_type is not None: + self.entity_type = entity_type + if created_by is not None: + self.created_by = created_by + if updated_by is not None: + self.updated_by = updated_by + if updated_at is not None: + self.updated_at = updated_at @property def id(self): @@ -95,6 +120,31 @@ def id(self, id): self._id = id + @property + def key(self): + """Gets the key of this Flag. # noqa: E501 + + unique key representation of the flag # noqa: E501 + + :return: The key of this Flag. # noqa: E501 + :rtype: str + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this Flag. + + unique key representation of the flag # noqa: E501 + + :param key: The key of this Flag. # noqa: E501 + :type: str + """ + if key is not None and len(key) < 1: + raise ValueError("Invalid value for `key`, length must be greater than or equal to `1`") # noqa: E501 + + self._key = key + @property def description(self): """Gets the description of this Flag. # noqa: E501 @@ -210,6 +260,92 @@ def data_records_enabled(self, data_records_enabled): self._data_records_enabled = data_records_enabled + @property + def entity_type(self): + """Gets the entity_type of this Flag. # noqa: E501 + + it will override the entityType in the evaluation logs if it's not empty # noqa: E501 + + :return: The entity_type of this Flag. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this Flag. + + it will override the entityType in the evaluation logs if it's not empty # noqa: E501 + + :param entity_type: The entity_type of this Flag. # noqa: E501 + :type: str + """ + + self._entity_type = entity_type + + @property + def created_by(self): + """Gets the created_by of this Flag. # noqa: E501 + + + :return: The created_by of this Flag. # noqa: E501 + :rtype: str + """ + return self._created_by + + @created_by.setter + def created_by(self, created_by): + """Sets the created_by of this Flag. + + + :param created_by: The created_by of this Flag. # noqa: E501 + :type: str + """ + + self._created_by = created_by + + @property + def updated_by(self): + """Gets the updated_by of this Flag. # noqa: E501 + + + :return: The updated_by of this Flag. # noqa: E501 + :rtype: str + """ + return self._updated_by + + @updated_by.setter + def updated_by(self, updated_by): + """Sets the updated_by of this Flag. + + + :param updated_by: The updated_by of this Flag. # noqa: E501 + :type: str + """ + + self._updated_by = updated_by + + @property + def updated_at(self): + """Gets the updated_at of this Flag. # noqa: E501 + + + :return: The updated_at of this Flag. # noqa: E501 + :rtype: datetime + """ + return self._updated_at + + @updated_at.setter + def updated_at(self, updated_at): + """Sets the updated_at of this Flag. + + + :param updated_at: The updated_at of this Flag. # noqa: E501 + :type: datetime + """ + + self._updated_at = updated_at + def to_dict(self): """Returns the model properties as a dict""" result = {} diff --git a/flagr/models/flag_snapshot.py b/flagr/models/flag_snapshot.py index beebe06..5eeecb9 100644 --- a/flagr/models/flag_snapshot.py +++ b/flagr/models/flag_snapshot.py @@ -3,9 +3,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/flagr/models/put_distributions_request.py b/flagr/models/put_distributions_request.py index 595466f..d53b92f 100644 --- a/flagr/models/put_distributions_request.py +++ b/flagr/models/put_distributions_request.py @@ -3,9 +3,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/flagr/models/put_flag_request.py b/flagr/models/put_flag_request.py index 3bb7e0d..c0f281c 100644 --- a/flagr/models/put_flag_request.py +++ b/flagr/models/put_flag_request.py @@ -3,9 +3,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -32,24 +32,40 @@ class PutFlagRequest(object): """ swagger_types = { 'description': 'str', - 'data_records_enabled': 'bool' + 'data_records_enabled': 'bool', + 'entity_type': 'str', + 'enabled': 'bool', + 'key': 'str' } attribute_map = { 'description': 'description', - 'data_records_enabled': 'dataRecordsEnabled' + 'data_records_enabled': 'dataRecordsEnabled', + 'entity_type': 'entityType', + 'enabled': 'enabled', + 'key': 'key' } - def __init__(self, description=None, data_records_enabled=None): # noqa: E501 + def __init__(self, description=None, data_records_enabled=None, entity_type=None, enabled=None, key=None): # noqa: E501 """PutFlagRequest - a model defined in Swagger""" # noqa: E501 self._description = None self._data_records_enabled = None + self._entity_type = None + self._enabled = None + self._key = None self.discriminator = None - self.description = description + if description is not None: + self.description = description if data_records_enabled is not None: self.data_records_enabled = data_records_enabled + if entity_type is not None: + self.entity_type = entity_type + if enabled is not None: + self.enabled = enabled + if key is not None: + self.key = key @property def description(self): @@ -69,8 +85,6 @@ def description(self, description): :param description: The description of this PutFlagRequest. # noqa: E501 :type: str """ - if description is None: - raise ValueError("Invalid value for `description`, must not be `None`") # noqa: E501 if description is not None and len(description) < 1: raise ValueError("Invalid value for `description`, length must be greater than or equal to `1`") # noqa: E501 @@ -99,6 +113,71 @@ def data_records_enabled(self, data_records_enabled): self._data_records_enabled = data_records_enabled + @property + def entity_type(self): + """Gets the entity_type of this PutFlagRequest. # noqa: E501 + + it will overwrite entityType into evaluation logs if it's not empty # noqa: E501 + + :return: The entity_type of this PutFlagRequest. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this PutFlagRequest. + + it will overwrite entityType into evaluation logs if it's not empty # noqa: E501 + + :param entity_type: The entity_type of this PutFlagRequest. # noqa: E501 + :type: str + """ + + self._entity_type = entity_type + + @property + def enabled(self): + """Gets the enabled of this PutFlagRequest. # noqa: E501 + + + :return: The enabled of this PutFlagRequest. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this PutFlagRequest. + + + :param enabled: The enabled of this PutFlagRequest. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + @property + def key(self): + """Gets the key of this PutFlagRequest. # noqa: E501 + + + :return: The key of this PutFlagRequest. # noqa: E501 + :rtype: str + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this PutFlagRequest. + + + :param key: The key of this PutFlagRequest. # noqa: E501 + :type: str + """ + + self._key = key + def to_dict(self): """Returns the model properties as a dict""" result = {} diff --git a/flagr/models/put_segment_reorder_request.py b/flagr/models/put_segment_reorder_request.py index 278f52a..90c7a85 100644 --- a/flagr/models/put_segment_reorder_request.py +++ b/flagr/models/put_segment_reorder_request.py @@ -3,9 +3,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/flagr/models/put_segment_request.py b/flagr/models/put_segment_request.py index d2fa2c7..52ade98 100644 --- a/flagr/models/put_segment_request.py +++ b/flagr/models/put_segment_request.py @@ -3,9 +3,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/flagr/models/put_variant_request.py b/flagr/models/put_variant_request.py index ec01b27..05868ef 100644 --- a/flagr/models/put_variant_request.py +++ b/flagr/models/put_variant_request.py @@ -3,9 +3,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -48,7 +48,8 @@ def __init__(self, key=None, attachment=None): # noqa: E501 self.discriminator = None self.key = key - self.attachment = attachment + if attachment is not None: + self.attachment = attachment @property def key(self): @@ -93,8 +94,6 @@ def attachment(self, attachment): :param attachment: The attachment of this PutVariantRequest. # noqa: E501 :type: object """ - if attachment is None: - raise ValueError("Invalid value for `attachment`, must not be `None`") # noqa: E501 self._attachment = attachment diff --git a/flagr/models/segment.py b/flagr/models/segment.py index 83a7e30..877112d 100644 --- a/flagr/models/segment.py +++ b/flagr/models/segment.py @@ -3,9 +3,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/flagr/models/segment_debug_log.py b/flagr/models/segment_debug_log.py index b7aaebf..87cb1d8 100644 --- a/flagr/models/segment_debug_log.py +++ b/flagr/models/segment_debug_log.py @@ -3,9 +3,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/flagr/models/set_flag_enabled_request.py b/flagr/models/set_flag_enabled_request.py index b1524ff..afc84e7 100644 --- a/flagr/models/set_flag_enabled_request.py +++ b/flagr/models/set_flag_enabled_request.py @@ -3,9 +3,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/flagr/models/variant.py b/flagr/models/variant.py index 16b18c3..2895185 100644 --- a/flagr/models/variant.py +++ b/flagr/models/variant.py @@ -3,9 +3,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/flagr/rest.py b/flagr/rest.py index 68f5b9a..5e8f2ce 100644 --- a/flagr/rest.py +++ b/flagr/rest.py @@ -3,9 +3,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/setup.py b/setup.py index 52b4d5b..ae1acd9 100644 --- a/setup.py +++ b/setup.py @@ -3,9 +3,9 @@ """ Flagr - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 - OpenAPI spec version: 1.0.0 + OpenAPI spec version: 1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -14,7 +14,7 @@ from setuptools import setup, find_packages # noqa: H301 NAME = "flagr" -VERSION = "0.1.0" +VERSION = "1.1.0" # To install the library, run the following # # python setup.py install @@ -35,6 +35,6 @@ packages=find_packages(), include_package_data=True, long_description="""\ - Flagr is a feature flagging, A/B testing and dynamic configuration microservice # noqa: E501 + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 """ ) diff --git a/swagger.yaml b/swagger.yaml index 5e1eb3e..7827f9c 100644 --- a/swagger.yaml +++ b/swagger.yaml @@ -1,10 +1,10 @@ swagger: '2.0' info: - description: >- + description: > Flagr is a feature flagging, A/B testing and dynamic configuration - microservice + microservice. The base path for all the APIs is "/api/v1". title: Flagr - version: 1.0.0 + version: 1.1.0 tags: - name: flag description: Everything about the flag @@ -18,6 +18,8 @@ tags: description: Variants are the possible outcomes of flag evaluation - name: evaluation description: Evaluation is the process of evaluating a flag given the entity context + - name: health + description: Check if Flagr is healthy x-tagGroups: - name: Flag Management tags: @@ -29,6 +31,12 @@ x-tagGroups: - name: Flag Evaluation tags: - evaluation + - name: Health Check + tags: + - health + - name: Export + tags: + - export consumes: - application/json produces: @@ -42,6 +50,39 @@ paths: tags: - flag operationId: findFlags + parameters: + - in: query + name: limit + type: integer + format: int64 + description: the numbers of flags to return + - in: query + name: enabled + type: boolean + description: return flags having given enabled status + - in: query + name: description + type: string + description: return flags exactly matching given description + - in: query + name: description_like + type: string + description: return flags partially matching given description + - in: query + name: key + type: string + description: return flags matching given key + - in: query + name: offset + type: integer + format: int64 + description: >- + return flags given the offset, it should usually set together with + limit + - in: query + name: preload + type: boolean + description: return flags with preloaded segments and variants responses: '200': description: list all the flags @@ -95,48 +136,48 @@ paths: description: generic error response schema: $ref: '#/definitions/error' - put: + delete: tags: - flag - operationId: putFlag + operationId: deleteFlag parameters: - in: path name: flagID - description: numeric ID of the flag to get + description: numeric ID of the flag required: true type: integer format: int64 minimum: 1 - - in: body - name: body - description: update a flag - required: true - schema: - $ref: '#/definitions/putFlagRequest' responses: '200': - description: returns the flag - schema: - $ref: '#/definitions/flag' + description: OK deleted default: description: generic error response schema: $ref: '#/definitions/error' - delete: + put: tags: - flag - operationId: deleteFlag + operationId: putFlag parameters: - in: path name: flagID - description: numeric ID of the flag + description: numeric ID of the flag to get required: true type: integer format: int64 minimum: 1 + - in: body + name: body + description: update a flag + required: true + schema: + $ref: '#/definitions/putFlagRequest' responses: '200': - description: OK deleted + description: returns the flag + schema: + $ref: '#/definitions/flag' default: description: generic error response schema: @@ -651,6 +692,23 @@ paths: description: generic error response schema: $ref: '#/definitions/error' + /flags/entity_types: + get: + tags: + - flag + operationId: getFlagEntityTypes + responses: + '200': + description: returns all the FlagEntityTypes + schema: + type: array + items: + type: string + minLength: 1 + default: + description: generic error response + schema: + $ref: '#/definitions/error' /evaluation: post: tags: @@ -693,6 +751,38 @@ paths: description: generic error response schema: $ref: '#/definitions/error' + /health: + get: + tags: + - health + operationId: getHealth + description: Check if Flagr is healthy + responses: + '200': + description: OK + default: + description: generic error response + schema: + $ref: '#/definitions/error' + /export/sqlite: + get: + tags: + - export + operationId: getExportSQLite + description: >- + Export sqlite3 format of the db dump, which is converted from the main + database. + produces: + - application/octet-stream + responses: + '200': + description: OK + schema: + type: file + default: + description: generic error response + schema: + $ref: '#/definitions/error' definitions: flag: type: object @@ -706,6 +796,10 @@ definitions: format: int64 minimum: 1 readOnly: true + key: + description: unique key representation of the flag + type: string + minLength: 1 description: type: string minLength: 1 @@ -724,6 +818,18 @@ definitions: enabled data records will get data logging in the metrics pipeline, for example, kafka. type: boolean + entityType: + description: >- + it will override the entityType in the evaluation logs if it's not + empty + type: string + createdBy: + type: string + updatedBy: + type: string + updatedAt: + type: string + format: date-time createFlagRequest: type: object required: @@ -732,20 +838,32 @@ definitions: description: type: string minLength: 1 + key: + description: unique key representation of the flag + type: string putFlagRequest: type: object - required: - - description properties: description: type: string minLength: 1 + x-nullable: true dataRecordsEnabled: type: boolean description: >- enabled data records will get data logging in the metrics pipeline, for example, kafka. x-nullable: true + entityType: + description: it will overwrite entityType into evaluation logs if it's not empty + type: string + x-nullable: true + enabled: + type: boolean + x-nullable: true + key: + type: string + x-nullable: true setFlagEnabledRequest: type: object required: @@ -764,7 +882,6 @@ definitions: type: integer format: int64 minimum: 1 - readOnly: true updatedBy: type: string flag: @@ -873,7 +990,6 @@ definitions: type: object required: - key - - attachment properties: key: type: string @@ -947,9 +1063,6 @@ definitions: format: int64 minimum: 0 maximum: 100 - bitmap: - type: string - minLength: 1 variantKey: type: string minLength: 1 @@ -968,61 +1081,53 @@ definitions: $ref: '#/definitions/distribution' evalContext: type: object - required: - - entityID - - entityType - - flagID properties: entityID: type: string - minLength: 1 + description: >- + entityID is used to deterministically at random to evaluate the flag + result. If it's empty, flagr will randomly generate one. entityType: type: string - minLength: 1 entityContext: type: object enableDebug: type: boolean flagID: + description: flagID type: integer format: int64 minimum: 1 + flagKey: + description: >- + flagKey. flagID or flagKey will resolve to the same flag. Either + works. + type: string evalResult: type: object - required: - - flagID - - segmentID - - variantID - - variantKey - - variantAttachment - - evalContext - - timestamp properties: flagID: type: integer format: int64 - minimum: 1 + flagKey: + type: string flagSnapshotID: type: integer format: int64 segmentID: type: integer format: int64 - minimum: 1 variantID: type: integer format: int64 - minimum: 1 variantKey: type: string - minLength: 1 variantAttachment: type: object evalContext: $ref: '#/definitions/evalContext' timestamp: type: string - minLength: 1 evalDebugLog: $ref: '#/definitions/evalDebugLog' evalDebugLog: @@ -1045,23 +1150,17 @@ definitions: type: string evaluationEntity: type: object - required: - - entityID - - entityType properties: entityID: type: string - minLength: 1 entityType: type: string - minLength: 1 entityContext: type: object evaluationBatchRequest: type: object required: - entities - - flagIDs properties: entities: type: array @@ -1071,12 +1170,22 @@ definitions: enableDebug: type: boolean flagIDs: + description: flagIDs type: array items: type: integer format: int64 minimum: 1 minItems: 1 + flagKeys: + description: >- + flagKeys. Either flagIDs or flagKeys works. If pass in both, Flagr may + return duplicate results. + type: array + items: + type: string + minLength: 1 + minItems: 1 evaluationBatchResponse: type: object required: diff --git a/swagger_py.json b/swagger_py.json index 9283008..78c6a64 100644 --- a/swagger_py.json +++ b/swagger_py.json @@ -1,6 +1,6 @@ { "packageName": "flagr", "projectName": "flagr", - "packageVersion": "0.1.0", + "packageVersion": "1.1.0", "packageUrl": "https://github.com/checkr/pyflagr" } diff --git a/test/test_export_api.py b/test/test_export_api.py new file mode 100644 index 0000000..c22e63b --- /dev/null +++ b/test/test_export_api.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Flagr + + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 + + OpenAPI spec version: 1.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import unittest + +import flagr +from flagr.api.export_api import ExportApi # noqa: E501 +from flagr.rest import ApiException + + +class TestExportApi(unittest.TestCase): + """ExportApi unit test stubs""" + + def setUp(self): + self.api = flagr.api.export_api.ExportApi() # noqa: E501 + + def tearDown(self): + pass + + def test_get_export_sq_lite(self): + """Test case for get_export_sq_lite + + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_health_api.py b/test/test_health_api.py new file mode 100644 index 0000000..62216a5 --- /dev/null +++ b/test/test_health_api.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Flagr + + Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\". # noqa: E501 + + OpenAPI spec version: 1.1.0 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import unittest + +import flagr +from flagr.api.health_api import HealthApi # noqa: E501 +from flagr.rest import ApiException + + +class TestHealthApi(unittest.TestCase): + """HealthApi unit test stubs""" + + def setUp(self): + self.api = flagr.api.health_api.HealthApi() # noqa: E501 + + def tearDown(self): + pass + + def test_get_health(self): + """Test case for get_health + + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/tox.ini b/tox.ini index 1cf0829..3d0be61 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ envlist = py27, py3 [testenv] deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt - + commands= nosetests \ - [] \ No newline at end of file + []