Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 49 additions & 6 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24862,6 +24862,8 @@ components:
description: The description of the feature flag.
example: "This is an example feature flag for demonstration"
type: string
distribution_channel:
$ref: "#/components/schemas/FeatureFlagDistributionChannel"
json_schema:
description: JSON schema for validation when value_type is JSON.
example: '{"type": "object", "properties": {"enabled": {"type": "boolean"}}}'
Expand All @@ -24875,6 +24877,19 @@ components:
description: The name of the feature flag.
example: "Feature Flag ABC123"
type: string
require_approval:
description: Indicates whether this feature flag requires approval for changes.
example: false
type: boolean
staleness_status:
$ref: "#/components/schemas/CreateFeatureFlagStalenessStatus"
tags:
description: Tags associated with the feature flag.
example: []
items:
description: A tag associated with the feature flag.
type: string
type: array
value_type:
$ref: "#/components/schemas/ValueType"
variants:
Expand All @@ -24885,7 +24900,6 @@ components:
required:
- key
- name
- description
- value_type
- variants
type: object
Expand Down Expand Up @@ -24916,6 +24930,16 @@ components:
required:
- data
type: object
CreateFeatureFlagStalenessStatus:
description: The staleness status for the feature flag at creation.
enum:
- ACTIVE
- PERMANENT
example: "ACTIVE"
type: string
x-enum-varnames:
- ACTIVE
- PERMANENT
CreateFormData:
description: The data for creating a form.
properties:
Expand Down Expand Up @@ -39184,6 +39208,18 @@ components:
- value_type
- variants
type: object
FeatureFlagDistributionChannel:
description: The distribution channel for the feature flag.
enum:
- ALL
- CLIENT
- SERVER
example: "ALL"
type: string
x-enum-varnames:
- ALL
- CLIENT
- SERVER
FeatureFlagEnvironment:
description: Environment-specific settings for a feature flag.
properties:
Expand Down Expand Up @@ -148869,14 +148905,21 @@ paths:
attributes:
default_variant_key: variant-a
description: A sample feature flag
enabled: true
distribution_channel: ALL
key: feature-flag-abc123
name: Feature Flag ABC 123
require_approval: false
staleness_status: ACTIVE
tags:
- team:feature-flags-app
value_type: BOOLEAN
variants:
- description: Variant A
key: variant-a
- description: Variant B
key: variant-b
- key: variant-a
name: Variant A
value: "true"
- key: variant-b
name: Variant B
value: "false"
type: feature-flags
schema:
$ref: "#/components/schemas/CreateFeatureFlagRequest"
Expand Down
5 changes: 4 additions & 1 deletion examples/v2/feature-flags/CreateFeatureFlag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ const params: v2.FeatureFlagsApiCreateFeatureFlagRequest = {
type: "feature-flags",
attributes: {
defaultVariantKey: "variant-Example-Feature-Flag-1",
description: "Test feature flag for BDD scenarios",
distributionChannel: "SERVER",
key: "test-feature-flag-Example-Feature-Flag",
name: "Test Feature Flag Example-Feature-Flag",
requireApproval: false,
stalenessStatus: "PERMANENT",
tags: ["env:api-client-test"],
valueType: "BOOLEAN",
variants: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@
"data": {
"attributes": {
"default_variant_key": "variant-{{ unique }}-1",
"description": "Test feature flag for BDD scenarios",
"distribution_channel": "SERVER",
"key": "test-feature-flag-{{ unique }}",
"name": "Test Feature Flag {{ unique }}",
"require_approval": false,
"staleness_status": "PERMANENT",
"tags": [
"env:api-client-test"
],
"value_type": "BOOLEAN",
"variants": [
{
Expand Down
29 changes: 17 additions & 12 deletions features/generated-test/test-server-data/v2/feature-flags.json

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions features/v2/feature_flags.feature
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,17 @@ Feature: Feature Flags
When the request is sent
Then the response status is 409 Conflict

@team:DataDog/feature-flags
@skip-validation @team:DataDog/feature-flags
Scenario: Create a feature flag returns "Created" response
Given new "CreateFeatureFlag" request
And body with value {"data": {"type": "feature-flags", "attributes": {"default_variant_key": "variant-{{ unique }}-1", "description": "Test feature flag for BDD scenarios", "key": "test-feature-flag-{{ unique }}", "name": "Test Feature Flag {{ unique }}", "value_type": "BOOLEAN", "variants": [{"key": "variant-{{ unique }}-1", "name": "Variant {{ unique }} A", "value": "true"}, {"key": "variant-{{ unique }}-2", "name": "Variant {{ unique }} B", "value": "false"}]}}}
And body with value {"data": {"type": "feature-flags", "attributes": {"default_variant_key": "variant-{{ unique }}-1", "distribution_channel": "SERVER", "key": "test-feature-flag-{{ unique }}", "name": "Test Feature Flag {{ unique }}", "require_approval": false, "staleness_status": "PERMANENT", "tags": ["env:api-client-test"], "value_type": "BOOLEAN", "variants": [{"key": "variant-{{ unique }}-1", "name": "Variant {{ unique }} A", "value": "true"}, {"key": "variant-{{ unique }}-2", "name": "Variant {{ unique }} B", "value": "false"}]}}}
When the request is sent
Then the response status is 201 Created
And the response "data.attributes.distribution_channel" is equal to "SERVER"
And the response "data.attributes.key" is equal to "test-feature-flag-{{ unique }}"
And the response "data.attributes.name" is equal to "Test Feature Flag {{ unique }}"
And the response "data.attributes.require_approval" is equal to false
And the response "data.attributes.tags" is equal to ["env:api-client-test"]
And the response "data.attributes.value_type" is equal to "BOOLEAN"

@team:DataDog/feature-flags
Expand Down
2 changes: 2 additions & 0 deletions packages/datadog-api-client-v2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3350,6 +3350,7 @@ export { CreateFeatureFlagAttributes } from "./models/CreateFeatureFlagAttribute
export { CreateFeatureFlagData } from "./models/CreateFeatureFlagData";
export { CreateFeatureFlagDataType } from "./models/CreateFeatureFlagDataType";
export { CreateFeatureFlagRequest } from "./models/CreateFeatureFlagRequest";
export { CreateFeatureFlagStalenessStatus } from "./models/CreateFeatureFlagStalenessStatus";
export { CreateFormData } from "./models/CreateFormData";
export { CreateFormDataAttributes } from "./models/CreateFormDataAttributes";
export { CreateFormRequest } from "./models/CreateFormRequest";
Expand Down Expand Up @@ -4260,6 +4261,7 @@ export { FastlyServicesResponse } from "./models/FastlyServicesResponse";
export { FastlyServiceType } from "./models/FastlyServiceType";
export { FeatureFlag } from "./models/FeatureFlag";
export { FeatureFlagAttributes } from "./models/FeatureFlagAttributes";
export { FeatureFlagDistributionChannel } from "./models/FeatureFlagDistributionChannel";
export { FeatureFlagEnvironment } from "./models/FeatureFlagEnvironment";
export { FeatureFlagEnvironmentListItem } from "./models/FeatureFlagEnvironmentListItem";
export { FeatureFlagListItem } from "./models/FeatureFlagListItem";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
* This product includes software developed at Datadog (https://www.datadoghq.com/).
* Copyright 2020-Present Datadog, Inc.
*/
import { CreateFeatureFlagStalenessStatus } from "./CreateFeatureFlagStalenessStatus";
import { CreateVariant } from "./CreateVariant";
import { FeatureFlagDistributionChannel } from "./FeatureFlagDistributionChannel";
import { ValueType } from "./ValueType";

import { AttributeTypeMap } from "../../datadog-api-client-common/util";
Expand All @@ -19,7 +21,11 @@ export class CreateFeatureFlagAttributes {
/**
* The description of the feature flag.
*/
"description": string;
"description"?: string;
/**
* The distribution channel for the feature flag.
*/
"distributionChannel"?: FeatureFlagDistributionChannel;
/**
* JSON schema for validation when value_type is JSON.
*/
Expand All @@ -32,6 +38,18 @@ export class CreateFeatureFlagAttributes {
* The name of the feature flag.
*/
"name": string;
/**
* Indicates whether this feature flag requires approval for changes.
*/
"requireApproval"?: boolean;
/**
* The staleness status for the feature flag at creation.
*/
"stalenessStatus"?: CreateFeatureFlagStalenessStatus;
/**
* Tags associated with the feature flag.
*/
"tags"?: Array<string>;
/**
* The type of values for the feature flag variants.
*/
Expand Down Expand Up @@ -64,7 +82,10 @@ export class CreateFeatureFlagAttributes {
description: {
baseName: "description",
type: "string",
required: true,
},
distributionChannel: {
baseName: "distribution_channel",
type: "FeatureFlagDistributionChannel",
},
jsonSchema: {
baseName: "json_schema",
Expand All @@ -80,6 +101,18 @@ export class CreateFeatureFlagAttributes {
type: "string",
required: true,
},
requireApproval: {
baseName: "require_approval",
type: "boolean",
},
stalenessStatus: {
baseName: "staleness_status",
type: "CreateFeatureFlagStalenessStatus",
},
tags: {
baseName: "tags",
type: "Array<string>",
},
valueType: {
baseName: "value_type",
type: "ValueType",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
* This product includes software developed at Datadog (https://www.datadoghq.com/).
* Copyright 2020-Present Datadog, Inc.
*/

import { UnparsedObject } from "../../datadog-api-client-common/util";

/**
* The staleness status for the feature flag at creation.
*/

export type CreateFeatureFlagStalenessStatus =
| typeof ACTIVE
| typeof PERMANENT
| UnparsedObject;
export const ACTIVE = "ACTIVE";
export const PERMANENT = "PERMANENT";
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
* This product includes software developed at Datadog (https://www.datadoghq.com/).
* Copyright 2020-Present Datadog, Inc.
*/

import { UnparsedObject } from "../../datadog-api-client-common/util";

/**
* The distribution channel for the feature flag.
*/

export type FeatureFlagDistributionChannel =
| typeof ALL
| typeof CLIENT
| typeof SERVER
| UnparsedObject;
export const ALL = "ALL";
export const CLIENT = "CLIENT";
export const SERVER = "SERVER";
2 changes: 2 additions & 0 deletions packages/datadog-api-client-v2/models/ObjectSerializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6572,6 +6572,7 @@ const enumsMap: { [key: string]: any[] } = {
],
CreateEnvironmentDataType: ["environments"],
CreateFeatureFlagDataType: ["feature-flags"],
CreateFeatureFlagStalenessStatus: ["ACTIVE", "PERMANENT"],
CreateMaintenanceRequestDataAttributesUpdatesItemsStatus: [
"in_progress",
"completed",
Expand Down Expand Up @@ -6838,6 +6839,7 @@ const enumsMap: { [key: string]: any[] } = {
FastlyAccountType: ["fastly-accounts"],
FastlyIntegrationType: ["Fastly"],
FastlyServiceType: ["fastly-services"],
FeatureFlagDistributionChannel: ["ALL", "CLIENT", "SERVER"],
FeatureFlagStatus: ["ENABLED", "DISABLED"],
FindingDataType: ["findings"],
FindingEvaluation: ["pass", "fail"],
Expand Down
Loading