diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 0b3f1b043af..6304211b52d 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -2775,6 +2775,15 @@ components: example: "550e8400-e29b-41d4-a716-446655440000" format: uuid type: string + suggestion_id: + description: The ID of the feature flag change suggestion. + in: path + name: suggestion_id + required: true + schema: + example: "550e8400-e29b-41d4-a716-446655440020" + format: uuid + type: string variant_id: description: The ID of the variant. in: path @@ -2804,6 +2813,14 @@ components: schema: $ref: "#/components/schemas/APIErrorResponse" description: Conflict + FeatureFlagSuggestionCreated: + content: + application/json: + schema: + $ref: "#/components/schemas/FeatureFlagSuggestionResponse" + description: Created - Approval is required. A suggestion was created and the change has not been applied. + FeatureFlagSuggestionCreatedWithoutSchema: + description: Created - Approval is required. A suggestion was created and the change has not been applied. FindingsBadRequestResponse: content: application/json: @@ -15450,6 +15467,37 @@ components: $ref: "#/components/schemas/ApplicationSecurityWafExclusionFilterResource" type: array type: object + ApproveFlagSuggestionAttributes: + description: Approval options for the suggestion. + properties: + apply: + default: true + description: |- + Whether to apply the change immediately. Set to `false` to approve without applying, then + call `ApplyFlagSuggestion` later. + example: false + type: boolean + comment: + description: A comment explaining the approval. + example: Approved for rollout. + type: string + type: object + ApproveFlagSuggestionData: + description: The approval event to create. + properties: + attributes: + $ref: "#/components/schemas/ApproveFlagSuggestionAttributes" + type: + $ref: "#/components/schemas/ReviewFlagSuggestionDataType" + required: [type, attributes] + type: object + ApproveFlagSuggestionRequest: + description: Request to approve a feature flag change suggestion. + properties: + data: + $ref: "#/components/schemas/ApproveFlagSuggestionData" + required: [data] + type: object AppsSortField: description: "The field and direction to sort apps by" enum: @@ -31438,6 +31486,62 @@ components: x-enum-varnames: - ACTIVE - PERMANENT + CreateFlagSuggestionAttributes: + description: Attributes for creating a feature flag change suggestion. + properties: + action: + description: The action proposed by the suggestion. + example: updated + type: string + comment: + description: A comment explaining the proposed change. + example: Restrict this flag to server applications. + type: string + environment_id: + description: |- + The ID of the target environment. Required for `ALLOCATIONS`, `DEFAULT_VARIANT`, and + `OVERRIDE_VARIANT` changes. + example: "550e8400-e29b-41d4-a716-446655440001" + format: uuid + type: string + notification_rule_targets: + description: |- + Handles to notify about the review, without the `@` prefix. For example, an email address + or a Slack channel name. + example: [requester@example.com] + items: + description: A notification handle. + type: string + minItems: 1 + type: array + property: + description: The property to change. The property must require approval for this flag and environment. + example: DISTRIBUTION_CHANNEL + type: string + suggestion: + description: The proposed value as a string. For structured values, supply a JSON-encoded string. + example: SERVER + type: string + suggestion_metadata: + $ref: "#/components/schemas/FeatureFlagSuggestionMetadataRequest" + required: [action, property, notification_rule_targets] + type: object + CreateFlagSuggestionData: + description: The suggestion to create. + properties: + attributes: + $ref: "#/components/schemas/CreateFlagSuggestionAttributes" + type: + $ref: "#/components/schemas/FeatureFlagSuggestionDataType" + required: [type, attributes] + type: object + CreateFlagSuggestionRequest: + description: Request to create a feature flag change suggestion. + properties: + data: + $ref: "#/components/schemas/CreateFlagSuggestionData" + required: [data] + type: object CreateFormData: description: The data for creating a form. properties: @@ -56648,6 +56752,63 @@ components: - type - attributes type: object + FeatureFlagApprovalRequired: + description: A proposed change requiring explicit submission through `CreateFlagSuggestion`. + properties: + attributes: + $ref: "#/components/schemas/FeatureFlagApprovalRequiredAttributes" + id: + description: The ID of the feature flag. This is not a suggestion ID. + example: "550e8400-e29b-41d4-a716-446655440000" + format: uuid + type: string + type: + $ref: "#/components/schemas/FeatureFlagApprovalRequiredDataType" + required: [id, type, attributes] + type: object + FeatureFlagApprovalRequiredAttributes: + description: The change to submit for approval. + properties: + action: + description: The proposed action. + example: updated + type: string + environment_id: + description: The ID of the environment targeted by the change. + example: "550e8400-e29b-41d4-a716-446655440001" + format: uuid + type: string + property: + description: The feature flag property to change. + example: ALLOCATIONS + type: string + suggestion: + description: The proposed value, serialized as a string. Allocation sets are JSON-encoded strings. + example: "[]" + type: string + suggestion_metadata: + $ref: "#/components/schemas/FeatureFlagSuggestionMetadata" + required: [property, action, suggestion] + type: object + FeatureFlagApprovalRequiredDataType: + description: The resource type for an approval-required response. + enum: [approval-required] + example: approval-required + type: string + x-enum-varnames: [APPROVAL_REQUIRED] + FeatureFlagApprovalRequiredResponse: + description: Approval-required response containing a proposed change. No suggestion has been persisted. + properties: + data: + $ref: "#/components/schemas/FeatureFlagApprovalRequired" + required: [data] + type: object + FeatureFlagApprovalsDataType: + description: The resource type for feature flag approval settings. + enum: [feature-flag-approvals] + example: feature-flag-approvals + type: string + x-enum-varnames: [FEATURE_FLAG_APPROVALS] FeatureFlagAttributes: description: Attributes of a feature flag. properties: @@ -56709,7 +56870,11 @@ components: staleness_details: $ref: "#/components/schemas/FeatureFlagStalenessDetails" staleness_status: - description: Indicates the whether a feature flag is stale or not. + deprecated: true + description: |- + Legacy status retained for compatibility. This field is always `ACTIVE`; use + `staleness_details.staleness_status` for the computed status. Do not copy it into an update + request: sending `ACTIVE` makes a `PERMANENT` flag temporary and clears any snooze. example: "ACTIVE" type: string staleness_status_override: @@ -56962,7 +57127,10 @@ components: $ref: "#/components/schemas/FeatureFlagStalenessDetails" staleness_status: deprecated: true - description: Legacy status retained for compatibility. This field is always `ACTIVE`; use `staleness_details.staleness_status` for the computed status. + description: |- + Legacy status retained for compatibility. This field is always `ACTIVE`; use + `staleness_details.staleness_status` for the computed status. Do not copy it into an update + request: sending `ACTIVE` makes a `PERMANENT` flag temporary and clears any snooze. example: "ACTIVE" type: string staleness_status_override: @@ -57118,6 +57286,189 @@ components: x-enum-varnames: - ENABLED - DISABLED + FeatureFlagSuggestion: + description: A proposed feature flag change and its approval lifecycle. + properties: + attributes: + $ref: "#/components/schemas/FeatureFlagSuggestionAttributes" + id: + description: The unique identifier of the suggestion. + example: "550e8400-e29b-41d4-a716-446655440020" + format: uuid + type: string + type: + $ref: "#/components/schemas/FeatureFlagSuggestionDataType" + required: + - id + - type + - attributes + type: object + FeatureFlagSuggestionAttributes: + description: Attributes of a feature flag change suggestion. + properties: + action: + description: The action proposed by the suggestion. + example: updated + type: string + base_flag_history_id: + description: The ID of the flag history entry on which the suggestion is based. + example: "550e8400-e29b-41d4-a716-446655440021" + format: uuid + type: string + comment: + description: The comment supplied by the suggestion's creator. + example: Restrict this flag to server applications. + type: string + created_at: + description: The timestamp when the suggestion was created. + example: "2024-01-01T00:00:00Z" + format: date-time + type: string + created_by: + description: The ID of the user who created the suggestion. + example: "550e8400-e29b-41d4-a716-446655440010" + format: uuid + type: string + current_status: + $ref: "#/components/schemas/FeatureFlagSuggestionAttributesCurrentStatus" + current_value: + description: The value before the proposed change, serialized as a string. + example: ALL + type: string + deleted_at: + description: The timestamp when the suggestion was deleted. + example: "2024-01-02T00:00:00Z" + format: date-time + type: string + deleted_by: + description: The ID of the user who deleted the suggestion. + example: "550e8400-e29b-41d4-a716-446655440011" + format: uuid + type: string + environment_id: + description: The ID of the environment targeted by the change, if the change is environment-specific. + example: "550e8400-e29b-41d4-a716-446655440001" + format: uuid + type: string + feature_flag_id: + description: The ID of the feature flag that the suggestion changes. + example: "550e8400-e29b-41d4-a716-446655440000" + format: uuid + type: string + lifecycle_status: + $ref: "#/components/schemas/FeatureFlagSuggestionAttributesLifecycleStatus" + message: + description: A message explaining why a suggestion was created. + example: This flag requires approval for this change. A suggestion has been created and is pending review. + type: string + property: + description: The feature flag property to update. + example: DISTRIBUTION_CHANNEL + type: string + suggestion: + description: |- + The proposed value, serialized as a string. Structured values, such as variants and allocations, + are JSON-encoded strings. + example: SERVER + type: string + suggestion_metadata: + $ref: "#/components/schemas/FeatureFlagSuggestionMetadata" + updated_at: + description: The timestamp when the suggestion was last updated. + example: "2024-01-02T00:00:00Z" + format: date-time + type: string + updated_by: + description: The ID of the user who last updated the suggestion. + example: "550e8400-e29b-41d4-a716-446655440011" + format: uuid + type: string + required: + - created_at + - created_by + - feature_flag_id + - base_flag_history_id + - current_status + - lifecycle_status + - action + - property + - suggestion + - current_value + type: object + FeatureFlagSuggestionAttributesCurrentStatus: + description: The legacy review status. Use `lifecycle_status` to distinguish approval from application. + enum: [pending, approved, rejected] + example: pending + type: string + x-enum-varnames: [PENDING, APPROVED, REJECTED] + FeatureFlagSuggestionAttributesLifecycleStatus: + description: The lifecycle status of the suggestion. + enum: [pending, approved, applied, rejected, discarded] + example: pending + type: string + x-enum-varnames: [PENDING, APPROVED, APPLIED, REJECTED, DISCARDED] + FeatureFlagSuggestionDataType: + description: The resource type for feature flag suggestions. + enum: + - flag-suggestions + example: flag-suggestions + type: string + x-enum-varnames: + - FLAG_SUGGESTIONS + FeatureFlagSuggestionExperimentAction: + description: Server-generated reference to an experiment action requiring approval. + properties: + action: + description: The proposed experiment action. + example: start + type: string + experiment_id: + description: The ID of the experiment. + example: "550e8400-e29b-41d4-a716-446655440030" + format: uuid + type: string + version: + description: The version of the experiment action reference. + example: 1 + format: int64 + type: integer + required: [experiment_id, action, version] + type: object + FeatureFlagSuggestionMetadata: + description: Metadata associated with a suggestion. Fields other than `variant_id` are set by the server. + properties: + allow_draft_reorder: + description: Whether the server allows this allocation suggestion to reorder persisted drafts. + example: false + type: boolean + experiment_action: + $ref: "#/components/schemas/FeatureFlagSuggestionExperimentAction" + experiment_action_request_fingerprint: + description: Server-generated fingerprint of the experiment action request. + type: string + variant_id: + description: The ID of the variant targeted by the suggestion. + example: "550e8400-e29b-41d4-a716-446655440002" + format: uuid + type: string + type: object + FeatureFlagSuggestionMetadataRequest: + description: Client-settable metadata for a suggestion. + properties: + variant_id: + description: The ID of the variant targeted by the suggestion. + example: "550e8400-e29b-41d4-a716-446655440002" + format: uuid + type: string + type: object + FeatureFlagSuggestionResponse: + description: Response containing a feature flag change suggestion. + properties: + data: + $ref: "#/components/schemas/FeatureFlagSuggestion" + required: + - data + type: object FeatureFlagsPaginationLinks: description: Pagination links. Follow `next` with the same authentication to retrieve the next page. Links use `page[limit]` and `page[offset]` and preserve the filters. Navigation links are omitted when not applicable. properties: @@ -112078,6 +112429,30 @@ components: data: $ref: "#/components/schemas/AppKeyRegistrationData" type: object + RejectFlagSuggestionAttributes: + description: Rejection options for the suggestion. + properties: + comment: + description: A comment explaining the rejection. + example: Keep the existing configuration. + type: string + type: object + RejectFlagSuggestionData: + description: The rejection event to create. + properties: + attributes: + $ref: "#/components/schemas/RejectFlagSuggestionAttributes" + type: + $ref: "#/components/schemas/ReviewFlagSuggestionDataType" + required: [type, attributes] + type: object + RejectFlagSuggestionRequest: + description: Request to reject a feature flag change suggestion. + properties: + data: + $ref: "#/components/schemas/RejectFlagSuggestionData" + required: [data] + type: object RelationAttributes: description: Relation attributes. properties: @@ -114522,6 +114897,12 @@ components: description: Target revision ID to revert to type: string type: object + ReviewFlagSuggestionDataType: + description: The resource type for reviewing feature flag suggestions. + enum: [flag-suggestion-events] + example: flag-suggestion-events + type: string + x-enum-varnames: [FLAG_SUGGESTION_EVENTS] Role: description: Role object returned by the API. properties: @@ -149928,6 +150309,31 @@ components: required: - data type: object + UpdateFeatureFlagApprovalsAttributes: + description: The approval requirement for the flag. + properties: + enabled: + description: Whether approval is required. Disabling requires the Feature Flag Approvals Override permission. + example: true + type: boolean + required: [enabled] + type: object + UpdateFeatureFlagApprovalsData: + description: The feature flag approval setting to update. + properties: + attributes: + $ref: "#/components/schemas/UpdateFeatureFlagApprovalsAttributes" + type: + $ref: "#/components/schemas/FeatureFlagApprovalsDataType" + required: [type, attributes] + type: object + UpdateFeatureFlagApprovalsRequest: + description: Request to change whether a feature flag requires approval. + properties: + data: + $ref: "#/components/schemas/UpdateFeatureFlagApprovalsData" + required: [data] + type: object UpdateFeatureFlagAttributes: description: Attributes for updating a feature flag. properties: @@ -149935,6 +150341,8 @@ components: description: The description of the feature flag. example: "Updated description for feature flag XYZ789" type: string + distribution_channel: + $ref: "#/components/schemas/FeatureFlagDistributionChannel" json_schema: description: JSON schema for validation when value_type is JSON. example: '{"type": "object", "properties": {"enabled": {"type": "boolean"}}}' @@ -149944,6 +150352,8 @@ components: description: The name of the feature flag. example: "Updated Feature Flag XYZ789" type: string + staleness_status: + $ref: "#/components/schemas/UpdateFeatureFlagStalenessStatus" tags: description: |- Tags associated with the feature flag. This field replaces the full set of @@ -149985,6 +150395,20 @@ components: required: - data type: object + UpdateFeatureFlagStalenessStatus: + description: |- + The lifecycle to set. `ACTIVE` makes the flag temporary; `PERMANENT` excludes it from + staleness detection. Either value clears any snooze; omit the field to keep the lifecycle. + Do not copy the top-level `staleness_status` from a response into this field: that legacy + response field is always `ACTIVE`. + enum: + - ACTIVE + - PERMANENT + example: "PERMANENT" + type: string + x-enum-varnames: + - ACTIVE + - PERMANENT UpdateFlakyTestsRequest: description: Request to update the state of multiple flaky tests. properties: @@ -187419,6 +187843,402 @@ paths: operator: AND permissions: - feature_flag_config_write + /api/v2/feature-flags/suggestions/{suggestion_id}: + delete: + description: |- + Deletes a pending suggestion or discards an approved suggestion that has not been + applied. Requires editor access to the flag, or contributor access for the suggestion's + creator. Applied and rejected suggestions return `409 Conflict`. A missing or already + discarded suggestion returns `204 No Content`. + operationId: DeleteFlagSuggestion + parameters: + - $ref: "#/components/parameters/suggestion_id" + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request - Invalid request parameters or body. + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Conflict - Applied or rejected suggestions cannot be deleted. + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - feature_flag_config_write + - feature_flag_environment_config_read + summary: Delete or discard a flag change suggestion + tags: + - Feature Flags + x-permission: + operator: AND + permissions: + - feature_flag_config_write + - feature_flag_environment_config_read + get: + description: |- + Returns a feature flag change suggestion by ID. Use `lifecycle_status` to distinguish + pending, approved, applied, rejected, and discarded suggestions. An approved suggestion + has not yet been applied; an applied suggestion has changed the flag. + operationId: GetFlagSuggestion + parameters: + - $ref: "#/components/parameters/suggestion_id" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + action: updated + base_flag_history_id: 550e8400-e29b-41d4-a716-446655440021 + comment: Restrict this flag to server applications. + created_at: "2024-01-01T00:00:00Z" + created_by: 550e8400-e29b-41d4-a716-446655440010 + current_status: pending + current_value: ALL + feature_flag_id: 550e8400-e29b-41d4-a716-446655440000 + lifecycle_status: pending + property: DISTRIBUTION_CHANNEL + suggestion: SERVER + id: 550e8400-e29b-41d4-a716-446655440020 + type: flag-suggestions + schema: + $ref: "#/components/schemas/FeatureFlagSuggestionResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request - Invalid request parameters or body. + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - feature_flag_config_write + - feature_flag_environment_config_read + summary: Get a flag change 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}/apply: + post: + description: |- + Applies a previously approved feature flag change suggestion. Requires contributor or + editor access to the flag. Pending, rejected, or discarded suggestions return `409 Conflict`. + An already applied suggestion also returns `409 Conflict`, except that retrying an applied + experiment action succeeds. This endpoint does not require a request body. + + When an `ALLOCATIONS` suggestion is applied, either by this endpoint or by an approval that applies it, + each exposure schedule with `autostart` set to `true`, no `absolute_start_time`, and no future + `scheduled_start_time` starts at apply time. This includes a schedule that is already running, so a + suggestion that omits its `absolute_start_time` restarts its rollout. If its `selection_interval_ms` is + greater than `0`, every step except the last uses that interval. An `absolute_start_time` in the + suggestion is kept, including one set by the allocations request that built the suggestion, so time spent + waiting for approval counts toward its rollout steps. + Schedules with `apm_retention`, in the suggestion or on the saved schedule, are the exception: apply does + not start them, and they start only through the exposure schedule start endpoint. When the suggestion omits + `apm_retention` or `absolute_start_time` for a saved schedule with `apm_retention`, apply keeps the saved + values, so a running schedule keeps its start, unless the suggestion changes its rollout strategy, which + stops it. + operationId: ApplyFlagSuggestion + parameters: + - $ref: "#/components/parameters/suggestion_id" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + action: updated + base_flag_history_id: 550e8400-e29b-41d4-a716-446655440021 + comment: Restrict this flag to server applications. + created_at: "2024-01-01T00:00:00Z" + created_by: 550e8400-e29b-41d4-a716-446655440010 + current_status: approved + current_value: ALL + feature_flag_id: 550e8400-e29b-41d4-a716-446655440000 + lifecycle_status: applied + property: DISTRIBUTION_CHANNEL + suggestion: SERVER + updated_at: "2024-01-02T00:00:00Z" + updated_by: 550e8400-e29b-41d4-a716-446655440011 + id: 550e8400-e29b-41d4-a716-446655440020 + type: flag-suggestions + schema: + $ref: "#/components/schemas/FeatureFlagSuggestionResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request - Invalid request parameters or body. + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: |- + Conflict - The suggestion is not approved or the proposed change conflicts with current configuration. + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - feature_flag_config_write + - feature_flag_environment_config_read + summary: Apply an approved flag change 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: |- + Approves a feature flag change suggestion and applies the change immediately by default. + Set `apply` to `false` to approve without applying, then call `ApplyFlagSuggestion` later. + Until it is applied or deleted, an approved suggestion still blocks conflicting changes. + Requires editor access to the flag or the Feature Flag Approvals Override permission. + A creator cannot approve their own suggestion unless they have override permission. + Applied or discarded suggestions return `409 Conflict`. Retrying approval of an already + applied experiment action with `apply` set to `true` succeeds. + operationId: ApproveFlagSuggestion + parameters: + - $ref: "#/components/parameters/suggestion_id" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + apply: false + comment: Approved for rollout. + type: flag-suggestion-events + schema: + $ref: "#/components/schemas/ApproveFlagSuggestionRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + action: updated + base_flag_history_id: 550e8400-e29b-41d4-a716-446655440021 + comment: Restrict this flag to server applications. + created_at: "2024-01-01T00:00:00Z" + created_by: 550e8400-e29b-41d4-a716-446655440010 + current_status: pending + current_value: ALL + feature_flag_id: 550e8400-e29b-41d4-a716-446655440000 + lifecycle_status: approved + property: DISTRIBUTION_CHANNEL + suggestion: SERVER + updated_at: "2024-01-02T00:00:00Z" + updated_by: 550e8400-e29b-41d4-a716-446655440011 + id: 550e8400-e29b-41d4-a716-446655440020 + type: flag-suggestions + schema: + $ref: "#/components/schemas/FeatureFlagSuggestionResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request - Invalid request parameters or body. + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: |- + Conflict - The suggestion is already applied or discarded, or the proposed change conflicts with current configuration. + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - feature_flag_config_write + - feature_flag_environment_config_read + summary: Approve a flag change 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: |- + Rejects a pending feature flag change suggestion without applying the change. Requires + editor access to the flag or the Feature Flag Approvals Override permission. Rejecting + an already rejected suggestion succeeds. Approved, applied, or discarded suggestions + return `409 Conflict`. + operationId: RejectFlagSuggestion + parameters: + - $ref: "#/components/parameters/suggestion_id" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + comment: Keep the existing configuration. + type: flag-suggestion-events + schema: + $ref: "#/components/schemas/RejectFlagSuggestionRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + action: updated + base_flag_history_id: 550e8400-e29b-41d4-a716-446655440021 + comment: Restrict this flag to server applications. + created_at: "2024-01-01T00:00:00Z" + created_by: 550e8400-e29b-41d4-a716-446655440010 + current_status: rejected + current_value: ALL + feature_flag_id: 550e8400-e29b-41d4-a716-446655440000 + lifecycle_status: rejected + property: DISTRIBUTION_CHANNEL + suggestion: SERVER + updated_at: "2024-01-02T00:00:00Z" + updated_by: 550e8400-e29b-41d4-a716-446655440011 + id: 550e8400-e29b-41d4-a716-446655440020 + type: flag-suggestions + schema: + $ref: "#/components/schemas/FeatureFlagSuggestionResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request - Invalid request parameters or body. + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Conflict - The suggestion is already approved, applied, or discarded. + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - feature_flag_config_write + - feature_flag_environment_config_read + summary: Reject a flag change 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: |- @@ -187486,13 +188306,30 @@ paths: - feature_flag_environment_config_read put: description: |- - Updates an existing feature flag's metadata such as - name and description. Does not modify targeting rules or allocations. + Updates an existing feature flag's metadata, including its name, + description, distribution channel, and tags. Does not modify targeting rules or allocations. To change the owning team, update `tags` and include a tag of the form `team:` in the array. `tags` is a full replacement of the existing tag set (including any `team:` tag), so include every tag you want to keep, not just the ones you're adding. + + To change the lifecycle, set `staleness_status` to `ACTIVE` (temporary) or `PERMANENT`. + Either value clears any snooze; omit it to keep the lifecycle. Send `staleness_status` in a + separate request from `distribution_channel`. Do not copy the top-level `staleness_status` + from a response into the request: that legacy response field is always `ACTIVE`, so + copying it makes a `PERMANENT` flag temporary. + + When backend approvals are enabled and a distribution channel change requires approval, + callers without the Feature Flag Approvals Override permission receive `201 Created` + with a suggestion instead of an updated flag. No fields in the request are applied. + The suggestion contains only the distribution channel change. To update other fields, such as + name, description, JSON schema, and tags, send a separate request without `distribution_channel`. + + While backend approvals are enabled, a request that includes `distribution_channel` + returns `409 Conflict` if a distribution channel suggestion for the flag is pending, or + approved but not yet applied. No fields are applied, including for callers with override + permission. operationId: UpdateFeatureFlag parameters: - $ref: "#/components/parameters/feature_flag_id" @@ -187501,14 +188338,22 @@ paths: application/json: examples: default: + summary: Update flag metadata value: data: attributes: description: Updated description for the feature flag - enabled: true name: Updated Feature Flag XYZ789 tags: ["team:feature-flagging"] type: feature-flags + distribution_channel: + description: Creates a suggestion instead of updating the flag when approval is required. + summary: Update the distribution channel + value: + data: + attributes: + distribution_channel: SERVER + type: feature-flags schema: $ref: "#/components/schemas/UpdateFeatureFlagRequest" required: true @@ -187541,6 +188386,32 @@ paths: schema: $ref: "#/components/schemas/FeatureFlagResponse" description: OK + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + action: updated + base_flag_history_id: "550e8400-e29b-41d4-a716-446655440021" + created_at: "2024-01-01T00:00:00Z" + created_by: "550e8400-e29b-41d4-a716-446655440010" + current_status: pending + current_value: ALL + feature_flag_id: "550e8400-e29b-41d4-a716-446655440000" + lifecycle_status: pending + message: >- + This flag requires approval for this change. A suggestion has been created and is pending review. + property: DISTRIBUTION_CHANNEL + suggestion: SERVER + id: "550e8400-e29b-41d4-a716-446655440020" + type: flag-suggestions + schema: + $ref: "#/components/schemas/FeatureFlagSuggestionResponse" + description: |- + Created - A distribution channel suggestion was created because approval is required. No flag fields were updated. "400": content: application/json: @@ -187559,6 +188430,13 @@ paths: schema: $ref: "#/components/schemas/APIErrorResponse" description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: |- + Conflict - A feature flag with this name already exists, a distribution channel suggestion is pending, or a pending experiment request or running approved experiment uses this flag. "429": $ref: "#/components/responses/TooManyRequestsResponse" security: @@ -187578,8 +188456,17 @@ paths: /api/v2/feature-flags/{feature_flag_id}/archive: post: description: |- - Archives a feature flag. Archived flags are - hidden from the main list but remain accessible and can be unarchived. + Archives a feature flag. Archived flags are hidden from the main list but remain accessible + and can be unarchived. + + When backend approvals are enabled and this change requires approval, callers without + the Feature Flag Approvals Override permission receive `201 Created` with a persisted + suggestion. The change is not applied until the suggestion is approved and applied. + Use the returned suggestion ID with `GetFlagSuggestion`, `ApproveFlagSuggestion`, + `RejectFlagSuggestion`, or `DeleteFlagSuggestion`. + + A conflicting suggestion that is pending, or approved but not yet applied, returns `409 Conflict` without applying the change, + including for callers with override permission or when approval is no longer required. operationId: ArchiveFeatureFlag parameters: - $ref: "#/components/parameters/feature_flag_id" @@ -187612,6 +188499,8 @@ paths: schema: $ref: "#/components/schemas/FeatureFlagResponse" description: OK + "201": + $ref: "#/components/responses/FeatureFlagSuggestionCreated" "400": content: application/json: @@ -187630,6 +188519,12 @@ paths: schema: $ref: "#/components/schemas/APIErrorResponse" description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Conflict - The flag is already archived or a conflicting suggestion is pending. "429": $ref: "#/components/responses/TooManyRequestsResponse" security: @@ -187649,7 +188544,17 @@ paths: /api/v2/feature-flags/{feature_flag_id}/environments/{environment_id}/allocations: post: description: |- - Creates a new targeting rule (allocation) for a specific feature flag in a specific environment. + Creates a new targeting rule (allocation) for a feature flag in an environment. + + When backend approvals are enabled and this change requires approval, callers without + the Feature Flag Approvals Override permission receive `202 Accepted` with an + `approval-required` resource. No allocation is created and no suggestion is persisted. + The resource ID is the flag ID. Submit its `property`, `action`, `suggestion`, and `environment_id` + to `CreateFlagSuggestion`, together with `notification_rule_targets`, to request approval. + The suggestion value contains the complete desired allocation set, including the new rule. + + A conflicting suggestion that is pending, or approved but not yet applied, returns `409 Conflict`, including for callers with + override permission or when approval is no longer required. operationId: CreateAllocationsForFeatureFlagInEnvironment parameters: - $ref: "#/components/parameters/feature_flag_id" @@ -187710,24 +188615,14 @@ paths: value: data: attributes: - created_at: "2024-01-01T00:00:00+00:00" - environment_ids: - - abc-123 - guardrail_metrics: [] - id: 00000000-0000-0000-0000-000000000016 - key: prod-rollout - name: Production Rollout - order_position: 0 - targeting_rules: [] - type: FEATURE_GATE - updated_at: "2024-01-01T00:00:00+00:00" - variant_weights: - - value: 50 - variant_id: abc-123 - id: 00000000-0000-0000-0000-000000000015 - type: allocations + action: updated + environment_id: "550e8400-e29b-41d4-a716-446655440001" + property: ALLOCATIONS + suggestion: '[{"name":"Production Rollout","key":"prod-rollout","type":"FEATURE_GATE","targeting_rules":[],"variant_weights":[{"variant_id":"550e8400-e29b-41d4-a716-446655440002","value":100}],"guardrail_metrics":[]}]' + id: "550e8400-e29b-41d4-a716-446655440000" + type: approval-required schema: - $ref: "#/components/schemas/AllocationResponse" + $ref: "#/components/schemas/FeatureFlagApprovalRequiredResponse" description: Accepted - Approval required for this change "400": content: @@ -187752,7 +188647,7 @@ paths: application/json: schema: $ref: "#/components/schemas/APIErrorResponse" - description: Conflict + description: Conflict - A conflicting suggestion is pending or an allocation with this key already exists. "429": $ref: "#/components/responses/TooManyRequestsResponse" security: @@ -187769,12 +188664,34 @@ paths: - feature_flag_config_write put: description: |- - Updates targeting rules (allocations) for a specific feature flag in a specific environment. - This operation replaces the existing allocation set with the request payload. + Updates targeting rules (allocations) for a feature flag in an environment. This operation + replaces the existing allocation set with the request payload. + + When backend approvals are enabled and this change requires approval, callers without + the Feature Flag Approvals Override permission receive `201 Created` with a persisted + suggestion. The change is not applied until the suggestion is approved and applied. + Use the returned suggestion ID with `GetFlagSuggestion`, `ApproveFlagSuggestion`, + `RejectFlagSuggestion`, or `DeleteFlagSuggestion`. + + A conflicting suggestion that is pending, or approved but not yet applied, returns `409 Conflict` without applying the change, + including for callers with override permission or when approval is no longer required. + + When approval is required, combining allocation replacement with `default_variant_key` + returns `400 Bad Request`. Omit that parameter and submit the default variant change + separately with `CreateFlagSuggestion` using the `DEFAULT_VARIANT` property and the variant ID. operationId: UpdateAllocationsForFeatureFlagInEnvironment parameters: - $ref: "#/components/parameters/feature_flag_id" - $ref: "#/components/parameters/environment_id" + - description: |- + The key of the default variant to set. When approval is required, omit this parameter + and submit a `DEFAULT_VARIANT` suggestion separately. + in: query + name: default_variant_key + required: false + schema: + example: control + type: string requestBody: content: application/json: @@ -187823,16 +188740,8 @@ paths: schema: $ref: "#/components/schemas/ListAllocationsResponse" description: OK - "202": - content: - application/json: - examples: - default: - value: - data: [] - schema: - $ref: "#/components/schemas/ListAllocationsResponse" - description: Accepted - Approval required for this change + "201": + $ref: "#/components/responses/FeatureFlagSuggestionCreated" "400": content: application/json: @@ -187856,7 +188765,8 @@ paths: application/json: schema: $ref: "#/components/schemas/APIErrorResponse" - description: Conflict + description: |- + Conflict - A conflicting suggestion is pending or the allocation update conflicts with the current configuration. "429": $ref: "#/components/responses/TooManyRequestsResponse" security: @@ -187874,7 +188784,17 @@ paths: /api/v2/feature-flags/{feature_flag_id}/environments/{environment_id}/disable: post: description: |- - Disable a feature flag in a specific environment. + Disables a feature flag in a specific environment. + + When backend approvals are enabled and this change requires approval, callers without + the Feature Flag Approvals Override permission receive `201 Created` with a persisted + suggestion, in the same format as the `GetFlagSuggestion` response. The change is not + applied until the suggestion is approved and applied. + Use the returned suggestion ID with `GetFlagSuggestion`, `ApproveFlagSuggestion`, + `RejectFlagSuggestion`, or `DeleteFlagSuggestion`. + + A conflicting suggestion that is pending, or approved but not yet applied, returns `409 Conflict` without applying the change, + including for callers with override permission or when approval is no longer required. operationId: DisableFeatureFlagEnvironment parameters: - $ref: "#/components/parameters/feature_flag_id" @@ -187882,8 +188802,14 @@ paths: responses: "200": description: OK - "202": - description: Accepted - Approval required for this change + "201": + $ref: "#/components/responses/FeatureFlagSuggestionCreatedWithoutSchema" + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request "403": content: application/json: @@ -187896,6 +188822,12 @@ paths: schema: $ref: "#/components/schemas/APIErrorResponse" description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Conflict - A conflicting suggestion is pending for this flag and environment. "429": $ref: "#/components/responses/TooManyRequestsResponse" security: @@ -187915,7 +188847,17 @@ paths: /api/v2/feature-flags/{feature_flag_id}/environments/{environment_id}/enable: post: description: |- - Enable a feature flag in a specific environment. + Enables a feature flag in a specific environment. + + When backend approvals are enabled and this change requires approval, callers without + the Feature Flag Approvals Override permission receive `201 Created` with a persisted + suggestion, in the same format as the `GetFlagSuggestion` response. The change is not + applied until the suggestion is approved and applied. + Use the returned suggestion ID with `GetFlagSuggestion`, `ApproveFlagSuggestion`, + `RejectFlagSuggestion`, or `DeleteFlagSuggestion`. + + A conflicting suggestion that is pending, or approved but not yet applied, returns `409 Conflict` without applying the change, + including for callers with override permission or when approval is no longer required. operationId: EnableFeatureFlagEnvironment parameters: - $ref: "#/components/parameters/feature_flag_id" @@ -187923,8 +188865,14 @@ paths: responses: "200": description: OK - "202": - description: Accepted - Approval required for this change + "201": + $ref: "#/components/responses/FeatureFlagSuggestionCreatedWithoutSchema" + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request "403": content: application/json: @@ -187937,6 +188885,12 @@ paths: schema: $ref: "#/components/schemas/APIErrorResponse" description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Conflict - A conflicting suggestion is pending for this flag and environment. "429": $ref: "#/components/responses/TooManyRequestsResponse" security: @@ -187953,11 +188907,224 @@ paths: permissions: - feature_flag_config_write - feature_flag_environment_config_read + /api/v2/feature-flags/{feature_flag_id}/require-approval: + post: + description: |- + Enables or disables the approval requirement for a feature flag. Requires the Feature + Flag Write permission and contributor or editor access to the flag. Disabling approvals + also requires the Feature Flag Approvals Override permission, even if approvals are already disabled. + This operation updates the setting directly and does not create a suggestion. Changing the setting + returns `409 Conflict` when a pending experiment request or a running approved experiment uses the flag. + operationId: UpdateFeatureFlagApprovals + parameters: + - $ref: "#/components/parameters/feature_flag_id" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + enabled: true + type: feature-flag-approvals + schema: + $ref: "#/components/schemas/UpdateFeatureFlagApprovalsRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2024-01-01T00:00:00+00:00" + description: A sample feature flag + key: feature-flag-abc123 + name: Feature Flag ABC 123 + require_approval: true + updated_at: "2024-01-02T00:00:00+00:00" + value_type: BOOLEAN + variants: + - id: 00000000-0000-0000-0000-000000000005 + key: variant-a + name: Variant A + value: "true" + - id: 00000000-0000-0000-0000-000000000006 + key: variant-b + name: Variant B + value: "false" + id: 00000000-0000-0000-0000-000000000004 + type: feature-flags + schema: + $ref: "#/components/schemas/FeatureFlagResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request - Invalid request parameters or body. + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Conflict - A pending experiment request or a running approved experiment uses this flag. + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - feature_flag_config_write + summary: Set the approval requirement for a feature flag + tags: + - Feature Flags + x-permission: + operator: AND + permissions: + - feature_flag_config_write + /api/v2/feature-flags/{feature_flag_id}/suggestions: + post: + description: |- + Creates a persisted suggestion for a feature flag change that requires approval. + The change is not applied until the suggestion is approved and applied. Requires + contributor or editor access to the flag. The request must contain at least one + `notification_rule_targets` handle for review notifications. + + Use this endpoint to submit the proposed change from the `202 Accepted` approval-required + response of `CreateAllocationsForFeatureFlagInEnvironment`. Other approval-gated mutation endpoints + return `201 Created` with a persisted suggestion. Do not submit those suggestions again. + + An `environment_id` is required for `ALLOCATIONS`, `DEFAULT_VARIANT`, and `OVERRIDE_VARIANT`. + For allocation and variant changes, `suggestion` is a JSON-encoded string, not a nested + JSON object. Conflicting suggestions that are pending, or approved but not yet applied, + return `409 Conflict`. + + The allocations in an `ALLOCATIONS` suggestion are validated with the rules that + `UpdateAllocationsForFeatureFlagInEnvironment` applies to a change that requires approval, including the + rules for request fields, targeting rules and their `ONE_OF` and `NOT_ONE_OF` value limits, variant and + metric references, draft allocations, and exposure schedules. A schedule with `apm_retention` that has not + started must be started with the exposure schedule start endpoint, not with `autostart` or an + `absolute_start_time`. That endpoint's Product Analytics Experiments Write permission checks also apply. + If that endpoint would reject the allocations, this endpoint returns the same error: `400 Bad Request` for + invalid allocations, for example a `UNIFORM_INTERVALS` schedule with a `selection_interval_ms` of `0`, + `403 Forbidden` when the caller lacks the Experiments Write permission the lineup needs, and + `409 Conflict` for a lineup that changes or omits a draft allocation. + operationId: CreateFlagSuggestion + parameters: + - $ref: "#/components/parameters/feature_flag_id" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + action: updated + comment: Restrict this flag to server applications. + notification_rule_targets: + - requester@example.com + property: DISTRIBUTION_CHANNEL + suggestion: SERVER + type: flag-suggestions + schema: + $ref: "#/components/schemas/CreateFlagSuggestionRequest" + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + action: updated + base_flag_history_id: 550e8400-e29b-41d4-a716-446655440021 + comment: Restrict this flag to server applications. + created_at: "2024-01-01T00:00:00Z" + created_by: 550e8400-e29b-41d4-a716-446655440010 + current_status: pending + current_value: ALL + feature_flag_id: 550e8400-e29b-41d4-a716-446655440000 + lifecycle_status: pending + property: DISTRIBUTION_CHANNEL + suggestion: SERVER + id: 550e8400-e29b-41d4-a716-446655440020 + type: flag-suggestions + schema: + $ref: "#/components/schemas/FeatureFlagSuggestionResponse" + description: Created + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request - Invalid request parameters or body. + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Conflict - A conflicting suggestion is pending, or the lineup changes or omits a draft allocation. + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - feature_flag_config_write + - feature_flag_environment_config_read + summary: Create a flag change 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: |- - Unarchives a previously archived feature flag, - making it visible in the main list again. + Unarchives a previously archived feature flag, making it visible in the main list again. + + When backend approvals are enabled and this change requires approval, callers without + the Feature Flag Approvals Override permission receive `201 Created` with a persisted + suggestion. The change is not applied until the suggestion is approved and applied. + Use the returned suggestion ID with `GetFlagSuggestion`, `ApproveFlagSuggestion`, + `RejectFlagSuggestion`, or `DeleteFlagSuggestion`. + + A conflicting suggestion that is pending, or approved but not yet applied, returns `409 Conflict` without applying the change, + including for callers with override permission or when approval is no longer required. operationId: UnarchiveFeatureFlag parameters: - $ref: "#/components/parameters/feature_flag_id" @@ -187989,6 +189156,8 @@ paths: schema: $ref: "#/components/schemas/FeatureFlagResponse" description: OK + "201": + $ref: "#/components/responses/FeatureFlagSuggestionCreated" "400": content: application/json: @@ -188007,6 +189176,12 @@ paths: schema: $ref: "#/components/schemas/APIErrorResponse" description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Conflict - The flag is not archived or a conflicting suggestion is pending. "429": $ref: "#/components/responses/TooManyRequestsResponse" security: @@ -188113,12 +189288,22 @@ paths: description: |- Deletes a variant from a feature flag. - When backend approvals are enabled and the flag requires approval, this endpoint creates and returns a `FlagSuggestion` with `201 Created` instead of deleting the variant immediately. If a pending suggestion already exists for this flag's variant property, the endpoint returns `409 Conflict`. + When backend approvals are enabled and this change requires approval, callers without + the Feature Flag Approvals Override permission receive `201 Created` with a persisted + suggestion, in the same format as the `GetFlagSuggestion` response. The change is not + applied until the suggestion is approved and applied. + Use the returned suggestion ID with `GetFlagSuggestion`, `ApproveFlagSuggestion`, + `RejectFlagSuggestion`, or `DeleteFlagSuggestion`. + + A conflicting suggestion that is pending, or approved but not yet applied, returns `409 Conflict` without applying the change, + including for callers with override permission or when approval is no longer required. operationId: DeleteVariantFromFeatureFlag parameters: - $ref: "#/components/parameters/feature_flag_id" - $ref: "#/components/parameters/variant_id" responses: + "201": + $ref: "#/components/responses/FeatureFlagSuggestionCreatedWithoutSchema" "204": description: No Content "400": @@ -188163,7 +189348,15 @@ paths: description: |- Updates the name and value of an existing variant on a feature flag. - When backend approvals are enabled and the flag requires approval, this endpoint creates and returns a `FlagSuggestion` with `201 Created` instead of applying the change immediately. Use the returned suggestion `id` to approve or reject the change. If a pending suggestion already exists for this flag's variant property, the endpoint returns `409 Conflict`. + When backend approvals are enabled and this change requires approval, callers without + the Feature Flag Approvals Override permission receive `201 Created` with a persisted + suggestion, in the same format as the `GetFlagSuggestion` response. The change is not + applied until the suggestion is approved and applied. + Use the returned suggestion ID with `GetFlagSuggestion`, `ApproveFlagSuggestion`, + `RejectFlagSuggestion`, or `DeleteFlagSuggestion`. + + A conflicting suggestion that is pending, or approved but not yet applied, returns `409 Conflict` without applying the change, + including for callers with override permission or when approval is no longer required. operationId: UpdateVariantForFeatureFlag parameters: - $ref: "#/components/parameters/feature_flag_id" @@ -188186,6 +189379,8 @@ paths: responses: "200": description: OK + "201": + $ref: "#/components/responses/FeatureFlagSuggestionCreatedWithoutSchema" "400": content: application/json: @@ -272804,7 +273999,7 @@ tags: - description: |- Manage your Datadog Fastly integration accounts and services directly through the Datadog API. See the [Fastly integration page](https://docs.datadoghq.com/integrations/fastly/) for more information. name: Fastly Integration - - description: Manage feature flags and environments. + - description: Manage feature flags, environments, and approval suggestions. name: Feature Flags - description: |- Manage automated deployments across your fleet of hosts. diff --git a/examples/v2/feature-flags/ApplyFlagSuggestion.java b/examples/v2/feature-flags/ApplyFlagSuggestion.java new file mode 100644 index 00000000000..e0945e37364 --- /dev/null +++ b/examples/v2/feature-flags/ApplyFlagSuggestion.java @@ -0,0 +1,27 @@ +// Apply an approved flag change 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.FeatureFlagSuggestionResponse; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + FeatureFlagsApi apiInstance = new FeatureFlagsApi(defaultClient); + + try { + FeatureFlagSuggestionResponse result = + apiInstance.applyFlagSuggestion(UUID.fromString("550e8400-e29b-41d4-a716-446655440020")); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FeatureFlagsApi#applyFlagSuggestion"); + 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/ApproveFlagSuggestion.java b/examples/v2/feature-flags/ApproveFlagSuggestion.java new file mode 100644 index 00000000000..2e78a40e5e8 --- /dev/null +++ b/examples/v2/feature-flags/ApproveFlagSuggestion.java @@ -0,0 +1,42 @@ +// Approve a flag change 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.ApproveFlagSuggestionAttributes; +import com.datadog.api.client.v2.model.ApproveFlagSuggestionData; +import com.datadog.api.client.v2.model.ApproveFlagSuggestionRequest; +import com.datadog.api.client.v2.model.FeatureFlagSuggestionResponse; +import com.datadog.api.client.v2.model.ReviewFlagSuggestionDataType; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + FeatureFlagsApi apiInstance = new FeatureFlagsApi(defaultClient); + + ApproveFlagSuggestionRequest body = + new ApproveFlagSuggestionRequest() + .data( + new ApproveFlagSuggestionData() + .attributes( + new ApproveFlagSuggestionAttributes() + .apply(false) + .comment("Approved for rollout.")) + .type(ReviewFlagSuggestionDataType.FLAG_SUGGESTION_EVENTS)); + + try { + FeatureFlagSuggestionResponse 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..ac102239693 --- /dev/null +++ b/examples/v2/feature-flags/CreateFlagSuggestion.java @@ -0,0 +1,53 @@ +// Create a flag change 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.FeatureFlagSuggestionDataType; +import com.datadog.api.client.v2.model.FeatureFlagSuggestionMetadataRequest; +import com.datadog.api.client.v2.model.FeatureFlagSuggestionResponse; +import java.util.Collections; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + FeatureFlagsApi apiInstance = new FeatureFlagsApi(defaultClient); + + CreateFlagSuggestionRequest body = + new CreateFlagSuggestionRequest() + .data( + new CreateFlagSuggestionData() + .attributes( + new CreateFlagSuggestionAttributes() + .action("updated") + .comment("Restrict this flag to server applications.") + .environmentId(UUID.fromString("550e8400-e29b-41d4-a716-446655440001")) + .notificationRuleTargets( + Collections.singletonList("requester@example.com")) + .property("DISTRIBUTION_CHANNEL") + .suggestion("SERVER") + .suggestionMetadata( + new FeatureFlagSuggestionMetadataRequest() + .variantId( + UUID.fromString("550e8400-e29b-41d4-a716-446655440002")))) + .type(FeatureFlagSuggestionDataType.FLAG_SUGGESTIONS)); + + try { + FeatureFlagSuggestionResponse 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..731da98e605 --- /dev/null +++ b/examples/v2/feature-flags/DeleteFlagSuggestion.java @@ -0,0 +1,24 @@ +// Delete or discard a flag change 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(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + 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..f779a978fe4 --- /dev/null +++ b/examples/v2/feature-flags/GetFlagSuggestion.java @@ -0,0 +1,27 @@ +// Get a flag change 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.FeatureFlagSuggestionResponse; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + FeatureFlagsApi apiInstance = new FeatureFlagsApi(defaultClient); + + try { + FeatureFlagSuggestionResponse 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..ead8afcd5f2 --- /dev/null +++ b/examples/v2/feature-flags/RejectFlagSuggestion.java @@ -0,0 +1,41 @@ +// Reject a flag change 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.FeatureFlagSuggestionResponse; +import com.datadog.api.client.v2.model.RejectFlagSuggestionAttributes; +import com.datadog.api.client.v2.model.RejectFlagSuggestionData; +import com.datadog.api.client.v2.model.RejectFlagSuggestionRequest; +import com.datadog.api.client.v2.model.ReviewFlagSuggestionDataType; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + FeatureFlagsApi apiInstance = new FeatureFlagsApi(defaultClient); + + RejectFlagSuggestionRequest body = + new RejectFlagSuggestionRequest() + .data( + new RejectFlagSuggestionData() + .attributes( + new RejectFlagSuggestionAttributes() + .comment("Keep the existing configuration.")) + .type(ReviewFlagSuggestionDataType.FLAG_SUGGESTION_EVENTS)); + + try { + FeatureFlagSuggestionResponse 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/examples/v2/feature-flags/UpdateFeatureFlagApprovals.java b/examples/v2/feature-flags/UpdateFeatureFlagApprovals.java new file mode 100644 index 00000000000..be54c88beb7 --- /dev/null +++ b/examples/v2/feature-flags/UpdateFeatureFlagApprovals.java @@ -0,0 +1,39 @@ +// Set the approval requirement for a feature flag 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.FeatureFlagApprovalsDataType; +import com.datadog.api.client.v2.model.FeatureFlagResponse; +import com.datadog.api.client.v2.model.UpdateFeatureFlagApprovalsAttributes; +import com.datadog.api.client.v2.model.UpdateFeatureFlagApprovalsData; +import com.datadog.api.client.v2.model.UpdateFeatureFlagApprovalsRequest; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + FeatureFlagsApi apiInstance = new FeatureFlagsApi(defaultClient); + + UpdateFeatureFlagApprovalsRequest body = + new UpdateFeatureFlagApprovalsRequest() + .data( + new UpdateFeatureFlagApprovalsData() + .attributes(new UpdateFeatureFlagApprovalsAttributes().enabled(true)) + .type(FeatureFlagApprovalsDataType.FEATURE_FLAG_APPROVALS)); + + try { + FeatureFlagResponse result = + apiInstance.updateFeatureFlagApprovals( + UUID.fromString("550e8400-e29b-41d4-a716-446655440000"), body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FeatureFlagsApi#updateFeatureFlagApprovals"); + 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 ae9885c75c2..36121dfd596 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 @@ -6,22 +6,27 @@ import com.datadog.api.client.Pair; import com.datadog.api.client.v2.model.AllocationExposureScheduleResponse; import com.datadog.api.client.v2.model.AllocationResponse; +import com.datadog.api.client.v2.model.ApproveFlagSuggestionRequest; 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.CreateVariantRequest; import com.datadog.api.client.v2.model.EnvironmentResponse; import com.datadog.api.client.v2.model.FeatureFlagDistributionChannel; import com.datadog.api.client.v2.model.FeatureFlagProductionStatus; import com.datadog.api.client.v2.model.FeatureFlagResponse; import com.datadog.api.client.v2.model.FeatureFlagStalenessStatus; +import com.datadog.api.client.v2.model.FeatureFlagSuggestionResponse; 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.PatchSavedFilterRequest; +import com.datadog.api.client.v2.model.RejectFlagSuggestionRequest; import com.datadog.api.client.v2.model.SavedFilterResponse; import com.datadog.api.client.v2.model.UpdateEnvironmentRequest; +import com.datadog.api.client.v2.model.UpdateFeatureFlagApprovalsRequest; import com.datadog.api.client.v2.model.UpdateFeatureFlagRequest; import com.datadog.api.client.v2.model.UpdateVariantRequest; import com.datadog.api.client.v2.model.ValueType; @@ -66,6 +71,338 @@ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } + /** + * Apply an approved flag change suggestion. + * + *

