From a0f8582c124a3f4a06d0907f54ae0264a514b685 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 17 Apr 2026 15:26:35 +0000 Subject: [PATCH] Regenerate client from commit 740eb90 of spec repo --- .generator/schemas/v2/openapi.yaml | 534 +++++++++++ .../feature-flags/ApproveFlagSuggestion.java | 39 + .../feature-flags/CreateFlagSuggestion.java | 52 ++ .../feature-flags/DeleteFlagSuggestion.java | 23 + .../v2/feature-flags/GetFlagSuggestion.java | 26 + .../feature-flags/RejectFlagSuggestion.java | 39 + .../api/client/v2/api/FeatureFlagsApi.java | 836 +++++++++++++++++- .../model/CreateFlagSuggestionAttributes.java | 348 ++++++++ .../v2/model/CreateFlagSuggestionData.java | 181 ++++ .../v2/model/CreateFlagSuggestionRequest.java | 146 +++ .../api/client/v2/model/FlagSuggestion.java | 210 +++++ .../client/v2/model/FlagSuggestionAction.java | 73 ++ .../v2/model/FlagSuggestionAttributes.java | 683 ++++++++++++++ .../v2/model/FlagSuggestionDataType.java | 57 ++ .../v2/model/FlagSuggestionEventDataType.java | 57 ++ .../v2/model/FlagSuggestionProperty.java | 91 ++ .../v2/model/FlagSuggestionResponse.java | 145 +++ .../client/v2/model/FlagSuggestionStatus.java | 57 ++ .../model/ReviewFlagSuggestionAttributes.java | 137 +++ .../v2/model/ReviewFlagSuggestionData.java | 178 ++++ .../v2/model/ReviewFlagSuggestionRequest.java | 146 +++ .../client/v2/model/SuggestionMetadata.java | 135 +++ .../api/client/v2/api/feature_flags.feature | 122 +++ .../com/datadog/api/client/v2/api/undo.json | 37 + 24 files changed, 4316 insertions(+), 36 deletions(-) create mode 100644 examples/v2/feature-flags/ApproveFlagSuggestion.java create mode 100644 examples/v2/feature-flags/CreateFlagSuggestion.java create mode 100644 examples/v2/feature-flags/DeleteFlagSuggestion.java create mode 100644 examples/v2/feature-flags/GetFlagSuggestion.java create mode 100644 examples/v2/feature-flags/RejectFlagSuggestion.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CreateFlagSuggestionAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CreateFlagSuggestionData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CreateFlagSuggestionRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/FlagSuggestion.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/FlagSuggestionAction.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/FlagSuggestionAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/FlagSuggestionDataType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/FlagSuggestionEventDataType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/FlagSuggestionProperty.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/FlagSuggestionResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/FlagSuggestionStatus.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ReviewFlagSuggestionAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ReviewFlagSuggestionData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ReviewFlagSuggestionRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/SuggestionMetadata.java diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index d16435a94fc..0ac074923c4 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/examples/v2/feature-flags/ApproveFlagSuggestion.java b/examples/v2/feature-flags/ApproveFlagSuggestion.java new file mode 100644 index 00000000000..874bd99a212 --- /dev/null +++ b/examples/v2/feature-flags/ApproveFlagSuggestion.java @@ -0,0 +1,39 @@ +// Approve a flag suggestion returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.FeatureFlagsApi; +import com.datadog.api.client.v2.model.FlagSuggestionEventDataType; +import com.datadog.api.client.v2.model.FlagSuggestionResponse; +import com.datadog.api.client.v2.model.ReviewFlagSuggestionAttributes; +import com.datadog.api.client.v2.model.ReviewFlagSuggestionData; +import com.datadog.api.client.v2.model.ReviewFlagSuggestionRequest; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + FeatureFlagsApi apiInstance = new FeatureFlagsApi(defaultClient); + + ReviewFlagSuggestionRequest body = + new ReviewFlagSuggestionRequest() + .data( + new ReviewFlagSuggestionData() + .attributes( + new ReviewFlagSuggestionAttributes().comment("Looks good, approved!")) + .type(FlagSuggestionEventDataType.FLAG_SUGGESTION_EVENTS)); + + try { + FlagSuggestionResponse result = + apiInstance.approveFlagSuggestion( + UUID.fromString("550e8400-e29b-41d4-a716-446655440020"), body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FeatureFlagsApi#approveFlagSuggestion"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/feature-flags/CreateFlagSuggestion.java b/examples/v2/feature-flags/CreateFlagSuggestion.java new file mode 100644 index 00000000000..37608f01053 --- /dev/null +++ b/examples/v2/feature-flags/CreateFlagSuggestion.java @@ -0,0 +1,52 @@ +// Create a flag suggestion returns "Created" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.FeatureFlagsApi; +import com.datadog.api.client.v2.model.CreateFlagSuggestionAttributes; +import com.datadog.api.client.v2.model.CreateFlagSuggestionData; +import com.datadog.api.client.v2.model.CreateFlagSuggestionRequest; +import com.datadog.api.client.v2.model.FlagSuggestionAction; +import com.datadog.api.client.v2.model.FlagSuggestionDataType; +import com.datadog.api.client.v2.model.FlagSuggestionProperty; +import com.datadog.api.client.v2.model.FlagSuggestionResponse; +import com.datadog.api.client.v2.model.SuggestionMetadata; +import java.util.Collections; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + FeatureFlagsApi apiInstance = new FeatureFlagsApi(defaultClient); + + CreateFlagSuggestionRequest body = + new CreateFlagSuggestionRequest() + .data( + new CreateFlagSuggestionData() + .attributes( + new CreateFlagSuggestionAttributes() + .action(FlagSuggestionAction.ARCHIVED) + .comment("Archive this deprecated flag") + .environmentId(UUID.fromString("550e8400-e29b-41d4-a716-446655440001")) + .notificationRuleTargets(Collections.singletonList("user@example.com")) + .property(FlagSuggestionProperty.FLAG) + .suggestion("ENABLED") + .suggestionMetadata( + new SuggestionMetadata() + .variantId("550e8400-e29b-41d4-a716-446655440005"))) + .type(FlagSuggestionDataType.FLAG_SUGGESTIONS)); + + try { + FlagSuggestionResponse result = + apiInstance.createFlagSuggestion( + UUID.fromString("550e8400-e29b-41d4-a716-446655440000"), body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FeatureFlagsApi#createFlagSuggestion"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/feature-flags/DeleteFlagSuggestion.java b/examples/v2/feature-flags/DeleteFlagSuggestion.java new file mode 100644 index 00000000000..4b594fbbb09 --- /dev/null +++ b/examples/v2/feature-flags/DeleteFlagSuggestion.java @@ -0,0 +1,23 @@ +// Delete a flag suggestion returns "No Content" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.FeatureFlagsApi; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + FeatureFlagsApi apiInstance = new FeatureFlagsApi(defaultClient); + + try { + apiInstance.deleteFlagSuggestion(UUID.fromString("550e8400-e29b-41d4-a716-446655440020")); + } catch (ApiException e) { + System.err.println("Exception when calling FeatureFlagsApi#deleteFlagSuggestion"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/feature-flags/GetFlagSuggestion.java b/examples/v2/feature-flags/GetFlagSuggestion.java new file mode 100644 index 00000000000..2e840b6c417 --- /dev/null +++ b/examples/v2/feature-flags/GetFlagSuggestion.java @@ -0,0 +1,26 @@ +// Get a flag suggestion returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.FeatureFlagsApi; +import com.datadog.api.client.v2.model.FlagSuggestionResponse; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + FeatureFlagsApi apiInstance = new FeatureFlagsApi(defaultClient); + + try { + FlagSuggestionResponse result = + apiInstance.getFlagSuggestion(UUID.fromString("550e8400-e29b-41d4-a716-446655440020")); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FeatureFlagsApi#getFlagSuggestion"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/feature-flags/RejectFlagSuggestion.java b/examples/v2/feature-flags/RejectFlagSuggestion.java new file mode 100644 index 00000000000..0f9933ff4b1 --- /dev/null +++ b/examples/v2/feature-flags/RejectFlagSuggestion.java @@ -0,0 +1,39 @@ +// Reject a flag suggestion returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.FeatureFlagsApi; +import com.datadog.api.client.v2.model.FlagSuggestionEventDataType; +import com.datadog.api.client.v2.model.FlagSuggestionResponse; +import com.datadog.api.client.v2.model.ReviewFlagSuggestionAttributes; +import com.datadog.api.client.v2.model.ReviewFlagSuggestionData; +import com.datadog.api.client.v2.model.ReviewFlagSuggestionRequest; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + FeatureFlagsApi apiInstance = new FeatureFlagsApi(defaultClient); + + ReviewFlagSuggestionRequest body = + new ReviewFlagSuggestionRequest() + .data( + new ReviewFlagSuggestionData() + .attributes( + new ReviewFlagSuggestionAttributes().comment("Looks good, approved!")) + .type(FlagSuggestionEventDataType.FLAG_SUGGESTION_EVENTS)); + + try { + FlagSuggestionResponse result = + apiInstance.rejectFlagSuggestion( + UUID.fromString("550e8400-e29b-41d4-a716-446655440020"), body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FeatureFlagsApi#rejectFlagSuggestion"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/v2/api/FeatureFlagsApi.java b/src/main/java/com/datadog/api/client/v2/api/FeatureFlagsApi.java index de2b1ca737d..14033023953 100644 --- a/src/main/java/com/datadog/api/client/v2/api/FeatureFlagsApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/FeatureFlagsApi.java @@ -9,12 +9,15 @@ import com.datadog.api.client.v2.model.CreateAllocationsRequest; import com.datadog.api.client.v2.model.CreateEnvironmentRequest; import com.datadog.api.client.v2.model.CreateFeatureFlagRequest; +import com.datadog.api.client.v2.model.CreateFlagSuggestionRequest; import com.datadog.api.client.v2.model.EnvironmentResponse; import com.datadog.api.client.v2.model.FeatureFlagResponse; +import com.datadog.api.client.v2.model.FlagSuggestionResponse; import com.datadog.api.client.v2.model.ListAllocationsResponse; import com.datadog.api.client.v2.model.ListEnvironmentsResponse; import com.datadog.api.client.v2.model.ListFeatureFlagsResponse; import com.datadog.api.client.v2.model.OverwriteAllocationsRequest; +import com.datadog.api.client.v2.model.ReviewFlagSuggestionRequest; import com.datadog.api.client.v2.model.UpdateEnvironmentRequest; import com.datadog.api.client.v2.model.UpdateFeatureFlagRequest; import jakarta.ws.rs.client.Invocation; @@ -57,6 +60,167 @@ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } + /** + * Approve a flag suggestion. + * + *

