From 56b5334ac64a22ad7a96f4bf7176b7815287c8b5 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 17 Apr 2026 15:24:28 +0000 Subject: [PATCH] Regenerate client from commit 740eb90 of spec repo --- .generator/schemas/v2/openapi.yaml | 534 ++++++++++++++++++ docs/datadog_api_client.v2.model.rst | 105 ++++ .../v2/feature-flags/ApproveFlagSuggestion.py | 29 + .../v2/feature-flags/CreateFlagSuggestion.py | 42 ++ .../v2/feature-flags/DeleteFlagSuggestion.py | 14 + .../v2/feature-flags/GetFlagSuggestion.py | 16 + .../v2/feature-flags/RejectFlagSuggestion.py | 29 + .../v2/api/feature_flags_api.py | 227 ++++++++ .../create_flag_suggestion_attributes.py | 104 ++++ .../v2/model/create_flag_suggestion_data.py | 48 ++ .../model/create_flag_suggestion_request.py | 40 ++ .../v2/model/flag_suggestion.py | 55 ++ .../v2/model/flag_suggestion_action.py | 59 ++ .../v2/model/flag_suggestion_attributes.py | 178 ++++++ .../v2/model/flag_suggestion_data_type.py | 35 ++ .../model/flag_suggestion_event_data_type.py | 35 ++ .../v2/model/flag_suggestion_property.py | 71 +++ .../v2/model/flag_suggestion_response.py | 40 ++ .../v2/model/flag_suggestion_status.py | 41 ++ .../review_flag_suggestion_attributes.py | 36 ++ .../v2/model/review_flag_suggestion_data.py | 56 ++ .../model/review_flag_suggestion_request.py | 40 ++ .../v2/model/suggestion_metadata.py | 36 ++ src/datadog_api_client/v2/models/__init__.py | 30 + tests/v2/features/feature_flags.feature | 122 ++++ tests/v2/features/undo.json | 37 ++ 26 files changed, 2059 insertions(+) create mode 100644 examples/v2/feature-flags/ApproveFlagSuggestion.py create mode 100644 examples/v2/feature-flags/CreateFlagSuggestion.py create mode 100644 examples/v2/feature-flags/DeleteFlagSuggestion.py create mode 100644 examples/v2/feature-flags/GetFlagSuggestion.py create mode 100644 examples/v2/feature-flags/RejectFlagSuggestion.py create mode 100644 src/datadog_api_client/v2/model/create_flag_suggestion_attributes.py create mode 100644 src/datadog_api_client/v2/model/create_flag_suggestion_data.py create mode 100644 src/datadog_api_client/v2/model/create_flag_suggestion_request.py create mode 100644 src/datadog_api_client/v2/model/flag_suggestion.py create mode 100644 src/datadog_api_client/v2/model/flag_suggestion_action.py create mode 100644 src/datadog_api_client/v2/model/flag_suggestion_attributes.py create mode 100644 src/datadog_api_client/v2/model/flag_suggestion_data_type.py create mode 100644 src/datadog_api_client/v2/model/flag_suggestion_event_data_type.py create mode 100644 src/datadog_api_client/v2/model/flag_suggestion_property.py create mode 100644 src/datadog_api_client/v2/model/flag_suggestion_response.py create mode 100644 src/datadog_api_client/v2/model/flag_suggestion_status.py create mode 100644 src/datadog_api_client/v2/model/review_flag_suggestion_attributes.py create mode 100644 src/datadog_api_client/v2/model/review_flag_suggestion_data.py create mode 100644 src/datadog_api_client/v2/model/review_flag_suggestion_request.py create mode 100644 src/datadog_api_client/v2/model/suggestion_metadata.py diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index d16435a94f..0ac074923c 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1526,6 +1526,15 @@ components: example: "550e8400-e29b-41d4-a716-446655440000" format: uuid type: string + suggestion_id: + description: The ID of the flag suggestion. + in: path + name: suggestion_id + required: true + schema: + example: "550e8400-e29b-41d4-a716-446655440020" + format: uuid + type: string requestBodies: {} responses: BadRequestResponse: @@ -16318,6 +16327,62 @@ components: required: - data type: object + CreateFlagSuggestionAttributes: + description: Attributes for creating a flag suggestion. + properties: + action: + $ref: "#/components/schemas/FlagSuggestionAction" + comment: + description: Optional comment explaining the change. + example: "Archive this deprecated flag" + type: string + environment_id: + description: The environment ID for environment-scoped changes. + example: "550e8400-e29b-41d4-a716-446655440001" + format: uuid + type: string + notification_rule_targets: + description: |- + Notification handles (without @ prefix) to receive approval or rejection notifications. + For example, an email address or Slack channel name. + example: + - "user@example.com" + items: + type: string + minItems: 1 + type: array + property: + $ref: "#/components/schemas/FlagSuggestionProperty" + suggestion: + description: The suggested new value (empty string for flag-level actions like archive, JSON-encoded for complex properties like allocations). + example: "ENABLED" + type: string + suggestion_metadata: + $ref: "#/components/schemas/SuggestionMetadata" + required: + - action + - property + - notification_rule_targets + type: object + CreateFlagSuggestionData: + description: Data for creating a flag suggestion. + properties: + attributes: + $ref: "#/components/schemas/CreateFlagSuggestionAttributes" + type: + $ref: "#/components/schemas/FlagSuggestionDataType" + required: + - type + - attributes + type: object + CreateFlagSuggestionRequest: + description: Request to create a flag suggestion. + properties: + data: + $ref: "#/components/schemas/CreateFlagSuggestionData" + required: + - data + type: object CreateIncidentNotificationRuleRequest: description: Create request for a notification rule. properties: @@ -27026,6 +27091,194 @@ components: $ref: "#/components/schemas/FindingData" type: array type: object + FlagSuggestion: + description: A flag change suggestion. + properties: + attributes: + $ref: "#/components/schemas/FlagSuggestionAttributes" + id: + description: Unique identifier for the suggestion. + example: "550e8400-e29b-41d4-a716-446655440020" + format: uuid + type: string + type: + $ref: "#/components/schemas/FlagSuggestionDataType" + required: + - id + - type + - attributes + type: object + FlagSuggestionAction: + description: The type of change action for a suggestion. + enum: + - created + - updated + - deleted + - archived + - unarchived + - started + - stopped + - paused + - unpaused + example: archived + type: string + x-enum-varnames: + - CREATED + - UPDATED + - DELETED + - ARCHIVED + - UNARCHIVED + - STARTED + - STOPPED + - PAUSED + - UNPAUSED + FlagSuggestionAttributes: + description: Attributes of a flag suggestion. + properties: + action: + $ref: "#/components/schemas/FlagSuggestionAction" + base_flag_history_id: + description: The flag history version this suggestion was based on. + example: "550e8400-e29b-41d4-a716-446655440030" + format: uuid + type: string + comment: + description: Optional comment from the requester. + example: "Please archive this deprecated flag" + nullable: true + type: string + created_at: + description: When the suggestion was created. + example: "2024-01-15T10:30:00Z" + format: date-time + type: string + created_by: + description: UUID of the user who created the suggestion. + example: "550e8400-e29b-41d4-a716-446655440099" + format: uuid + type: string + current_status: + $ref: "#/components/schemas/FlagSuggestionStatus" + current_value: + description: The current value before the suggested change (empty string for flag-level actions like archive). + example: "DISABLED" + type: string + deleted_at: + description: When the suggestion was soft-deleted. + format: date-time + nullable: true + type: string + deleted_by: + description: UUID of the user who deleted the suggestion. + nullable: true + type: string + environment_id: + description: The environment ID for environment-scoped suggestions. Null for flag-level changes. + example: "550e8400-e29b-41d4-a716-446655440001" + nullable: true + type: string + feature_flag_id: + description: The ID of the feature flag this suggestion applies to. + example: "550e8400-e29b-41d4-a716-446655440000" + format: uuid + type: string + message: + description: Human-readable message about the suggestion (populated on auto-created suggestions). + example: "This flag requires approval to archive. A suggestion has been created and is pending review." + type: string + property: + $ref: "#/components/schemas/FlagSuggestionProperty" + suggestion: + description: The suggested new value (JSON-encoded for complex properties, empty string for flag-level actions like archive). + example: "ENABLED" + type: string + suggestion_metadata: + $ref: "#/components/schemas/SuggestionMetadata" + updated_at: + description: When the suggestion was last updated. + format: date-time + nullable: true + type: string + updated_by: + description: UUID of the user who last updated the suggestion. + nullable: true + type: string + required: + - feature_flag_id + - current_status + - action + - property + - created_by + - created_at + type: object + FlagSuggestionDataType: + description: Flag suggestions resource type. + enum: + - "flag-suggestions" + example: "flag-suggestions" + type: string + x-enum-varnames: + - FLAG_SUGGESTIONS + FlagSuggestionEventDataType: + description: Flag suggestion events resource type. + enum: + - "flag-suggestion-events" + example: "flag-suggestion-events" + type: string + x-enum-varnames: + - FLAG_SUGGESTION_EVENTS + FlagSuggestionProperty: + description: The flag property being changed. + enum: + - FLAG + - FLAG_NAME + - FLAG_DESCRIPTION + - JSON_SCHEMA + - DISTRIBUTION_CHANNEL + - VARIANT + - VARIANT_NAME + - VARIANT_VALUE + - ALLOCATIONS + - ROLLOUT + - ENVIRONMENT_STATUS + - DEFAULT_VARIANT + - OVERRIDE_VARIANT + example: FLAG + type: string + x-enum-varnames: + - FLAG + - FLAG_NAME + - FLAG_DESCRIPTION + - JSON_SCHEMA + - DISTRIBUTION_CHANNEL + - VARIANT + - VARIANT_NAME + - VARIANT_VALUE + - ALLOCATIONS + - ROLLOUT + - ENVIRONMENT_STATUS + - DEFAULT_VARIANT + - OVERRIDE_VARIANT + FlagSuggestionResponse: + description: Response containing a flag suggestion. + properties: + data: + $ref: "#/components/schemas/FlagSuggestion" + required: + - data + type: object + FlagSuggestionStatus: + description: The status of a flag suggestion. + enum: + - pending + - rejected + - approved + example: pending + type: string + x-enum-varnames: + - PENDING + - REJECTED + - APPROVED FlakyTest: description: A flaky test object. properties: @@ -57825,6 +58078,32 @@ components: description: Target revision ID to revert to type: string type: object + ReviewFlagSuggestionAttributes: + description: Attributes for reviewing a flag suggestion. + properties: + comment: + description: Optional comment from the reviewer. + example: "Looks good, approved!" + type: string + type: object + ReviewFlagSuggestionData: + description: Data for reviewing a flag suggestion. + properties: + attributes: + $ref: "#/components/schemas/ReviewFlagSuggestionAttributes" + type: + $ref: "#/components/schemas/FlagSuggestionEventDataType" + required: + - type + type: object + ReviewFlagSuggestionRequest: + description: Request to approve or reject a flag suggestion. + properties: + data: + $ref: "#/components/schemas/ReviewFlagSuggestionData" + required: + - data + type: object Role: description: Role object returned by the API. properties: @@ -70548,6 +70827,14 @@ components: format: double type: number type: object + SuggestionMetadata: + description: Optional metadata for a suggestion. + properties: + variant_id: + description: Variant ID for variant delete suggestions. + example: "550e8400-e29b-41d4-a716-446655440005" + type: string + type: object SuiteCreateEdit: description: Data object for creating or editing a Synthetic test suite. properties: @@ -91949,6 +92236,194 @@ paths: operator: AND permissions: - feature_flag_config_write + /api/v2/feature-flags/suggestions/{suggestion_id}: + delete: + description: |- + Delete a pending flag change suggestion. Approved suggestions cannot be deleted. + operationId: DeleteFlagSuggestion + parameters: + - $ref: "#/components/parameters/suggestion_id" + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Delete a flag suggestion + tags: + - Feature Flags + x-permission: + operator: AND + permissions: + - feature_flag_config_write + - feature_flag_environment_config_read + get: + description: |- + Get a flag change suggestion by ID. + operationId: GetFlagSuggestion + parameters: + - $ref: "#/components/parameters/suggestion_id" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/FlagSuggestionResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Get a flag suggestion + tags: + - Feature Flags + x-permission: + operator: AND + permissions: + - feature_flag_config_write + - feature_flag_environment_config_read + /api/v2/feature-flags/suggestions/{suggestion_id}/approve: + post: + description: |- + Approve a pending flag change suggestion. The change is applied immediately + upon approval. A user cannot approve their own suggestion. + operationId: ApproveFlagSuggestion + parameters: + - $ref: "#/components/parameters/suggestion_id" + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/ReviewFlagSuggestionRequest" + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/FlagSuggestionResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden - Cannot approve your own suggestion + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Approve a flag suggestion + tags: + - Feature Flags + x-permission: + operator: AND + permissions: + - feature_flag_config_write + - feature_flag_environment_config_read + /api/v2/feature-flags/suggestions/{suggestion_id}/reject: + post: + description: |- + Reject a pending flag change suggestion. The suggested change is not applied. + operationId: RejectFlagSuggestion + parameters: + - $ref: "#/components/parameters/suggestion_id" + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/ReviewFlagSuggestionRequest" + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/FlagSuggestionResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Reject a flag suggestion + tags: + - Feature Flags + x-permission: + operator: AND + permissions: + - feature_flag_config_write + - feature_flag_environment_config_read /api/v2/feature-flags/{feature_flag_id}: get: description: |- @@ -92360,6 +92835,65 @@ paths: permissions: - feature_flag_config_write - feature_flag_environment_config_read + /api/v2/feature-flags/{feature_flag_id}/suggestions: + post: + description: |- + Create a change suggestion for a feature flag. Suggestions require approval + before the change is applied. The request must include at least one + notification_rule_targets handle to receive approval or rejection notifications. + operationId: CreateFlagSuggestion + parameters: + - $ref: "#/components/parameters/feature_flag_id" + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/CreateFlagSuggestionRequest" + required: true + responses: + "201": + content: + application/json: + schema: + $ref: "#/components/schemas/FlagSuggestionResponse" + description: Created + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Conflict + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Create a flag suggestion + tags: + - Feature Flags + x-permission: + operator: AND + permissions: + - feature_flag_config_write + - feature_flag_environment_config_read /api/v2/feature-flags/{feature_flag_id}/unarchive: post: description: |- diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 56fae95ae9..a41f844384 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -6563,6 +6563,27 @@ datadog\_api\_client.v2.model.create\_feature\_flag\_request module :members: :show-inheritance: +datadog\_api\_client.v2.model.create\_flag\_suggestion\_attributes module +------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.create_flag_suggestion_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.create\_flag\_suggestion\_data module +------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.create_flag_suggestion_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.create\_flag\_suggestion\_request module +---------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.create_flag_suggestion_request + :members: + :show-inheritance: + datadog\_api\_client.v2.model.create\_incident\_notification\_rule\_request module ---------------------------------------------------------------------------------- @@ -11295,6 +11316,62 @@ datadog\_api\_client.v2.model.findings module :members: :show-inheritance: +datadog\_api\_client.v2.model.flag\_suggestion module +----------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.flag_suggestion + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.flag\_suggestion\_action module +------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.flag_suggestion_action + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.flag\_suggestion\_attributes module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.flag_suggestion_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.flag\_suggestion\_data\_type module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.flag_suggestion_data_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.flag\_suggestion\_event\_data\_type module +------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.flag_suggestion_event_data_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.flag\_suggestion\_property module +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.flag_suggestion_property + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.flag\_suggestion\_response module +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.flag_suggestion_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.flag\_suggestion\_status module +------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.flag_suggestion_status + :members: + :show-inheritance: + datadog\_api\_client.v2.model.flaky\_test module ------------------------------------------------ @@ -25449,6 +25526,27 @@ datadog\_api\_client.v2.model.revert\_custom\_rule\_revision\_request\_data\_att :members: :show-inheritance: +datadog\_api\_client.v2.model.review\_flag\_suggestion\_attributes module +------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.review_flag_suggestion_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.review\_flag\_suggestion\_data module +------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.review_flag_suggestion_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.review\_flag\_suggestion\_request module +---------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.review_flag_suggestion_request + :members: + :show-inheritance: + datadog\_api\_client.v2.model.role module ----------------------------------------- @@ -31462,6 +31560,13 @@ datadog\_api\_client.v2.model.step\_display\_bounds module :members: :show-inheritance: +datadog\_api\_client.v2.model.suggestion\_metadata module +--------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.suggestion_metadata + :members: + :show-inheritance: + datadog\_api\_client.v2.model.suite\_create\_edit module -------------------------------------------------------- diff --git a/examples/v2/feature-flags/ApproveFlagSuggestion.py b/examples/v2/feature-flags/ApproveFlagSuggestion.py new file mode 100644 index 0000000000..940e9802d0 --- /dev/null +++ b/examples/v2/feature-flags/ApproveFlagSuggestion.py @@ -0,0 +1,29 @@ +""" +Approve a flag suggestion returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.feature_flags_api import FeatureFlagsApi +from datadog_api_client.v2.model.flag_suggestion_event_data_type import FlagSuggestionEventDataType +from datadog_api_client.v2.model.review_flag_suggestion_attributes import ReviewFlagSuggestionAttributes +from datadog_api_client.v2.model.review_flag_suggestion_data import ReviewFlagSuggestionData +from datadog_api_client.v2.model.review_flag_suggestion_request import ReviewFlagSuggestionRequest +from uuid import UUID + +body = ReviewFlagSuggestionRequest( + data=ReviewFlagSuggestionData( + attributes=ReviewFlagSuggestionAttributes( + comment="Looks good, approved!", + ), + type=FlagSuggestionEventDataType.FLAG_SUGGESTION_EVENTS, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = FeatureFlagsApi(api_client) + response = api_instance.approve_flag_suggestion( + suggestion_id=UUID("550e8400-e29b-41d4-a716-446655440020"), body=body + ) + + print(response) diff --git a/examples/v2/feature-flags/CreateFlagSuggestion.py b/examples/v2/feature-flags/CreateFlagSuggestion.py new file mode 100644 index 0000000000..f11abd5443 --- /dev/null +++ b/examples/v2/feature-flags/CreateFlagSuggestion.py @@ -0,0 +1,42 @@ +""" +Create a flag suggestion returns "Created" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.feature_flags_api import FeatureFlagsApi +from datadog_api_client.v2.model.create_flag_suggestion_attributes import CreateFlagSuggestionAttributes +from datadog_api_client.v2.model.create_flag_suggestion_data import CreateFlagSuggestionData +from datadog_api_client.v2.model.create_flag_suggestion_request import CreateFlagSuggestionRequest +from datadog_api_client.v2.model.flag_suggestion_action import FlagSuggestionAction +from datadog_api_client.v2.model.flag_suggestion_data_type import FlagSuggestionDataType +from datadog_api_client.v2.model.flag_suggestion_property import FlagSuggestionProperty +from datadog_api_client.v2.model.suggestion_metadata import SuggestionMetadata +from uuid import UUID + +body = CreateFlagSuggestionRequest( + data=CreateFlagSuggestionData( + attributes=CreateFlagSuggestionAttributes( + action=FlagSuggestionAction.ARCHIVED, + comment="Archive this deprecated flag", + environment_id=UUID("550e8400-e29b-41d4-a716-446655440001"), + notification_rule_targets=[ + "user@example.com", + ], + _property=FlagSuggestionProperty.FLAG, + suggestion="ENABLED", + suggestion_metadata=SuggestionMetadata( + variant_id="550e8400-e29b-41d4-a716-446655440005", + ), + ), + type=FlagSuggestionDataType.FLAG_SUGGESTIONS, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = FeatureFlagsApi(api_client) + response = api_instance.create_flag_suggestion( + feature_flag_id=UUID("550e8400-e29b-41d4-a716-446655440000"), body=body + ) + + print(response) diff --git a/examples/v2/feature-flags/DeleteFlagSuggestion.py b/examples/v2/feature-flags/DeleteFlagSuggestion.py new file mode 100644 index 0000000000..221943ba21 --- /dev/null +++ b/examples/v2/feature-flags/DeleteFlagSuggestion.py @@ -0,0 +1,14 @@ +""" +Delete a flag suggestion returns "No Content" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.feature_flags_api import FeatureFlagsApi +from uuid import UUID + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = FeatureFlagsApi(api_client) + api_instance.delete_flag_suggestion( + suggestion_id=UUID("550e8400-e29b-41d4-a716-446655440020"), + ) diff --git a/examples/v2/feature-flags/GetFlagSuggestion.py b/examples/v2/feature-flags/GetFlagSuggestion.py new file mode 100644 index 0000000000..e3916ec883 --- /dev/null +++ b/examples/v2/feature-flags/GetFlagSuggestion.py @@ -0,0 +1,16 @@ +""" +Get a flag suggestion returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.feature_flags_api import FeatureFlagsApi +from uuid import UUID + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = FeatureFlagsApi(api_client) + response = api_instance.get_flag_suggestion( + suggestion_id=UUID("550e8400-e29b-41d4-a716-446655440020"), + ) + + print(response) diff --git a/examples/v2/feature-flags/RejectFlagSuggestion.py b/examples/v2/feature-flags/RejectFlagSuggestion.py new file mode 100644 index 0000000000..4d1328d93d --- /dev/null +++ b/examples/v2/feature-flags/RejectFlagSuggestion.py @@ -0,0 +1,29 @@ +""" +Reject a flag suggestion returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.feature_flags_api import FeatureFlagsApi +from datadog_api_client.v2.model.flag_suggestion_event_data_type import FlagSuggestionEventDataType +from datadog_api_client.v2.model.review_flag_suggestion_attributes import ReviewFlagSuggestionAttributes +from datadog_api_client.v2.model.review_flag_suggestion_data import ReviewFlagSuggestionData +from datadog_api_client.v2.model.review_flag_suggestion_request import ReviewFlagSuggestionRequest +from uuid import UUID + +body = ReviewFlagSuggestionRequest( + data=ReviewFlagSuggestionData( + attributes=ReviewFlagSuggestionAttributes( + comment="Looks good, approved!", + ), + type=FlagSuggestionEventDataType.FLAG_SUGGESTION_EVENTS, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = FeatureFlagsApi(api_client) + response = api_instance.reject_flag_suggestion( + suggestion_id=UUID("550e8400-e29b-41d4-a716-446655440020"), body=body + ) + + print(response) diff --git a/src/datadog_api_client/v2/api/feature_flags_api.py b/src/datadog_api_client/v2/api/feature_flags_api.py index a51a2811e3..9636e0ec55 100644 --- a/src/datadog_api_client/v2/api/feature_flags_api.py +++ b/src/datadog_api_client/v2/api/feature_flags_api.py @@ -20,11 +20,14 @@ from datadog_api_client.v2.model.create_environment_request import CreateEnvironmentRequest from datadog_api_client.v2.model.update_environment_request import UpdateEnvironmentRequest from datadog_api_client.v2.model.allocation_exposure_schedule_response import AllocationExposureScheduleResponse +from datadog_api_client.v2.model.flag_suggestion_response import FlagSuggestionResponse +from datadog_api_client.v2.model.review_flag_suggestion_request import ReviewFlagSuggestionRequest from datadog_api_client.v2.model.update_feature_flag_request import UpdateFeatureFlagRequest from datadog_api_client.v2.model.allocation_response import AllocationResponse from datadog_api_client.v2.model.create_allocations_request import CreateAllocationsRequest from datadog_api_client.v2.model.list_allocations_response import ListAllocationsResponse from datadog_api_client.v2.model.overwrite_allocations_request import OverwriteAllocationsRequest +from datadog_api_client.v2.model.create_flag_suggestion_request import CreateFlagSuggestionRequest class FeatureFlagsApi: @@ -37,6 +40,32 @@ def __init__(self, api_client=None): api_client = ApiClient(Configuration()) self.api_client = api_client + self._approve_flag_suggestion_endpoint = _Endpoint( + settings={ + "response_type": (FlagSuggestionResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/feature-flags/suggestions/{suggestion_id}/approve", + "operation_id": "approve_flag_suggestion", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "suggestion_id": { + "required": True, + "openapi_types": (UUID,), + "attribute": "suggestion_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (ReviewFlagSuggestionRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._archive_feature_flag_endpoint = _Endpoint( settings={ "response_type": (FeatureFlagResponse,), @@ -132,6 +161,32 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._create_flag_suggestion_endpoint = _Endpoint( + settings={ + "response_type": (FlagSuggestionResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/feature-flags/{feature_flag_id}/suggestions", + "operation_id": "create_flag_suggestion", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "feature_flag_id": { + "required": True, + "openapi_types": (UUID,), + "attribute": "feature_flag_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (CreateFlagSuggestionRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._delete_feature_flags_environment_endpoint = _Endpoint( settings={ "response_type": None, @@ -155,6 +210,29 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._delete_flag_suggestion_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/feature-flags/suggestions/{suggestion_id}", + "operation_id": "delete_flag_suggestion", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "suggestion_id": { + "required": True, + "openapi_types": (UUID,), + "attribute": "suggestion_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + self._disable_feature_flag_environment_endpoint = _Endpoint( settings={ "response_type": None, @@ -259,6 +337,29 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._get_flag_suggestion_endpoint = _Endpoint( + settings={ + "response_type": (FlagSuggestionResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/feature-flags/suggestions/{suggestion_id}", + "operation_id": "get_flag_suggestion", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "suggestion_id": { + "required": True, + "openapi_types": (UUID,), + "attribute": "suggestion_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._list_feature_flags_endpoint = _Endpoint( settings={ "response_type": (ListFeatureFlagsResponse,), @@ -370,6 +471,32 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._reject_flag_suggestion_endpoint = _Endpoint( + settings={ + "response_type": (FlagSuggestionResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/feature-flags/suggestions/{suggestion_id}/reject", + "operation_id": "reject_flag_suggestion", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "suggestion_id": { + "required": True, + "openapi_types": (UUID,), + "attribute": "suggestion_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (ReviewFlagSuggestionRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._resume_exposure_schedule_endpoint = _Endpoint( settings={ "response_type": (AllocationExposureScheduleResponse,), @@ -546,6 +673,28 @@ def __init__(self, api_client=None): api_client=api_client, ) + def approve_flag_suggestion( + self, + suggestion_id: UUID, + body: ReviewFlagSuggestionRequest, + ) -> FlagSuggestionResponse: + """Approve a flag suggestion. + + Approve a pending flag change suggestion. The change is applied immediately + upon approval. A user cannot approve their own suggestion. + + :param suggestion_id: The ID of the flag suggestion. + :type suggestion_id: UUID + :type body: ReviewFlagSuggestionRequest + :rtype: FlagSuggestionResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["suggestion_id"] = suggestion_id + + kwargs["body"] = body + + return self._approve_flag_suggestion_endpoint.call_with_http_info(**kwargs) + def archive_feature_flag( self, feature_flag_id: UUID, @@ -622,6 +771,29 @@ def create_feature_flags_environment( return self._create_feature_flags_environment_endpoint.call_with_http_info(**kwargs) + def create_flag_suggestion( + self, + feature_flag_id: UUID, + body: CreateFlagSuggestionRequest, + ) -> FlagSuggestionResponse: + """Create a flag suggestion. + + Create a change suggestion for a feature flag. Suggestions require approval + before the change is applied. The request must include at least one + notification_rule_targets handle to receive approval or rejection notifications. + + :param feature_flag_id: The ID of the feature flag. + :type feature_flag_id: UUID + :type body: CreateFlagSuggestionRequest + :rtype: FlagSuggestionResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["feature_flag_id"] = feature_flag_id + + kwargs["body"] = body + + return self._create_flag_suggestion_endpoint.call_with_http_info(**kwargs) + def delete_feature_flags_environment( self, environment_id: UUID, @@ -639,6 +811,23 @@ def delete_feature_flags_environment( return self._delete_feature_flags_environment_endpoint.call_with_http_info(**kwargs) + def delete_flag_suggestion( + self, + suggestion_id: UUID, + ) -> None: + """Delete a flag suggestion. + + Delete a pending flag change suggestion. Approved suggestions cannot be deleted. + + :param suggestion_id: The ID of the flag suggestion. + :type suggestion_id: UUID + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["suggestion_id"] = suggestion_id + + return self._delete_flag_suggestion_endpoint.call_with_http_info(**kwargs) + def disable_feature_flag_environment( self, feature_flag_id: UUID, @@ -718,6 +907,23 @@ def get_feature_flags_environment( return self._get_feature_flags_environment_endpoint.call_with_http_info(**kwargs) + def get_flag_suggestion( + self, + suggestion_id: UUID, + ) -> FlagSuggestionResponse: + """Get a flag suggestion. + + Get a flag change suggestion by ID. + + :param suggestion_id: The ID of the flag suggestion. + :type suggestion_id: UUID + :rtype: FlagSuggestionResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["suggestion_id"] = suggestion_id + + return self._get_flag_suggestion_endpoint.call_with_http_info(**kwargs) + def list_feature_flags( self, *, @@ -811,6 +1017,27 @@ def pause_exposure_schedule( return self._pause_exposure_schedule_endpoint.call_with_http_info(**kwargs) + def reject_flag_suggestion( + self, + suggestion_id: UUID, + body: ReviewFlagSuggestionRequest, + ) -> FlagSuggestionResponse: + """Reject a flag suggestion. + + Reject a pending flag change suggestion. The suggested change is not applied. + + :param suggestion_id: The ID of the flag suggestion. + :type suggestion_id: UUID + :type body: ReviewFlagSuggestionRequest + :rtype: FlagSuggestionResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["suggestion_id"] = suggestion_id + + kwargs["body"] = body + + return self._reject_flag_suggestion_endpoint.call_with_http_info(**kwargs) + def resume_exposure_schedule( self, exposure_schedule_id: UUID, diff --git a/src/datadog_api_client/v2/model/create_flag_suggestion_attributes.py b/src/datadog_api_client/v2/model/create_flag_suggestion_attributes.py new file mode 100644 index 0000000000..324409cf2c --- /dev/null +++ b/src/datadog_api_client/v2/model/create_flag_suggestion_attributes.py @@ -0,0 +1,104 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.flag_suggestion_action import FlagSuggestionAction + from datadog_api_client.v2.model.flag_suggestion_property import FlagSuggestionProperty + from datadog_api_client.v2.model.suggestion_metadata import SuggestionMetadata + + +class CreateFlagSuggestionAttributes(ModelNormal): + validations = { + "notification_rule_targets": { + "min_items": 1, + }, + } + + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.flag_suggestion_action import FlagSuggestionAction + from datadog_api_client.v2.model.flag_suggestion_property import FlagSuggestionProperty + from datadog_api_client.v2.model.suggestion_metadata import SuggestionMetadata + + return { + "action": (FlagSuggestionAction,), + "comment": (str,), + "environment_id": (UUID,), + "notification_rule_targets": ([str],), + "_property": (FlagSuggestionProperty,), + "suggestion": (str,), + "suggestion_metadata": (SuggestionMetadata,), + } + + attribute_map = { + "action": "action", + "comment": "comment", + "environment_id": "environment_id", + "notification_rule_targets": "notification_rule_targets", + "_property": "property", + "suggestion": "suggestion", + "suggestion_metadata": "suggestion_metadata", + } + + def __init__( + self_, + action: FlagSuggestionAction, + notification_rule_targets: List[str], + _property: FlagSuggestionProperty, + comment: Union[str, UnsetType] = unset, + environment_id: Union[UUID, UnsetType] = unset, + suggestion: Union[str, UnsetType] = unset, + suggestion_metadata: Union[SuggestionMetadata, UnsetType] = unset, + **kwargs, + ): + """ + Attributes for creating a flag suggestion. + + :param action: The type of change action for a suggestion. + :type action: FlagSuggestionAction + + :param comment: Optional comment explaining the change. + :type comment: str, optional + + :param environment_id: The environment ID for environment-scoped changes. + :type environment_id: UUID, optional + + :param notification_rule_targets: Notification handles (without @ prefix) to receive approval or rejection notifications. + For example, an email address or Slack channel name. + :type notification_rule_targets: [str] + + :param _property: The flag property being changed. + :type _property: FlagSuggestionProperty + + :param suggestion: The suggested new value (empty string for flag-level actions like archive, JSON-encoded for complex properties like allocations). + :type suggestion: str, optional + + :param suggestion_metadata: Optional metadata for a suggestion. + :type suggestion_metadata: SuggestionMetadata, optional + """ + if comment is not unset: + kwargs["comment"] = comment + if environment_id is not unset: + kwargs["environment_id"] = environment_id + if suggestion is not unset: + kwargs["suggestion"] = suggestion + if suggestion_metadata is not unset: + kwargs["suggestion_metadata"] = suggestion_metadata + super().__init__(kwargs) + + self_.action = action + self_.notification_rule_targets = notification_rule_targets + self_._property = _property diff --git a/src/datadog_api_client/v2/model/create_flag_suggestion_data.py b/src/datadog_api_client/v2/model/create_flag_suggestion_data.py new file mode 100644 index 0000000000..268de96eb1 --- /dev/null +++ b/src/datadog_api_client/v2/model/create_flag_suggestion_data.py @@ -0,0 +1,48 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.create_flag_suggestion_attributes import CreateFlagSuggestionAttributes + from datadog_api_client.v2.model.flag_suggestion_data_type import FlagSuggestionDataType + + +class CreateFlagSuggestionData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.create_flag_suggestion_attributes import CreateFlagSuggestionAttributes + from datadog_api_client.v2.model.flag_suggestion_data_type import FlagSuggestionDataType + + return { + "attributes": (CreateFlagSuggestionAttributes,), + "type": (FlagSuggestionDataType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: CreateFlagSuggestionAttributes, type: FlagSuggestionDataType, **kwargs): + """ + Data for creating a flag suggestion. + + :param attributes: Attributes for creating a flag suggestion. + :type attributes: CreateFlagSuggestionAttributes + + :param type: Flag suggestions resource type. + :type type: FlagSuggestionDataType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/create_flag_suggestion_request.py b/src/datadog_api_client/v2/model/create_flag_suggestion_request.py new file mode 100644 index 0000000000..5303c32e09 --- /dev/null +++ b/src/datadog_api_client/v2/model/create_flag_suggestion_request.py @@ -0,0 +1,40 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.create_flag_suggestion_data import CreateFlagSuggestionData + + +class CreateFlagSuggestionRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.create_flag_suggestion_data import CreateFlagSuggestionData + + return { + "data": (CreateFlagSuggestionData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: CreateFlagSuggestionData, **kwargs): + """ + Request to create a flag suggestion. + + :param data: Data for creating a flag suggestion. + :type data: CreateFlagSuggestionData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/flag_suggestion.py b/src/datadog_api_client/v2/model/flag_suggestion.py new file mode 100644 index 0000000000..d807b363f8 --- /dev/null +++ b/src/datadog_api_client/v2/model/flag_suggestion.py @@ -0,0 +1,55 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.flag_suggestion_attributes import FlagSuggestionAttributes + from datadog_api_client.v2.model.flag_suggestion_data_type import FlagSuggestionDataType + + +class FlagSuggestion(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.flag_suggestion_attributes import FlagSuggestionAttributes + from datadog_api_client.v2.model.flag_suggestion_data_type import FlagSuggestionDataType + + return { + "attributes": (FlagSuggestionAttributes,), + "id": (UUID,), + "type": (FlagSuggestionDataType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__(self_, attributes: FlagSuggestionAttributes, id: UUID, type: FlagSuggestionDataType, **kwargs): + """ + A flag change suggestion. + + :param attributes: Attributes of a flag suggestion. + :type attributes: FlagSuggestionAttributes + + :param id: Unique identifier for the suggestion. + :type id: UUID + + :param type: Flag suggestions resource type. + :type type: FlagSuggestionDataType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/flag_suggestion_action.py b/src/datadog_api_client/v2/model/flag_suggestion_action.py new file mode 100644 index 0000000000..e064d9b271 --- /dev/null +++ b/src/datadog_api_client/v2/model/flag_suggestion_action.py @@ -0,0 +1,59 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class FlagSuggestionAction(ModelSimple): + """ + The type of change action for a suggestion. + + :param value: Must be one of ["created", "updated", "deleted", "archived", "unarchived", "started", "stopped", "paused", "unpaused"]. + :type value: str + """ + + allowed_values = { + "created", + "updated", + "deleted", + "archived", + "unarchived", + "started", + "stopped", + "paused", + "unpaused", + } + CREATED: ClassVar["FlagSuggestionAction"] + UPDATED: ClassVar["FlagSuggestionAction"] + DELETED: ClassVar["FlagSuggestionAction"] + ARCHIVED: ClassVar["FlagSuggestionAction"] + UNARCHIVED: ClassVar["FlagSuggestionAction"] + STARTED: ClassVar["FlagSuggestionAction"] + STOPPED: ClassVar["FlagSuggestionAction"] + PAUSED: ClassVar["FlagSuggestionAction"] + UNPAUSED: ClassVar["FlagSuggestionAction"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +FlagSuggestionAction.CREATED = FlagSuggestionAction("created") +FlagSuggestionAction.UPDATED = FlagSuggestionAction("updated") +FlagSuggestionAction.DELETED = FlagSuggestionAction("deleted") +FlagSuggestionAction.ARCHIVED = FlagSuggestionAction("archived") +FlagSuggestionAction.UNARCHIVED = FlagSuggestionAction("unarchived") +FlagSuggestionAction.STARTED = FlagSuggestionAction("started") +FlagSuggestionAction.STOPPED = FlagSuggestionAction("stopped") +FlagSuggestionAction.PAUSED = FlagSuggestionAction("paused") +FlagSuggestionAction.UNPAUSED = FlagSuggestionAction("unpaused") diff --git a/src/datadog_api_client/v2/model/flag_suggestion_attributes.py b/src/datadog_api_client/v2/model/flag_suggestion_attributes.py new file mode 100644 index 0000000000..f0f4c3c8a2 --- /dev/null +++ b/src/datadog_api_client/v2/model/flag_suggestion_attributes.py @@ -0,0 +1,178 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + none_type, + unset, + UnsetType, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.flag_suggestion_action import FlagSuggestionAction + from datadog_api_client.v2.model.flag_suggestion_status import FlagSuggestionStatus + from datadog_api_client.v2.model.flag_suggestion_property import FlagSuggestionProperty + from datadog_api_client.v2.model.suggestion_metadata import SuggestionMetadata + + +class FlagSuggestionAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.flag_suggestion_action import FlagSuggestionAction + from datadog_api_client.v2.model.flag_suggestion_status import FlagSuggestionStatus + from datadog_api_client.v2.model.flag_suggestion_property import FlagSuggestionProperty + from datadog_api_client.v2.model.suggestion_metadata import SuggestionMetadata + + return { + "action": (FlagSuggestionAction,), + "base_flag_history_id": (UUID,), + "comment": (str, none_type), + "created_at": (datetime,), + "created_by": (UUID,), + "current_status": (FlagSuggestionStatus,), + "current_value": (str,), + "deleted_at": (datetime, none_type), + "deleted_by": (str, none_type), + "environment_id": (str, none_type), + "feature_flag_id": (UUID,), + "message": (str,), + "_property": (FlagSuggestionProperty,), + "suggestion": (str,), + "suggestion_metadata": (SuggestionMetadata,), + "updated_at": (datetime, none_type), + "updated_by": (str, none_type), + } + + attribute_map = { + "action": "action", + "base_flag_history_id": "base_flag_history_id", + "comment": "comment", + "created_at": "created_at", + "created_by": "created_by", + "current_status": "current_status", + "current_value": "current_value", + "deleted_at": "deleted_at", + "deleted_by": "deleted_by", + "environment_id": "environment_id", + "feature_flag_id": "feature_flag_id", + "message": "message", + "_property": "property", + "suggestion": "suggestion", + "suggestion_metadata": "suggestion_metadata", + "updated_at": "updated_at", + "updated_by": "updated_by", + } + + def __init__( + self_, + action: FlagSuggestionAction, + created_at: datetime, + created_by: UUID, + current_status: FlagSuggestionStatus, + feature_flag_id: UUID, + _property: FlagSuggestionProperty, + base_flag_history_id: Union[UUID, UnsetType] = unset, + comment: Union[str, none_type, UnsetType] = unset, + current_value: Union[str, UnsetType] = unset, + deleted_at: Union[datetime, none_type, UnsetType] = unset, + deleted_by: Union[str, none_type, UnsetType] = unset, + environment_id: Union[str, none_type, UnsetType] = unset, + message: Union[str, UnsetType] = unset, + suggestion: Union[str, UnsetType] = unset, + suggestion_metadata: Union[SuggestionMetadata, UnsetType] = unset, + updated_at: Union[datetime, none_type, UnsetType] = unset, + updated_by: Union[str, none_type, UnsetType] = unset, + **kwargs, + ): + """ + Attributes of a flag suggestion. + + :param action: The type of change action for a suggestion. + :type action: FlagSuggestionAction + + :param base_flag_history_id: The flag history version this suggestion was based on. + :type base_flag_history_id: UUID, optional + + :param comment: Optional comment from the requester. + :type comment: str, none_type, optional + + :param created_at: When the suggestion was created. + :type created_at: datetime + + :param created_by: UUID of the user who created the suggestion. + :type created_by: UUID + + :param current_status: The status of a flag suggestion. + :type current_status: FlagSuggestionStatus + + :param current_value: The current value before the suggested change (empty string for flag-level actions like archive). + :type current_value: str, optional + + :param deleted_at: When the suggestion was soft-deleted. + :type deleted_at: datetime, none_type, optional + + :param deleted_by: UUID of the user who deleted the suggestion. + :type deleted_by: str, none_type, optional + + :param environment_id: The environment ID for environment-scoped suggestions. Null for flag-level changes. + :type environment_id: str, none_type, optional + + :param feature_flag_id: The ID of the feature flag this suggestion applies to. + :type feature_flag_id: UUID + + :param message: Human-readable message about the suggestion (populated on auto-created suggestions). + :type message: str, optional + + :param _property: The flag property being changed. + :type _property: FlagSuggestionProperty + + :param suggestion: The suggested new value (JSON-encoded for complex properties, empty string for flag-level actions like archive). + :type suggestion: str, optional + + :param suggestion_metadata: Optional metadata for a suggestion. + :type suggestion_metadata: SuggestionMetadata, optional + + :param updated_at: When the suggestion was last updated. + :type updated_at: datetime, none_type, optional + + :param updated_by: UUID of the user who last updated the suggestion. + :type updated_by: str, none_type, optional + """ + if base_flag_history_id is not unset: + kwargs["base_flag_history_id"] = base_flag_history_id + if comment is not unset: + kwargs["comment"] = comment + if current_value is not unset: + kwargs["current_value"] = current_value + if deleted_at is not unset: + kwargs["deleted_at"] = deleted_at + if deleted_by is not unset: + kwargs["deleted_by"] = deleted_by + if environment_id is not unset: + kwargs["environment_id"] = environment_id + if message is not unset: + kwargs["message"] = message + if suggestion is not unset: + kwargs["suggestion"] = suggestion + if suggestion_metadata is not unset: + kwargs["suggestion_metadata"] = suggestion_metadata + if updated_at is not unset: + kwargs["updated_at"] = updated_at + if updated_by is not unset: + kwargs["updated_by"] = updated_by + super().__init__(kwargs) + + self_.action = action + self_.created_at = created_at + self_.created_by = created_by + self_.current_status = current_status + self_.feature_flag_id = feature_flag_id + self_._property = _property diff --git a/src/datadog_api_client/v2/model/flag_suggestion_data_type.py b/src/datadog_api_client/v2/model/flag_suggestion_data_type.py new file mode 100644 index 0000000000..c4fb4e527e --- /dev/null +++ b/src/datadog_api_client/v2/model/flag_suggestion_data_type.py @@ -0,0 +1,35 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class FlagSuggestionDataType(ModelSimple): + """ + Flag suggestions resource type. + + :param value: If omitted defaults to "flag-suggestions". Must be one of ["flag-suggestions"]. + :type value: str + """ + + allowed_values = { + "flag-suggestions", + } + FLAG_SUGGESTIONS: ClassVar["FlagSuggestionDataType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +FlagSuggestionDataType.FLAG_SUGGESTIONS = FlagSuggestionDataType("flag-suggestions") diff --git a/src/datadog_api_client/v2/model/flag_suggestion_event_data_type.py b/src/datadog_api_client/v2/model/flag_suggestion_event_data_type.py new file mode 100644 index 0000000000..253f236ca3 --- /dev/null +++ b/src/datadog_api_client/v2/model/flag_suggestion_event_data_type.py @@ -0,0 +1,35 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class FlagSuggestionEventDataType(ModelSimple): + """ + Flag suggestion events resource type. + + :param value: If omitted defaults to "flag-suggestion-events". Must be one of ["flag-suggestion-events"]. + :type value: str + """ + + allowed_values = { + "flag-suggestion-events", + } + FLAG_SUGGESTION_EVENTS: ClassVar["FlagSuggestionEventDataType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +FlagSuggestionEventDataType.FLAG_SUGGESTION_EVENTS = FlagSuggestionEventDataType("flag-suggestion-events") diff --git a/src/datadog_api_client/v2/model/flag_suggestion_property.py b/src/datadog_api_client/v2/model/flag_suggestion_property.py new file mode 100644 index 0000000000..0792d5947c --- /dev/null +++ b/src/datadog_api_client/v2/model/flag_suggestion_property.py @@ -0,0 +1,71 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class FlagSuggestionProperty(ModelSimple): + """ + The flag property being changed. + + :param value: Must be one of ["FLAG", "FLAG_NAME", "FLAG_DESCRIPTION", "JSON_SCHEMA", "DISTRIBUTION_CHANNEL", "VARIANT", "VARIANT_NAME", "VARIANT_VALUE", "ALLOCATIONS", "ROLLOUT", "ENVIRONMENT_STATUS", "DEFAULT_VARIANT", "OVERRIDE_VARIANT"]. + :type value: str + """ + + allowed_values = { + "FLAG", + "FLAG_NAME", + "FLAG_DESCRIPTION", + "JSON_SCHEMA", + "DISTRIBUTION_CHANNEL", + "VARIANT", + "VARIANT_NAME", + "VARIANT_VALUE", + "ALLOCATIONS", + "ROLLOUT", + "ENVIRONMENT_STATUS", + "DEFAULT_VARIANT", + "OVERRIDE_VARIANT", + } + FLAG: ClassVar["FlagSuggestionProperty"] + FLAG_NAME: ClassVar["FlagSuggestionProperty"] + FLAG_DESCRIPTION: ClassVar["FlagSuggestionProperty"] + JSON_SCHEMA: ClassVar["FlagSuggestionProperty"] + DISTRIBUTION_CHANNEL: ClassVar["FlagSuggestionProperty"] + VARIANT: ClassVar["FlagSuggestionProperty"] + VARIANT_NAME: ClassVar["FlagSuggestionProperty"] + VARIANT_VALUE: ClassVar["FlagSuggestionProperty"] + ALLOCATIONS: ClassVar["FlagSuggestionProperty"] + ROLLOUT: ClassVar["FlagSuggestionProperty"] + ENVIRONMENT_STATUS: ClassVar["FlagSuggestionProperty"] + DEFAULT_VARIANT: ClassVar["FlagSuggestionProperty"] + OVERRIDE_VARIANT: ClassVar["FlagSuggestionProperty"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +FlagSuggestionProperty.FLAG = FlagSuggestionProperty("FLAG") +FlagSuggestionProperty.FLAG_NAME = FlagSuggestionProperty("FLAG_NAME") +FlagSuggestionProperty.FLAG_DESCRIPTION = FlagSuggestionProperty("FLAG_DESCRIPTION") +FlagSuggestionProperty.JSON_SCHEMA = FlagSuggestionProperty("JSON_SCHEMA") +FlagSuggestionProperty.DISTRIBUTION_CHANNEL = FlagSuggestionProperty("DISTRIBUTION_CHANNEL") +FlagSuggestionProperty.VARIANT = FlagSuggestionProperty("VARIANT") +FlagSuggestionProperty.VARIANT_NAME = FlagSuggestionProperty("VARIANT_NAME") +FlagSuggestionProperty.VARIANT_VALUE = FlagSuggestionProperty("VARIANT_VALUE") +FlagSuggestionProperty.ALLOCATIONS = FlagSuggestionProperty("ALLOCATIONS") +FlagSuggestionProperty.ROLLOUT = FlagSuggestionProperty("ROLLOUT") +FlagSuggestionProperty.ENVIRONMENT_STATUS = FlagSuggestionProperty("ENVIRONMENT_STATUS") +FlagSuggestionProperty.DEFAULT_VARIANT = FlagSuggestionProperty("DEFAULT_VARIANT") +FlagSuggestionProperty.OVERRIDE_VARIANT = FlagSuggestionProperty("OVERRIDE_VARIANT") diff --git a/src/datadog_api_client/v2/model/flag_suggestion_response.py b/src/datadog_api_client/v2/model/flag_suggestion_response.py new file mode 100644 index 0000000000..c18050e490 --- /dev/null +++ b/src/datadog_api_client/v2/model/flag_suggestion_response.py @@ -0,0 +1,40 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.flag_suggestion import FlagSuggestion + + +class FlagSuggestionResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.flag_suggestion import FlagSuggestion + + return { + "data": (FlagSuggestion,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: FlagSuggestion, **kwargs): + """ + Response containing a flag suggestion. + + :param data: A flag change suggestion. + :type data: FlagSuggestion + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/flag_suggestion_status.py b/src/datadog_api_client/v2/model/flag_suggestion_status.py new file mode 100644 index 0000000000..1b9590bb51 --- /dev/null +++ b/src/datadog_api_client/v2/model/flag_suggestion_status.py @@ -0,0 +1,41 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class FlagSuggestionStatus(ModelSimple): + """ + The status of a flag suggestion. + + :param value: Must be one of ["pending", "rejected", "approved"]. + :type value: str + """ + + allowed_values = { + "pending", + "rejected", + "approved", + } + PENDING: ClassVar["FlagSuggestionStatus"] + REJECTED: ClassVar["FlagSuggestionStatus"] + APPROVED: ClassVar["FlagSuggestionStatus"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +FlagSuggestionStatus.PENDING = FlagSuggestionStatus("pending") +FlagSuggestionStatus.REJECTED = FlagSuggestionStatus("rejected") +FlagSuggestionStatus.APPROVED = FlagSuggestionStatus("approved") diff --git a/src/datadog_api_client/v2/model/review_flag_suggestion_attributes.py b/src/datadog_api_client/v2/model/review_flag_suggestion_attributes.py new file mode 100644 index 0000000000..6a9266489d --- /dev/null +++ b/src/datadog_api_client/v2/model/review_flag_suggestion_attributes.py @@ -0,0 +1,36 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class ReviewFlagSuggestionAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "comment": (str,), + } + + attribute_map = { + "comment": "comment", + } + + def __init__(self_, comment: Union[str, UnsetType] = unset, **kwargs): + """ + Attributes for reviewing a flag suggestion. + + :param comment: Optional comment from the reviewer. + :type comment: str, optional + """ + if comment is not unset: + kwargs["comment"] = comment + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/review_flag_suggestion_data.py b/src/datadog_api_client/v2/model/review_flag_suggestion_data.py new file mode 100644 index 0000000000..c91085d408 --- /dev/null +++ b/src/datadog_api_client/v2/model/review_flag_suggestion_data.py @@ -0,0 +1,56 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.review_flag_suggestion_attributes import ReviewFlagSuggestionAttributes + from datadog_api_client.v2.model.flag_suggestion_event_data_type import FlagSuggestionEventDataType + + +class ReviewFlagSuggestionData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.review_flag_suggestion_attributes import ReviewFlagSuggestionAttributes + from datadog_api_client.v2.model.flag_suggestion_event_data_type import FlagSuggestionEventDataType + + return { + "attributes": (ReviewFlagSuggestionAttributes,), + "type": (FlagSuggestionEventDataType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__( + self_, + type: FlagSuggestionEventDataType, + attributes: Union[ReviewFlagSuggestionAttributes, UnsetType] = unset, + **kwargs, + ): + """ + Data for reviewing a flag suggestion. + + :param attributes: Attributes for reviewing a flag suggestion. + :type attributes: ReviewFlagSuggestionAttributes, optional + + :param type: Flag suggestion events resource type. + :type type: FlagSuggestionEventDataType + """ + if attributes is not unset: + kwargs["attributes"] = attributes + super().__init__(kwargs) + + self_.type = type diff --git a/src/datadog_api_client/v2/model/review_flag_suggestion_request.py b/src/datadog_api_client/v2/model/review_flag_suggestion_request.py new file mode 100644 index 0000000000..f40fc8c364 --- /dev/null +++ b/src/datadog_api_client/v2/model/review_flag_suggestion_request.py @@ -0,0 +1,40 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.review_flag_suggestion_data import ReviewFlagSuggestionData + + +class ReviewFlagSuggestionRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.review_flag_suggestion_data import ReviewFlagSuggestionData + + return { + "data": (ReviewFlagSuggestionData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: ReviewFlagSuggestionData, **kwargs): + """ + Request to approve or reject a flag suggestion. + + :param data: Data for reviewing a flag suggestion. + :type data: ReviewFlagSuggestionData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/suggestion_metadata.py b/src/datadog_api_client/v2/model/suggestion_metadata.py new file mode 100644 index 0000000000..abd9af88b1 --- /dev/null +++ b/src/datadog_api_client/v2/model/suggestion_metadata.py @@ -0,0 +1,36 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class SuggestionMetadata(ModelNormal): + @cached_property + def openapi_types(_): + return { + "variant_id": (str,), + } + + attribute_map = { + "variant_id": "variant_id", + } + + def __init__(self_, variant_id: Union[str, UnsetType] = unset, **kwargs): + """ + Optional metadata for a suggestion. + + :param variant_id: Variant ID for variant delete suggestions. + :type variant_id: str, optional + """ + if variant_id is not unset: + kwargs["variant_id"] = variant_id + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 29cf412a84..4ff96b891d 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -1242,6 +1242,9 @@ from datadog_api_client.v2.model.create_feature_flag_data import CreateFeatureFlagData from datadog_api_client.v2.model.create_feature_flag_data_type import CreateFeatureFlagDataType from datadog_api_client.v2.model.create_feature_flag_request import CreateFeatureFlagRequest +from datadog_api_client.v2.model.create_flag_suggestion_attributes import CreateFlagSuggestionAttributes +from datadog_api_client.v2.model.create_flag_suggestion_data import CreateFlagSuggestionData +from datadog_api_client.v2.model.create_flag_suggestion_request import CreateFlagSuggestionRequest from datadog_api_client.v2.model.create_incident_notification_rule_request import CreateIncidentNotificationRuleRequest from datadog_api_client.v2.model.create_incident_notification_template_request import ( CreateIncidentNotificationTemplateRequest, @@ -2195,6 +2198,14 @@ from datadog_api_client.v2.model.finding_type import FindingType from datadog_api_client.v2.model.finding_vulnerability_type import FindingVulnerabilityType from datadog_api_client.v2.model.findings import Findings +from datadog_api_client.v2.model.flag_suggestion import FlagSuggestion +from datadog_api_client.v2.model.flag_suggestion_action import FlagSuggestionAction +from datadog_api_client.v2.model.flag_suggestion_attributes import FlagSuggestionAttributes +from datadog_api_client.v2.model.flag_suggestion_data_type import FlagSuggestionDataType +from datadog_api_client.v2.model.flag_suggestion_event_data_type import FlagSuggestionEventDataType +from datadog_api_client.v2.model.flag_suggestion_property import FlagSuggestionProperty +from datadog_api_client.v2.model.flag_suggestion_response import FlagSuggestionResponse +from datadog_api_client.v2.model.flag_suggestion_status import FlagSuggestionStatus from datadog_api_client.v2.model.flaky_test import FlakyTest from datadog_api_client.v2.model.flaky_test_attributes import FlakyTestAttributes from datadog_api_client.v2.model.flaky_test_attributes_flaky_state import FlakyTestAttributesFlakyState @@ -5215,6 +5226,9 @@ from datadog_api_client.v2.model.revert_custom_rule_revision_request_data_attributes import ( RevertCustomRuleRevisionRequestDataAttributes, ) +from datadog_api_client.v2.model.review_flag_suggestion_attributes import ReviewFlagSuggestionAttributes +from datadog_api_client.v2.model.review_flag_suggestion_data import ReviewFlagSuggestionData +from datadog_api_client.v2.model.review_flag_suggestion_request import ReviewFlagSuggestionRequest from datadog_api_client.v2.model.role import Role from datadog_api_client.v2.model.role_attributes import RoleAttributes from datadog_api_client.v2.model.role_clone import RoleClone @@ -6417,6 +6431,7 @@ from datadog_api_client.v2.model.step import Step from datadog_api_client.v2.model.step_display import StepDisplay from datadog_api_client.v2.model.step_display_bounds import StepDisplayBounds +from datadog_api_client.v2.model.suggestion_metadata import SuggestionMetadata from datadog_api_client.v2.model.suite_create_edit import SuiteCreateEdit from datadog_api_client.v2.model.suite_create_edit_request import SuiteCreateEditRequest from datadog_api_client.v2.model.suite_json_patch_request import SuiteJsonPatchRequest @@ -8177,6 +8192,9 @@ "CreateFeatureFlagData", "CreateFeatureFlagDataType", "CreateFeatureFlagRequest", + "CreateFlagSuggestionAttributes", + "CreateFlagSuggestionData", + "CreateFlagSuggestionRequest", "CreateIncidentNotificationRuleRequest", "CreateIncidentNotificationTemplateRequest", "CreateJiraIssueRequestArray", @@ -8852,6 +8870,14 @@ "FindingType", "FindingVulnerabilityType", "Findings", + "FlagSuggestion", + "FlagSuggestionAction", + "FlagSuggestionAttributes", + "FlagSuggestionDataType", + "FlagSuggestionEventDataType", + "FlagSuggestionProperty", + "FlagSuggestionResponse", + "FlagSuggestionStatus", "FlakyTest", "FlakyTestAttributes", "FlakyTestAttributesFlakyState", @@ -10928,6 +10954,9 @@ "RevertCustomRuleRevisionRequest", "RevertCustomRuleRevisionRequestData", "RevertCustomRuleRevisionRequestDataAttributes", + "ReviewFlagSuggestionAttributes", + "ReviewFlagSuggestionData", + "ReviewFlagSuggestionRequest", "Role", "RoleAttributes", "RoleClone", @@ -11740,6 +11769,7 @@ "Step", "StepDisplay", "StepDisplayBounds", + "SuggestionMetadata", "SuiteCreateEdit", "SuiteCreateEditRequest", "SuiteJsonPatchRequest", diff --git a/tests/v2/features/feature_flags.feature b/tests/v2/features/feature_flags.feature index fd2ff16520..b2642c78ca 100644 --- a/tests/v2/features/feature_flags.feature +++ b/tests/v2/features/feature_flags.feature @@ -7,6 +7,30 @@ Feature: Feature Flags And a valid "appKeyAuth" key in the system And an instance of "FeatureFlags" API + @generated @skip @team:DataDog/feature-flags + Scenario: Approve a flag suggestion returns "Bad Request" response + Given new "ApproveFlagSuggestion" request + And request contains "suggestion_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"comment": "Looks good, approved!"}, "type": "flag-suggestion-events"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/feature-flags + Scenario: Approve a flag suggestion returns "Not Found" response + Given new "ApproveFlagSuggestion" request + And request contains "suggestion_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"comment": "Looks good, approved!"}, "type": "flag-suggestion-events"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/feature-flags + Scenario: Approve a flag suggestion returns "OK" response + Given new "ApproveFlagSuggestion" request + And request contains "suggestion_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"comment": "Looks good, approved!"}, "type": "flag-suggestion-events"}} + When the request is sent + Then the response status is 200 OK + @skip @team:DataDog/feature-flags Scenario: Archive a feature flag returns "Bad Request" response Given new "ArchiveFeatureFlag" request @@ -53,6 +77,38 @@ Feature: Feature Flags And the response "data.attributes.name" is equal to "Test Feature Flag {{ unique }}" And the response "data.attributes.value_type" is equal to "BOOLEAN" + @generated @skip @team:DataDog/feature-flags + Scenario: Create a flag suggestion returns "Bad Request" response + Given new "CreateFlagSuggestion" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"action": "archived", "comment": "Archive this deprecated flag", "environment_id": "550e8400-e29b-41d4-a716-446655440001", "notification_rule_targets": ["user@example.com"], "property": "FLAG", "suggestion": "ENABLED", "suggestion_metadata": {"variant_id": "550e8400-e29b-41d4-a716-446655440005"}}, "type": "flag-suggestions"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/feature-flags + Scenario: Create a flag suggestion returns "Conflict" response + Given new "CreateFlagSuggestion" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"action": "archived", "comment": "Archive this deprecated flag", "environment_id": "550e8400-e29b-41d4-a716-446655440001", "notification_rule_targets": ["user@example.com"], "property": "FLAG", "suggestion": "ENABLED", "suggestion_metadata": {"variant_id": "550e8400-e29b-41d4-a716-446655440005"}}, "type": "flag-suggestions"}} + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/feature-flags + Scenario: Create a flag suggestion returns "Created" response + Given new "CreateFlagSuggestion" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"action": "archived", "comment": "Archive this deprecated flag", "environment_id": "550e8400-e29b-41d4-a716-446655440001", "notification_rule_targets": ["user@example.com"], "property": "FLAG", "suggestion": "ENABLED", "suggestion_metadata": {"variant_id": "550e8400-e29b-41d4-a716-446655440005"}}, "type": "flag-suggestions"}} + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:DataDog/feature-flags + Scenario: Create a flag suggestion returns "Not Found" response + Given new "CreateFlagSuggestion" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"action": "archived", "comment": "Archive this deprecated flag", "environment_id": "550e8400-e29b-41d4-a716-446655440001", "notification_rule_targets": ["user@example.com"], "property": "FLAG", "suggestion": "ENABLED", "suggestion_metadata": {"variant_id": "550e8400-e29b-41d4-a716-446655440005"}}, "type": "flag-suggestions"}} + When the request is sent + Then the response status is 404 Not Found + @team:DataDog/feature-flags Scenario: Create allocation for a flag in an environment returns "Created" response Given there is a valid "feature_flag" in the system @@ -130,6 +186,27 @@ Feature: Feature Flags When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/feature-flags + Scenario: Delete a flag suggestion returns "Bad Request" response + Given new "DeleteFlagSuggestion" request + And request contains "suggestion_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/feature-flags + Scenario: Delete a flag suggestion returns "No Content" response + Given new "DeleteFlagSuggestion" request + And request contains "suggestion_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/feature-flags + Scenario: Delete a flag suggestion returns "Not Found" response + Given new "DeleteFlagSuggestion" request + And request contains "suggestion_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + @skip @team:DataDog/feature-flags Scenario: Delete an environment returns "No Content" response Given there is a valid "environment" in the system @@ -219,6 +296,27 @@ Feature: Feature Flags And the response "data.attributes.name" has the same value as "feature_flag.data.attributes.name" And the response "data.attributes.value_type" has the same value as "feature_flag.data.attributes.value_type" + @generated @skip @team:DataDog/feature-flags + Scenario: Get a flag suggestion returns "Bad Request" response + Given new "GetFlagSuggestion" request + And request contains "suggestion_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/feature-flags + Scenario: Get a flag suggestion returns "Not Found" response + Given new "GetFlagSuggestion" request + And request contains "suggestion_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/feature-flags + Scenario: Get a flag suggestion returns "OK" response + Given new "GetFlagSuggestion" request + And request contains "suggestion_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @skip @team:DataDog/feature-flags Scenario: Get an environment returns "Not Found" response Given new "GetFeatureFlagsEnvironment" request @@ -274,6 +372,30 @@ Feature: Feature Flags When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/feature-flags + Scenario: Reject a flag suggestion returns "Bad Request" response + Given new "RejectFlagSuggestion" request + And request contains "suggestion_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"comment": "Looks good, approved!"}, "type": "flag-suggestion-events"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/feature-flags + Scenario: Reject a flag suggestion returns "Not Found" response + Given new "RejectFlagSuggestion" request + And request contains "suggestion_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"comment": "Looks good, approved!"}, "type": "flag-suggestion-events"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/feature-flags + Scenario: Reject a flag suggestion returns "OK" response + Given new "RejectFlagSuggestion" request + And request contains "suggestion_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"comment": "Looks good, approved!"}, "type": "flag-suggestion-events"}} + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/feature-flags Scenario: Resume a progressive rollout returns "Bad Request" response Given new "ResumeExposureSchedule" request diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index bbfa27e028..eae2df8f1b 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -1954,6 +1954,30 @@ "type": "idempotent" } }, + "DeleteFlagSuggestion": { + "tag": "Feature Flags", + "undo": { + "type": "idempotent" + } + }, + "GetFlagSuggestion": { + "tag": "Feature Flags", + "undo": { + "type": "safe" + } + }, + "ApproveFlagSuggestion": { + "tag": "Feature Flags", + "undo": { + "type": "safe" + } + }, + "RejectFlagSuggestion": { + "tag": "Feature Flags", + "undo": { + "type": "safe" + } + }, "GetFeatureFlag": { "tag": "Feature Flags", "undo": { @@ -2003,6 +2027,19 @@ "type": "idempotent" } }, + "CreateFlagSuggestion": { + "tag": "Feature Flags", + "undo": { + "operationId": "DeleteFlagSuggestion", + "parameters": [ + { + "name": "suggestion_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, "UnarchiveFeatureFlag": { "tag": "Feature Flags", "undo": {