See {@link #applyFlagSuggestionWithHttpInfo}. + * + * @param suggestionId The ID of the feature flag change suggestion. (required) + * @return FeatureFlagSuggestionResponse + * @throws ApiException if fails to make API call + */ + public FeatureFlagSuggestionResponse applyFlagSuggestion(UUID suggestionId) throws ApiException { + return applyFlagSuggestionWithHttpInfo(suggestionId).getData(); + } + + /** + * Apply an approved flag change suggestion. + * + *

See {@link #applyFlagSuggestionWithHttpInfoAsync}. + * + * @param suggestionId The ID of the feature flag change suggestion. (required) + * @return CompletableFuture<FeatureFlagSuggestionResponse> + */ + public CompletableFuture applyFlagSuggestionAsync( + UUID suggestionId) { + return applyFlagSuggestionWithHttpInfoAsync(suggestionId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Applies a previously approved feature flag change suggestion. Requires contributor or editor + * access to the flag. Pending, rejected, or discarded suggestions return 409 Conflict + * . An already applied suggestion also returns 409 Conflict, except that + * retrying an applied experiment action succeeds. This endpoint does not require a request body. + * + *

When an ALLOCATIONS suggestion is applied, either by this endpoint or by an + * approval that applies it, each exposure schedule with autostart set to true + * , no absolute_start_time, and no future scheduled_start_time + * starts at apply time. This includes a schedule that is already running, so a suggestion that + * omits its absolute_start_time restarts its rollout. If its + * selection_interval_ms is greater than 0, every step except the last uses + * that interval. An absolute_start_time in the suggestion is kept, including one set + * by the allocations request that built the suggestion, so time spent waiting for approval counts + * toward its rollout steps. Schedules with apm_retention, in the suggestion or on + * the saved schedule, are the exception: apply does not start them, and they start only through + * the exposure schedule start endpoint. When the suggestion omits apm_retention or + * absolute_start_time for a saved schedule with apm_retention, apply + * keeps the saved values, so a running schedule keeps its start, unless the suggestion changes + * its rollout strategy, which stops it. + * + * @param suggestionId The ID of the feature flag change suggestion. (required) + * @return ApiResponse<FeatureFlagSuggestionResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request - Invalid request parameters or body. -
403 Forbidden -
404 Not Found -
409 Conflict - The suggestion is not approved or the proposed change conflicts with current configuration. -
429 Too many requests -
+ */ + public ApiResponse applyFlagSuggestionWithHttpInfo( + 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 applyFlagSuggestion"); + } + // create path and map variables + String localVarPath = + "/api/v2/feature-flags/suggestions/{suggestion_id}/apply" + .replaceAll( + "\\{" + "suggestion_id" + "\\}", apiClient.escapeString(suggestionId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.FeatureFlagsApi.applyFlagSuggestion", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Apply an approved flag change suggestion. + * + *

See {@link #applyFlagSuggestionWithHttpInfo}. + * + * @param suggestionId The ID of the feature flag change suggestion. (required) + * @return CompletableFuture<ApiResponse<FeatureFlagSuggestionResponse>> + */ + public CompletableFuture> + applyFlagSuggestionWithHttpInfoAsync(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 applyFlagSuggestion")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/feature-flags/suggestions/{suggestion_id}/apply" + .replaceAll( + "\\{" + "suggestion_id" + "\\}", apiClient.escapeString(suggestionId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.FeatureFlagsApi.applyFlagSuggestion", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Approve a flag change suggestion. + * + *

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

See {@link #approveFlagSuggestionWithHttpInfoAsync}. + * + * @param suggestionId The ID of the feature flag change suggestion. (required) + * @param body (required) + * @return CompletableFuture<FeatureFlagSuggestionResponse> + */ + public CompletableFuture approveFlagSuggestionAsync( + UUID suggestionId, ApproveFlagSuggestionRequest body) { + return approveFlagSuggestionWithHttpInfoAsync(suggestionId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Approves a feature flag change suggestion and applies the change immediately by default. Set + * apply to false to approve without applying, then call + * ApplyFlagSuggestion later. Until it is applied or deleted, an approved suggestion still + * blocks conflicting changes. Requires editor access to the flag or the Feature Flag Approvals + * Override permission. A creator cannot approve their own suggestion unless they have override + * permission. Applied or discarded suggestions return 409 Conflict. Retrying + * approval of an already applied experiment action with apply set to true + * succeeds. + * + * @param suggestionId The ID of the feature flag change suggestion. (required) + * @param body (required) + * @return ApiResponse<FeatureFlagSuggestionResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request - Invalid request parameters or body. -
403 Forbidden -
404 Not Found -
409 Conflict - The suggestion is already applied or discarded, or the proposed change conflicts with current configuration. -
429 Too many requests -
+ */ + public ApiResponse approveFlagSuggestionWithHttpInfo( + UUID suggestionId, ApproveFlagSuggestionRequest 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", "AuthZ"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Approve a flag change suggestion. + * + *

See {@link #approveFlagSuggestionWithHttpInfo}. + * + * @param suggestionId The ID of the feature flag change suggestion. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<FeatureFlagSuggestionResponse>> + */ + public CompletableFuture> + approveFlagSuggestionWithHttpInfoAsync(UUID suggestionId, ApproveFlagSuggestionRequest 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", "AuthZ"}); + } 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. * @@ -99,6 +436,16 @@ public CompletableFuture archiveFeatureFlagAsync(UUID featu * Archives a feature flag. Archived flags are hidden from the main list but remain accessible and * can be unarchived. * + *

When backend approvals are enabled and this change requires approval, callers without the + * Feature Flag Approvals Override permission receive 201 Created with a persisted + * suggestion. The change is not applied until the suggestion is approved and applied. Use the + * returned suggestion ID with GetFlagSuggestion, ApproveFlagSuggestion, + * RejectFlagSuggestion, or DeleteFlagSuggestion. + * + *

A conflicting suggestion that is pending, or approved but not yet applied, returns + * 409 Conflict without applying the change, including for callers with override permission + * or when approval is no longer required. + * * @param featureFlagId The ID of the feature flag. (required) * @return ApiResponse<FeatureFlagResponse> * @throws ApiException if fails to make API call @@ -107,9 +454,11 @@ public CompletableFuture archiveFeatureFlagAsync(UUID featu * Response details * Status Code Description Response Headers * 200 OK - + * 201 Created - Approval is required. A suggestion was created and the change has not been applied. - * 400 Bad Request - * 403 Forbidden - * 404 Not Found - + * 409 Conflict - The flag is already archived or a conflicting suggestion is pending. - * 429 Too many requests - * */ @@ -247,8 +596,19 @@ public CompletableFuture createAllocationsForFeatureFlagInEn } /** - * Creates a new targeting rule (allocation) for a specific feature flag in a specific - * environment. + * Creates a new targeting rule (allocation) for a feature flag in an environment. + * + *

When backend approvals are enabled and this change requires approval, callers without the + * Feature Flag Approvals Override permission receive 202 Accepted with an + * approval-required resource. No allocation is created and no suggestion is persisted. The + * resource ID is the flag ID. Submit its property, action, + * suggestion, and environment_id to CreateFlagSuggestion, + * together with notification_rule_targets, to request approval. The suggestion value + * contains the complete desired allocation set, including the new rule. + * + *

A conflicting suggestion that is pending, or approved but not yet applied, returns + * 409 Conflict, including for callers with override permission or when approval is no + * longer required. * * @param featureFlagId The ID of the feature flag. (required) * @param environmentId The ID of the environment. (required) @@ -264,7 +624,7 @@ public CompletableFuture createAllocationsForFeatureFlagInEn * 400 Bad Request - * 403 Forbidden - * 404 Not Found - - * 409 Conflict - + * 409 Conflict - A conflicting suggestion is pending or an allocation with this key already exists. - * 429 Too many requests - * */ @@ -677,6 +1037,199 @@ public ApiResponse createFeatureFlagsEnvironmentWithHttpInf new GenericType() {}); } + /** + * Create a flag change suggestion. + * + *

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

See {@link #createFlagSuggestionWithHttpInfoAsync}. + * + * @param featureFlagId The ID of the feature flag. (required) + * @param body (required) + * @return CompletableFuture<FeatureFlagSuggestionResponse> + */ + public CompletableFuture createFlagSuggestionAsync( + UUID featureFlagId, CreateFlagSuggestionRequest body) { + return createFlagSuggestionWithHttpInfoAsync(featureFlagId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Creates a persisted suggestion for a feature flag change that requires approval. The change is + * not applied until the suggestion is approved and applied. Requires contributor or editor access + * to the flag. The request must contain at least one notification_rule_targets + * handle for review notifications. + * + *

Use this endpoint to submit the proposed change from the 202 Accepted + * approval-required response of CreateAllocationsForFeatureFlagInEnvironment. Other + * approval-gated mutation endpoints return 201 Created with a persisted suggestion. + * Do not submit those suggestions again. + * + *

An environment_id is required for ALLOCATIONS, + * DEFAULT_VARIANT, and OVERRIDE_VARIANT. For allocation and variant changes, + * suggestion is a JSON-encoded string, not a nested JSON object. Conflicting + * suggestions that are pending, or approved but not yet applied, return 409 Conflict + * . + * + *

The allocations in an ALLOCATIONS suggestion are validated with the rules that + * UpdateAllocationsForFeatureFlagInEnvironment applies to a change that requires + * approval, including the rules for request fields, targeting rules and their ONE_OF + * and NOT_ONE_OF value limits, variant and metric references, draft allocations, and + * exposure schedules. A schedule with apm_retention that has not started must be + * started with the exposure schedule start endpoint, not with autostart or an + * absolute_start_time. That endpoint's Product Analytics Experiments Write permission + * checks also apply. If that endpoint would reject the allocations, this endpoint returns the + * same error: 400 Bad Request for invalid allocations, for example a + * UNIFORM_INTERVALS schedule with a selection_interval_ms of 0, + * 403 Forbidden when the caller lacks the Experiments Write permission the lineup + * needs, and 409 Conflict for a lineup that changes or omits a draft allocation. + * + * @param featureFlagId The ID of the feature flag. (required) + * @param body (required) + * @return ApiResponse<FeatureFlagSuggestionResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
201 Created -
400 Bad Request - Invalid request parameters or body. -
403 Forbidden -
404 Not Found -
409 Conflict - A conflicting suggestion is pending, or the lineup changes or omits a draft allocation. -
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", "AuthZ"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create a flag change suggestion. + * + *

See {@link #createFlagSuggestionWithHttpInfo}. + * + * @param featureFlagId The ID of the feature flag. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<FeatureFlagSuggestionResponse>> + */ + 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", "AuthZ"}); + } 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() {}); + } + /** * Add a variant to a feature flag. * @@ -906,15 +1459,157 @@ public ApiResponse deleteFeatureFlagsEnvironmentWithHttpInfo(UUID environm } // create path and map variables String localVarPath = - "/api/v2/feature-flags/environments/{environment_id}" + "/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", "AuthZ"}); + 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", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Delete or discard a flag change suggestion. + * + *

See {@link #deleteFlagSuggestionWithHttpInfo}. + * + * @param suggestionId The ID of the feature flag change suggestion. (required) + * @throws ApiException if fails to make API call + */ + public void deleteFlagSuggestion(UUID suggestionId) throws ApiException { + deleteFlagSuggestionWithHttpInfo(suggestionId); + } + + /** + * Delete or discard a flag change suggestion. + * + *

See {@link #deleteFlagSuggestionWithHttpInfoAsync}. + * + * @param suggestionId The ID of the feature flag change suggestion. (required) + * @return CompletableFuture + */ + public CompletableFuture deleteFlagSuggestionAsync(UUID suggestionId) { + return deleteFlagSuggestionWithHttpInfoAsync(suggestionId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Deletes a pending suggestion or discards an approved suggestion that has not been applied. + * Requires editor access to the flag, or contributor access for the suggestion's creator. Applied + * and rejected suggestions return 409 Conflict. A missing or already discarded + * suggestion returns 204 No Content. + * + * @param suggestionId The ID of the feature flag change suggestion. (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 -
400 Bad Request - Invalid request parameters or body. -
403 Forbidden -
404 Not Found -
409 Conflict - Applied or rejected suggestions cannot be deleted. -
429 Too many requests -
+ */ + public ApiResponse deleteFlagSuggestionWithHttpInfo(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 deleteFlagSuggestion"); + } + // create path and map variables + String localVarPath = + "/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, @@ -933,32 +1628,31 @@ public ApiResponse deleteFeatureFlagsEnvironmentWithHttpInfo(UUID environm } /** - * Delete an environment. + * Delete or discard a flag change suggestion. * - *

See {@link #deleteFeatureFlagsEnvironmentWithHttpInfo}. + *

See {@link #deleteFlagSuggestionWithHttpInfo}. * - * @param environmentId The ID of the environment. (required) + * @param suggestionId The ID of the feature flag change 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(); @@ -966,7 +1660,7 @@ public CompletableFuture> deleteFeatureFlagsEnvironmentWithHtt try { builder = apiClient.createBuilder( - "v2.FeatureFlagsApi.deleteFeatureFlagsEnvironment", + "v2.FeatureFlagsApi.deleteFlagSuggestion", localVarPath, new ArrayList(), localVarHeaderParams, @@ -1023,10 +1717,16 @@ public CompletableFuture deleteVariantFromFeatureFlagAsync( /** * Deletes a variant from a feature flag. * - *

When backend approvals are enabled and the flag requires approval, this endpoint creates and - * returns a FlagSuggestion with 201 Created instead of deleting the - * variant immediately. If a pending suggestion already exists for this flag's variant property, - * the endpoint returns 409 Conflict. + *

When backend approvals are enabled and this change requires approval, callers without the + * Feature Flag Approvals Override permission receive 201 Created with a persisted + * suggestion, in the same format as the GetFlagSuggestion response. The change is + * not applied until the suggestion is approved and applied. Use the returned suggestion ID with + * GetFlagSuggestion, ApproveFlagSuggestion, RejectFlagSuggestion + * , or DeleteFlagSuggestion. + * + *

A conflicting suggestion that is pending, or approved but not yet applied, returns + * 409 Conflict without applying the change, including for callers with override permission + * or when approval is no longer required. * * @param featureFlagId The ID of the feature flag. (required) * @param variantId The ID of the variant. (required) @@ -1036,6 +1736,7 @@ public CompletableFuture deleteVariantFromFeatureFlagAsync( * * * + * * * * @@ -1194,7 +1895,18 @@ public CompletableFuture disableFeatureFlagEnvironmentAsync( } /** - * Disable a feature flag in a specific environment. + * Disables a feature flag in a specific environment. + * + *

When backend approvals are enabled and this change requires approval, callers without the + * Feature Flag Approvals Override permission receive 201 Created with a persisted + * suggestion, in the same format as the GetFlagSuggestion response. The change is + * not applied until the suggestion is approved and applied. Use the returned suggestion ID with + * GetFlagSuggestion, ApproveFlagSuggestion, RejectFlagSuggestion + * , or DeleteFlagSuggestion. + * + *

A conflicting suggestion that is pending, or approved but not yet applied, returns + * 409 Conflict without applying the change, including for callers with override permission + * or when approval is no longer required. * * @param featureFlagId The ID of the feature flag. (required) * @param environmentId The ID of the environment. (required) @@ -1205,9 +1917,11 @@ public CompletableFuture disableFeatureFlagEnvironmentAsync( *

* * - * + * + * * * + * * *
Response details
Status Code Description Response Headers
201 Created - Approval is required. A suggestion was created and the change has not been applied. -
204 No Content -
400 Bad Request -
403 Forbidden -
Response details
Status Code Description Response Headers
200 OK -
202 Accepted - Approval required for this change -
201 Created - Approval is required. A suggestion was created and the change has not been applied. -
400 Bad Request -
403 Forbidden -
404 Not Found -
409 Conflict - A conflicting suggestion is pending for this flag and environment. -
429 Too many requests -
*/ @@ -1364,7 +2078,18 @@ public CompletableFuture enableFeatureFlagEnvironmentAsync( } /** - * Enable a feature flag in a specific environment. + * Enables a feature flag in a specific environment. + * + *

When backend approvals are enabled and this change requires approval, callers without the + * Feature Flag Approvals Override permission receive 201 Created with a persisted + * suggestion, in the same format as the GetFlagSuggestion response. The change is + * not applied until the suggestion is approved and applied. Use the returned suggestion ID with + * GetFlagSuggestion, ApproveFlagSuggestion, RejectFlagSuggestion + * , or DeleteFlagSuggestion. + * + *

A conflicting suggestion that is pending, or approved but not yet applied, returns + * 409 Conflict without applying the change, including for callers with override permission + * or when approval is no longer required. * * @param featureFlagId The ID of the feature flag. (required) * @param environmentId The ID of the environment. (required) @@ -1375,9 +2100,11 @@ public CompletableFuture enableFeatureFlagEnvironmentAsync( * Response details * Status Code Description Response Headers * 200 OK - - * 202 Accepted - Approval required for this change - + * 201 Created - Approval is required. A suggestion was created and the change has not been applied. - + * 400 Bad Request - * 403 Forbidden - * 404 Not Found - + * 409 Conflict - A conflicting suggestion is pending for this flag and environment. - * 429 Too many requests - * */ @@ -1781,6 +2508,149 @@ public ApiResponse getFeatureFlagsEnvironmentWithHttpInfo(U new GenericType() {}); } + /** + * Get a flag change suggestion. + * + *

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

See {@link #getFlagSuggestionWithHttpInfoAsync}. + * + * @param suggestionId The ID of the feature flag change suggestion. (required) + * @return CompletableFuture<FeatureFlagSuggestionResponse> + */ + public CompletableFuture getFlagSuggestionAsync( + UUID suggestionId) { + return getFlagSuggestionWithHttpInfoAsync(suggestionId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Returns a feature flag change suggestion by ID. Use lifecycle_status to + * distinguish pending, approved, applied, rejected, and discarded suggestions. An approved + * suggestion has not yet been applied; an applied suggestion has changed the flag. + * + * @param suggestionId The ID of the feature flag change suggestion. (required) + * @return ApiResponse<FeatureFlagSuggestionResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request - Invalid request parameters or body. -
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", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get a flag change suggestion. + * + *

See {@link #getFlagSuggestionWithHttpInfo}. + * + * @param suggestionId The ID of the feature flag change suggestion. (required) + * @return CompletableFuture<ApiResponse<FeatureFlagSuggestionResponse>> + */ + 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", "AuthZ"}); + } 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() {}); + } + /** * Get a saved filter. * @@ -2710,24 +3580,182 @@ public ApiResponse pauseExposureScheduleWith UUID exposureScheduleId) throws ApiException { Object localVarPostBody = null; - // verify the required parameter 'exposureScheduleId' is set - if (exposureScheduleId == null) { + // verify the required parameter 'exposureScheduleId' is set + if (exposureScheduleId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'exposureScheduleId' when calling pauseExposureSchedule"); + } + // create path and map variables + String localVarPath = + "/api/v2/feature-flags/exposure-schedules/{exposure_schedule_id}/pause" + .replaceAll( + "\\{" + "exposure_schedule_id" + "\\}", + apiClient.escapeString(exposureScheduleId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.FeatureFlagsApi.pauseExposureSchedule", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Pause a progressive rollout. + * + *

See {@link #pauseExposureScheduleWithHttpInfo}. + * + * @param exposureScheduleId The ID of the exposure schedule. (required) + * @return CompletableFuture<ApiResponse<AllocationExposureScheduleResponse>> + */ + public CompletableFuture> + pauseExposureScheduleWithHttpInfoAsync(UUID exposureScheduleId) { + Object localVarPostBody = null; + + // verify the required parameter 'exposureScheduleId' is set + if (exposureScheduleId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'exposureScheduleId' when calling" + + " pauseExposureSchedule")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/feature-flags/exposure-schedules/{exposure_schedule_id}/pause" + .replaceAll( + "\\{" + "exposure_schedule_id" + "\\}", + apiClient.escapeString(exposureScheduleId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.FeatureFlagsApi.pauseExposureSchedule", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Reject a flag change suggestion. + * + *

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

See {@link #rejectFlagSuggestionWithHttpInfoAsync}. + * + * @param suggestionId The ID of the feature flag change suggestion. (required) + * @param body (required) + * @return CompletableFuture<FeatureFlagSuggestionResponse> + */ + public CompletableFuture rejectFlagSuggestionAsync( + UUID suggestionId, RejectFlagSuggestionRequest body) { + return rejectFlagSuggestionWithHttpInfoAsync(suggestionId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Rejects a pending feature flag change suggestion without applying the change. Requires editor + * access to the flag or the Feature Flag Approvals Override permission. Rejecting an already + * rejected suggestion succeeds. Approved, applied, or discarded suggestions return + * 409 Conflict. + * + * @param suggestionId The ID of the feature flag change suggestion. (required) + * @param body (required) + * @return ApiResponse<FeatureFlagSuggestionResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request - Invalid request parameters or body. -
403 Forbidden -
404 Not Found -
409 Conflict - The suggestion is already approved, applied, or discarded. -
429 Too many requests -
+ */ + public ApiResponse rejectFlagSuggestionWithHttpInfo( + UUID suggestionId, RejectFlagSuggestionRequest body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'suggestionId' is set + if (suggestionId == null) { throw new ApiException( - 400, - "Missing the required parameter 'exposureScheduleId' when calling pauseExposureSchedule"); + 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/exposure-schedules/{exposure_schedule_id}/pause" + "/api/v2/feature-flags/suggestions/{suggestion_id}/reject" .replaceAll( - "\\{" + "exposure_schedule_id" + "\\}", - apiClient.escapeString(exposureScheduleId.toString())); + "\\{" + "suggestion_id" + "\\}", apiClient.escapeString(suggestionId.toString())); Map localVarHeaderParams = new HashMap(); Invocation.Builder builder = apiClient.createBuilder( - "v2.FeatureFlagsApi.pauseExposureSchedule", + "v2.FeatureFlagsApi.rejectFlagSuggestion", localVarPath, new ArrayList(), localVarHeaderParams, @@ -2738,42 +3766,51 @@ public ApiResponse pauseExposureScheduleWith "POST", builder, localVarHeaderParams, - new String[] {}, + new String[] {"application/json"}, localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** - * Pause a progressive rollout. + * Reject a flag change suggestion. * - *

See {@link #pauseExposureScheduleWithHttpInfo}. + *

See {@link #rejectFlagSuggestionWithHttpInfo}. * - * @param exposureScheduleId The ID of the exposure schedule. (required) - * @return CompletableFuture<ApiResponse<AllocationExposureScheduleResponse>> + * @param suggestionId The ID of the feature flag change suggestion. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<FeatureFlagSuggestionResponse>> */ - public CompletableFuture> - pauseExposureScheduleWithHttpInfoAsync(UUID exposureScheduleId) { - Object localVarPostBody = null; + public CompletableFuture> + rejectFlagSuggestionWithHttpInfoAsync(UUID suggestionId, RejectFlagSuggestionRequest body) { + Object localVarPostBody = body; - // verify the required parameter 'exposureScheduleId' is set - if (exposureScheduleId == null) { - CompletableFuture> result = + // verify the required parameter 'suggestionId' is set + if (suggestionId == null) { + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException( 400, - "Missing the required parameter 'exposureScheduleId' when calling" - + " pauseExposureSchedule")); + "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/exposure-schedules/{exposure_schedule_id}/pause" + "/api/v2/feature-flags/suggestions/{suggestion_id}/reject" .replaceAll( - "\\{" + "exposure_schedule_id" + "\\}", - apiClient.escapeString(exposureScheduleId.toString())); + "\\{" + "suggestion_id" + "\\}", apiClient.escapeString(suggestionId.toString())); Map localVarHeaderParams = new HashMap(); @@ -2781,7 +3818,7 @@ public ApiResponse pauseExposureScheduleWith try { builder = apiClient.createBuilder( - "v2.FeatureFlagsApi.pauseExposureSchedule", + "v2.FeatureFlagsApi.rejectFlagSuggestion", localVarPath, new ArrayList(), localVarHeaderParams, @@ -2789,7 +3826,7 @@ public ApiResponse pauseExposureScheduleWith new String[] {"application/json"}, new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); } catch (ApiException ex) { - CompletableFuture> result = + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally(ex); return result; @@ -2798,11 +3835,11 @@ public ApiResponse pauseExposureScheduleWith "POST", builder, localVarHeaderParams, - new String[] {}, + new String[] {"application/json"}, localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** @@ -3282,6 +4319,16 @@ public CompletableFuture unarchiveFeatureFlagAsync(UUID fea /** * Unarchives a previously archived feature flag, making it visible in the main list again. * + *

When backend approvals are enabled and this change requires approval, callers without the + * Feature Flag Approvals Override permission receive 201 Created with a persisted + * suggestion. The change is not applied until the suggestion is approved and applied. Use the + * returned suggestion ID with GetFlagSuggestion, ApproveFlagSuggestion, + * RejectFlagSuggestion, or DeleteFlagSuggestion. + * + *

A conflicting suggestion that is pending, or approved but not yet applied, returns + * 409 Conflict without applying the change, including for callers with override permission + * or when approval is no longer required. + * * @param featureFlagId The ID of the feature flag. (required) * @return ApiResponse<FeatureFlagResponse> * @throws ApiException if fails to make API call @@ -3290,9 +4337,11 @@ public CompletableFuture unarchiveFeatureFlagAsync(UUID fea * Response details * Status Code Description Response Headers * 200 OK - + * 201 Created - Approval is required. A suggestion was created and the change has not been applied. - * 400 Bad Request - * 403 Forbidden - * 404 Not Found - + * 409 Conflict - The flag is not archived or a conflicting suggestion is pending. - * 429 Too many requests - * */ @@ -3391,6 +4440,25 @@ public CompletableFuture> unarchiveFeatureFlagW new GenericType() {}); } + /** Manage optional parameters to updateAllocationsForFeatureFlagInEnvironment. */ + public static class UpdateAllocationsForFeatureFlagInEnvironmentOptionalParameters { + private String defaultVariantKey; + + /** + * Set defaultVariantKey. + * + * @param defaultVariantKey The key of the default variant to set. When approval is required, + * omit this parameter and submit a DEFAULT_VARIANT suggestion separately. + * (optional) + * @return UpdateAllocationsForFeatureFlagInEnvironmentOptionalParameters + */ + public UpdateAllocationsForFeatureFlagInEnvironmentOptionalParameters defaultVariantKey( + String defaultVariantKey) { + this.defaultVariantKey = defaultVariantKey; + return this; + } + } + /** * Update targeting rules for a flag. * @@ -3406,7 +4474,10 @@ public ListAllocationsResponse updateAllocationsForFeatureFlagInEnvironment( UUID featureFlagId, UUID environmentId, OverwriteAllocationsRequest body) throws ApiException { return updateAllocationsForFeatureFlagInEnvironmentWithHttpInfo( - featureFlagId, environmentId, body) + featureFlagId, + environmentId, + body, + new UpdateAllocationsForFeatureFlagInEnvironmentOptionalParameters()) .getData(); } @@ -3424,7 +4495,58 @@ public ListAllocationsResponse updateAllocationsForFeatureFlagInEnvironment( updateAllocationsForFeatureFlagInEnvironmentAsync( UUID featureFlagId, UUID environmentId, OverwriteAllocationsRequest body) { return updateAllocationsForFeatureFlagInEnvironmentWithHttpInfoAsync( - featureFlagId, environmentId, body) + featureFlagId, + environmentId, + body, + new UpdateAllocationsForFeatureFlagInEnvironmentOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Update targeting rules for a flag. + * + *

See {@link #updateAllocationsForFeatureFlagInEnvironmentWithHttpInfo}. + * + * @param featureFlagId The ID of the feature flag. (required) + * @param environmentId The ID of the environment. (required) + * @param body (required) + * @param parameters Optional parameters for the request. + * @return ListAllocationsResponse + * @throws ApiException if fails to make API call + */ + public ListAllocationsResponse updateAllocationsForFeatureFlagInEnvironment( + UUID featureFlagId, + UUID environmentId, + OverwriteAllocationsRequest body, + UpdateAllocationsForFeatureFlagInEnvironmentOptionalParameters parameters) + throws ApiException { + return updateAllocationsForFeatureFlagInEnvironmentWithHttpInfo( + featureFlagId, environmentId, body, parameters) + .getData(); + } + + /** + * Update targeting rules for a flag. + * + *

See {@link #updateAllocationsForFeatureFlagInEnvironmentWithHttpInfoAsync}. + * + * @param featureFlagId The ID of the feature flag. (required) + * @param environmentId The ID of the environment. (required) + * @param body (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ListAllocationsResponse> + */ + public CompletableFuture + updateAllocationsForFeatureFlagInEnvironmentAsync( + UUID featureFlagId, + UUID environmentId, + OverwriteAllocationsRequest body, + UpdateAllocationsForFeatureFlagInEnvironmentOptionalParameters parameters) { + return updateAllocationsForFeatureFlagInEnvironmentWithHttpInfoAsync( + featureFlagId, environmentId, body, parameters) .thenApply( response -> { return response.getData(); @@ -3432,12 +4554,28 @@ public ListAllocationsResponse updateAllocationsForFeatureFlagInEnvironment( } /** - * Updates targeting rules (allocations) for a specific feature flag in a specific environment. - * This operation replaces the existing allocation set with the request payload. + * Updates targeting rules (allocations) for a feature flag in an environment. This operation + * replaces the existing allocation set with the request payload. + * + *

When backend approvals are enabled and this change requires approval, callers without the + * Feature Flag Approvals Override permission receive 201 Created with a persisted + * suggestion. The change is not applied until the suggestion is approved and applied. Use the + * returned suggestion ID with GetFlagSuggestion, ApproveFlagSuggestion, + * RejectFlagSuggestion, or DeleteFlagSuggestion. + * + *

A conflicting suggestion that is pending, or approved but not yet applied, returns + * 409 Conflict without applying the change, including for callers with override permission + * or when approval is no longer required. + * + *

When approval is required, combining allocation replacement with default_variant_key + * returns 400 Bad Request. Omit that parameter and submit the default + * variant change separately with CreateFlagSuggestion using the + * DEFAULT_VARIANT property and the variant ID. * * @param featureFlagId The ID of the feature flag. (required) * @param environmentId The ID of the environment. (required) * @param body (required) + * @param parameters Optional parameters for the request. * @return ApiResponse<ListAllocationsResponse> * @throws ApiException if fails to make API call * @http.response.details @@ -3445,17 +4583,20 @@ public ListAllocationsResponse updateAllocationsForFeatureFlagInEnvironment( * Response details * Status Code Description Response Headers * 200 OK - - * 202 Accepted - Approval required for this change - + * 201 Created - Approval is required. A suggestion was created and the change has not been applied. - * 400 Bad Request - * 403 Forbidden - * 404 Not Found - - * 409 Conflict - + * 409 Conflict - A conflicting suggestion is pending or the allocation update conflicts with the current configuration. - * 429 Too many requests - * */ public ApiResponse updateAllocationsForFeatureFlagInEnvironmentWithHttpInfo( - UUID featureFlagId, UUID environmentId, OverwriteAllocationsRequest body) + UUID featureFlagId, + UUID environmentId, + OverwriteAllocationsRequest body, + UpdateAllocationsForFeatureFlagInEnvironmentOptionalParameters parameters) throws ApiException { Object localVarPostBody = body; @@ -3482,6 +4623,7 @@ public ListAllocationsResponse updateAllocationsForFeatureFlagInEnvironment( "Missing the required parameter 'body' when calling" + " updateAllocationsForFeatureFlagInEnvironment"); } + String defaultVariantKey = parameters.defaultVariantKey; // create path and map variables String localVarPath = "/api/v2/feature-flags/{feature_flag_id}/environments/{environment_id}/allocations" @@ -3490,13 +4632,17 @@ public ListAllocationsResponse updateAllocationsForFeatureFlagInEnvironment( .replaceAll( "\\{" + "environment_id" + "\\}", apiClient.escapeString(environmentId.toString())); + List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "default_variant_key", defaultVariantKey)); + Invocation.Builder builder = apiClient.createBuilder( "v2.FeatureFlagsApi.updateAllocationsForFeatureFlagInEnvironment", localVarPath, - new ArrayList(), + localVarQueryParams, localVarHeaderParams, new HashMap(), new String[] {"application/json"}, @@ -3520,11 +4666,15 @@ public ListAllocationsResponse updateAllocationsForFeatureFlagInEnvironment( * @param featureFlagId The ID of the feature flag. (required) * @param environmentId The ID of the environment. (required) * @param body (required) + * @param parameters Optional parameters for the request. * @return CompletableFuture<ApiResponse<ListAllocationsResponse>> */ public CompletableFuture> updateAllocationsForFeatureFlagInEnvironmentWithHttpInfoAsync( - UUID featureFlagId, UUID environmentId, OverwriteAllocationsRequest body) { + UUID featureFlagId, + UUID environmentId, + OverwriteAllocationsRequest body, + UpdateAllocationsForFeatureFlagInEnvironmentOptionalParameters parameters) { Object localVarPostBody = body; // verify the required parameter 'featureFlagId' is set @@ -3559,6 +4709,7 @@ public ListAllocationsResponse updateAllocationsForFeatureFlagInEnvironment( + " updateAllocationsForFeatureFlagInEnvironment")); return result; } + String defaultVariantKey = parameters.defaultVariantKey; // create path and map variables String localVarPath = "/api/v2/feature-flags/{feature_flag_id}/environments/{environment_id}/allocations" @@ -3567,15 +4718,19 @@ public ListAllocationsResponse updateAllocationsForFeatureFlagInEnvironment( .replaceAll( "\\{" + "environment_id" + "\\}", apiClient.escapeString(environmentId.toString())); + List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "default_variant_key", defaultVariantKey)); + Invocation.Builder builder; try { builder = apiClient.createBuilder( "v2.FeatureFlagsApi.updateAllocationsForFeatureFlagInEnvironment", localVarPath, - new ArrayList(), + localVarQueryParams, localVarHeaderParams, new HashMap(), new String[] {"application/json"}, @@ -3630,14 +4785,33 @@ public CompletableFuture updateFeatureFlagAsync( } /** - * Updates an existing feature flag's metadata such as name and description. Does not modify - * targeting rules or allocations. + * Updates an existing feature flag's metadata, including its name, description, distribution + * channel, and tags. Does not modify targeting rules or allocations. * *

To change the owning team, update tags and include a tag of the form * team:<team-handle> in the array. tags is a full replacement of the * existing tag set (including any team: tag), so include every tag you want to keep, * not just the ones you're adding. * + *

To change the lifecycle, set staleness_status to ACTIVE + * (temporary) or PERMANENT. Either value clears any snooze; omit it to keep the + * lifecycle. Send staleness_status in a separate request from + * distribution_channel. Do not copy the top-level staleness_status from a + * response into the request: that legacy response field is always ACTIVE, so copying + * it makes a PERMANENT flag temporary. + * + *

When backend approvals are enabled and a distribution channel change requires approval, + * callers without the Feature Flag Approvals Override permission receive 201 Created + * with a suggestion instead of an updated flag. No fields in the request are applied. The + * suggestion contains only the distribution channel change. To update other fields, such as name, + * description, JSON schema, and tags, send a separate request without distribution_channel + * . + * + *

While backend approvals are enabled, a request that includes distribution_channel + * returns 409 Conflict if a distribution channel suggestion for the flag is + * pending, or approved but not yet applied. No fields are applied, including for callers with + * override permission. + * * @param featureFlagId The ID of the feature flag. (required) * @param body (required) * @return ApiResponse<FeatureFlagResponse> @@ -3647,9 +4821,11 @@ public CompletableFuture updateFeatureFlagAsync( * Response details * Status Code Description Response Headers * 200 OK - + * 201 Created - A distribution channel suggestion was created because approval is required. No flag fields were updated. - * 400 Bad Request - * 403 Forbidden - * 404 Not Found - + * 409 Conflict - A feature flag with this name already exists, a distribution channel suggestion is pending, or a pending experiment request or running approved experiment uses this flag. - * 429 Too many requests - * */ @@ -3764,6 +4940,178 @@ public CompletableFuture> updateFeatureFlagWith new GenericType() {}); } + /** + * Set the approval requirement for a feature flag. + * + *

See {@link #updateFeatureFlagApprovalsWithHttpInfo}. + * + * @param featureFlagId The ID of the feature flag. (required) + * @param body (required) + * @return FeatureFlagResponse + * @throws ApiException if fails to make API call + */ + public FeatureFlagResponse updateFeatureFlagApprovals( + UUID featureFlagId, UpdateFeatureFlagApprovalsRequest body) throws ApiException { + return updateFeatureFlagApprovalsWithHttpInfo(featureFlagId, body).getData(); + } + + /** + * Set the approval requirement for a feature flag. + * + *

See {@link #updateFeatureFlagApprovalsWithHttpInfoAsync}. + * + * @param featureFlagId The ID of the feature flag. (required) + * @param body (required) + * @return CompletableFuture<FeatureFlagResponse> + */ + public CompletableFuture updateFeatureFlagApprovalsAsync( + UUID featureFlagId, UpdateFeatureFlagApprovalsRequest body) { + return updateFeatureFlagApprovalsWithHttpInfoAsync(featureFlagId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Enables or disables the approval requirement for a feature flag. Requires the Feature Flag + * Write permission and contributor or editor access to the flag. Disabling approvals also + * requires the Feature Flag Approvals Override permission, even if approvals are already + * disabled. This operation updates the setting directly and does not create a suggestion. + * Changing the setting returns 409 Conflict when a pending experiment request or a + * running approved experiment uses the flag. + * + * @param featureFlagId The ID of the feature flag. (required) + * @param body (required) + * @return ApiResponse<FeatureFlagResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request - Invalid request parameters or body. -
403 Forbidden -
404 Not Found -
409 Conflict - A pending experiment request or a running approved experiment uses this flag. -
429 Too many requests -
+ */ + public ApiResponse updateFeatureFlagApprovalsWithHttpInfo( + UUID featureFlagId, UpdateFeatureFlagApprovalsRequest 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 updateFeatureFlagApprovals"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling updateFeatureFlagApprovals"); + } + // create path and map variables + String localVarPath = + "/api/v2/feature-flags/{feature_flag_id}/require-approval" + .replaceAll( + "\\{" + "feature_flag_id" + "\\}", + apiClient.escapeString(featureFlagId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.FeatureFlagsApi.updateFeatureFlagApprovals", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Set the approval requirement for a feature flag. + * + *

See {@link #updateFeatureFlagApprovalsWithHttpInfo}. + * + * @param featureFlagId The ID of the feature flag. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<FeatureFlagResponse>> + */ + public CompletableFuture> + updateFeatureFlagApprovalsWithHttpInfoAsync( + UUID featureFlagId, UpdateFeatureFlagApprovalsRequest 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" + + " updateFeatureFlagApprovals")); + 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 updateFeatureFlagApprovals")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/feature-flags/{feature_flag_id}/require-approval" + .replaceAll( + "\\{" + "feature_flag_id" + "\\}", + apiClient.escapeString(featureFlagId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.FeatureFlagsApi.updateFeatureFlagApprovals", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } 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() {}); + } + /** * Update an environment. * @@ -4142,11 +5490,16 @@ public CompletableFuture updateVariantForFeatureFlagAsync( /** * Updates the name and value of an existing variant on a feature flag. * - *

When backend approvals are enabled and the flag requires approval, this endpoint creates and - * returns a FlagSuggestion with 201 Created instead of applying the - * change immediately. Use the returned suggestion id to approve or reject the - * change. If a pending suggestion already exists for this flag's variant property, the endpoint - * returns 409 Conflict. + *

When backend approvals are enabled and this change requires approval, callers without the + * Feature Flag Approvals Override permission receive 201 Created with a persisted + * suggestion, in the same format as the GetFlagSuggestion response. The change is + * not applied until the suggestion is approved and applied. Use the returned suggestion ID with + * GetFlagSuggestion, ApproveFlagSuggestion, RejectFlagSuggestion + * , or DeleteFlagSuggestion. + * + *

A conflicting suggestion that is pending, or approved but not yet applied, returns + * 409 Conflict without applying the change, including for callers with override permission + * or when approval is no longer required. * * @param featureFlagId The ID of the feature flag. (required) * @param variantId The ID of the variant. (required) @@ -4158,6 +5511,7 @@ public CompletableFuture updateVariantForFeatureFlagAsync( * Response details * Status Code Description Response Headers * 200 OK - + * 201 Created - Approval is required. A suggestion was created and the change has not been applied. - * 400 Bad Request - * 403 Forbidden - * 404 Not Found - diff --git a/src/main/java/com/datadog/api/client/v2/model/ApproveFlagSuggestionAttributes.java b/src/main/java/com/datadog/api/client/v2/model/ApproveFlagSuggestionAttributes.java new file mode 100644 index 00000000000..42e80cbd0db --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ApproveFlagSuggestionAttributes.java @@ -0,0 +1,167 @@ +/* + * 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; + +/** Approval options for the suggestion. */ +@JsonPropertyOrder({ + ApproveFlagSuggestionAttributes.JSON_PROPERTY_APPLY, + ApproveFlagSuggestionAttributes.JSON_PROPERTY_COMMENT +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ApproveFlagSuggestionAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_APPLY = "apply"; + private Boolean apply = true; + + public static final String JSON_PROPERTY_COMMENT = "comment"; + private String comment; + + public ApproveFlagSuggestionAttributes apply(Boolean apply) { + this.apply = apply; + return this; + } + + /** + * Whether to apply the change immediately. Set to false to approve without applying, + * then call ApplyFlagSuggestion later. + * + * @return apply + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_APPLY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getApply() { + return apply; + } + + public void setApply(Boolean apply) { + this.apply = apply; + } + + public ApproveFlagSuggestionAttributes comment(String comment) { + this.comment = comment; + return this; + } + + /** + * A comment explaining the approval. + * + * @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 ApproveFlagSuggestionAttributes + */ + @JsonAnySetter + public ApproveFlagSuggestionAttributes 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 ApproveFlagSuggestionAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ApproveFlagSuggestionAttributes approveFlagSuggestionAttributes = + (ApproveFlagSuggestionAttributes) o; + return Objects.equals(this.apply, approveFlagSuggestionAttributes.apply) + && Objects.equals(this.comment, approveFlagSuggestionAttributes.comment) + && Objects.equals( + this.additionalProperties, approveFlagSuggestionAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apply, comment, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ApproveFlagSuggestionAttributes {\n"); + sb.append(" apply: ").append(toIndentedString(apply)).append("\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/ApproveFlagSuggestionData.java b/src/main/java/com/datadog/api/client/v2/model/ApproveFlagSuggestionData.java new file mode 100644 index 00000000000..cd9fa4be69d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ApproveFlagSuggestionData.java @@ -0,0 +1,186 @@ +/* + * 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; + +/** The approval event to create. */ +@JsonPropertyOrder({ + ApproveFlagSuggestionData.JSON_PROPERTY_ATTRIBUTES, + ApproveFlagSuggestionData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ApproveFlagSuggestionData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private ApproveFlagSuggestionAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private ReviewFlagSuggestionDataType type; + + public ApproveFlagSuggestionData() {} + + @JsonCreator + public ApproveFlagSuggestionData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + ApproveFlagSuggestionAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + ReviewFlagSuggestionDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public ApproveFlagSuggestionData attributes(ApproveFlagSuggestionAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Approval options for the suggestion. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ApproveFlagSuggestionAttributes getAttributes() { + return attributes; + } + + public void setAttributes(ApproveFlagSuggestionAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public ApproveFlagSuggestionData type(ReviewFlagSuggestionDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The resource type for reviewing feature flag suggestions. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ReviewFlagSuggestionDataType getType() { + return type; + } + + public void setType(ReviewFlagSuggestionDataType 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 ApproveFlagSuggestionData + */ + @JsonAnySetter + public ApproveFlagSuggestionData 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 ApproveFlagSuggestionData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ApproveFlagSuggestionData approveFlagSuggestionData = (ApproveFlagSuggestionData) o; + return Objects.equals(this.attributes, approveFlagSuggestionData.attributes) + && Objects.equals(this.type, approveFlagSuggestionData.type) + && Objects.equals( + this.additionalProperties, approveFlagSuggestionData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ApproveFlagSuggestionData {\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/ApproveFlagSuggestionRequest.java b/src/main/java/com/datadog/api/client/v2/model/ApproveFlagSuggestionRequest.java new file mode 100644 index 00000000000..15fa6d09638 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ApproveFlagSuggestionRequest.java @@ -0,0 +1,149 @@ +/* + * 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 a feature flag change suggestion. */ +@JsonPropertyOrder({ApproveFlagSuggestionRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ApproveFlagSuggestionRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private ApproveFlagSuggestionData data; + + public ApproveFlagSuggestionRequest() {} + + @JsonCreator + public ApproveFlagSuggestionRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) ApproveFlagSuggestionData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public ApproveFlagSuggestionRequest data(ApproveFlagSuggestionData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The approval event to create. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ApproveFlagSuggestionData getData() { + return data; + } + + public void setData(ApproveFlagSuggestionData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * 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 ApproveFlagSuggestionRequest + */ + @JsonAnySetter + public ApproveFlagSuggestionRequest 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 ApproveFlagSuggestionRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ApproveFlagSuggestionRequest approveFlagSuggestionRequest = (ApproveFlagSuggestionRequest) o; + return Objects.equals(this.data, approveFlagSuggestionRequest.data) + && Objects.equals( + this.additionalProperties, approveFlagSuggestionRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ApproveFlagSuggestionRequest {\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/CreateFlagSuggestionAttributes.java b/src/main/java/com/datadog/api/client/v2/model/CreateFlagSuggestionAttributes.java new file mode 100644 index 00000000000..c4314212815 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreateFlagSuggestionAttributes.java @@ -0,0 +1,341 @@ +/* + * 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 feature flag change 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 String 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 String property; + + public static final String JSON_PROPERTY_SUGGESTION = "suggestion"; + private String suggestion; + + public static final String JSON_PROPERTY_SUGGESTION_METADATA = "suggestion_metadata"; + private FeatureFlagSuggestionMetadataRequest suggestionMetadata; + + public CreateFlagSuggestionAttributes() {} + + @JsonCreator + public CreateFlagSuggestionAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_ACTION) String action, + @JsonProperty(required = true, value = JSON_PROPERTY_NOTIFICATION_RULE_TARGETS) + List notificationRuleTargets, + @JsonProperty(required = true, value = JSON_PROPERTY_PROPERTY) String property) { + this.action = action; + this.notificationRuleTargets = notificationRuleTargets; + this.property = property; + } + + public CreateFlagSuggestionAttributes action(String action) { + this.action = action; + return this; + } + + /** + * The action proposed by the suggestion. + * + * @return action + */ + @JsonProperty(JSON_PROPERTY_ACTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getAction() { + return action; + } + + public void setAction(String action) { + this.action = action; + } + + public CreateFlagSuggestionAttributes comment(String comment) { + this.comment = comment; + return this; + } + + /** + * A comment explaining the proposed 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 ID of the target environment. Required for ALLOCATIONS, DEFAULT_VARIANT + * , and OVERRIDE_VARIANT 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; + } + + /** + * Handles to notify about the review, without the @ prefix. For example, an email + * address or a 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(String property) { + this.property = property; + return this; + } + + /** + * The property to change. The property must require approval for this flag and environment. + * + * @return property + */ + @JsonProperty(JSON_PROPERTY_PROPERTY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getProperty() { + return property; + } + + public void setProperty(String property) { + this.property = property; + } + + public CreateFlagSuggestionAttributes suggestion(String suggestion) { + this.suggestion = suggestion; + return this; + } + + /** + * The proposed value as a string. For structured values, supply a JSON-encoded string. + * + * @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( + FeatureFlagSuggestionMetadataRequest suggestionMetadata) { + this.suggestionMetadata = suggestionMetadata; + this.unparsed |= suggestionMetadata.unparsed; + return this; + } + + /** + * Client-settable metadata for a suggestion. + * + * @return suggestionMetadata + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SUGGESTION_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public FeatureFlagSuggestionMetadataRequest getSuggestionMetadata() { + return suggestionMetadata; + } + + public void setSuggestionMetadata(FeatureFlagSuggestionMetadataRequest suggestionMetadata) { + this.suggestionMetadata = suggestionMetadata; + if (suggestionMetadata != null) { + this.unparsed |= suggestionMetadata.unparsed; + } + } + + /** + * 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..e8e802b9e55 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreateFlagSuggestionData.java @@ -0,0 +1,185 @@ +/* + * 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; + +/** The suggestion to create. */ +@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 FeatureFlagSuggestionDataType type; + + public CreateFlagSuggestionData() {} + + @JsonCreator + public CreateFlagSuggestionData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + CreateFlagSuggestionAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + FeatureFlagSuggestionDataType 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 feature flag change 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; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public CreateFlagSuggestionData type(FeatureFlagSuggestionDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The resource type for feature flag suggestions. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FeatureFlagSuggestionDataType getType() { + return type; + } + + public void setType(FeatureFlagSuggestionDataType 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..034574810c4 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreateFlagSuggestionRequest.java @@ -0,0 +1,149 @@ +/* + * 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 feature flag change 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; + } + + /** + * The suggestion to create. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CreateFlagSuggestionData getData() { + return data; + } + + public void setData(CreateFlagSuggestionData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * 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/FeatureFlagApprovalRequired.java b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagApprovalRequired.java new file mode 100644 index 00000000000..da42317c563 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagApprovalRequired.java @@ -0,0 +1,215 @@ +/* + * 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 proposed change requiring explicit submission through CreateFlagSuggestion. */ +@JsonPropertyOrder({ + FeatureFlagApprovalRequired.JSON_PROPERTY_ATTRIBUTES, + FeatureFlagApprovalRequired.JSON_PROPERTY_ID, + FeatureFlagApprovalRequired.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FeatureFlagApprovalRequired { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private FeatureFlagApprovalRequiredAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private FeatureFlagApprovalRequiredDataType type; + + public FeatureFlagApprovalRequired() {} + + @JsonCreator + public FeatureFlagApprovalRequired( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + FeatureFlagApprovalRequiredAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) UUID id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + FeatureFlagApprovalRequiredDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public FeatureFlagApprovalRequired attributes(FeatureFlagApprovalRequiredAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The change to submit for approval. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FeatureFlagApprovalRequiredAttributes getAttributes() { + return attributes; + } + + public void setAttributes(FeatureFlagApprovalRequiredAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public FeatureFlagApprovalRequired id(UUID id) { + this.id = id; + return this; + } + + /** + * The ID of the feature flag. This is not a suggestion ID. + * + * @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 FeatureFlagApprovalRequired type(FeatureFlagApprovalRequiredDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The resource type for an approval-required response. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FeatureFlagApprovalRequiredDataType getType() { + return type; + } + + public void setType(FeatureFlagApprovalRequiredDataType 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 FeatureFlagApprovalRequired + */ + @JsonAnySetter + public FeatureFlagApprovalRequired 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 FeatureFlagApprovalRequired object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FeatureFlagApprovalRequired featureFlagApprovalRequired = (FeatureFlagApprovalRequired) o; + return Objects.equals(this.attributes, featureFlagApprovalRequired.attributes) + && Objects.equals(this.id, featureFlagApprovalRequired.id) + && Objects.equals(this.type, featureFlagApprovalRequired.type) + && Objects.equals( + this.additionalProperties, featureFlagApprovalRequired.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FeatureFlagApprovalRequired {\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/FeatureFlagApprovalRequiredAttributes.java b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagApprovalRequiredAttributes.java new file mode 100644 index 00000000000..ed448ac6940 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagApprovalRequiredAttributes.java @@ -0,0 +1,266 @@ +/* + * 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; + +/** The change to submit for approval. */ +@JsonPropertyOrder({ + FeatureFlagApprovalRequiredAttributes.JSON_PROPERTY_ACTION, + FeatureFlagApprovalRequiredAttributes.JSON_PROPERTY_ENVIRONMENT_ID, + FeatureFlagApprovalRequiredAttributes.JSON_PROPERTY_PROPERTY, + FeatureFlagApprovalRequiredAttributes.JSON_PROPERTY_SUGGESTION, + FeatureFlagApprovalRequiredAttributes.JSON_PROPERTY_SUGGESTION_METADATA +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FeatureFlagApprovalRequiredAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ACTION = "action"; + private String action; + + public static final String JSON_PROPERTY_ENVIRONMENT_ID = "environment_id"; + private UUID environmentId; + + public static final String JSON_PROPERTY_PROPERTY = "property"; + private String property; + + public static final String JSON_PROPERTY_SUGGESTION = "suggestion"; + private String suggestion; + + public static final String JSON_PROPERTY_SUGGESTION_METADATA = "suggestion_metadata"; + private FeatureFlagSuggestionMetadata suggestionMetadata; + + public FeatureFlagApprovalRequiredAttributes() {} + + @JsonCreator + public FeatureFlagApprovalRequiredAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_ACTION) String action, + @JsonProperty(required = true, value = JSON_PROPERTY_PROPERTY) String property, + @JsonProperty(required = true, value = JSON_PROPERTY_SUGGESTION) String suggestion) { + this.action = action; + this.property = property; + this.suggestion = suggestion; + } + + public FeatureFlagApprovalRequiredAttributes action(String action) { + this.action = action; + return this; + } + + /** + * The proposed action. + * + * @return action + */ + @JsonProperty(JSON_PROPERTY_ACTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getAction() { + return action; + } + + public void setAction(String action) { + this.action = action; + } + + public FeatureFlagApprovalRequiredAttributes environmentId(UUID environmentId) { + this.environmentId = environmentId; + return this; + } + + /** + * The ID of the environment targeted by the change. + * + * @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 FeatureFlagApprovalRequiredAttributes property(String property) { + this.property = property; + return this; + } + + /** + * The feature flag property to change. + * + * @return property + */ + @JsonProperty(JSON_PROPERTY_PROPERTY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getProperty() { + return property; + } + + public void setProperty(String property) { + this.property = property; + } + + public FeatureFlagApprovalRequiredAttributes suggestion(String suggestion) { + this.suggestion = suggestion; + return this; + } + + /** + * The proposed value, serialized as a string. Allocation sets are JSON-encoded strings. + * + * @return suggestion + */ + @JsonProperty(JSON_PROPERTY_SUGGESTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getSuggestion() { + return suggestion; + } + + public void setSuggestion(String suggestion) { + this.suggestion = suggestion; + } + + public FeatureFlagApprovalRequiredAttributes suggestionMetadata( + FeatureFlagSuggestionMetadata suggestionMetadata) { + this.suggestionMetadata = suggestionMetadata; + this.unparsed |= suggestionMetadata.unparsed; + return this; + } + + /** + * Metadata associated with a suggestion. Fields other than variant_id are set by the + * server. + * + * @return suggestionMetadata + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SUGGESTION_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public FeatureFlagSuggestionMetadata getSuggestionMetadata() { + return suggestionMetadata; + } + + public void setSuggestionMetadata(FeatureFlagSuggestionMetadata suggestionMetadata) { + this.suggestionMetadata = suggestionMetadata; + if (suggestionMetadata != null) { + this.unparsed |= suggestionMetadata.unparsed; + } + } + + /** + * 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 FeatureFlagApprovalRequiredAttributes + */ + @JsonAnySetter + public FeatureFlagApprovalRequiredAttributes 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 FeatureFlagApprovalRequiredAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FeatureFlagApprovalRequiredAttributes featureFlagApprovalRequiredAttributes = + (FeatureFlagApprovalRequiredAttributes) o; + return Objects.equals(this.action, featureFlagApprovalRequiredAttributes.action) + && Objects.equals(this.environmentId, featureFlagApprovalRequiredAttributes.environmentId) + && Objects.equals(this.property, featureFlagApprovalRequiredAttributes.property) + && Objects.equals(this.suggestion, featureFlagApprovalRequiredAttributes.suggestion) + && Objects.equals( + this.suggestionMetadata, featureFlagApprovalRequiredAttributes.suggestionMetadata) + && Objects.equals( + this.additionalProperties, featureFlagApprovalRequiredAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + action, environmentId, property, suggestion, suggestionMetadata, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FeatureFlagApprovalRequiredAttributes {\n"); + sb.append(" action: ").append(toIndentedString(action)).append("\n"); + sb.append(" environmentId: ").append(toIndentedString(environmentId)).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/FeatureFlagApprovalRequiredDataType.java b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagApprovalRequiredDataType.java new file mode 100644 index 00000000000..24f7fc5d751 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagApprovalRequiredDataType.java @@ -0,0 +1,59 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +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 resource type for an approval-required response. */ +@JsonSerialize( + using = FeatureFlagApprovalRequiredDataType.FeatureFlagApprovalRequiredDataTypeSerializer.class) +public class FeatureFlagApprovalRequiredDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("approval-required")); + + public static final FeatureFlagApprovalRequiredDataType APPROVAL_REQUIRED = + new FeatureFlagApprovalRequiredDataType("approval-required"); + + FeatureFlagApprovalRequiredDataType(String value) { + super(value, allowedValues); + } + + public static class FeatureFlagApprovalRequiredDataTypeSerializer + extends StdSerializer { + public FeatureFlagApprovalRequiredDataTypeSerializer( + Class t) { + super(t); + } + + public FeatureFlagApprovalRequiredDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + FeatureFlagApprovalRequiredDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static FeatureFlagApprovalRequiredDataType fromValue(String value) { + return new FeatureFlagApprovalRequiredDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FeatureFlagApprovalRequiredResponse.java b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagApprovalRequiredResponse.java new file mode 100644 index 00000000000..eec7b510c8c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagApprovalRequiredResponse.java @@ -0,0 +1,150 @@ +/* + * 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; + +/** Approval-required response containing a proposed change. No suggestion has been persisted. */ +@JsonPropertyOrder({FeatureFlagApprovalRequiredResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FeatureFlagApprovalRequiredResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private FeatureFlagApprovalRequired data; + + public FeatureFlagApprovalRequiredResponse() {} + + @JsonCreator + public FeatureFlagApprovalRequiredResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) FeatureFlagApprovalRequired data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public FeatureFlagApprovalRequiredResponse data(FeatureFlagApprovalRequired data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * A proposed change requiring explicit submission through CreateFlagSuggestion. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FeatureFlagApprovalRequired getData() { + return data; + } + + public void setData(FeatureFlagApprovalRequired data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * 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 FeatureFlagApprovalRequiredResponse + */ + @JsonAnySetter + public FeatureFlagApprovalRequiredResponse 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 FeatureFlagApprovalRequiredResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FeatureFlagApprovalRequiredResponse featureFlagApprovalRequiredResponse = + (FeatureFlagApprovalRequiredResponse) o; + return Objects.equals(this.data, featureFlagApprovalRequiredResponse.data) + && Objects.equals( + this.additionalProperties, featureFlagApprovalRequiredResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FeatureFlagApprovalRequiredResponse {\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/FeatureFlagApprovalsDataType.java b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagApprovalsDataType.java new file mode 100644 index 00000000000..ce69a9cf5a2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagApprovalsDataType.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 resource type for feature flag approval settings. */ +@JsonSerialize(using = FeatureFlagApprovalsDataType.FeatureFlagApprovalsDataTypeSerializer.class) +public class FeatureFlagApprovalsDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("feature-flag-approvals")); + + public static final FeatureFlagApprovalsDataType FEATURE_FLAG_APPROVALS = + new FeatureFlagApprovalsDataType("feature-flag-approvals"); + + FeatureFlagApprovalsDataType(String value) { + super(value, allowedValues); + } + + public static class FeatureFlagApprovalsDataTypeSerializer + extends StdSerializer { + public FeatureFlagApprovalsDataTypeSerializer(Class t) { + super(t); + } + + public FeatureFlagApprovalsDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + FeatureFlagApprovalsDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static FeatureFlagApprovalsDataType fromValue(String value) { + return new FeatureFlagApprovalsDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FeatureFlagAttributes.java b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagAttributes.java index 975a2fac11c..ac6b466feb9 100644 --- a/src/main/java/com/datadog/api/client/v2/model/FeatureFlagAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagAttributes.java @@ -446,10 +446,15 @@ public FeatureFlagAttributes stalenessStatus(String stalenessStatus) { } /** - * Indicates the whether a feature flag is stale or not. + * Legacy status retained for compatibility. This field is always ACTIVE; use + * staleness_details.staleness_status for the computed status. Do not copy it into an + * update request: sending ACTIVE makes a PERMANENT flag temporary and + * clears any snooze. * * @return stalenessStatus + * @deprecated */ + @Deprecated @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_STALENESS_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -457,6 +462,7 @@ public String getStalenessStatus() { return stalenessStatus; } + @Deprecated public void setStalenessStatus(String stalenessStatus) { this.stalenessStatus = stalenessStatus; } diff --git a/src/main/java/com/datadog/api/client/v2/model/FeatureFlagListItemAttributes.java b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagListItemAttributes.java index 65570a00186..68e39f6349e 100644 --- a/src/main/java/com/datadog/api/client/v2/model/FeatureFlagListItemAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagListItemAttributes.java @@ -449,7 +449,9 @@ public FeatureFlagListItemAttributes stalenessStatus(String stalenessStatus) { /** * Legacy status retained for compatibility. This field is always ACTIVE; use - * staleness_details.staleness_status for the computed status. + * staleness_details.staleness_status for the computed status. Do not copy it into an + * update request: sending ACTIVE makes a PERMANENT flag temporary and + * clears any snooze. * * @return stalenessStatus * @deprecated diff --git a/src/main/java/com/datadog/api/client/v2/model/FeatureFlagSuggestion.java b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagSuggestion.java new file mode 100644 index 00000000000..e10b658cd1e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagSuggestion.java @@ -0,0 +1,214 @@ +/* + * 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 proposed feature flag change and its approval lifecycle. */ +@JsonPropertyOrder({ + FeatureFlagSuggestion.JSON_PROPERTY_ATTRIBUTES, + FeatureFlagSuggestion.JSON_PROPERTY_ID, + FeatureFlagSuggestion.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FeatureFlagSuggestion { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private FeatureFlagSuggestionAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private FeatureFlagSuggestionDataType type; + + public FeatureFlagSuggestion() {} + + @JsonCreator + public FeatureFlagSuggestion( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + FeatureFlagSuggestionAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) UUID id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + FeatureFlagSuggestionDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public FeatureFlagSuggestion attributes(FeatureFlagSuggestionAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of a feature flag change suggestion. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FeatureFlagSuggestionAttributes getAttributes() { + return attributes; + } + + public void setAttributes(FeatureFlagSuggestionAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public FeatureFlagSuggestion id(UUID id) { + this.id = id; + return this; + } + + /** + * The unique identifier of 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 FeatureFlagSuggestion type(FeatureFlagSuggestionDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The resource type for feature flag suggestions. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FeatureFlagSuggestionDataType getType() { + return type; + } + + public void setType(FeatureFlagSuggestionDataType 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 FeatureFlagSuggestion + */ + @JsonAnySetter + public FeatureFlagSuggestion 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 FeatureFlagSuggestion object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FeatureFlagSuggestion featureFlagSuggestion = (FeatureFlagSuggestion) o; + return Objects.equals(this.attributes, featureFlagSuggestion.attributes) + && Objects.equals(this.id, featureFlagSuggestion.id) + && Objects.equals(this.type, featureFlagSuggestion.type) + && Objects.equals(this.additionalProperties, featureFlagSuggestion.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FeatureFlagSuggestion {\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/FeatureFlagSuggestionAttributes.java b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagSuggestionAttributes.java new file mode 100644 index 00000000000..95730a407ce --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagSuggestionAttributes.java @@ -0,0 +1,660 @@ +/* + * 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; + +/** Attributes of a feature flag change suggestion. */ +@JsonPropertyOrder({ + FeatureFlagSuggestionAttributes.JSON_PROPERTY_ACTION, + FeatureFlagSuggestionAttributes.JSON_PROPERTY_BASE_FLAG_HISTORY_ID, + FeatureFlagSuggestionAttributes.JSON_PROPERTY_COMMENT, + FeatureFlagSuggestionAttributes.JSON_PROPERTY_CREATED_AT, + FeatureFlagSuggestionAttributes.JSON_PROPERTY_CREATED_BY, + FeatureFlagSuggestionAttributes.JSON_PROPERTY_CURRENT_STATUS, + FeatureFlagSuggestionAttributes.JSON_PROPERTY_CURRENT_VALUE, + FeatureFlagSuggestionAttributes.JSON_PROPERTY_DELETED_AT, + FeatureFlagSuggestionAttributes.JSON_PROPERTY_DELETED_BY, + FeatureFlagSuggestionAttributes.JSON_PROPERTY_ENVIRONMENT_ID, + FeatureFlagSuggestionAttributes.JSON_PROPERTY_FEATURE_FLAG_ID, + FeatureFlagSuggestionAttributes.JSON_PROPERTY_LIFECYCLE_STATUS, + FeatureFlagSuggestionAttributes.JSON_PROPERTY_MESSAGE, + FeatureFlagSuggestionAttributes.JSON_PROPERTY_PROPERTY, + FeatureFlagSuggestionAttributes.JSON_PROPERTY_SUGGESTION, + FeatureFlagSuggestionAttributes.JSON_PROPERTY_SUGGESTION_METADATA, + FeatureFlagSuggestionAttributes.JSON_PROPERTY_UPDATED_AT, + FeatureFlagSuggestionAttributes.JSON_PROPERTY_UPDATED_BY +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FeatureFlagSuggestionAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ACTION = "action"; + private String 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 String comment; + + 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 FeatureFlagSuggestionAttributesCurrentStatus 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 OffsetDateTime deletedAt; + + public static final String JSON_PROPERTY_DELETED_BY = "deleted_by"; + private UUID deletedBy; + + public static final String JSON_PROPERTY_ENVIRONMENT_ID = "environment_id"; + private UUID environmentId; + + public static final String JSON_PROPERTY_FEATURE_FLAG_ID = "feature_flag_id"; + private UUID featureFlagId; + + public static final String JSON_PROPERTY_LIFECYCLE_STATUS = "lifecycle_status"; + private FeatureFlagSuggestionAttributesLifecycleStatus lifecycleStatus; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + private String message; + + public static final String JSON_PROPERTY_PROPERTY = "property"; + private String property; + + public static final String JSON_PROPERTY_SUGGESTION = "suggestion"; + private String suggestion; + + public static final String JSON_PROPERTY_SUGGESTION_METADATA = "suggestion_metadata"; + private FeatureFlagSuggestionMetadata suggestionMetadata; + + public static final String JSON_PROPERTY_UPDATED_AT = "updated_at"; + private OffsetDateTime updatedAt; + + public static final String JSON_PROPERTY_UPDATED_BY = "updated_by"; + private UUID updatedBy; + + public FeatureFlagSuggestionAttributes() {} + + @JsonCreator + public FeatureFlagSuggestionAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_ACTION) String action, + @JsonProperty(required = true, value = JSON_PROPERTY_BASE_FLAG_HISTORY_ID) + UUID baseFlagHistoryId, + @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) + FeatureFlagSuggestionAttributesCurrentStatus currentStatus, + @JsonProperty(required = true, value = JSON_PROPERTY_CURRENT_VALUE) String currentValue, + @JsonProperty(required = true, value = JSON_PROPERTY_FEATURE_FLAG_ID) UUID featureFlagId, + @JsonProperty(required = true, value = JSON_PROPERTY_LIFECYCLE_STATUS) + FeatureFlagSuggestionAttributesLifecycleStatus lifecycleStatus, + @JsonProperty(required = true, value = JSON_PROPERTY_PROPERTY) String property, + @JsonProperty(required = true, value = JSON_PROPERTY_SUGGESTION) String suggestion) { + this.action = action; + this.baseFlagHistoryId = baseFlagHistoryId; + this.createdAt = createdAt; + this.createdBy = createdBy; + this.currentStatus = currentStatus; + this.unparsed |= !currentStatus.isValid(); + this.currentValue = currentValue; + this.featureFlagId = featureFlagId; + this.lifecycleStatus = lifecycleStatus; + this.unparsed |= !lifecycleStatus.isValid(); + this.property = property; + this.suggestion = suggestion; + } + + public FeatureFlagSuggestionAttributes action(String action) { + this.action = action; + return this; + } + + /** + * The action proposed by the suggestion. + * + * @return action + */ + @JsonProperty(JSON_PROPERTY_ACTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getAction() { + return action; + } + + public void setAction(String action) { + this.action = action; + } + + public FeatureFlagSuggestionAttributes baseFlagHistoryId(UUID baseFlagHistoryId) { + this.baseFlagHistoryId = baseFlagHistoryId; + return this; + } + + /** + * The ID of the flag history entry on which the suggestion is based. + * + * @return baseFlagHistoryId + */ + @JsonProperty(JSON_PROPERTY_BASE_FLAG_HISTORY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getBaseFlagHistoryId() { + return baseFlagHistoryId; + } + + public void setBaseFlagHistoryId(UUID baseFlagHistoryId) { + this.baseFlagHistoryId = baseFlagHistoryId; + } + + public FeatureFlagSuggestionAttributes comment(String comment) { + this.comment = comment; + return this; + } + + /** + * The comment supplied by the suggestion's creator. + * + * @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 FeatureFlagSuggestionAttributes createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The timestamp 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 FeatureFlagSuggestionAttributes createdBy(UUID createdBy) { + this.createdBy = createdBy; + return this; + } + + /** + * The ID 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 FeatureFlagSuggestionAttributes currentStatus( + FeatureFlagSuggestionAttributesCurrentStatus currentStatus) { + this.currentStatus = currentStatus; + this.unparsed |= !currentStatus.isValid(); + return this; + } + + /** + * The legacy review status. Use lifecycle_status to distinguish approval from + * application. + * + * @return currentStatus + */ + @JsonProperty(JSON_PROPERTY_CURRENT_STATUS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FeatureFlagSuggestionAttributesCurrentStatus getCurrentStatus() { + return currentStatus; + } + + public void setCurrentStatus(FeatureFlagSuggestionAttributesCurrentStatus currentStatus) { + if (!currentStatus.isValid()) { + this.unparsed = true; + } + this.currentStatus = currentStatus; + } + + public FeatureFlagSuggestionAttributes currentValue(String currentValue) { + this.currentValue = currentValue; + return this; + } + + /** + * The value before the proposed change, serialized as a string. + * + * @return currentValue + */ + @JsonProperty(JSON_PROPERTY_CURRENT_VALUE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCurrentValue() { + return currentValue; + } + + public void setCurrentValue(String currentValue) { + this.currentValue = currentValue; + } + + public FeatureFlagSuggestionAttributes deletedAt(OffsetDateTime deletedAt) { + this.deletedAt = deletedAt; + return this; + } + + /** + * The timestamp when the suggestion was deleted. + * + * @return deletedAt + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DELETED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getDeletedAt() { + return deletedAt; + } + + public void setDeletedAt(OffsetDateTime deletedAt) { + this.deletedAt = deletedAt; + } + + public FeatureFlagSuggestionAttributes deletedBy(UUID deletedBy) { + this.deletedBy = deletedBy; + return this; + } + + /** + * The ID of the user who deleted the suggestion. + * + * @return deletedBy + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DELETED_BY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UUID getDeletedBy() { + return deletedBy; + } + + public void setDeletedBy(UUID deletedBy) { + this.deletedBy = deletedBy; + } + + public FeatureFlagSuggestionAttributes environmentId(UUID environmentId) { + this.environmentId = environmentId; + return this; + } + + /** + * The ID of the environment targeted by the change, if the change is environment-specific. + * + * @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 FeatureFlagSuggestionAttributes featureFlagId(UUID featureFlagId) { + this.featureFlagId = featureFlagId; + return this; + } + + /** + * The ID of the feature flag that the suggestion changes. + * + * @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 FeatureFlagSuggestionAttributes lifecycleStatus( + FeatureFlagSuggestionAttributesLifecycleStatus lifecycleStatus) { + this.lifecycleStatus = lifecycleStatus; + this.unparsed |= !lifecycleStatus.isValid(); + return this; + } + + /** + * The lifecycle status of the suggestion. + * + * @return lifecycleStatus + */ + @JsonProperty(JSON_PROPERTY_LIFECYCLE_STATUS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FeatureFlagSuggestionAttributesLifecycleStatus getLifecycleStatus() { + return lifecycleStatus; + } + + public void setLifecycleStatus(FeatureFlagSuggestionAttributesLifecycleStatus lifecycleStatus) { + if (!lifecycleStatus.isValid()) { + this.unparsed = true; + } + this.lifecycleStatus = lifecycleStatus; + } + + public FeatureFlagSuggestionAttributes message(String message) { + this.message = message; + return this; + } + + /** + * A message explaining why a suggestion was created. + * + * @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 FeatureFlagSuggestionAttributes property(String property) { + this.property = property; + return this; + } + + /** + * The feature flag property to update. + * + * @return property + */ + @JsonProperty(JSON_PROPERTY_PROPERTY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getProperty() { + return property; + } + + public void setProperty(String property) { + this.property = property; + } + + public FeatureFlagSuggestionAttributes suggestion(String suggestion) { + this.suggestion = suggestion; + return this; + } + + /** + * The proposed value, serialized as a string. Structured values, such as variants and + * allocations, are JSON-encoded strings. + * + * @return suggestion + */ + @JsonProperty(JSON_PROPERTY_SUGGESTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getSuggestion() { + return suggestion; + } + + public void setSuggestion(String suggestion) { + this.suggestion = suggestion; + } + + public FeatureFlagSuggestionAttributes suggestionMetadata( + FeatureFlagSuggestionMetadata suggestionMetadata) { + this.suggestionMetadata = suggestionMetadata; + this.unparsed |= suggestionMetadata.unparsed; + return this; + } + + /** + * Metadata associated with a suggestion. Fields other than variant_id are set by the + * server. + * + * @return suggestionMetadata + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SUGGESTION_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public FeatureFlagSuggestionMetadata getSuggestionMetadata() { + return suggestionMetadata; + } + + public void setSuggestionMetadata(FeatureFlagSuggestionMetadata suggestionMetadata) { + this.suggestionMetadata = suggestionMetadata; + if (suggestionMetadata != null) { + this.unparsed |= suggestionMetadata.unparsed; + } + } + + public FeatureFlagSuggestionAttributes updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * The timestamp when the suggestion was last updated. + * + * @return updatedAt + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + public FeatureFlagSuggestionAttributes updatedBy(UUID updatedBy) { + this.updatedBy = updatedBy; + return this; + } + + /** + * The ID of the user who last updated the suggestion. + * + * @return updatedBy + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_UPDATED_BY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UUID getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedBy(UUID updatedBy) { + this.updatedBy = 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 FeatureFlagSuggestionAttributes + */ + @JsonAnySetter + public FeatureFlagSuggestionAttributes 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 FeatureFlagSuggestionAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FeatureFlagSuggestionAttributes featureFlagSuggestionAttributes = + (FeatureFlagSuggestionAttributes) o; + return Objects.equals(this.action, featureFlagSuggestionAttributes.action) + && Objects.equals(this.baseFlagHistoryId, featureFlagSuggestionAttributes.baseFlagHistoryId) + && Objects.equals(this.comment, featureFlagSuggestionAttributes.comment) + && Objects.equals(this.createdAt, featureFlagSuggestionAttributes.createdAt) + && Objects.equals(this.createdBy, featureFlagSuggestionAttributes.createdBy) + && Objects.equals(this.currentStatus, featureFlagSuggestionAttributes.currentStatus) + && Objects.equals(this.currentValue, featureFlagSuggestionAttributes.currentValue) + && Objects.equals(this.deletedAt, featureFlagSuggestionAttributes.deletedAt) + && Objects.equals(this.deletedBy, featureFlagSuggestionAttributes.deletedBy) + && Objects.equals(this.environmentId, featureFlagSuggestionAttributes.environmentId) + && Objects.equals(this.featureFlagId, featureFlagSuggestionAttributes.featureFlagId) + && Objects.equals(this.lifecycleStatus, featureFlagSuggestionAttributes.lifecycleStatus) + && Objects.equals(this.message, featureFlagSuggestionAttributes.message) + && Objects.equals(this.property, featureFlagSuggestionAttributes.property) + && Objects.equals(this.suggestion, featureFlagSuggestionAttributes.suggestion) + && Objects.equals( + this.suggestionMetadata, featureFlagSuggestionAttributes.suggestionMetadata) + && Objects.equals(this.updatedAt, featureFlagSuggestionAttributes.updatedAt) + && Objects.equals(this.updatedBy, featureFlagSuggestionAttributes.updatedBy) + && Objects.equals( + this.additionalProperties, featureFlagSuggestionAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + action, + baseFlagHistoryId, + comment, + createdAt, + createdBy, + currentStatus, + currentValue, + deletedAt, + deletedBy, + environmentId, + featureFlagId, + lifecycleStatus, + message, + property, + suggestion, + suggestionMetadata, + updatedAt, + updatedBy, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FeatureFlagSuggestionAttributes {\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(" lifecycleStatus: ").append(toIndentedString(lifecycleStatus)).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/FeatureFlagSuggestionAttributesCurrentStatus.java b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagSuggestionAttributesCurrentStatus.java new file mode 100644 index 00000000000..ca74a5df5bb --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagSuggestionAttributesCurrentStatus.java @@ -0,0 +1,70 @@ +/* + * 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 legacy review status. Use lifecycle_status to distinguish approval from + * application. + */ +@JsonSerialize( + using = + FeatureFlagSuggestionAttributesCurrentStatus + .FeatureFlagSuggestionAttributesCurrentStatusSerializer.class) +public class FeatureFlagSuggestionAttributesCurrentStatus extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("pending", "approved", "rejected")); + + public static final FeatureFlagSuggestionAttributesCurrentStatus PENDING = + new FeatureFlagSuggestionAttributesCurrentStatus("pending"); + public static final FeatureFlagSuggestionAttributesCurrentStatus APPROVED = + new FeatureFlagSuggestionAttributesCurrentStatus("approved"); + public static final FeatureFlagSuggestionAttributesCurrentStatus REJECTED = + new FeatureFlagSuggestionAttributesCurrentStatus("rejected"); + + FeatureFlagSuggestionAttributesCurrentStatus(String value) { + super(value, allowedValues); + } + + public static class FeatureFlagSuggestionAttributesCurrentStatusSerializer + extends StdSerializer { + public FeatureFlagSuggestionAttributesCurrentStatusSerializer( + Class t) { + super(t); + } + + public FeatureFlagSuggestionAttributesCurrentStatusSerializer() { + this(null); + } + + @Override + public void serialize( + FeatureFlagSuggestionAttributesCurrentStatus value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static FeatureFlagSuggestionAttributesCurrentStatus fromValue(String value) { + return new FeatureFlagSuggestionAttributesCurrentStatus(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FeatureFlagSuggestionAttributesLifecycleStatus.java b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagSuggestionAttributesLifecycleStatus.java new file mode 100644 index 00000000000..c3f270ad72e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagSuggestionAttributesLifecycleStatus.java @@ -0,0 +1,71 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +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 lifecycle status of the suggestion. */ +@JsonSerialize( + using = + FeatureFlagSuggestionAttributesLifecycleStatus + .FeatureFlagSuggestionAttributesLifecycleStatusSerializer.class) +public class FeatureFlagSuggestionAttributesLifecycleStatus extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("pending", "approved", "applied", "rejected", "discarded")); + + public static final FeatureFlagSuggestionAttributesLifecycleStatus PENDING = + new FeatureFlagSuggestionAttributesLifecycleStatus("pending"); + public static final FeatureFlagSuggestionAttributesLifecycleStatus APPROVED = + new FeatureFlagSuggestionAttributesLifecycleStatus("approved"); + public static final FeatureFlagSuggestionAttributesLifecycleStatus APPLIED = + new FeatureFlagSuggestionAttributesLifecycleStatus("applied"); + public static final FeatureFlagSuggestionAttributesLifecycleStatus REJECTED = + new FeatureFlagSuggestionAttributesLifecycleStatus("rejected"); + public static final FeatureFlagSuggestionAttributesLifecycleStatus DISCARDED = + new FeatureFlagSuggestionAttributesLifecycleStatus("discarded"); + + FeatureFlagSuggestionAttributesLifecycleStatus(String value) { + super(value, allowedValues); + } + + public static class FeatureFlagSuggestionAttributesLifecycleStatusSerializer + extends StdSerializer { + public FeatureFlagSuggestionAttributesLifecycleStatusSerializer( + Class t) { + super(t); + } + + public FeatureFlagSuggestionAttributesLifecycleStatusSerializer() { + this(null); + } + + @Override + public void serialize( + FeatureFlagSuggestionAttributesLifecycleStatus value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static FeatureFlagSuggestionAttributesLifecycleStatus fromValue(String value) { + return new FeatureFlagSuggestionAttributesLifecycleStatus(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FeatureFlagSuggestionDataType.java b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagSuggestionDataType.java new file mode 100644 index 00000000000..39ed0a1cb56 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagSuggestionDataType.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 resource type for feature flag suggestions. */ +@JsonSerialize(using = FeatureFlagSuggestionDataType.FeatureFlagSuggestionDataTypeSerializer.class) +public class FeatureFlagSuggestionDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("flag-suggestions")); + + public static final FeatureFlagSuggestionDataType FLAG_SUGGESTIONS = + new FeatureFlagSuggestionDataType("flag-suggestions"); + + FeatureFlagSuggestionDataType(String value) { + super(value, allowedValues); + } + + public static class FeatureFlagSuggestionDataTypeSerializer + extends StdSerializer { + public FeatureFlagSuggestionDataTypeSerializer(Class t) { + super(t); + } + + public FeatureFlagSuggestionDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + FeatureFlagSuggestionDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static FeatureFlagSuggestionDataType fromValue(String value) { + return new FeatureFlagSuggestionDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FeatureFlagSuggestionExperimentAction.java b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagSuggestionExperimentAction.java new file mode 100644 index 00000000000..19df5c0a04c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagSuggestionExperimentAction.java @@ -0,0 +1,204 @@ +/* + * 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; + +/** Server-generated reference to an experiment action requiring approval. */ +@JsonPropertyOrder({ + FeatureFlagSuggestionExperimentAction.JSON_PROPERTY_ACTION, + FeatureFlagSuggestionExperimentAction.JSON_PROPERTY_EXPERIMENT_ID, + FeatureFlagSuggestionExperimentAction.JSON_PROPERTY_VERSION +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FeatureFlagSuggestionExperimentAction { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ACTION = "action"; + private String action; + + public static final String JSON_PROPERTY_EXPERIMENT_ID = "experiment_id"; + private UUID experimentId; + + public static final String JSON_PROPERTY_VERSION = "version"; + private Long version; + + public FeatureFlagSuggestionExperimentAction() {} + + @JsonCreator + public FeatureFlagSuggestionExperimentAction( + @JsonProperty(required = true, value = JSON_PROPERTY_ACTION) String action, + @JsonProperty(required = true, value = JSON_PROPERTY_EXPERIMENT_ID) UUID experimentId, + @JsonProperty(required = true, value = JSON_PROPERTY_VERSION) Long version) { + this.action = action; + this.experimentId = experimentId; + this.version = version; + } + + public FeatureFlagSuggestionExperimentAction action(String action) { + this.action = action; + return this; + } + + /** + * The proposed experiment action. + * + * @return action + */ + @JsonProperty(JSON_PROPERTY_ACTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getAction() { + return action; + } + + public void setAction(String action) { + this.action = action; + } + + public FeatureFlagSuggestionExperimentAction experimentId(UUID experimentId) { + this.experimentId = experimentId; + return this; + } + + /** + * The ID of the experiment. + * + * @return experimentId + */ + @JsonProperty(JSON_PROPERTY_EXPERIMENT_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getExperimentId() { + return experimentId; + } + + public void setExperimentId(UUID experimentId) { + this.experimentId = experimentId; + } + + public FeatureFlagSuggestionExperimentAction version(Long version) { + this.version = version; + return this; + } + + /** + * The version of the experiment action reference. + * + * @return version + */ + @JsonProperty(JSON_PROPERTY_VERSION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getVersion() { + return version; + } + + public void setVersion(Long version) { + this.version = version; + } + + /** + * 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 FeatureFlagSuggestionExperimentAction + */ + @JsonAnySetter + public FeatureFlagSuggestionExperimentAction 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 FeatureFlagSuggestionExperimentAction object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FeatureFlagSuggestionExperimentAction featureFlagSuggestionExperimentAction = + (FeatureFlagSuggestionExperimentAction) o; + return Objects.equals(this.action, featureFlagSuggestionExperimentAction.action) + && Objects.equals(this.experimentId, featureFlagSuggestionExperimentAction.experimentId) + && Objects.equals(this.version, featureFlagSuggestionExperimentAction.version) + && Objects.equals( + this.additionalProperties, featureFlagSuggestionExperimentAction.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(action, experimentId, version, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FeatureFlagSuggestionExperimentAction {\n"); + sb.append(" action: ").append(toIndentedString(action)).append("\n"); + sb.append(" experimentId: ").append(toIndentedString(experimentId)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).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/FeatureFlagSuggestionMetadata.java b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagSuggestionMetadata.java new file mode 100644 index 00000000000..d1ea66936be --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagSuggestionMetadata.java @@ -0,0 +1,239 @@ +/* + * 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; +import java.util.UUID; + +/** + * Metadata associated with a suggestion. Fields other than variant_id are set by the + * server. + */ +@JsonPropertyOrder({ + FeatureFlagSuggestionMetadata.JSON_PROPERTY_ALLOW_DRAFT_REORDER, + FeatureFlagSuggestionMetadata.JSON_PROPERTY_EXPERIMENT_ACTION, + FeatureFlagSuggestionMetadata.JSON_PROPERTY_EXPERIMENT_ACTION_REQUEST_FINGERPRINT, + FeatureFlagSuggestionMetadata.JSON_PROPERTY_VARIANT_ID +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FeatureFlagSuggestionMetadata { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ALLOW_DRAFT_REORDER = "allow_draft_reorder"; + private Boolean allowDraftReorder; + + public static final String JSON_PROPERTY_EXPERIMENT_ACTION = "experiment_action"; + private FeatureFlagSuggestionExperimentAction experimentAction; + + public static final String JSON_PROPERTY_EXPERIMENT_ACTION_REQUEST_FINGERPRINT = + "experiment_action_request_fingerprint"; + private String experimentActionRequestFingerprint; + + public static final String JSON_PROPERTY_VARIANT_ID = "variant_id"; + private UUID variantId; + + public FeatureFlagSuggestionMetadata allowDraftReorder(Boolean allowDraftReorder) { + this.allowDraftReorder = allowDraftReorder; + return this; + } + + /** + * Whether the server allows this allocation suggestion to reorder persisted drafts. + * + * @return allowDraftReorder + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ALLOW_DRAFT_REORDER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getAllowDraftReorder() { + return allowDraftReorder; + } + + public void setAllowDraftReorder(Boolean allowDraftReorder) { + this.allowDraftReorder = allowDraftReorder; + } + + public FeatureFlagSuggestionMetadata experimentAction( + FeatureFlagSuggestionExperimentAction experimentAction) { + this.experimentAction = experimentAction; + this.unparsed |= experimentAction.unparsed; + return this; + } + + /** + * Server-generated reference to an experiment action requiring approval. + * + * @return experimentAction + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EXPERIMENT_ACTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public FeatureFlagSuggestionExperimentAction getExperimentAction() { + return experimentAction; + } + + public void setExperimentAction(FeatureFlagSuggestionExperimentAction experimentAction) { + this.experimentAction = experimentAction; + if (experimentAction != null) { + this.unparsed |= experimentAction.unparsed; + } + } + + public FeatureFlagSuggestionMetadata experimentActionRequestFingerprint( + String experimentActionRequestFingerprint) { + this.experimentActionRequestFingerprint = experimentActionRequestFingerprint; + return this; + } + + /** + * Server-generated fingerprint of the experiment action request. + * + * @return experimentActionRequestFingerprint + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EXPERIMENT_ACTION_REQUEST_FINGERPRINT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getExperimentActionRequestFingerprint() { + return experimentActionRequestFingerprint; + } + + public void setExperimentActionRequestFingerprint(String experimentActionRequestFingerprint) { + this.experimentActionRequestFingerprint = experimentActionRequestFingerprint; + } + + public FeatureFlagSuggestionMetadata variantId(UUID variantId) { + this.variantId = variantId; + return this; + } + + /** + * The ID of the variant targeted by the suggestion. + * + * @return variantId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_VARIANT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UUID getVariantId() { + return variantId; + } + + public void setVariantId(UUID 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 FeatureFlagSuggestionMetadata + */ + @JsonAnySetter + public FeatureFlagSuggestionMetadata 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 FeatureFlagSuggestionMetadata object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FeatureFlagSuggestionMetadata featureFlagSuggestionMetadata = (FeatureFlagSuggestionMetadata) o; + return Objects.equals(this.allowDraftReorder, featureFlagSuggestionMetadata.allowDraftReorder) + && Objects.equals(this.experimentAction, featureFlagSuggestionMetadata.experimentAction) + && Objects.equals( + this.experimentActionRequestFingerprint, + featureFlagSuggestionMetadata.experimentActionRequestFingerprint) + && Objects.equals(this.variantId, featureFlagSuggestionMetadata.variantId) + && Objects.equals( + this.additionalProperties, featureFlagSuggestionMetadata.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + allowDraftReorder, + experimentAction, + experimentActionRequestFingerprint, + variantId, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FeatureFlagSuggestionMetadata {\n"); + sb.append(" allowDraftReorder: ").append(toIndentedString(allowDraftReorder)).append("\n"); + sb.append(" experimentAction: ").append(toIndentedString(experimentAction)).append("\n"); + sb.append(" experimentActionRequestFingerprint: ") + .append(toIndentedString(experimentActionRequestFingerprint)) + .append("\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/main/java/com/datadog/api/client/v2/model/FeatureFlagSuggestionMetadataRequest.java b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagSuggestionMetadataRequest.java new file mode 100644 index 00000000000..a732144a35f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagSuggestionMetadataRequest.java @@ -0,0 +1,138 @@ +/* + * 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; +import java.util.UUID; + +/** Client-settable metadata for a suggestion. */ +@JsonPropertyOrder({FeatureFlagSuggestionMetadataRequest.JSON_PROPERTY_VARIANT_ID}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FeatureFlagSuggestionMetadataRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_VARIANT_ID = "variant_id"; + private UUID variantId; + + public FeatureFlagSuggestionMetadataRequest variantId(UUID variantId) { + this.variantId = variantId; + return this; + } + + /** + * The ID of the variant targeted by the suggestion. + * + * @return variantId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_VARIANT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UUID getVariantId() { + return variantId; + } + + public void setVariantId(UUID 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 FeatureFlagSuggestionMetadataRequest + */ + @JsonAnySetter + public FeatureFlagSuggestionMetadataRequest 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 FeatureFlagSuggestionMetadataRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FeatureFlagSuggestionMetadataRequest featureFlagSuggestionMetadataRequest = + (FeatureFlagSuggestionMetadataRequest) o; + return Objects.equals(this.variantId, featureFlagSuggestionMetadataRequest.variantId) + && Objects.equals( + this.additionalProperties, featureFlagSuggestionMetadataRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(variantId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FeatureFlagSuggestionMetadataRequest {\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/main/java/com/datadog/api/client/v2/model/FeatureFlagSuggestionResponse.java b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagSuggestionResponse.java new file mode 100644 index 00000000000..38c82df092f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagSuggestionResponse.java @@ -0,0 +1,149 @@ +/* + * 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 feature flag change suggestion. */ +@JsonPropertyOrder({FeatureFlagSuggestionResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FeatureFlagSuggestionResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private FeatureFlagSuggestion data; + + public FeatureFlagSuggestionResponse() {} + + @JsonCreator + public FeatureFlagSuggestionResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) FeatureFlagSuggestion data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public FeatureFlagSuggestionResponse data(FeatureFlagSuggestion data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * A proposed feature flag change and its approval lifecycle. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FeatureFlagSuggestion getData() { + return data; + } + + public void setData(FeatureFlagSuggestion data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * 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 FeatureFlagSuggestionResponse + */ + @JsonAnySetter + public FeatureFlagSuggestionResponse 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 FeatureFlagSuggestionResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FeatureFlagSuggestionResponse featureFlagSuggestionResponse = (FeatureFlagSuggestionResponse) o; + return Objects.equals(this.data, featureFlagSuggestionResponse.data) + && Objects.equals( + this.additionalProperties, featureFlagSuggestionResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FeatureFlagSuggestionResponse {\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/RejectFlagSuggestionAttributes.java b/src/main/java/com/datadog/api/client/v2/model/RejectFlagSuggestionAttributes.java new file mode 100644 index 00000000000..f57ffbe1cd2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RejectFlagSuggestionAttributes.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; + +/** Rejection options for the suggestion. */ +@JsonPropertyOrder({RejectFlagSuggestionAttributes.JSON_PROPERTY_COMMENT}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RejectFlagSuggestionAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_COMMENT = "comment"; + private String comment; + + public RejectFlagSuggestionAttributes comment(String comment) { + this.comment = comment; + return this; + } + + /** + * A comment explaining the rejection. + * + * @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 RejectFlagSuggestionAttributes + */ + @JsonAnySetter + public RejectFlagSuggestionAttributes 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 RejectFlagSuggestionAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RejectFlagSuggestionAttributes rejectFlagSuggestionAttributes = + (RejectFlagSuggestionAttributes) o; + return Objects.equals(this.comment, rejectFlagSuggestionAttributes.comment) + && Objects.equals( + this.additionalProperties, rejectFlagSuggestionAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(comment, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RejectFlagSuggestionAttributes {\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/RejectFlagSuggestionData.java b/src/main/java/com/datadog/api/client/v2/model/RejectFlagSuggestionData.java new file mode 100644 index 00000000000..093ab22ada9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RejectFlagSuggestionData.java @@ -0,0 +1,185 @@ +/* + * 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; + +/** The rejection event to create. */ +@JsonPropertyOrder({ + RejectFlagSuggestionData.JSON_PROPERTY_ATTRIBUTES, + RejectFlagSuggestionData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RejectFlagSuggestionData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private RejectFlagSuggestionAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private ReviewFlagSuggestionDataType type; + + public RejectFlagSuggestionData() {} + + @JsonCreator + public RejectFlagSuggestionData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + RejectFlagSuggestionAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + ReviewFlagSuggestionDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public RejectFlagSuggestionData attributes(RejectFlagSuggestionAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Rejection options for the suggestion. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public RejectFlagSuggestionAttributes getAttributes() { + return attributes; + } + + public void setAttributes(RejectFlagSuggestionAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public RejectFlagSuggestionData type(ReviewFlagSuggestionDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The resource type for reviewing feature flag suggestions. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ReviewFlagSuggestionDataType getType() { + return type; + } + + public void setType(ReviewFlagSuggestionDataType 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 RejectFlagSuggestionData + */ + @JsonAnySetter + public RejectFlagSuggestionData 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 RejectFlagSuggestionData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RejectFlagSuggestionData rejectFlagSuggestionData = (RejectFlagSuggestionData) o; + return Objects.equals(this.attributes, rejectFlagSuggestionData.attributes) + && Objects.equals(this.type, rejectFlagSuggestionData.type) + && Objects.equals(this.additionalProperties, rejectFlagSuggestionData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RejectFlagSuggestionData {\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/RejectFlagSuggestionRequest.java b/src/main/java/com/datadog/api/client/v2/model/RejectFlagSuggestionRequest.java new file mode 100644 index 00000000000..a364799c98a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RejectFlagSuggestionRequest.java @@ -0,0 +1,149 @@ +/* + * 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 reject a feature flag change suggestion. */ +@JsonPropertyOrder({RejectFlagSuggestionRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RejectFlagSuggestionRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private RejectFlagSuggestionData data; + + public RejectFlagSuggestionRequest() {} + + @JsonCreator + public RejectFlagSuggestionRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) RejectFlagSuggestionData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public RejectFlagSuggestionRequest data(RejectFlagSuggestionData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The rejection event to create. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public RejectFlagSuggestionData getData() { + return data; + } + + public void setData(RejectFlagSuggestionData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * 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 RejectFlagSuggestionRequest + */ + @JsonAnySetter + public RejectFlagSuggestionRequest 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 RejectFlagSuggestionRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RejectFlagSuggestionRequest rejectFlagSuggestionRequest = (RejectFlagSuggestionRequest) o; + return Objects.equals(this.data, rejectFlagSuggestionRequest.data) + && Objects.equals( + this.additionalProperties, rejectFlagSuggestionRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RejectFlagSuggestionRequest {\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/ReviewFlagSuggestionDataType.java b/src/main/java/com/datadog/api/client/v2/model/ReviewFlagSuggestionDataType.java new file mode 100644 index 00000000000..08004cb33a9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ReviewFlagSuggestionDataType.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 resource type for reviewing feature flag suggestions. */ +@JsonSerialize(using = ReviewFlagSuggestionDataType.ReviewFlagSuggestionDataTypeSerializer.class) +public class ReviewFlagSuggestionDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("flag-suggestion-events")); + + public static final ReviewFlagSuggestionDataType FLAG_SUGGESTION_EVENTS = + new ReviewFlagSuggestionDataType("flag-suggestion-events"); + + ReviewFlagSuggestionDataType(String value) { + super(value, allowedValues); + } + + public static class ReviewFlagSuggestionDataTypeSerializer + extends StdSerializer { + public ReviewFlagSuggestionDataTypeSerializer(Class t) { + super(t); + } + + public ReviewFlagSuggestionDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + ReviewFlagSuggestionDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ReviewFlagSuggestionDataType fromValue(String value) { + return new ReviewFlagSuggestionDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/UpdateFeatureFlagApprovalsAttributes.java b/src/main/java/com/datadog/api/client/v2/model/UpdateFeatureFlagApprovalsAttributes.java new file mode 100644 index 00000000000..99617edd04a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UpdateFeatureFlagApprovalsAttributes.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; + +/** The approval requirement for the flag. */ +@JsonPropertyOrder({UpdateFeatureFlagApprovalsAttributes.JSON_PROPERTY_ENABLED}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UpdateFeatureFlagApprovalsAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ENABLED = "enabled"; + private Boolean enabled; + + public UpdateFeatureFlagApprovalsAttributes() {} + + @JsonCreator + public UpdateFeatureFlagApprovalsAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_ENABLED) Boolean enabled) { + this.enabled = enabled; + } + + public UpdateFeatureFlagApprovalsAttributes enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Whether approval is required. Disabling requires the Feature Flag Approvals Override + * permission. + * + * @return enabled + */ + @JsonProperty(JSON_PROPERTY_ENABLED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + /** + * 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 UpdateFeatureFlagApprovalsAttributes + */ + @JsonAnySetter + public UpdateFeatureFlagApprovalsAttributes 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 UpdateFeatureFlagApprovalsAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateFeatureFlagApprovalsAttributes updateFeatureFlagApprovalsAttributes = + (UpdateFeatureFlagApprovalsAttributes) o; + return Objects.equals(this.enabled, updateFeatureFlagApprovalsAttributes.enabled) + && Objects.equals( + this.additionalProperties, updateFeatureFlagApprovalsAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(enabled, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateFeatureFlagApprovalsAttributes {\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).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/UpdateFeatureFlagApprovalsData.java b/src/main/java/com/datadog/api/client/v2/model/UpdateFeatureFlagApprovalsData.java new file mode 100644 index 00000000000..cefa6737b60 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UpdateFeatureFlagApprovalsData.java @@ -0,0 +1,188 @@ +/* + * 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; + +/** The feature flag approval setting to update. */ +@JsonPropertyOrder({ + UpdateFeatureFlagApprovalsData.JSON_PROPERTY_ATTRIBUTES, + UpdateFeatureFlagApprovalsData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UpdateFeatureFlagApprovalsData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private UpdateFeatureFlagApprovalsAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private FeatureFlagApprovalsDataType type; + + public UpdateFeatureFlagApprovalsData() {} + + @JsonCreator + public UpdateFeatureFlagApprovalsData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + UpdateFeatureFlagApprovalsAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + FeatureFlagApprovalsDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public UpdateFeatureFlagApprovalsData attributes( + UpdateFeatureFlagApprovalsAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The approval requirement for the flag. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UpdateFeatureFlagApprovalsAttributes getAttributes() { + return attributes; + } + + public void setAttributes(UpdateFeatureFlagApprovalsAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public UpdateFeatureFlagApprovalsData type(FeatureFlagApprovalsDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The resource type for feature flag approval settings. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FeatureFlagApprovalsDataType getType() { + return type; + } + + public void setType(FeatureFlagApprovalsDataType 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 UpdateFeatureFlagApprovalsData + */ + @JsonAnySetter + public UpdateFeatureFlagApprovalsData 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 UpdateFeatureFlagApprovalsData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateFeatureFlagApprovalsData updateFeatureFlagApprovalsData = + (UpdateFeatureFlagApprovalsData) o; + return Objects.equals(this.attributes, updateFeatureFlagApprovalsData.attributes) + && Objects.equals(this.type, updateFeatureFlagApprovalsData.type) + && Objects.equals( + this.additionalProperties, updateFeatureFlagApprovalsData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateFeatureFlagApprovalsData {\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/UpdateFeatureFlagApprovalsRequest.java b/src/main/java/com/datadog/api/client/v2/model/UpdateFeatureFlagApprovalsRequest.java new file mode 100644 index 00000000000..d601341b1f0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UpdateFeatureFlagApprovalsRequest.java @@ -0,0 +1,151 @@ +/* + * 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 change whether a feature flag requires approval. */ +@JsonPropertyOrder({UpdateFeatureFlagApprovalsRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UpdateFeatureFlagApprovalsRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private UpdateFeatureFlagApprovalsData data; + + public UpdateFeatureFlagApprovalsRequest() {} + + @JsonCreator + public UpdateFeatureFlagApprovalsRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + UpdateFeatureFlagApprovalsData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public UpdateFeatureFlagApprovalsRequest data(UpdateFeatureFlagApprovalsData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The feature flag approval setting to update. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UpdateFeatureFlagApprovalsData getData() { + return data; + } + + public void setData(UpdateFeatureFlagApprovalsData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * 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 UpdateFeatureFlagApprovalsRequest + */ + @JsonAnySetter + public UpdateFeatureFlagApprovalsRequest 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 UpdateFeatureFlagApprovalsRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateFeatureFlagApprovalsRequest updateFeatureFlagApprovalsRequest = + (UpdateFeatureFlagApprovalsRequest) o; + return Objects.equals(this.data, updateFeatureFlagApprovalsRequest.data) + && Objects.equals( + this.additionalProperties, updateFeatureFlagApprovalsRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateFeatureFlagApprovalsRequest {\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/UpdateFeatureFlagAttributes.java b/src/main/java/com/datadog/api/client/v2/model/UpdateFeatureFlagAttributes.java index 6ee6ac08309..be6f3102cf9 100644 --- a/src/main/java/com/datadog/api/client/v2/model/UpdateFeatureFlagAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/UpdateFeatureFlagAttributes.java @@ -22,8 +22,10 @@ /** Attributes for updating a feature flag. */ @JsonPropertyOrder({ UpdateFeatureFlagAttributes.JSON_PROPERTY_DESCRIPTION, + UpdateFeatureFlagAttributes.JSON_PROPERTY_DISTRIBUTION_CHANNEL, UpdateFeatureFlagAttributes.JSON_PROPERTY_JSON_SCHEMA, UpdateFeatureFlagAttributes.JSON_PROPERTY_NAME, + UpdateFeatureFlagAttributes.JSON_PROPERTY_STALENESS_STATUS, UpdateFeatureFlagAttributes.JSON_PROPERTY_TAGS }) @jakarta.annotation.Generated( @@ -33,12 +35,18 @@ public class UpdateFeatureFlagAttributes { public static final String JSON_PROPERTY_DESCRIPTION = "description"; private String description; + public static final String JSON_PROPERTY_DISTRIBUTION_CHANNEL = "distribution_channel"; + private FeatureFlagDistributionChannel distributionChannel; + public static final String JSON_PROPERTY_JSON_SCHEMA = "json_schema"; private JsonNullable jsonSchema = JsonNullable.undefined(); public static final String JSON_PROPERTY_NAME = "name"; private String name; + public static final String JSON_PROPERTY_STALENESS_STATUS = "staleness_status"; + private UpdateFeatureFlagStalenessStatus stalenessStatus; + public static final String JSON_PROPERTY_TAGS = "tags"; private List tags = null; @@ -63,6 +71,32 @@ public void setDescription(String description) { this.description = description; } + public UpdateFeatureFlagAttributes distributionChannel( + FeatureFlagDistributionChannel distributionChannel) { + this.distributionChannel = distributionChannel; + this.unparsed |= !distributionChannel.isValid(); + return this; + } + + /** + * The distribution channel for the feature flag. + * + * @return distributionChannel + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DISTRIBUTION_CHANNEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public FeatureFlagDistributionChannel getDistributionChannel() { + return distributionChannel; + } + + public void setDistributionChannel(FeatureFlagDistributionChannel distributionChannel) { + if (!distributionChannel.isValid()) { + this.unparsed = true; + } + this.distributionChannel = distributionChannel; + } + public UpdateFeatureFlagAttributes jsonSchema(String jsonSchema) { this.jsonSchema = JsonNullable.of(jsonSchema); return this; @@ -115,6 +149,35 @@ public void setName(String name) { this.name = name; } + public UpdateFeatureFlagAttributes stalenessStatus( + UpdateFeatureFlagStalenessStatus stalenessStatus) { + this.stalenessStatus = stalenessStatus; + this.unparsed |= !stalenessStatus.isValid(); + return this; + } + + /** + * The lifecycle to set. ACTIVE makes the flag temporary; PERMANENT + * excludes it from staleness detection. Either value clears any snooze; omit the field to keep + * the lifecycle. Do not copy the top-level staleness_status from a response into + * this field: that legacy response field is always ACTIVE. + * + * @return stalenessStatus + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_STALENESS_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UpdateFeatureFlagStalenessStatus getStalenessStatus() { + return stalenessStatus; + } + + public void setStalenessStatus(UpdateFeatureFlagStalenessStatus stalenessStatus) { + if (!stalenessStatus.isValid()) { + this.unparsed = true; + } + this.stalenessStatus = stalenessStatus; + } + public UpdateFeatureFlagAttributes tags(List tags) { this.tags = tags; return this; @@ -203,8 +266,10 @@ public boolean equals(Object o) { } UpdateFeatureFlagAttributes updateFeatureFlagAttributes = (UpdateFeatureFlagAttributes) o; return Objects.equals(this.description, updateFeatureFlagAttributes.description) + && Objects.equals(this.distributionChannel, updateFeatureFlagAttributes.distributionChannel) && Objects.equals(this.jsonSchema, updateFeatureFlagAttributes.jsonSchema) && Objects.equals(this.name, updateFeatureFlagAttributes.name) + && Objects.equals(this.stalenessStatus, updateFeatureFlagAttributes.stalenessStatus) && Objects.equals(this.tags, updateFeatureFlagAttributes.tags) && Objects.equals( this.additionalProperties, updateFeatureFlagAttributes.additionalProperties); @@ -212,7 +277,14 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(description, jsonSchema, name, tags, additionalProperties); + return Objects.hash( + description, + distributionChannel, + jsonSchema, + name, + stalenessStatus, + tags, + additionalProperties); } @Override @@ -220,8 +292,12 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class UpdateFeatureFlagAttributes {\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" distributionChannel: ") + .append(toIndentedString(distributionChannel)) + .append("\n"); sb.append(" jsonSchema: ").append(toIndentedString(jsonSchema)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" stalenessStatus: ").append(toIndentedString(stalenessStatus)).append("\n"); sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) diff --git a/src/main/java/com/datadog/api/client/v2/model/UpdateFeatureFlagStalenessStatus.java b/src/main/java/com/datadog/api/client/v2/model/UpdateFeatureFlagStalenessStatus.java new file mode 100644 index 00000000000..8d84c7ce34f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UpdateFeatureFlagStalenessStatus.java @@ -0,0 +1,65 @@ +/* + * 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 lifecycle to set. ACTIVE makes the flag temporary; PERMANENT + * excludes it from staleness detection. Either value clears any snooze; omit the field to keep the + * lifecycle. Do not copy the top-level staleness_status from a response into this + * field: that legacy response field is always ACTIVE. + */ +@JsonSerialize( + using = UpdateFeatureFlagStalenessStatus.UpdateFeatureFlagStalenessStatusSerializer.class) +public class UpdateFeatureFlagStalenessStatus extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("ACTIVE", "PERMANENT")); + + public static final UpdateFeatureFlagStalenessStatus ACTIVE = + new UpdateFeatureFlagStalenessStatus("ACTIVE"); + public static final UpdateFeatureFlagStalenessStatus PERMANENT = + new UpdateFeatureFlagStalenessStatus("PERMANENT"); + + UpdateFeatureFlagStalenessStatus(String value) { + super(value, allowedValues); + } + + public static class UpdateFeatureFlagStalenessStatusSerializer + extends StdSerializer { + public UpdateFeatureFlagStalenessStatusSerializer(Class t) { + super(t); + } + + public UpdateFeatureFlagStalenessStatusSerializer() { + this(null); + } + + @Override + public void serialize( + UpdateFeatureFlagStalenessStatus value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static UpdateFeatureFlagStalenessStatus fromValue(String value) { + return new UpdateFeatureFlagStalenessStatus(value); + } +} 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 98d3aa2f7d9..95f2267e662 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 @@ -1,6 +1,6 @@ @endpoint(feature-flags) @endpoint(feature-flags-v2) Feature: Feature Flags - Manage feature flags and environments. + Manage feature flags, environments, and approval suggestions. Background: Given a valid "apiKeyAuth" key in the system @@ -39,6 +39,66 @@ Feature: Feature Flags When the request is sent Then the response status is 404 Not Found + @generated @skip @team:ddoghq/feature-flags + Scenario: Apply an approved flag change suggestion returns "Bad Request - Invalid request parameters or body." response + Given new "ApplyFlagSuggestion" request + And request contains "suggestion_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request - Invalid request parameters or body. + + @generated @skip @team:ddoghq/feature-flags + Scenario: Apply an approved flag change suggestion returns "Conflict - The suggestion is not approved or the proposed change conflicts with current configuration." response + Given new "ApplyFlagSuggestion" request + And request contains "suggestion_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 409 Conflict - The suggestion is not approved or the proposed change conflicts with current configuration. + + @generated @skip @team:ddoghq/feature-flags + Scenario: Apply an approved flag change suggestion returns "Not Found" response + Given new "ApplyFlagSuggestion" 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:ddoghq/feature-flags + Scenario: Apply an approved flag change suggestion returns "OK" response + Given new "ApplyFlagSuggestion" request + And request contains "suggestion_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:ddoghq/feature-flags + Scenario: Approve a flag change suggestion returns "Bad Request - Invalid request parameters or body." response + Given new "ApproveFlagSuggestion" request + And request contains "suggestion_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"apply": false, "comment": "Approved for rollout."}, "type": "flag-suggestion-events"}} + When the request is sent + Then the response status is 400 Bad Request - Invalid request parameters or body. + + @generated @skip @team:ddoghq/feature-flags + Scenario: Approve a flag change suggestion returns "Conflict - The suggestion is already applied or discarded, or the proposed change conflicts with current configuration." response + Given new "ApproveFlagSuggestion" request + And request contains "suggestion_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"apply": false, "comment": "Approved for rollout."}, "type": "flag-suggestion-events"}} + When the request is sent + Then the response status is 409 Conflict - The suggestion is already applied or discarded, or the proposed change conflicts with current configuration. + + @generated @skip @team:ddoghq/feature-flags + Scenario: Approve a flag change suggestion returns "Not Found" response + Given new "ApproveFlagSuggestion" request + And request contains "suggestion_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"apply": false, "comment": "Approved for rollout."}, "type": "flag-suggestion-events"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:ddoghq/feature-flags + Scenario: Approve a flag change suggestion returns "OK" response + Given new "ApproveFlagSuggestion" request + And request contains "suggestion_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"apply": false, "comment": "Approved for rollout."}, "type": "flag-suggestion-events"}} + When the request is sent + Then the response status is 200 OK + @skip @team:ddoghq/feature-flags Scenario: Archive a feature flag returns "Bad Request" response Given new "ArchiveFeatureFlag" request @@ -46,6 +106,20 @@ Feature: Feature Flags When the request is sent Then the response status is 400 Bad Request + @generated @skip @team:ddoghq/feature-flags + Scenario: Archive a feature flag returns "Conflict - The flag is already archived or a conflicting suggestion is pending." response + Given new "ArchiveFeatureFlag" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 409 Conflict - The flag is already archived or a conflicting suggestion is pending. + + @generated @skip @team:ddoghq/feature-flags + Scenario: Archive a feature flag returns "Created - Approval is required. A suggestion was created and the change has not been applied." response + Given new "ArchiveFeatureFlag" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 201 Created - Approval is required. A suggestion was created and the change has not been applied. + @skip @team:ddoghq/feature-flags Scenario: Archive a feature flag returns "Not Found" response Given new "ArchiveFeatureFlag" request @@ -89,6 +163,38 @@ Feature: Feature Flags And the response "data.attributes.tags" is equal to ["env:api-client-test"] And the response "data.attributes.value_type" is equal to "BOOLEAN" + @generated @skip @team:ddoghq/feature-flags + Scenario: Create a flag change suggestion returns "Bad Request - Invalid request parameters or body." response + Given new "CreateFlagSuggestion" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"action": "updated", "comment": "Restrict this flag to server applications.", "environment_id": "550e8400-e29b-41d4-a716-446655440001", "notification_rule_targets": ["requester@example.com"], "property": "DISTRIBUTION_CHANNEL", "suggestion": "SERVER", "suggestion_metadata": {"variant_id": "550e8400-e29b-41d4-a716-446655440002"}}, "type": "flag-suggestions"}} + When the request is sent + Then the response status is 400 Bad Request - Invalid request parameters or body. + + @generated @skip @team:ddoghq/feature-flags + Scenario: Create a flag change suggestion returns "Conflict - A conflicting suggestion is pending, or the lineup changes or omits a draft allocation." response + Given new "CreateFlagSuggestion" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"action": "updated", "comment": "Restrict this flag to server applications.", "environment_id": "550e8400-e29b-41d4-a716-446655440001", "notification_rule_targets": ["requester@example.com"], "property": "DISTRIBUTION_CHANNEL", "suggestion": "SERVER", "suggestion_metadata": {"variant_id": "550e8400-e29b-41d4-a716-446655440002"}}, "type": "flag-suggestions"}} + When the request is sent + Then the response status is 409 Conflict - A conflicting suggestion is pending, or the lineup changes or omits a draft allocation. + + @generated @skip @team:ddoghq/feature-flags + Scenario: Create a flag change 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": "updated", "comment": "Restrict this flag to server applications.", "environment_id": "550e8400-e29b-41d4-a716-446655440001", "notification_rule_targets": ["requester@example.com"], "property": "DISTRIBUTION_CHANNEL", "suggestion": "SERVER", "suggestion_metadata": {"variant_id": "550e8400-e29b-41d4-a716-446655440002"}}, "type": "flag-suggestions"}} + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:ddoghq/feature-flags + Scenario: Create a flag change 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": "updated", "comment": "Restrict this flag to server applications.", "environment_id": "550e8400-e29b-41d4-a716-446655440001", "notification_rule_targets": ["requester@example.com"], "property": "DISTRIBUTION_CHANNEL", "suggestion": "SERVER", "suggestion_metadata": {"variant_id": "550e8400-e29b-41d4-a716-446655440002"}}, "type": "flag-suggestions"}} + When the request is sent + Then the response status is 404 Not Found + @team:ddoghq/feature-flags Scenario: Create allocation for a flag in an environment returns "Created" response Given there is a valid "feature_flag" in the system @@ -121,7 +227,7 @@ Feature: Feature Flags When the request is sent Then the response status is 201 Created - @generated @skip @team:ddoghq/feature-flags + @skip @team:ddoghq/feature-flags Scenario: Create targeting rules for a flag env returns "Accepted - Approval required for this change" response Given new "CreateAllocationsForFeatureFlagInEnvironment" request And request contains "feature_flag_id" parameter from "REPLACE.ME" @@ -129,6 +235,9 @@ Feature: Feature Flags And body with value {"data": {"attributes": {"experiment_id": "550e8400-e29b-41d4-a716-446655440030", "exposure_schedule": {"absolute_start_time": "2025-06-13T12:00:00Z", "control_variant_id": "550e8400-e29b-41d4-a716-446655440012", "control_variant_key": "control", "id": "550e8400-e29b-41d4-a716-446655440010", "rollout_options": {"autostart": false, "selection_interval_ms": 3600000, "strategy": "UNIFORM_INTERVALS"}, "rollout_steps": [{"exposure_ratio": 0.5, "grouped_step_index": 1, "id": "550e8400-e29b-41d4-a716-446655440040", "interval_ms": 3600000, "is_pause_record": false}]}, "guardrail_metrics": [{"metric_id": "metric-error-rate", "trigger_action": "PAUSE"}], "id": "550e8400-e29b-41d4-a716-446655440020", "key": "prod-rollout", "name": "Production Rollout", "targeting_rules": [{"conditions": [{"attribute": "user_tier", "operator": "ONE_OF", "saved_filter_id": "550e8400-e29b-41d4-a716-446655440090", "value": ["premium", "enterprise"]}]}], "type": "FEATURE_GATE", "variant_weights": [{"value": 50, "variant_id": "550e8400-e29b-41d4-a716-446655440001", "variant_key": "control"}]}, "type": "allocations"}} When the request is sent Then the response status is 202 Accepted - Approval required for this change + And the response "data.type" is equal to "approval-required" + And the response "data.attributes.property" is equal to "ALLOCATIONS" + And the response "data.attributes.action" is equal to "updated" @generated @skip @team:ddoghq/feature-flags Scenario: Create targeting rules for a flag env returns "Bad Request" response @@ -140,13 +249,13 @@ Feature: Feature Flags Then the response status is 400 Bad Request @generated @skip @team:ddoghq/feature-flags - Scenario: Create targeting rules for a flag env returns "Conflict" response + Scenario: Create targeting rules for a flag env returns "Conflict - A conflicting suggestion is pending or an allocation with this key already exists." response Given new "CreateAllocationsForFeatureFlagInEnvironment" request And request contains "feature_flag_id" parameter from "REPLACE.ME" And request contains "environment_id" parameter from "REPLACE.ME" And body with value {"data": {"attributes": {"experiment_id": "550e8400-e29b-41d4-a716-446655440030", "exposure_schedule": {"absolute_start_time": "2025-06-13T12:00:00Z", "control_variant_id": "550e8400-e29b-41d4-a716-446655440012", "control_variant_key": "control", "id": "550e8400-e29b-41d4-a716-446655440010", "rollout_options": {"autostart": false, "selection_interval_ms": 3600000, "strategy": "UNIFORM_INTERVALS"}, "rollout_steps": [{"exposure_ratio": 0.5, "grouped_step_index": 1, "id": "550e8400-e29b-41d4-a716-446655440040", "interval_ms": 3600000, "is_pause_record": false}]}, "guardrail_metrics": [{"metric_id": "metric-error-rate", "trigger_action": "PAUSE"}], "id": "550e8400-e29b-41d4-a716-446655440020", "key": "prod-rollout", "name": "Production Rollout", "targeting_rules": [{"conditions": [{"attribute": "user_tier", "operator": "ONE_OF", "saved_filter_id": "550e8400-e29b-41d4-a716-446655440090", "value": ["premium", "enterprise"]}]}], "type": "FEATURE_GATE", "variant_weights": [{"value": 50, "variant_id": "550e8400-e29b-41d4-a716-446655440001", "variant_key": "control"}]}, "type": "allocations"}} When the request is sent - Then the response status is 409 Conflict + Then the response status is 409 Conflict - A conflicting suggestion is pending or an allocation with this key already exists. @generated @skip @team:ddoghq/feature-flags Scenario: Create targeting rules for a flag env returns "Created" response @@ -182,6 +291,14 @@ Feature: Feature Flags When the request is sent Then the response status is 409 Conflict - A pending suggestion already exists for this property. + @generated @skip @team:ddoghq/feature-flags + Scenario: Delete a variant returns "Created - Approval is required. A suggestion was created and the change has not been applied." response + Given new "DeleteVariantFromFeatureFlag" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And request contains "variant_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 201 Created - Approval is required. A suggestion was created and the change has not been applied. + @generated @skip @team:ddoghq/feature-flags Scenario: Delete a variant returns "No Content" response Given new "DeleteVariantFromFeatureFlag" request @@ -213,15 +330,59 @@ Feature: Feature Flags When the request is sent Then the response status is 404 Not Found + @generated @skip @team:ddoghq/feature-flags + Scenario: Delete or discard a flag change suggestion returns "Bad Request - Invalid request parameters or body." 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 - Invalid request parameters or body. + + @generated @skip @team:ddoghq/feature-flags + Scenario: Delete or discard a flag change suggestion returns "Conflict - Applied or rejected suggestions cannot be deleted." response + Given new "DeleteFlagSuggestion" request + And request contains "suggestion_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 409 Conflict - Applied or rejected suggestions cannot be deleted. + + @generated @skip @team:ddoghq/feature-flags + Scenario: Delete or discard a flag change 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:ddoghq/feature-flags + Scenario: Delete or discard a flag change 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 + + @generated @skip @team:ddoghq/feature-flags + Scenario: Disable a feature flag in an environment returns "Bad Request" response + Given new "DisableFeatureFlagEnvironment" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And request contains "environment_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/feature-flags + Scenario: Disable a feature flag in an environment returns "Conflict - A conflicting suggestion is pending for this flag and environment." response + Given new "DisableFeatureFlagEnvironment" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And request contains "environment_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 409 Conflict - A conflicting suggestion is pending for this flag and environment. + @skip @team:ddoghq/feature-flags - Scenario: Disable a feature flag in an environment returns "Accepted - Approval required for this change" response + Scenario: Disable a feature flag in an environment returns "Created - Approval is required. A suggestion was created and the change has not been applied." response Given there is a valid "feature_flag" in the system And there is a valid "environment" in the system And new "DisableFeatureFlagEnvironment" request And request contains "feature_flag_id" parameter from "feature_flag.data.id" And request contains "environment_id" parameter from "environment.data.id" When the request is sent - Then the response status is 202 Accepted - Approval required for this change + Then the response status is 201 Created - Approval is required. A suggestion was created and the change has not been applied. @skip @team:ddoghq/feature-flags Scenario: Disable a feature flag in an environment returns "Not Found" response @@ -241,15 +402,31 @@ Feature: Feature Flags When the request is sent Then the response status is 200 OK + @generated @skip @team:ddoghq/feature-flags + Scenario: Enable a feature flag in an environment returns "Bad Request" response + Given new "EnableFeatureFlagEnvironment" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And request contains "environment_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/feature-flags + Scenario: Enable a feature flag in an environment returns "Conflict - A conflicting suggestion is pending for this flag and environment." response + Given new "EnableFeatureFlagEnvironment" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And request contains "environment_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 409 Conflict - A conflicting suggestion is pending for this flag and environment. + @skip @team:ddoghq/feature-flags - Scenario: Enable a feature flag in an environment returns "Accepted - Approval required for this change" response + Scenario: Enable a feature flag in an environment returns "Created - Approval is required. A suggestion was created and the change has not been applied." response Given there is a valid "feature_flag" in the system And there is a valid "environment" in the system And new "EnableFeatureFlagEnvironment" request And request contains "feature_flag_id" parameter from "feature_flag.data.id" And request contains "environment_id" parameter from "environment.data.id" When the request is sent - Then the response status is 202 Accepted - Approval required for this change + Then the response status is 201 Created - Approval is required. A suggestion was created and the change has not been applied. @skip @team:ddoghq/feature-flags Scenario: Enable a feature flag in an environment returns "Not Found" response @@ -287,6 +464,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:ddoghq/feature-flags + Scenario: Get a flag change suggestion returns "Bad Request - Invalid request parameters or body." 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 - Invalid request parameters or body. + + @generated @skip @team:ddoghq/feature-flags + Scenario: Get a flag change 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:ddoghq/feature-flags + Scenario: Get a flag change 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 + @generated @skip @team:ddoghq/feature-flags Scenario: Get a saved filter returns "Bad Request" response Given new "GetSavedFilter" request @@ -954,6 +1152,38 @@ Feature: Feature Flags When the request is sent Then the response status is 200 OK + @generated @skip @team:ddoghq/feature-flags + Scenario: Reject a flag change suggestion returns "Bad Request - Invalid request parameters or body." response + Given new "RejectFlagSuggestion" request + And request contains "suggestion_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"comment": "Keep the existing configuration."}, "type": "flag-suggestion-events"}} + When the request is sent + Then the response status is 400 Bad Request - Invalid request parameters or body. + + @generated @skip @team:ddoghq/feature-flags + Scenario: Reject a flag change suggestion returns "Conflict - The suggestion is already approved, applied, or discarded." response + Given new "RejectFlagSuggestion" request + And request contains "suggestion_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"comment": "Keep the existing configuration."}, "type": "flag-suggestion-events"}} + When the request is sent + Then the response status is 409 Conflict - The suggestion is already approved, applied, or discarded. + + @generated @skip @team:ddoghq/feature-flags + Scenario: Reject a flag change 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": "Keep the existing configuration."}, "type": "flag-suggestion-events"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:ddoghq/feature-flags + Scenario: Reject a flag change suggestion returns "OK" response + Given new "RejectFlagSuggestion" request + And request contains "suggestion_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"comment": "Keep the existing configuration."}, "type": "flag-suggestion-events"}} + When the request is sent + Then the response status is 200 OK + @generated @skip @team:ddoghq/feature-flags Scenario: Resume a progressive rollout returns "Bad Request" response Given new "ResumeExposureSchedule" request @@ -982,6 +1212,38 @@ Feature: Feature Flags When the request is sent Then the response status is 200 OK + @generated @skip @team:ddoghq/feature-flags + Scenario: Set the approval requirement for a feature flag returns "Bad Request - Invalid request parameters or body." response + Given new "UpdateFeatureFlagApprovals" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"enabled": true}, "type": "feature-flag-approvals"}} + When the request is sent + Then the response status is 400 Bad Request - Invalid request parameters or body. + + @generated @skip @team:ddoghq/feature-flags + Scenario: Set the approval requirement for a feature flag returns "Conflict - A pending experiment request or a running approved experiment uses this flag." response + Given new "UpdateFeatureFlagApprovals" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"enabled": true}, "type": "feature-flag-approvals"}} + When the request is sent + Then the response status is 409 Conflict - A pending experiment request or a running approved experiment uses this flag. + + @generated @skip @team:ddoghq/feature-flags + Scenario: Set the approval requirement for a feature flag returns "Not Found" response + Given new "UpdateFeatureFlagApprovals" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"enabled": true}, "type": "feature-flag-approvals"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:ddoghq/feature-flags + Scenario: Set the approval requirement for a feature flag returns "OK" response + Given new "UpdateFeatureFlagApprovals" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"enabled": true}, "type": "feature-flag-approvals"}} + When the request is sent + Then the response status is 200 OK + @generated @skip @team:ddoghq/feature-flags Scenario: Start a progressive rollout returns "Bad Request" response Given new "StartExposureSchedule" request @@ -1045,6 +1307,20 @@ Feature: Feature Flags When the request is sent Then the response status is 400 Bad Request + @generated @skip @team:ddoghq/feature-flags + Scenario: Unarchive a feature flag returns "Conflict - The flag is not archived or a conflicting suggestion is pending." response + Given new "UnarchiveFeatureFlag" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 409 Conflict - The flag is not archived or a conflicting suggestion is pending. + + @generated @skip @team:ddoghq/feature-flags + Scenario: Unarchive a feature flag returns "Created - Approval is required. A suggestion was created and the change has not been applied." response + Given new "UnarchiveFeatureFlag" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 201 Created - Approval is required. A suggestion was created and the change has not been applied. + @skip @team:ddoghq/feature-flags Scenario: Unarchive a feature flag returns "Not Found" response Given new "UnarchiveFeatureFlag" request @@ -1068,6 +1344,22 @@ Feature: Feature Flags When the request is sent Then the response status is 400 Bad Request + @generated @skip @team:ddoghq/feature-flags + Scenario: Update a feature flag returns "Conflict - A feature flag with this name already exists, a distribution channel suggestion is pending, or a pending experiment request or running approved experiment uses this flag." response + Given new "UpdateFeatureFlag" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "Updated description for feature flag XYZ789", "distribution_channel": "ALL", "json_schema": "{\"type\": \"object\", \"properties\": {\"enabled\": {\"type\": \"boolean\"}}}", "name": "Updated Feature Flag XYZ789", "staleness_status": "PERMANENT", "tags": ["team:feature-flagging"]}, "type": "feature-flags"}} + When the request is sent + Then the response status is 409 Conflict - A feature flag with this name already exists, a distribution channel suggestion is pending, or a pending experiment request or running approved experiment uses this flag. + + @generated @skip @team:ddoghq/feature-flags + Scenario: Update a feature flag returns "Created - A distribution channel suggestion was created because approval is required. No flag fields were updated." response + Given new "UpdateFeatureFlag" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "Updated description for feature flag XYZ789", "distribution_channel": "ALL", "json_schema": "{\"type\": \"object\", \"properties\": {\"enabled\": {\"type\": \"boolean\"}}}", "name": "Updated Feature Flag XYZ789", "staleness_status": "PERMANENT", "tags": ["team:feature-flagging"]}, "type": "feature-flags"}} + When the request is sent + Then the response status is 201 Created - A distribution channel suggestion was created because approval is required. No flag fields were updated. + @skip @team:ddoghq/feature-flags Scenario: Update a feature flag returns "Not Found" response Given new "UpdateFeatureFlag" request @@ -1105,6 +1397,15 @@ Feature: Feature Flags When the request is sent Then the response status is 409 Conflict - A pending suggestion already exists for this property. + @generated @skip @team:ddoghq/feature-flags + Scenario: Update a variant returns "Created - Approval is required. A suggestion was created and the change has not been applied." response + Given new "UpdateVariantForFeatureFlag" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And request contains "variant_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "Variant ABC123 Updated", "value": "new_value"}, "id": "550e8400-e29b-41d4-a716-446655440002", "type": "variants"}} + When the request is sent + Then the response status is 201 Created - Approval is required. A suggestion was created and the change has not been applied. + @generated @skip @team:ddoghq/feature-flags Scenario: Update a variant returns "Not Found" response Given new "UpdateVariantForFeatureFlag" request @@ -1160,31 +1461,33 @@ Feature: Feature Flags Then the response status is 200 OK @generated @skip @team:ddoghq/feature-flags - Scenario: Update targeting rules for a flag returns "Accepted - Approval required for this change" response + Scenario: Update targeting rules for a flag returns "Bad Request" response Given new "UpdateAllocationsForFeatureFlagInEnvironment" request And request contains "feature_flag_id" parameter from "REPLACE.ME" And request contains "environment_id" parameter from "REPLACE.ME" And body with value {"data": [{"attributes": {"experiment_id": "550e8400-e29b-41d4-a716-446655440030", "exposure_schedule": {"absolute_start_time": "2025-06-13T12:00:00Z", "control_variant_id": "550e8400-e29b-41d4-a716-446655440012", "control_variant_key": "control", "id": "550e8400-e29b-41d4-a716-446655440010", "rollout_options": {"autostart": false, "selection_interval_ms": 3600000, "strategy": "UNIFORM_INTERVALS"}, "rollout_steps": [{"exposure_ratio": 0.5, "grouped_step_index": 1, "id": "550e8400-e29b-41d4-a716-446655440040", "interval_ms": 3600000, "is_pause_record": false}]}, "guardrail_metrics": [{"metric_id": "metric-error-rate", "trigger_action": "PAUSE"}], "id": "550e8400-e29b-41d4-a716-446655440020", "key": "prod-rollout", "name": "Production Rollout", "targeting_rules": [{"conditions": [{"attribute": "user_tier", "operator": "ONE_OF", "saved_filter_id": "550e8400-e29b-41d4-a716-446655440090", "value": ["premium", "enterprise"]}]}], "type": "FEATURE_GATE", "variant_weights": [{"value": 50, "variant_id": "550e8400-e29b-41d4-a716-446655440001", "variant_key": "control"}]}, "type": "allocations"}]} When the request is sent - Then the response status is 202 Accepted - Approval required for this change + Then the response status is 400 Bad Request @generated @skip @team:ddoghq/feature-flags - Scenario: Update targeting rules for a flag returns "Bad Request" response + Scenario: Update targeting rules for a flag returns "Conflict - A conflicting suggestion is pending or the allocation update conflicts with the current configuration." response Given new "UpdateAllocationsForFeatureFlagInEnvironment" request And request contains "feature_flag_id" parameter from "REPLACE.ME" And request contains "environment_id" parameter from "REPLACE.ME" And body with value {"data": [{"attributes": {"experiment_id": "550e8400-e29b-41d4-a716-446655440030", "exposure_schedule": {"absolute_start_time": "2025-06-13T12:00:00Z", "control_variant_id": "550e8400-e29b-41d4-a716-446655440012", "control_variant_key": "control", "id": "550e8400-e29b-41d4-a716-446655440010", "rollout_options": {"autostart": false, "selection_interval_ms": 3600000, "strategy": "UNIFORM_INTERVALS"}, "rollout_steps": [{"exposure_ratio": 0.5, "grouped_step_index": 1, "id": "550e8400-e29b-41d4-a716-446655440040", "interval_ms": 3600000, "is_pause_record": false}]}, "guardrail_metrics": [{"metric_id": "metric-error-rate", "trigger_action": "PAUSE"}], "id": "550e8400-e29b-41d4-a716-446655440020", "key": "prod-rollout", "name": "Production Rollout", "targeting_rules": [{"conditions": [{"attribute": "user_tier", "operator": "ONE_OF", "saved_filter_id": "550e8400-e29b-41d4-a716-446655440090", "value": ["premium", "enterprise"]}]}], "type": "FEATURE_GATE", "variant_weights": [{"value": 50, "variant_id": "550e8400-e29b-41d4-a716-446655440001", "variant_key": "control"}]}, "type": "allocations"}]} When the request is sent - Then the response status is 400 Bad Request + Then the response status is 409 Conflict - A conflicting suggestion is pending or the allocation update conflicts with the current configuration. - @generated @skip @team:ddoghq/feature-flags - Scenario: Update targeting rules for a flag returns "Conflict" response + @skip @team:ddoghq/feature-flags + Scenario: Update targeting rules for a flag returns "Created - Approval is required. A suggestion was created and the change has not been applied." response Given new "UpdateAllocationsForFeatureFlagInEnvironment" request And request contains "feature_flag_id" parameter from "REPLACE.ME" And request contains "environment_id" parameter from "REPLACE.ME" And body with value {"data": [{"attributes": {"experiment_id": "550e8400-e29b-41d4-a716-446655440030", "exposure_schedule": {"absolute_start_time": "2025-06-13T12:00:00Z", "control_variant_id": "550e8400-e29b-41d4-a716-446655440012", "control_variant_key": "control", "id": "550e8400-e29b-41d4-a716-446655440010", "rollout_options": {"autostart": false, "selection_interval_ms": 3600000, "strategy": "UNIFORM_INTERVALS"}, "rollout_steps": [{"exposure_ratio": 0.5, "grouped_step_index": 1, "id": "550e8400-e29b-41d4-a716-446655440040", "interval_ms": 3600000, "is_pause_record": false}]}, "guardrail_metrics": [{"metric_id": "metric-error-rate", "trigger_action": "PAUSE"}], "id": "550e8400-e29b-41d4-a716-446655440020", "key": "prod-rollout", "name": "Production Rollout", "targeting_rules": [{"conditions": [{"attribute": "user_tier", "operator": "ONE_OF", "saved_filter_id": "550e8400-e29b-41d4-a716-446655440090", "value": ["premium", "enterprise"]}]}], "type": "FEATURE_GATE", "variant_weights": [{"value": 50, "variant_id": "550e8400-e29b-41d4-a716-446655440001", "variant_key": "control"}]}, "type": "allocations"}]} When the request is sent - Then the response status is 409 Conflict + Then the response status is 201 Created - Approval is required. A suggestion was created and the change has not been applied. + And the response "data.type" is equal to "flag-suggestions" + And the response "data.attributes.lifecycle_status" is equal to "pending" @generated @skip @team:ddoghq/feature-flags Scenario: Update targeting rules for a flag returns "Not Found" response 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 d92af14e39a..ae4fa97c5cb 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 @@ -3312,6 +3312,36 @@ "type": "idempotent" } }, + "DeleteFlagSuggestion": { + "tag": "Feature Flags", + "undo": { + "type": "idempotent" + } + }, + "GetFlagSuggestion": { + "tag": "Feature Flags", + "undo": { + "type": "safe" + } + }, + "ApplyFlagSuggestion": { + "tag": "Feature Flags", + "undo": { + "type": "unsafe" + } + }, + "ApproveFlagSuggestion": { + "tag": "Feature Flags", + "undo": { + "type": "unsafe" + } + }, + "RejectFlagSuggestion": { + "tag": "Feature Flags", + "undo": { + "type": "unsafe" + } + }, "GetFeatureFlag": { "tag": "Feature Flags", "undo": { @@ -3361,6 +3391,25 @@ "type": "idempotent" } }, + "UpdateFeatureFlagApprovals": { + "tag": "Feature Flags", + "undo": { + "type": "idempotent" + } + }, + "CreateFlagSuggestion": { + "tag": "Feature Flags", + "undo": { + "operationId": "DeleteFlagSuggestion", + "parameters": [ + { + "name": "suggestion_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, "UnarchiveFeatureFlag": { "tag": "Feature Flags", "undo": {