See {@link #approveFlagSuggestionWithHttpInfo}. + * + * @param suggestionId The ID of the flag suggestion. (required) + * @param body (required) + * @return FlagSuggestionResponse + * @throws ApiException if fails to make API call + */ + public FlagSuggestionResponse approveFlagSuggestion( + UUID suggestionId, ReviewFlagSuggestionRequest body) throws ApiException { + return approveFlagSuggestionWithHttpInfo(suggestionId, body).getData(); + } + + /** + * Approve a flag suggestion. + * + *

See {@link #approveFlagSuggestionWithHttpInfoAsync}. + * + * @param suggestionId The ID of the flag suggestion. (required) + * @param body (required) + * @return CompletableFuture<FlagSuggestionResponse> + */ + public CompletableFuture approveFlagSuggestionAsync( + UUID suggestionId, ReviewFlagSuggestionRequest body) { + return approveFlagSuggestionWithHttpInfoAsync(suggestionId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Approve a pending flag change suggestion. The change is applied immediately upon approval. A + * user cannot approve their own suggestion. + * + * @param suggestionId The ID of the flag suggestion. (required) + * @param body (required) + * @return ApiResponse<FlagSuggestionResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden - Cannot approve your own suggestion -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse approveFlagSuggestionWithHttpInfo( + UUID suggestionId, ReviewFlagSuggestionRequest body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'suggestionId' is set + if (suggestionId == null) { + throw new ApiException( + 400, "Missing the required parameter 'suggestionId' when calling approveFlagSuggestion"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling approveFlagSuggestion"); + } + // create path and map variables + String localVarPath = + "/api/v2/feature-flags/suggestions/{suggestion_id}/approve" + .replaceAll( + "\\{" + "suggestion_id" + "\\}", apiClient.escapeString(suggestionId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.FeatureFlagsApi.approveFlagSuggestion", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Approve a flag suggestion. + * + *

See {@link #approveFlagSuggestionWithHttpInfo}. + * + * @param suggestionId The ID of the flag suggestion. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<FlagSuggestionResponse>> + */ + public CompletableFuture> + approveFlagSuggestionWithHttpInfoAsync(UUID suggestionId, ReviewFlagSuggestionRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'suggestionId' is set + if (suggestionId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'suggestionId' when calling approveFlagSuggestion")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling approveFlagSuggestion")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/feature-flags/suggestions/{suggestion_id}/approve" + .replaceAll( + "\\{" + "suggestion_id" + "\\}", apiClient.escapeString(suggestionId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.FeatureFlagsApi.approveFlagSuggestion", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Archive a feature flag. * @@ -661,35 +825,340 @@ public ApiResponse createFeatureFlagsEnvironmentWithHttpInf "POST", builder, localVarHeaderParams, - new String[] {"application/json"}, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create a flag suggestion. + * + *

See {@link #createFlagSuggestionWithHttpInfo}. + * + * @param featureFlagId The ID of the feature flag. (required) + * @param body (required) + * @return FlagSuggestionResponse + * @throws ApiException if fails to make API call + */ + public FlagSuggestionResponse createFlagSuggestion( + UUID featureFlagId, CreateFlagSuggestionRequest body) throws ApiException { + return createFlagSuggestionWithHttpInfo(featureFlagId, body).getData(); + } + + /** + * Create a flag suggestion. + * + *

See {@link #createFlagSuggestionWithHttpInfoAsync}. + * + * @param featureFlagId The ID of the feature flag. (required) + * @param body (required) + * @return CompletableFuture<FlagSuggestionResponse> + */ + public CompletableFuture createFlagSuggestionAsync( + UUID featureFlagId, CreateFlagSuggestionRequest body) { + return createFlagSuggestionWithHttpInfoAsync(featureFlagId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * 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 featureFlagId The ID of the feature flag. (required) + * @param body (required) + * @return ApiResponse<FlagSuggestionResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
201 Created -
400 Bad Request -
403 Forbidden -
404 Not Found -
409 Conflict -
429 Too many requests -
+ */ + public ApiResponse createFlagSuggestionWithHttpInfo( + UUID featureFlagId, CreateFlagSuggestionRequest body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'featureFlagId' is set + if (featureFlagId == null) { + throw new ApiException( + 400, "Missing the required parameter 'featureFlagId' when calling createFlagSuggestion"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createFlagSuggestion"); + } + // create path and map variables + String localVarPath = + "/api/v2/feature-flags/{feature_flag_id}/suggestions" + .replaceAll( + "\\{" + "feature_flag_id" + "\\}", + apiClient.escapeString(featureFlagId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.FeatureFlagsApi.createFlagSuggestion", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create a flag suggestion. + * + *

See {@link #createFlagSuggestionWithHttpInfo}. + * + * @param featureFlagId The ID of the feature flag. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<FlagSuggestionResponse>> + */ + public CompletableFuture> + createFlagSuggestionWithHttpInfoAsync(UUID featureFlagId, CreateFlagSuggestionRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'featureFlagId' is set + if (featureFlagId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'featureFlagId' when calling createFlagSuggestion")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling createFlagSuggestion")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/feature-flags/{feature_flag_id}/suggestions" + .replaceAll( + "\\{" + "feature_flag_id" + "\\}", + apiClient.escapeString(featureFlagId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.FeatureFlagsApi.createFlagSuggestion", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Delete an environment. + * + *

See {@link #deleteFeatureFlagsEnvironmentWithHttpInfo}. + * + * @param environmentId The ID of the environment. (required) + * @throws ApiException if fails to make API call + */ + public void deleteFeatureFlagsEnvironment(UUID environmentId) throws ApiException { + deleteFeatureFlagsEnvironmentWithHttpInfo(environmentId); + } + + /** + * Delete an environment. + * + *

See {@link #deleteFeatureFlagsEnvironmentWithHttpInfoAsync}. + * + * @param environmentId The ID of the environment. (required) + * @return CompletableFuture + */ + public CompletableFuture deleteFeatureFlagsEnvironmentAsync(UUID environmentId) { + return deleteFeatureFlagsEnvironmentWithHttpInfoAsync(environmentId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Deletes an environment. This operation cannot be undone. + * + * @param environmentId The ID of the environment. (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
204 No Content -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse deleteFeatureFlagsEnvironmentWithHttpInfo(UUID environmentId) + throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'environmentId' is set + if (environmentId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'environmentId' when calling" + + " deleteFeatureFlagsEnvironment"); + } + // create path and map variables + String localVarPath = + "/api/v2/feature-flags/environments/{environment_id}" + .replaceAll( + "\\{" + "environment_id" + "\\}", apiClient.escapeString(environmentId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.FeatureFlagsApi.deleteFeatureFlagsEnvironment", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Delete an environment. + * + *

See {@link #deleteFeatureFlagsEnvironmentWithHttpInfo}. + * + * @param environmentId The ID of the environment. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deleteFeatureFlagsEnvironmentWithHttpInfoAsync( + UUID environmentId) { + Object localVarPostBody = null; + + // verify the required parameter 'environmentId' is set + if (environmentId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'environmentId' when calling" + + " deleteFeatureFlagsEnvironment")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/feature-flags/environments/{environment_id}" + .replaceAll( + "\\{" + "environment_id" + "\\}", apiClient.escapeString(environmentId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.FeatureFlagsApi.deleteFeatureFlagsEnvironment", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, localVarPostBody, new HashMap(), false, - new GenericType() {}); + null); } /** - * Delete an environment. + * Delete a flag suggestion. * - *

See {@link #deleteFeatureFlagsEnvironmentWithHttpInfo}. + *

See {@link #deleteFlagSuggestionWithHttpInfo}. * - * @param environmentId The ID of the environment. (required) + * @param suggestionId The ID of the flag suggestion. (required) * @throws ApiException if fails to make API call */ - public void deleteFeatureFlagsEnvironment(UUID environmentId) throws ApiException { - deleteFeatureFlagsEnvironmentWithHttpInfo(environmentId); + public void deleteFlagSuggestion(UUID suggestionId) throws ApiException { + deleteFlagSuggestionWithHttpInfo(suggestionId); } /** - * Delete an environment. + * Delete a flag suggestion. * - *

See {@link #deleteFeatureFlagsEnvironmentWithHttpInfoAsync}. + *

See {@link #deleteFlagSuggestionWithHttpInfoAsync}. * - * @param environmentId The ID of the environment. (required) + * @param suggestionId The ID of the flag suggestion. (required) * @return CompletableFuture */ - public CompletableFuture deleteFeatureFlagsEnvironmentAsync(UUID environmentId) { - return deleteFeatureFlagsEnvironmentWithHttpInfoAsync(environmentId) + public CompletableFuture deleteFlagSuggestionAsync(UUID suggestionId) { + return deleteFlagSuggestionWithHttpInfoAsync(suggestionId) .thenApply( response -> { return response.getData(); @@ -697,9 +1166,9 @@ public CompletableFuture deleteFeatureFlagsEnvironmentAsync(UUID environme } /** - * Deletes an environment. This operation cannot be undone. + * Delete a pending flag change suggestion. Approved suggestions cannot be deleted. * - * @param environmentId The ID of the environment. (required) + * @param suggestionId The ID of the flag suggestion. (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details @@ -707,33 +1176,31 @@ public CompletableFuture deleteFeatureFlagsEnvironmentAsync(UUID environme * Response details * Status Code Description Response Headers * 204 No Content - + * 400 Bad Request - * 403 Forbidden - * 404 Not Found - * 429 Too many requests - * */ - public ApiResponse deleteFeatureFlagsEnvironmentWithHttpInfo(UUID environmentId) - throws ApiException { + public ApiResponse deleteFlagSuggestionWithHttpInfo(UUID suggestionId) throws ApiException { Object localVarPostBody = null; - // verify the required parameter 'environmentId' is set - if (environmentId == null) { + // verify the required parameter 'suggestionId' is set + if (suggestionId == null) { throw new ApiException( - 400, - "Missing the required parameter 'environmentId' when calling" - + " deleteFeatureFlagsEnvironment"); + 400, "Missing the required parameter 'suggestionId' when calling deleteFlagSuggestion"); } // create path and map variables String localVarPath = - "/api/v2/feature-flags/environments/{environment_id}" + "/api/v2/feature-flags/suggestions/{suggestion_id}" .replaceAll( - "\\{" + "environment_id" + "\\}", apiClient.escapeString(environmentId.toString())); + "\\{" + "suggestion_id" + "\\}", apiClient.escapeString(suggestionId.toString())); Map localVarHeaderParams = new HashMap(); Invocation.Builder builder = apiClient.createBuilder( - "v2.FeatureFlagsApi.deleteFeatureFlagsEnvironment", + "v2.FeatureFlagsApi.deleteFlagSuggestion", localVarPath, new ArrayList(), localVarHeaderParams, @@ -752,32 +1219,31 @@ public ApiResponse deleteFeatureFlagsEnvironmentWithHttpInfo(UUID environm } /** - * Delete an environment. + * Delete a flag suggestion. * - *

See {@link #deleteFeatureFlagsEnvironmentWithHttpInfo}. + *

See {@link #deleteFlagSuggestionWithHttpInfo}. * - * @param environmentId The ID of the environment. (required) + * @param suggestionId The ID of the flag suggestion. (required) * @return CompletableFuture<ApiResponse<Void>> */ - public CompletableFuture> deleteFeatureFlagsEnvironmentWithHttpInfoAsync( - UUID environmentId) { + public CompletableFuture> deleteFlagSuggestionWithHttpInfoAsync( + UUID suggestionId) { Object localVarPostBody = null; - // verify the required parameter 'environmentId' is set - if (environmentId == null) { + // verify the required parameter 'suggestionId' is set + if (suggestionId == null) { CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException( 400, - "Missing the required parameter 'environmentId' when calling" - + " deleteFeatureFlagsEnvironment")); + "Missing the required parameter 'suggestionId' when calling deleteFlagSuggestion")); return result; } // create path and map variables String localVarPath = - "/api/v2/feature-flags/environments/{environment_id}" + "/api/v2/feature-flags/suggestions/{suggestion_id}" .replaceAll( - "\\{" + "environment_id" + "\\}", apiClient.escapeString(environmentId.toString())); + "\\{" + "suggestion_id" + "\\}", apiClient.escapeString(suggestionId.toString())); Map localVarHeaderParams = new HashMap(); @@ -785,7 +1251,7 @@ public CompletableFuture> deleteFeatureFlagsEnvironmentWithHtt try { builder = apiClient.createBuilder( - "v2.FeatureFlagsApi.deleteFeatureFlagsEnvironment", + "v2.FeatureFlagsApi.deleteFlagSuggestion", localVarPath, new ArrayList(), localVarHeaderParams, @@ -1428,6 +1894,144 @@ public ApiResponse getFeatureFlagsEnvironmentWithHttpInfo(U new GenericType() {}); } + /** + * Get a flag suggestion. + * + *

See {@link #getFlagSuggestionWithHttpInfo}. + * + * @param suggestionId The ID of the flag suggestion. (required) + * @return FlagSuggestionResponse + * @throws ApiException if fails to make API call + */ + public FlagSuggestionResponse getFlagSuggestion(UUID suggestionId) throws ApiException { + return getFlagSuggestionWithHttpInfo(suggestionId).getData(); + } + + /** + * Get a flag suggestion. + * + *

See {@link #getFlagSuggestionWithHttpInfoAsync}. + * + * @param suggestionId The ID of the flag suggestion. (required) + * @return CompletableFuture<FlagSuggestionResponse> + */ + public CompletableFuture getFlagSuggestionAsync(UUID suggestionId) { + return getFlagSuggestionWithHttpInfoAsync(suggestionId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get a flag change suggestion by ID. + * + * @param suggestionId The ID of the flag suggestion. (required) + * @return ApiResponse<FlagSuggestionResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse getFlagSuggestionWithHttpInfo(UUID suggestionId) + throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'suggestionId' is set + if (suggestionId == null) { + throw new ApiException( + 400, "Missing the required parameter 'suggestionId' when calling getFlagSuggestion"); + } + // create path and map variables + String localVarPath = + "/api/v2/feature-flags/suggestions/{suggestion_id}" + .replaceAll( + "\\{" + "suggestion_id" + "\\}", apiClient.escapeString(suggestionId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.FeatureFlagsApi.getFlagSuggestion", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get a flag suggestion. + * + *

See {@link #getFlagSuggestionWithHttpInfo}. + * + * @param suggestionId The ID of the flag suggestion. (required) + * @return CompletableFuture<ApiResponse<FlagSuggestionResponse>> + */ + public CompletableFuture> getFlagSuggestionWithHttpInfoAsync( + UUID suggestionId) { + Object localVarPostBody = null; + + // verify the required parameter 'suggestionId' is set + if (suggestionId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'suggestionId' when calling getFlagSuggestion")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/feature-flags/suggestions/{suggestion_id}" + .replaceAll( + "\\{" + "suggestion_id" + "\\}", apiClient.escapeString(suggestionId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.FeatureFlagsApi.getFlagSuggestion", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** Manage optional parameters to listFeatureFlags. */ public static class ListFeatureFlagsOptionalParameters { private String key; @@ -2013,6 +2617,166 @@ public ApiResponse pauseExposureScheduleWith new GenericType() {}); } + /** + * Reject a flag suggestion. + * + *

See {@link #rejectFlagSuggestionWithHttpInfo}. + * + * @param suggestionId The ID of the flag suggestion. (required) + * @param body (required) + * @return FlagSuggestionResponse + * @throws ApiException if fails to make API call + */ + public FlagSuggestionResponse rejectFlagSuggestion( + UUID suggestionId, ReviewFlagSuggestionRequest body) throws ApiException { + return rejectFlagSuggestionWithHttpInfo(suggestionId, body).getData(); + } + + /** + * Reject a flag suggestion. + * + *

See {@link #rejectFlagSuggestionWithHttpInfoAsync}. + * + * @param suggestionId The ID of the flag suggestion. (required) + * @param body (required) + * @return CompletableFuture<FlagSuggestionResponse> + */ + public CompletableFuture rejectFlagSuggestionAsync( + UUID suggestionId, ReviewFlagSuggestionRequest body) { + return rejectFlagSuggestionWithHttpInfoAsync(suggestionId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Reject a pending flag change suggestion. The suggested change is not applied. + * + * @param suggestionId The ID of the flag suggestion. (required) + * @param body (required) + * @return ApiResponse<FlagSuggestionResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse rejectFlagSuggestionWithHttpInfo( + UUID suggestionId, ReviewFlagSuggestionRequest body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'suggestionId' is set + if (suggestionId == null) { + throw new ApiException( + 400, "Missing the required parameter 'suggestionId' when calling rejectFlagSuggestion"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling rejectFlagSuggestion"); + } + // create path and map variables + String localVarPath = + "/api/v2/feature-flags/suggestions/{suggestion_id}/reject" + .replaceAll( + "\\{" + "suggestion_id" + "\\}", apiClient.escapeString(suggestionId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.FeatureFlagsApi.rejectFlagSuggestion", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Reject a flag suggestion. + * + *

See {@link #rejectFlagSuggestionWithHttpInfo}. + * + * @param suggestionId The ID of the flag suggestion. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<FlagSuggestionResponse>> + */ + public CompletableFuture> + rejectFlagSuggestionWithHttpInfoAsync(UUID suggestionId, ReviewFlagSuggestionRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'suggestionId' is set + if (suggestionId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'suggestionId' when calling rejectFlagSuggestion")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling rejectFlagSuggestion")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/feature-flags/suggestions/{suggestion_id}/reject" + .replaceAll( + "\\{" + "suggestion_id" + "\\}", apiClient.escapeString(suggestionId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.FeatureFlagsApi.rejectFlagSuggestion", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Resume a progressive rollout. * diff --git a/src/main/java/com/datadog/api/client/v2/model/CreateFlagSuggestionAttributes.java b/src/main/java/com/datadog/api/client/v2/model/CreateFlagSuggestionAttributes.java new file mode 100644 index 00000000000..14b4f698a0c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreateFlagSuggestionAttributes.java @@ -0,0 +1,348 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** Attributes for creating a flag suggestion. */ +@JsonPropertyOrder({ + CreateFlagSuggestionAttributes.JSON_PROPERTY_ACTION, + CreateFlagSuggestionAttributes.JSON_PROPERTY_COMMENT, + CreateFlagSuggestionAttributes.JSON_PROPERTY_ENVIRONMENT_ID, + CreateFlagSuggestionAttributes.JSON_PROPERTY_NOTIFICATION_RULE_TARGETS, + CreateFlagSuggestionAttributes.JSON_PROPERTY_PROPERTY, + CreateFlagSuggestionAttributes.JSON_PROPERTY_SUGGESTION, + CreateFlagSuggestionAttributes.JSON_PROPERTY_SUGGESTION_METADATA +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CreateFlagSuggestionAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ACTION = "action"; + private FlagSuggestionAction action; + + public static final String JSON_PROPERTY_COMMENT = "comment"; + private String comment; + + public static final String JSON_PROPERTY_ENVIRONMENT_ID = "environment_id"; + private UUID environmentId; + + public static final String JSON_PROPERTY_NOTIFICATION_RULE_TARGETS = "notification_rule_targets"; + private List notificationRuleTargets = new ArrayList<>(); + + public static final String JSON_PROPERTY_PROPERTY = "property"; + private FlagSuggestionProperty property; + + public static final String JSON_PROPERTY_SUGGESTION = "suggestion"; + private String suggestion; + + public static final String JSON_PROPERTY_SUGGESTION_METADATA = "suggestion_metadata"; + private SuggestionMetadata suggestionMetadata; + + public CreateFlagSuggestionAttributes() {} + + @JsonCreator + public CreateFlagSuggestionAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_ACTION) FlagSuggestionAction action, + @JsonProperty(required = true, value = JSON_PROPERTY_NOTIFICATION_RULE_TARGETS) + List notificationRuleTargets, + @JsonProperty(required = true, value = JSON_PROPERTY_PROPERTY) + FlagSuggestionProperty property) { + this.action = action; + this.unparsed |= !action.isValid(); + this.notificationRuleTargets = notificationRuleTargets; + this.property = property; + this.unparsed |= !property.isValid(); + } + + public CreateFlagSuggestionAttributes action(FlagSuggestionAction action) { + this.action = action; + this.unparsed |= !action.isValid(); + return this; + } + + /** + * The type of change action for a suggestion. + * + * @return action + */ + @JsonProperty(JSON_PROPERTY_ACTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FlagSuggestionAction getAction() { + return action; + } + + public void setAction(FlagSuggestionAction action) { + if (!action.isValid()) { + this.unparsed = true; + } + this.action = action; + } + + public CreateFlagSuggestionAttributes comment(String comment) { + this.comment = comment; + return this; + } + + /** + * Optional comment explaining the change. + * + * @return comment + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_COMMENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getComment() { + return comment; + } + + public void setComment(String comment) { + this.comment = comment; + } + + public CreateFlagSuggestionAttributes environmentId(UUID environmentId) { + this.environmentId = environmentId; + return this; + } + + /** + * The environment ID for environment-scoped changes. + * + * @return environmentId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ENVIRONMENT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UUID getEnvironmentId() { + return environmentId; + } + + public void setEnvironmentId(UUID environmentId) { + this.environmentId = environmentId; + } + + public CreateFlagSuggestionAttributes notificationRuleTargets( + List notificationRuleTargets) { + this.notificationRuleTargets = notificationRuleTargets; + return this; + } + + public CreateFlagSuggestionAttributes addNotificationRuleTargetsItem( + String notificationRuleTargetsItem) { + this.notificationRuleTargets.add(notificationRuleTargetsItem); + return this; + } + + /** + * Notification handles (without @ prefix) to receive approval or rejection notifications. For + * example, an email address or Slack channel name. + * + * @return notificationRuleTargets + */ + @JsonProperty(JSON_PROPERTY_NOTIFICATION_RULE_TARGETS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getNotificationRuleTargets() { + return notificationRuleTargets; + } + + public void setNotificationRuleTargets(List notificationRuleTargets) { + this.notificationRuleTargets = notificationRuleTargets; + } + + public CreateFlagSuggestionAttributes property(FlagSuggestionProperty property) { + this.property = property; + this.unparsed |= !property.isValid(); + return this; + } + + /** + * The flag property being changed. + * + * @return property + */ + @JsonProperty(JSON_PROPERTY_PROPERTY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FlagSuggestionProperty getProperty() { + return property; + } + + public void setProperty(FlagSuggestionProperty property) { + if (!property.isValid()) { + this.unparsed = true; + } + this.property = property; + } + + public CreateFlagSuggestionAttributes suggestion(String suggestion) { + this.suggestion = suggestion; + return this; + } + + /** + * The suggested new value (empty string for flag-level actions like archive, JSON-encoded for + * complex properties like allocations). + * + * @return suggestion + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SUGGESTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getSuggestion() { + return suggestion; + } + + public void setSuggestion(String suggestion) { + this.suggestion = suggestion; + } + + public CreateFlagSuggestionAttributes suggestionMetadata(SuggestionMetadata suggestionMetadata) { + this.suggestionMetadata = suggestionMetadata; + this.unparsed |= suggestionMetadata.unparsed; + return this; + } + + /** + * Optional metadata for a suggestion. + * + * @return suggestionMetadata + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SUGGESTION_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public SuggestionMetadata getSuggestionMetadata() { + return suggestionMetadata; + } + + public void setSuggestionMetadata(SuggestionMetadata suggestionMetadata) { + this.suggestionMetadata = suggestionMetadata; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CreateFlagSuggestionAttributes + */ + @JsonAnySetter + public CreateFlagSuggestionAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CreateFlagSuggestionAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateFlagSuggestionAttributes createFlagSuggestionAttributes = + (CreateFlagSuggestionAttributes) o; + return Objects.equals(this.action, createFlagSuggestionAttributes.action) + && Objects.equals(this.comment, createFlagSuggestionAttributes.comment) + && Objects.equals(this.environmentId, createFlagSuggestionAttributes.environmentId) + && Objects.equals( + this.notificationRuleTargets, createFlagSuggestionAttributes.notificationRuleTargets) + && Objects.equals(this.property, createFlagSuggestionAttributes.property) + && Objects.equals(this.suggestion, createFlagSuggestionAttributes.suggestion) + && Objects.equals( + this.suggestionMetadata, createFlagSuggestionAttributes.suggestionMetadata) + && Objects.equals( + this.additionalProperties, createFlagSuggestionAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + action, + comment, + environmentId, + notificationRuleTargets, + property, + suggestion, + suggestionMetadata, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateFlagSuggestionAttributes {\n"); + sb.append(" action: ").append(toIndentedString(action)).append("\n"); + sb.append(" comment: ").append(toIndentedString(comment)).append("\n"); + sb.append(" environmentId: ").append(toIndentedString(environmentId)).append("\n"); + sb.append(" notificationRuleTargets: ") + .append(toIndentedString(notificationRuleTargets)) + .append("\n"); + sb.append(" property: ").append(toIndentedString(property)).append("\n"); + sb.append(" suggestion: ").append(toIndentedString(suggestion)).append("\n"); + sb.append(" suggestionMetadata: ").append(toIndentedString(suggestionMetadata)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CreateFlagSuggestionData.java b/src/main/java/com/datadog/api/client/v2/model/CreateFlagSuggestionData.java new file mode 100644 index 00000000000..2cdd2238668 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreateFlagSuggestionData.java @@ -0,0 +1,181 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Data for creating a flag suggestion. */ +@JsonPropertyOrder({ + CreateFlagSuggestionData.JSON_PROPERTY_ATTRIBUTES, + CreateFlagSuggestionData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CreateFlagSuggestionData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private CreateFlagSuggestionAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private FlagSuggestionDataType type; + + public CreateFlagSuggestionData() {} + + @JsonCreator + public CreateFlagSuggestionData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + CreateFlagSuggestionAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) FlagSuggestionDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public CreateFlagSuggestionData attributes(CreateFlagSuggestionAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for creating a flag suggestion. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CreateFlagSuggestionAttributes getAttributes() { + return attributes; + } + + public void setAttributes(CreateFlagSuggestionAttributes attributes) { + this.attributes = attributes; + } + + public CreateFlagSuggestionData type(FlagSuggestionDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Flag suggestions resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FlagSuggestionDataType getType() { + return type; + } + + public void setType(FlagSuggestionDataType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CreateFlagSuggestionData + */ + @JsonAnySetter + public CreateFlagSuggestionData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CreateFlagSuggestionData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateFlagSuggestionData createFlagSuggestionData = (CreateFlagSuggestionData) o; + return Objects.equals(this.attributes, createFlagSuggestionData.attributes) + && Objects.equals(this.type, createFlagSuggestionData.type) + && Objects.equals(this.additionalProperties, createFlagSuggestionData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateFlagSuggestionData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CreateFlagSuggestionRequest.java b/src/main/java/com/datadog/api/client/v2/model/CreateFlagSuggestionRequest.java new file mode 100644 index 00000000000..4d2754ea479 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreateFlagSuggestionRequest.java @@ -0,0 +1,146 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Request to create a flag suggestion. */ +@JsonPropertyOrder({CreateFlagSuggestionRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CreateFlagSuggestionRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private CreateFlagSuggestionData data; + + public CreateFlagSuggestionRequest() {} + + @JsonCreator + public CreateFlagSuggestionRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) CreateFlagSuggestionData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public CreateFlagSuggestionRequest data(CreateFlagSuggestionData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data for creating a flag suggestion. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CreateFlagSuggestionData getData() { + return data; + } + + public void setData(CreateFlagSuggestionData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CreateFlagSuggestionRequest + */ + @JsonAnySetter + public CreateFlagSuggestionRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CreateFlagSuggestionRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateFlagSuggestionRequest createFlagSuggestionRequest = (CreateFlagSuggestionRequest) o; + return Objects.equals(this.data, createFlagSuggestionRequest.data) + && Objects.equals( + this.additionalProperties, createFlagSuggestionRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateFlagSuggestionRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FlagSuggestion.java b/src/main/java/com/datadog/api/client/v2/model/FlagSuggestion.java new file mode 100644 index 00000000000..1fc2a027ecb --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FlagSuggestion.java @@ -0,0 +1,210 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** A flag change suggestion. */ +@JsonPropertyOrder({ + FlagSuggestion.JSON_PROPERTY_ATTRIBUTES, + FlagSuggestion.JSON_PROPERTY_ID, + FlagSuggestion.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FlagSuggestion { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private FlagSuggestionAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private FlagSuggestionDataType type; + + public FlagSuggestion() {} + + @JsonCreator + public FlagSuggestion( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + FlagSuggestionAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) UUID id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) FlagSuggestionDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public FlagSuggestion attributes(FlagSuggestionAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of a flag suggestion. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FlagSuggestionAttributes getAttributes() { + return attributes; + } + + public void setAttributes(FlagSuggestionAttributes attributes) { + this.attributes = attributes; + } + + public FlagSuggestion id(UUID id) { + this.id = id; + return this; + } + + /** + * Unique identifier for the suggestion. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public FlagSuggestion type(FlagSuggestionDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Flag suggestions resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FlagSuggestionDataType getType() { + return type; + } + + public void setType(FlagSuggestionDataType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return FlagSuggestion + */ + @JsonAnySetter + public FlagSuggestion putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this FlagSuggestion object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FlagSuggestion flagSuggestion = (FlagSuggestion) o; + return Objects.equals(this.attributes, flagSuggestion.attributes) + && Objects.equals(this.id, flagSuggestion.id) + && Objects.equals(this.type, flagSuggestion.type) + && Objects.equals(this.additionalProperties, flagSuggestion.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FlagSuggestion {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FlagSuggestionAction.java b/src/main/java/com/datadog/api/client/v2/model/FlagSuggestionAction.java new file mode 100644 index 00000000000..99d9a38cbe8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FlagSuggestionAction.java @@ -0,0 +1,73 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The type of change action for a suggestion. */ +@JsonSerialize(using = FlagSuggestionAction.FlagSuggestionActionSerializer.class) +public class FlagSuggestionAction extends ModelEnum { + + private static final Set allowedValues = + new HashSet( + Arrays.asList( + "created", + "updated", + "deleted", + "archived", + "unarchived", + "started", + "stopped", + "paused", + "unpaused")); + + public static final FlagSuggestionAction CREATED = new FlagSuggestionAction("created"); + public static final FlagSuggestionAction UPDATED = new FlagSuggestionAction("updated"); + public static final FlagSuggestionAction DELETED = new FlagSuggestionAction("deleted"); + public static final FlagSuggestionAction ARCHIVED = new FlagSuggestionAction("archived"); + public static final FlagSuggestionAction UNARCHIVED = new FlagSuggestionAction("unarchived"); + public static final FlagSuggestionAction STARTED = new FlagSuggestionAction("started"); + public static final FlagSuggestionAction STOPPED = new FlagSuggestionAction("stopped"); + public static final FlagSuggestionAction PAUSED = new FlagSuggestionAction("paused"); + public static final FlagSuggestionAction UNPAUSED = new FlagSuggestionAction("unpaused"); + + FlagSuggestionAction(String value) { + super(value, allowedValues); + } + + public static class FlagSuggestionActionSerializer extends StdSerializer { + public FlagSuggestionActionSerializer(Class t) { + super(t); + } + + public FlagSuggestionActionSerializer() { + this(null); + } + + @Override + public void serialize( + FlagSuggestionAction value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static FlagSuggestionAction fromValue(String value) { + return new FlagSuggestionAction(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FlagSuggestionAttributes.java b/src/main/java/com/datadog/api/client/v2/model/FlagSuggestionAttributes.java new file mode 100644 index 00000000000..3a7f72b83a0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FlagSuggestionAttributes.java @@ -0,0 +1,683 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Attributes of a flag suggestion. */ +@JsonPropertyOrder({ + FlagSuggestionAttributes.JSON_PROPERTY_ACTION, + FlagSuggestionAttributes.JSON_PROPERTY_BASE_FLAG_HISTORY_ID, + FlagSuggestionAttributes.JSON_PROPERTY_COMMENT, + FlagSuggestionAttributes.JSON_PROPERTY_CREATED_AT, + FlagSuggestionAttributes.JSON_PROPERTY_CREATED_BY, + FlagSuggestionAttributes.JSON_PROPERTY_CURRENT_STATUS, + FlagSuggestionAttributes.JSON_PROPERTY_CURRENT_VALUE, + FlagSuggestionAttributes.JSON_PROPERTY_DELETED_AT, + FlagSuggestionAttributes.JSON_PROPERTY_DELETED_BY, + FlagSuggestionAttributes.JSON_PROPERTY_ENVIRONMENT_ID, + FlagSuggestionAttributes.JSON_PROPERTY_FEATURE_FLAG_ID, + FlagSuggestionAttributes.JSON_PROPERTY_MESSAGE, + FlagSuggestionAttributes.JSON_PROPERTY_PROPERTY, + FlagSuggestionAttributes.JSON_PROPERTY_SUGGESTION, + FlagSuggestionAttributes.JSON_PROPERTY_SUGGESTION_METADATA, + FlagSuggestionAttributes.JSON_PROPERTY_UPDATED_AT, + FlagSuggestionAttributes.JSON_PROPERTY_UPDATED_BY +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FlagSuggestionAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ACTION = "action"; + private FlagSuggestionAction action; + + public static final String JSON_PROPERTY_BASE_FLAG_HISTORY_ID = "base_flag_history_id"; + private UUID baseFlagHistoryId; + + public static final String JSON_PROPERTY_COMMENT = "comment"; + private JsonNullable comment = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_CREATED_BY = "created_by"; + private UUID createdBy; + + public static final String JSON_PROPERTY_CURRENT_STATUS = "current_status"; + private FlagSuggestionStatus currentStatus; + + public static final String JSON_PROPERTY_CURRENT_VALUE = "current_value"; + private String currentValue; + + public static final String JSON_PROPERTY_DELETED_AT = "deleted_at"; + private JsonNullable deletedAt = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_DELETED_BY = "deleted_by"; + private JsonNullable deletedBy = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_ENVIRONMENT_ID = "environment_id"; + private JsonNullable environmentId = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_FEATURE_FLAG_ID = "feature_flag_id"; + private UUID featureFlagId; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + private String message; + + public static final String JSON_PROPERTY_PROPERTY = "property"; + private FlagSuggestionProperty property; + + public static final String JSON_PROPERTY_SUGGESTION = "suggestion"; + private String suggestion; + + public static final String JSON_PROPERTY_SUGGESTION_METADATA = "suggestion_metadata"; + private SuggestionMetadata suggestionMetadata; + + public static final String JSON_PROPERTY_UPDATED_AT = "updated_at"; + private JsonNullable updatedAt = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_UPDATED_BY = "updated_by"; + private JsonNullable updatedBy = JsonNullable.undefined(); + + public FlagSuggestionAttributes() {} + + @JsonCreator + public FlagSuggestionAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_ACTION) FlagSuggestionAction action, + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt, + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_BY) UUID createdBy, + @JsonProperty(required = true, value = JSON_PROPERTY_CURRENT_STATUS) + FlagSuggestionStatus currentStatus, + @JsonProperty(required = true, value = JSON_PROPERTY_FEATURE_FLAG_ID) UUID featureFlagId, + @JsonProperty(required = true, value = JSON_PROPERTY_PROPERTY) + FlagSuggestionProperty property) { + this.action = action; + this.unparsed |= !action.isValid(); + this.createdAt = createdAt; + this.createdBy = createdBy; + this.currentStatus = currentStatus; + this.unparsed |= !currentStatus.isValid(); + this.featureFlagId = featureFlagId; + this.property = property; + this.unparsed |= !property.isValid(); + } + + public FlagSuggestionAttributes action(FlagSuggestionAction action) { + this.action = action; + this.unparsed |= !action.isValid(); + return this; + } + + /** + * The type of change action for a suggestion. + * + * @return action + */ + @JsonProperty(JSON_PROPERTY_ACTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FlagSuggestionAction getAction() { + return action; + } + + public void setAction(FlagSuggestionAction action) { + if (!action.isValid()) { + this.unparsed = true; + } + this.action = action; + } + + public FlagSuggestionAttributes baseFlagHistoryId(UUID baseFlagHistoryId) { + this.baseFlagHistoryId = baseFlagHistoryId; + return this; + } + + /** + * The flag history version this suggestion was based on. + * + * @return baseFlagHistoryId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_BASE_FLAG_HISTORY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UUID getBaseFlagHistoryId() { + return baseFlagHistoryId; + } + + public void setBaseFlagHistoryId(UUID baseFlagHistoryId) { + this.baseFlagHistoryId = baseFlagHistoryId; + } + + public FlagSuggestionAttributes comment(String comment) { + this.comment = JsonNullable.of(comment); + return this; + } + + /** + * Optional comment from the requester. + * + * @return comment + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getComment() { + return comment.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_COMMENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getComment_JsonNullable() { + return comment; + } + + @JsonProperty(JSON_PROPERTY_COMMENT) + public void setComment_JsonNullable(JsonNullable comment) { + this.comment = comment; + } + + public void setComment(String comment) { + this.comment = JsonNullable.of(comment); + } + + public FlagSuggestionAttributes createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * When the suggestion was created. + * + * @return createdAt + */ + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public FlagSuggestionAttributes createdBy(UUID createdBy) { + this.createdBy = createdBy; + return this; + } + + /** + * UUID of the user who created the suggestion. + * + * @return createdBy + */ + @JsonProperty(JSON_PROPERTY_CREATED_BY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(UUID createdBy) { + this.createdBy = createdBy; + } + + public FlagSuggestionAttributes currentStatus(FlagSuggestionStatus currentStatus) { + this.currentStatus = currentStatus; + this.unparsed |= !currentStatus.isValid(); + return this; + } + + /** + * The status of a flag suggestion. + * + * @return currentStatus + */ + @JsonProperty(JSON_PROPERTY_CURRENT_STATUS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FlagSuggestionStatus getCurrentStatus() { + return currentStatus; + } + + public void setCurrentStatus(FlagSuggestionStatus currentStatus) { + if (!currentStatus.isValid()) { + this.unparsed = true; + } + this.currentStatus = currentStatus; + } + + public FlagSuggestionAttributes currentValue(String currentValue) { + this.currentValue = currentValue; + return this; + } + + /** + * The current value before the suggested change (empty string for flag-level actions like + * archive). + * + * @return currentValue + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CURRENT_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCurrentValue() { + return currentValue; + } + + public void setCurrentValue(String currentValue) { + this.currentValue = currentValue; + } + + public FlagSuggestionAttributes deletedAt(OffsetDateTime deletedAt) { + this.deletedAt = JsonNullable.of(deletedAt); + return this; + } + + /** + * When the suggestion was soft-deleted. + * + * @return deletedAt + */ + @jakarta.annotation.Nullable + @JsonIgnore + public OffsetDateTime getDeletedAt() { + return deletedAt.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DELETED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getDeletedAt_JsonNullable() { + return deletedAt; + } + + @JsonProperty(JSON_PROPERTY_DELETED_AT) + public void setDeletedAt_JsonNullable(JsonNullable deletedAt) { + this.deletedAt = deletedAt; + } + + public void setDeletedAt(OffsetDateTime deletedAt) { + this.deletedAt = JsonNullable.of(deletedAt); + } + + public FlagSuggestionAttributes deletedBy(String deletedBy) { + this.deletedBy = JsonNullable.of(deletedBy); + return this; + } + + /** + * UUID of the user who deleted the suggestion. + * + * @return deletedBy + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getDeletedBy() { + return deletedBy.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DELETED_BY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getDeletedBy_JsonNullable() { + return deletedBy; + } + + @JsonProperty(JSON_PROPERTY_DELETED_BY) + public void setDeletedBy_JsonNullable(JsonNullable deletedBy) { + this.deletedBy = deletedBy; + } + + public void setDeletedBy(String deletedBy) { + this.deletedBy = JsonNullable.of(deletedBy); + } + + public FlagSuggestionAttributes environmentId(String environmentId) { + this.environmentId = JsonNullable.of(environmentId); + return this; + } + + /** + * The environment ID for environment-scoped suggestions. Null for flag-level changes. + * + * @return environmentId + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getEnvironmentId() { + return environmentId.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ENVIRONMENT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getEnvironmentId_JsonNullable() { + return environmentId; + } + + @JsonProperty(JSON_PROPERTY_ENVIRONMENT_ID) + public void setEnvironmentId_JsonNullable(JsonNullable environmentId) { + this.environmentId = environmentId; + } + + public void setEnvironmentId(String environmentId) { + this.environmentId = JsonNullable.of(environmentId); + } + + public FlagSuggestionAttributes featureFlagId(UUID featureFlagId) { + this.featureFlagId = featureFlagId; + return this; + } + + /** + * The ID of the feature flag this suggestion applies to. + * + * @return featureFlagId + */ + @JsonProperty(JSON_PROPERTY_FEATURE_FLAG_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getFeatureFlagId() { + return featureFlagId; + } + + public void setFeatureFlagId(UUID featureFlagId) { + this.featureFlagId = featureFlagId; + } + + public FlagSuggestionAttributes message(String message) { + this.message = message; + return this; + } + + /** + * Human-readable message about the suggestion (populated on auto-created suggestions). + * + * @return message + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public FlagSuggestionAttributes property(FlagSuggestionProperty property) { + this.property = property; + this.unparsed |= !property.isValid(); + return this; + } + + /** + * The flag property being changed. + * + * @return property + */ + @JsonProperty(JSON_PROPERTY_PROPERTY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FlagSuggestionProperty getProperty() { + return property; + } + + public void setProperty(FlagSuggestionProperty property) { + if (!property.isValid()) { + this.unparsed = true; + } + this.property = property; + } + + public FlagSuggestionAttributes suggestion(String suggestion) { + this.suggestion = suggestion; + return this; + } + + /** + * The suggested new value (JSON-encoded for complex properties, empty string for flag-level + * actions like archive). + * + * @return suggestion + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SUGGESTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getSuggestion() { + return suggestion; + } + + public void setSuggestion(String suggestion) { + this.suggestion = suggestion; + } + + public FlagSuggestionAttributes suggestionMetadata(SuggestionMetadata suggestionMetadata) { + this.suggestionMetadata = suggestionMetadata; + this.unparsed |= suggestionMetadata.unparsed; + return this; + } + + /** + * Optional metadata for a suggestion. + * + * @return suggestionMetadata + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SUGGESTION_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public SuggestionMetadata getSuggestionMetadata() { + return suggestionMetadata; + } + + public void setSuggestionMetadata(SuggestionMetadata suggestionMetadata) { + this.suggestionMetadata = suggestionMetadata; + } + + public FlagSuggestionAttributes updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = JsonNullable.of(updatedAt); + return this; + } + + /** + * When the suggestion was last updated. + * + * @return updatedAt + */ + @jakarta.annotation.Nullable + @JsonIgnore + public OffsetDateTime getUpdatedAt() { + return updatedAt.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getUpdatedAt_JsonNullable() { + return updatedAt; + } + + @JsonProperty(JSON_PROPERTY_UPDATED_AT) + public void setUpdatedAt_JsonNullable(JsonNullable updatedAt) { + this.updatedAt = updatedAt; + } + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = JsonNullable.of(updatedAt); + } + + public FlagSuggestionAttributes updatedBy(String updatedBy) { + this.updatedBy = JsonNullable.of(updatedBy); + return this; + } + + /** + * UUID of the user who last updated the suggestion. + * + * @return updatedBy + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getUpdatedBy() { + return updatedBy.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_UPDATED_BY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getUpdatedBy_JsonNullable() { + return updatedBy; + } + + @JsonProperty(JSON_PROPERTY_UPDATED_BY) + public void setUpdatedBy_JsonNullable(JsonNullable updatedBy) { + this.updatedBy = updatedBy; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = JsonNullable.of(updatedBy); + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return FlagSuggestionAttributes + */ + @JsonAnySetter + public FlagSuggestionAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this FlagSuggestionAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FlagSuggestionAttributes flagSuggestionAttributes = (FlagSuggestionAttributes) o; + return Objects.equals(this.action, flagSuggestionAttributes.action) + && Objects.equals(this.baseFlagHistoryId, flagSuggestionAttributes.baseFlagHistoryId) + && Objects.equals(this.comment, flagSuggestionAttributes.comment) + && Objects.equals(this.createdAt, flagSuggestionAttributes.createdAt) + && Objects.equals(this.createdBy, flagSuggestionAttributes.createdBy) + && Objects.equals(this.currentStatus, flagSuggestionAttributes.currentStatus) + && Objects.equals(this.currentValue, flagSuggestionAttributes.currentValue) + && Objects.equals(this.deletedAt, flagSuggestionAttributes.deletedAt) + && Objects.equals(this.deletedBy, flagSuggestionAttributes.deletedBy) + && Objects.equals(this.environmentId, flagSuggestionAttributes.environmentId) + && Objects.equals(this.featureFlagId, flagSuggestionAttributes.featureFlagId) + && Objects.equals(this.message, flagSuggestionAttributes.message) + && Objects.equals(this.property, flagSuggestionAttributes.property) + && Objects.equals(this.suggestion, flagSuggestionAttributes.suggestion) + && Objects.equals(this.suggestionMetadata, flagSuggestionAttributes.suggestionMetadata) + && Objects.equals(this.updatedAt, flagSuggestionAttributes.updatedAt) + && Objects.equals(this.updatedBy, flagSuggestionAttributes.updatedBy) + && Objects.equals(this.additionalProperties, flagSuggestionAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + action, + baseFlagHistoryId, + comment, + createdAt, + createdBy, + currentStatus, + currentValue, + deletedAt, + deletedBy, + environmentId, + featureFlagId, + message, + property, + suggestion, + suggestionMetadata, + updatedAt, + updatedBy, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FlagSuggestionAttributes {\n"); + sb.append(" action: ").append(toIndentedString(action)).append("\n"); + sb.append(" baseFlagHistoryId: ").append(toIndentedString(baseFlagHistoryId)).append("\n"); + sb.append(" comment: ").append(toIndentedString(comment)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); + sb.append(" currentStatus: ").append(toIndentedString(currentStatus)).append("\n"); + sb.append(" currentValue: ").append(toIndentedString(currentValue)).append("\n"); + sb.append(" deletedAt: ").append(toIndentedString(deletedAt)).append("\n"); + sb.append(" deletedBy: ").append(toIndentedString(deletedBy)).append("\n"); + sb.append(" environmentId: ").append(toIndentedString(environmentId)).append("\n"); + sb.append(" featureFlagId: ").append(toIndentedString(featureFlagId)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" property: ").append(toIndentedString(property)).append("\n"); + sb.append(" suggestion: ").append(toIndentedString(suggestion)).append("\n"); + sb.append(" suggestionMetadata: ").append(toIndentedString(suggestionMetadata)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" updatedBy: ").append(toIndentedString(updatedBy)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FlagSuggestionDataType.java b/src/main/java/com/datadog/api/client/v2/model/FlagSuggestionDataType.java new file mode 100644 index 00000000000..df14b382c9b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FlagSuggestionDataType.java @@ -0,0 +1,57 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Flag suggestions resource type. */ +@JsonSerialize(using = FlagSuggestionDataType.FlagSuggestionDataTypeSerializer.class) +public class FlagSuggestionDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("flag-suggestions")); + + public static final FlagSuggestionDataType FLAG_SUGGESTIONS = + new FlagSuggestionDataType("flag-suggestions"); + + FlagSuggestionDataType(String value) { + super(value, allowedValues); + } + + public static class FlagSuggestionDataTypeSerializer + extends StdSerializer { + public FlagSuggestionDataTypeSerializer(Class t) { + super(t); + } + + public FlagSuggestionDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + FlagSuggestionDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static FlagSuggestionDataType fromValue(String value) { + return new FlagSuggestionDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FlagSuggestionEventDataType.java b/src/main/java/com/datadog/api/client/v2/model/FlagSuggestionEventDataType.java new file mode 100644 index 00000000000..0465420a377 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FlagSuggestionEventDataType.java @@ -0,0 +1,57 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Flag suggestion events resource type. */ +@JsonSerialize(using = FlagSuggestionEventDataType.FlagSuggestionEventDataTypeSerializer.class) +public class FlagSuggestionEventDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("flag-suggestion-events")); + + public static final FlagSuggestionEventDataType FLAG_SUGGESTION_EVENTS = + new FlagSuggestionEventDataType("flag-suggestion-events"); + + FlagSuggestionEventDataType(String value) { + super(value, allowedValues); + } + + public static class FlagSuggestionEventDataTypeSerializer + extends StdSerializer { + public FlagSuggestionEventDataTypeSerializer(Class t) { + super(t); + } + + public FlagSuggestionEventDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + FlagSuggestionEventDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static FlagSuggestionEventDataType fromValue(String value) { + return new FlagSuggestionEventDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FlagSuggestionProperty.java b/src/main/java/com/datadog/api/client/v2/model/FlagSuggestionProperty.java new file mode 100644 index 00000000000..546f7dcc9b7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FlagSuggestionProperty.java @@ -0,0 +1,91 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The flag property being changed. */ +@JsonSerialize(using = FlagSuggestionProperty.FlagSuggestionPropertySerializer.class) +public class FlagSuggestionProperty extends ModelEnum { + + private static final Set allowedValues = + new HashSet( + Arrays.asList( + "FLAG", + "FLAG_NAME", + "FLAG_DESCRIPTION", + "JSON_SCHEMA", + "DISTRIBUTION_CHANNEL", + "VARIANT", + "VARIANT_NAME", + "VARIANT_VALUE", + "ALLOCATIONS", + "ROLLOUT", + "ENVIRONMENT_STATUS", + "DEFAULT_VARIANT", + "OVERRIDE_VARIANT")); + + public static final FlagSuggestionProperty FLAG = new FlagSuggestionProperty("FLAG"); + public static final FlagSuggestionProperty FLAG_NAME = new FlagSuggestionProperty("FLAG_NAME"); + public static final FlagSuggestionProperty FLAG_DESCRIPTION = + new FlagSuggestionProperty("FLAG_DESCRIPTION"); + public static final FlagSuggestionProperty JSON_SCHEMA = + new FlagSuggestionProperty("JSON_SCHEMA"); + public static final FlagSuggestionProperty DISTRIBUTION_CHANNEL = + new FlagSuggestionProperty("DISTRIBUTION_CHANNEL"); + public static final FlagSuggestionProperty VARIANT = new FlagSuggestionProperty("VARIANT"); + public static final FlagSuggestionProperty VARIANT_NAME = + new FlagSuggestionProperty("VARIANT_NAME"); + public static final FlagSuggestionProperty VARIANT_VALUE = + new FlagSuggestionProperty("VARIANT_VALUE"); + public static final FlagSuggestionProperty ALLOCATIONS = + new FlagSuggestionProperty("ALLOCATIONS"); + public static final FlagSuggestionProperty ROLLOUT = new FlagSuggestionProperty("ROLLOUT"); + public static final FlagSuggestionProperty ENVIRONMENT_STATUS = + new FlagSuggestionProperty("ENVIRONMENT_STATUS"); + public static final FlagSuggestionProperty DEFAULT_VARIANT = + new FlagSuggestionProperty("DEFAULT_VARIANT"); + public static final FlagSuggestionProperty OVERRIDE_VARIANT = + new FlagSuggestionProperty("OVERRIDE_VARIANT"); + + FlagSuggestionProperty(String value) { + super(value, allowedValues); + } + + public static class FlagSuggestionPropertySerializer + extends StdSerializer { + public FlagSuggestionPropertySerializer(Class t) { + super(t); + } + + public FlagSuggestionPropertySerializer() { + this(null); + } + + @Override + public void serialize( + FlagSuggestionProperty value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static FlagSuggestionProperty fromValue(String value) { + return new FlagSuggestionProperty(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FlagSuggestionResponse.java b/src/main/java/com/datadog/api/client/v2/model/FlagSuggestionResponse.java new file mode 100644 index 00000000000..63a613985e3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FlagSuggestionResponse.java @@ -0,0 +1,145 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Response containing a flag suggestion. */ +@JsonPropertyOrder({FlagSuggestionResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FlagSuggestionResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private FlagSuggestion data; + + public FlagSuggestionResponse() {} + + @JsonCreator + public FlagSuggestionResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) FlagSuggestion data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public FlagSuggestionResponse data(FlagSuggestion data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * A flag change suggestion. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FlagSuggestion getData() { + return data; + } + + public void setData(FlagSuggestion data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return FlagSuggestionResponse + */ + @JsonAnySetter + public FlagSuggestionResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this FlagSuggestionResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FlagSuggestionResponse flagSuggestionResponse = (FlagSuggestionResponse) o; + return Objects.equals(this.data, flagSuggestionResponse.data) + && Objects.equals(this.additionalProperties, flagSuggestionResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FlagSuggestionResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FlagSuggestionStatus.java b/src/main/java/com/datadog/api/client/v2/model/FlagSuggestionStatus.java new file mode 100644 index 00000000000..e8da1517d59 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FlagSuggestionStatus.java @@ -0,0 +1,57 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The status of a flag suggestion. */ +@JsonSerialize(using = FlagSuggestionStatus.FlagSuggestionStatusSerializer.class) +public class FlagSuggestionStatus extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("pending", "rejected", "approved")); + + public static final FlagSuggestionStatus PENDING = new FlagSuggestionStatus("pending"); + public static final FlagSuggestionStatus REJECTED = new FlagSuggestionStatus("rejected"); + public static final FlagSuggestionStatus APPROVED = new FlagSuggestionStatus("approved"); + + FlagSuggestionStatus(String value) { + super(value, allowedValues); + } + + public static class FlagSuggestionStatusSerializer extends StdSerializer { + public FlagSuggestionStatusSerializer(Class t) { + super(t); + } + + public FlagSuggestionStatusSerializer() { + this(null); + } + + @Override + public void serialize( + FlagSuggestionStatus value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static FlagSuggestionStatus fromValue(String value) { + return new FlagSuggestionStatus(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ReviewFlagSuggestionAttributes.java b/src/main/java/com/datadog/api/client/v2/model/ReviewFlagSuggestionAttributes.java new file mode 100644 index 00000000000..2a6ffb034ff --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ReviewFlagSuggestionAttributes.java @@ -0,0 +1,137 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Attributes for reviewing a flag suggestion. */ +@JsonPropertyOrder({ReviewFlagSuggestionAttributes.JSON_PROPERTY_COMMENT}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ReviewFlagSuggestionAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_COMMENT = "comment"; + private String comment; + + public ReviewFlagSuggestionAttributes comment(String comment) { + this.comment = comment; + return this; + } + + /** + * Optional comment from the reviewer. + * + * @return comment + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_COMMENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getComment() { + return comment; + } + + public void setComment(String comment) { + this.comment = comment; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ReviewFlagSuggestionAttributes + */ + @JsonAnySetter + public ReviewFlagSuggestionAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ReviewFlagSuggestionAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReviewFlagSuggestionAttributes reviewFlagSuggestionAttributes = + (ReviewFlagSuggestionAttributes) o; + return Objects.equals(this.comment, reviewFlagSuggestionAttributes.comment) + && Objects.equals( + this.additionalProperties, reviewFlagSuggestionAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(comment, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReviewFlagSuggestionAttributes {\n"); + sb.append(" comment: ").append(toIndentedString(comment)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ReviewFlagSuggestionData.java b/src/main/java/com/datadog/api/client/v2/model/ReviewFlagSuggestionData.java new file mode 100644 index 00000000000..37132966f11 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ReviewFlagSuggestionData.java @@ -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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Data for reviewing a flag suggestion. */ +@JsonPropertyOrder({ + ReviewFlagSuggestionData.JSON_PROPERTY_ATTRIBUTES, + ReviewFlagSuggestionData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ReviewFlagSuggestionData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private ReviewFlagSuggestionAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private FlagSuggestionEventDataType type; + + public ReviewFlagSuggestionData() {} + + @JsonCreator + public ReviewFlagSuggestionData( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) FlagSuggestionEventDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public ReviewFlagSuggestionData attributes(ReviewFlagSuggestionAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for reviewing a flag suggestion. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ReviewFlagSuggestionAttributes getAttributes() { + return attributes; + } + + public void setAttributes(ReviewFlagSuggestionAttributes attributes) { + this.attributes = attributes; + } + + public ReviewFlagSuggestionData type(FlagSuggestionEventDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Flag suggestion events resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FlagSuggestionEventDataType getType() { + return type; + } + + public void setType(FlagSuggestionEventDataType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ReviewFlagSuggestionData + */ + @JsonAnySetter + public ReviewFlagSuggestionData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ReviewFlagSuggestionData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReviewFlagSuggestionData reviewFlagSuggestionData = (ReviewFlagSuggestionData) o; + return Objects.equals(this.attributes, reviewFlagSuggestionData.attributes) + && Objects.equals(this.type, reviewFlagSuggestionData.type) + && Objects.equals(this.additionalProperties, reviewFlagSuggestionData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReviewFlagSuggestionData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ReviewFlagSuggestionRequest.java b/src/main/java/com/datadog/api/client/v2/model/ReviewFlagSuggestionRequest.java new file mode 100644 index 00000000000..635cf8cb5e0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ReviewFlagSuggestionRequest.java @@ -0,0 +1,146 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Request to approve or reject a flag suggestion. */ +@JsonPropertyOrder({ReviewFlagSuggestionRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ReviewFlagSuggestionRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private ReviewFlagSuggestionData data; + + public ReviewFlagSuggestionRequest() {} + + @JsonCreator + public ReviewFlagSuggestionRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) ReviewFlagSuggestionData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public ReviewFlagSuggestionRequest data(ReviewFlagSuggestionData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data for reviewing a flag suggestion. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ReviewFlagSuggestionData getData() { + return data; + } + + public void setData(ReviewFlagSuggestionData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ReviewFlagSuggestionRequest + */ + @JsonAnySetter + public ReviewFlagSuggestionRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ReviewFlagSuggestionRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReviewFlagSuggestionRequest reviewFlagSuggestionRequest = (ReviewFlagSuggestionRequest) o; + return Objects.equals(this.data, reviewFlagSuggestionRequest.data) + && Objects.equals( + this.additionalProperties, reviewFlagSuggestionRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReviewFlagSuggestionRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SuggestionMetadata.java b/src/main/java/com/datadog/api/client/v2/model/SuggestionMetadata.java new file mode 100644 index 00000000000..bb6dd02e0c2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SuggestionMetadata.java @@ -0,0 +1,135 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Optional metadata for a suggestion. */ +@JsonPropertyOrder({SuggestionMetadata.JSON_PROPERTY_VARIANT_ID}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SuggestionMetadata { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_VARIANT_ID = "variant_id"; + private String variantId; + + public SuggestionMetadata variantId(String variantId) { + this.variantId = variantId; + return this; + } + + /** + * Variant ID for variant delete suggestions. + * + * @return variantId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_VARIANT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getVariantId() { + return variantId; + } + + public void setVariantId(String variantId) { + this.variantId = variantId; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return SuggestionMetadata + */ + @JsonAnySetter + public SuggestionMetadata putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this SuggestionMetadata object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SuggestionMetadata suggestionMetadata = (SuggestionMetadata) o; + return Objects.equals(this.variantId, suggestionMetadata.variantId) + && Objects.equals(this.additionalProperties, suggestionMetadata.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(variantId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SuggestionMetadata {\n"); + sb.append(" variantId: ").append(toIndentedString(variantId)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/feature_flags.feature b/src/test/resources/com/datadog/api/client/v2/api/feature_flags.feature index fd2ff16520c..b2642c78ca5 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/feature_flags.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/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/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index bbfa27e028c..eae2df8f1b8 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/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": {