diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index bf9ea4d591a..2de34ce5d21 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -2348,6 +2348,82 @@ components: example: "550e8400-e29b-41d4-a716-446655440010" format: uuid type: string + feature_flag_history_end_date: + description: Only include changes made before this time, for example `2026-02-01T00:00:00Z`. Omit for no upper bound. Must be after `start_date` when both are set. + in: query + name: end_date + required: false + schema: + example: "2026-02-01T00:00:00Z" + format: date-time + type: string + feature_flag_history_environment_id: + description: Only include changes to this environment. Changes to the flag itself, which have no environment, are always included. + in: query + name: environment_id + required: false + schema: + example: "550e8400-e29b-41d4-a716-446655440001" + format: uuid + type: string + feature_flag_history_feature_flag_id: + description: Only include changes to this feature flag. + in: query + name: feature_flag_id + required: false + schema: + example: "550e8400-e29b-41d4-a716-446655440000" + format: uuid + type: string + feature_flag_history_include_suggestion_events: + description: |- + Also include review events for change requests that needed approval: rejected requests and requests still pending review. Applies only to organizations with flag approvals enabled. + in: query + name: include_suggestion_events + required: false + schema: + default: false + example: false + type: boolean + feature_flag_history_start_date: + description: Only include changes made after this time, for example `2026-01-01T00:00:00Z`. Omit for no lower bound. + in: query + name: start_date + required: false + schema: + example: "2026-01-01T00:00:00Z" + format: date-time + type: string + feature_flag_history_tags: + description: |- + Only include changes to flags that have all of these exact tags, as repeated parameters, such as `tags=env:prod&tags=tier:1`. Values of the form `team:` match any selected team and are combined with `teams`. Empty values are ignored. + example: + - env:prod + - tier:1 + explode: true + in: query + name: tags + required: false + schema: + items: + type: string + type: array + style: form + feature_flag_history_teams: + description: |- + Only include changes to flags that belong to at least one of these teams. Use team handles without the `team:` prefix, as repeated parameters, such as `teams=checkout&teams=payments`. Handles from `teams` and `team:` values from `tags` are treated as one set. Handles that are empty, have surrounding white space, or include the `team:` prefix return a `400 Bad Request` error. + example: + - checkout + - payments + explode: true + in: query + name: teams + required: false + schema: + items: + type: string + type: array + style: form feature_flag_id: description: The ID of the feature flag. in: path @@ -50411,6 +50487,259 @@ components: - value_type - variants type: object + FeatureFlagChangeEvent: + description: A change made to a feature flag. + properties: + attributes: + $ref: "#/components/schemas/FeatureFlagChangeEventAttributes" + id: + description: The ID of the change event. + example: "550e8400-e29b-41d4-a716-446655440005" + format: uuid + type: string + type: + $ref: "#/components/schemas/FeatureFlagChangeEventType" + required: + - id + - type + - attributes + type: object + FeatureFlagChangeEventAction: + description: The kind of change. + enum: + - created + - updated + - deleted + - archived + - unarchived + - scheduled + - started + - paused + - unpaused + - stopped + example: "updated" + type: string + x-enum-varnames: + - CREATED + - UPDATED + - DELETED + - ARCHIVED + - UNARCHIVED + - SCHEDULED + - STARTED + - PAUSED + - UNPAUSED + - STOPPED + FeatureFlagChangeEventAttributes: + description: Attributes of a feature flag change event. + properties: + action: + $ref: "#/components/schemas/FeatureFlagChangeEventAction" + change_metadata: + description: Additional details about the change, as a JSON-encoded string. + example: '{"variant_key": "control"}' + nullable: true + type: string + creation_source: + $ref: "#/components/schemas/FeatureFlagChangeEventCreationSource" + description: + description: A readable sentence describing the change, as shown on the flag history page and in the Action column of the CSV export. + example: 'Changed flag name from "Mobile Feature Rollout" to "Mobile Feature Toggle".' + type: string + environment: + $ref: "#/components/schemas/FeatureFlagChangeEventEnvironment" + feature_flag: + $ref: "#/components/schemas/FeatureFlagChangeEventFlag" + new_value: + description: The value after the change, serialized as a string. + example: "Mobile Feature Toggle" + nullable: true + type: string + previous_value: + description: The value before the change, serialized as a string. + example: "Mobile Feature Rollout" + nullable: true + type: string + property: + $ref: "#/components/schemas/FeatureFlagChangeEventProperty" + suggestion_review: + $ref: "#/components/schemas/FeatureFlagChangeEventSuggestionReview" + timestamp: + description: When the change was made. + example: "2023-10-02T14:30:00Z" + format: date-time + type: string + user_id: + description: The ID of the user who made the change. Null when no user made the change. + example: "00000000-0000-0000-0000-000000000001" + nullable: true + type: string + version_number: + description: The version of the feature flag the change produced. + example: 3 + format: int64 + type: integer + required: + - action + - property + - timestamp + - version_number + - feature_flag + type: object + FeatureFlagChangeEventCreationSource: + description: "Where the change was made: `UI` for the Datadog app, or `MCP` for a Model Context Protocol (MCP) client." + enum: + - UI + - MCP + example: "UI" + nullable: true + type: string + x-enum-varnames: + - UI + - MCP + FeatureFlagChangeEventEnvironment: + description: The environment the change applies to. Null for a change to the flag itself rather than to one environment. + nullable: true + properties: + id: + description: The ID of the environment. + example: "550e8400-e29b-41d4-a716-446655440001" + format: uuid + type: string + is_production: + description: Whether the environment is a production environment. + example: true + type: boolean + name: + description: The name of the environment. + example: "Production" + type: string + required: + - id + - name + - is_production + type: object + FeatureFlagChangeEventFlag: + description: The feature flag the change applies to. + properties: + id: + description: The ID of the feature flag. + example: "550e8400-e29b-41d4-a716-446655440000" + format: uuid + type: string + key: + description: The key of the feature flag. + example: "mobile-feature-toggle" + type: string + name: + description: The name of the feature flag. + example: "Mobile Feature Toggle" + type: string + required: + - id + - name + - key + type: object + FeatureFlagChangeEventProperty: + description: The part of the feature flag the change applies to. + enum: + - FLAG + - FLAG_NAME + - FLAG_DESCRIPTION + - JSON_SCHEMA + - DISTRIBUTION_CHANNEL + - REQUIRE_APPROVAL + - VARIANT + - VARIANT_NAME + - VARIANT_VALUE + - ALLOCATIONS + - ROLLOUT + - ENVIRONMENT_STATUS + - DEFAULT_VARIANT + - OVERRIDE_VARIANT + - STALENESS_STATUS + - SAVED_FILTER + example: "FLAG_NAME" + type: string + x-enum-varnames: + - FLAG + - FLAG_NAME + - FLAG_DESCRIPTION + - JSON_SCHEMA + - DISTRIBUTION_CHANNEL + - REQUIRE_APPROVAL + - VARIANT + - VARIANT_NAME + - VARIANT_VALUE + - ALLOCATIONS + - ROLLOUT + - ENVIRONMENT_STATUS + - DEFAULT_VARIANT + - OVERRIDE_VARIANT + - STALENESS_STATUS + - SAVED_FILTER + FeatureFlagChangeEventSuggestionLifecycleStatus: + description: Where the change request is in its lifecycle. + enum: + - pending + - approved + - applied + - rejected + - discarded + example: "rejected" + type: string + x-enum-varnames: + - PENDING + - APPROVED + - APPLIED + - REJECTED + - DISCARDED + FeatureFlagChangeEventSuggestionReview: + description: |- + Review details of a change request that needed approval. + Present on review events, which `include_suggestion_events` adds. + Also present on a change that an approved change request applied, even when `include_suggestion_events` is `false`. + properties: + lifecycle_status: + $ref: "#/components/schemas/FeatureFlagChangeEventSuggestionLifecycleStatus" + requester_comment: + description: The comment left by the person who requested the change. + example: "Ready for production." + type: string + reviewer_comment: + description: The comment left by the reviewer. + example: "Roll out to staging first." + type: string + status: + $ref: "#/components/schemas/FeatureFlagChangeEventSuggestionStatus" + suggestion_created_by: + description: The ID of the user who requested the change. + example: "00000000-0000-0000-0000-000000000001" + type: string + required: + - status + - lifecycle_status + type: object + FeatureFlagChangeEventSuggestionStatus: + description: The review status of the change request. + enum: + - pending + - approved + - rejected + example: "rejected" + type: string + x-enum-varnames: + - PENDING + - APPROVED + - REJECTED + FeatureFlagChangeEventType: + description: The resource type. + enum: + - "change-events" + example: "change-events" + type: string + x-enum-varnames: + - CHANGE_EVENTS FeatureFlagDistributionChannel: description: The distribution channel for the feature flag. enum: @@ -50554,6 +50883,60 @@ components: - environment_id - status type: object + FeatureFlagHistoryPaginationMeta: + description: Pagination metadata for feature flag change history. + properties: + page: + $ref: "#/components/schemas/FeatureFlagHistoryPaginationMetaPage" + type: object + FeatureFlagHistoryPaginationMetaPage: + description: Pagination metadata for feature flag change history responses. + properties: + first_offset: + description: Offset of the first page. + example: 0 + format: int64 + type: integer + last_offset: + description: Offset of the last page. + example: 75 + format: int64 + nullable: true + type: integer + limit: + description: Maximum number of events returned on this page. + example: 25 + format: int64 + type: integer + next_offset: + description: Offset of the next page, or null when there is no next page. + example: 25 + format: int64 + nullable: true + type: integer + offset: + description: Number of matching events skipped before this page. + example: 0 + format: int64 + type: integer + prev_offset: + description: Offset of the previous page, or null when there is no previous page. + example: 0 + format: int64 + nullable: true + type: integer + total: + description: |- + Total number of events matching the filters, independent of the page size. + It counts experiment proposals that you cannot read, which are left out of the pages, so a page can hold fewer events than `limit`. + example: 100 + format: int64 + type: integer + type: + description: The pagination method. Always `offset_limit`. + example: offset_limit + type: string + type: object FeatureFlagListItem: description: A feature flag resource for list responses. properties: @@ -76929,6 +77312,21 @@ components: required: - data type: object + ListFeatureFlagHistoryResponse: + description: Response containing feature flag change events, newest first. + properties: + data: + description: The change events. + items: + $ref: "#/components/schemas/FeatureFlagChangeEvent" + type: array + links: + $ref: "#/components/schemas/FeatureFlagsPaginationLinks" + meta: + $ref: "#/components/schemas/FeatureFlagHistoryPaginationMeta" + required: + - data + type: object ListFeatureFlagsResponse: description: Response containing a list of feature flags. properties: @@ -175910,6 +176308,164 @@ paths: operator: AND permissions: - feature_flag_config_write + /api/v2/feature-flags/history: + get: + description: |- + Returns the organization's feature flag change events, newest first. + Each event includes a readable description of the change. + All filters are optional, and events must match every filter you set. Without a date range, the whole history is listed. + Results are paginated with `page[limit]` and `page[offset]`; follow `links.next` to read further back. + operationId: ListFeatureFlagHistory + parameters: + - $ref: "#/components/parameters/feature_flag_history_start_date" + - $ref: "#/components/parameters/feature_flag_history_end_date" + - $ref: "#/components/parameters/feature_flag_history_teams" + - $ref: "#/components/parameters/feature_flag_history_tags" + - $ref: "#/components/parameters/feature_flag_history_feature_flag_id" + - $ref: "#/components/parameters/feature_flag_history_environment_id" + - $ref: "#/components/parameters/feature_flag_history_include_suggestion_events" + - description: Maximum number of events to return. Defaults to `25`. Values above `50` return `50` events. Non-positive or empty values use the default. A non-integer value returns a `400 Bad Request` error. + example: 25 + in: query + name: page[limit] + schema: + default: 25 + format: int64 + maximum: 50 + minimum: 1 + type: integer + - description: Number of matching events to skip before returning results. Defaults to `0`. Negative or empty values are set to `0`. A non-integer value returns a `400 Bad Request` error. + example: 0 + in: query + name: page[offset] + schema: + default: 0 + format: int64 + minimum: 0 + type: integer + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + action: "updated" + change_metadata: + creation_source: "UI" + description: 'Changed flag name from "Mobile Feature Rollout" to "Mobile Feature Toggle".' + environment: + feature_flag: + id: "550e8400-e29b-41d4-a716-446655440000" + key: "mobile-feature-toggle" + name: "Mobile Feature Toggle" + new_value: "Mobile Feature Toggle" + previous_value: "Mobile Feature Rollout" + property: "FLAG_NAME" + timestamp: "2023-10-02T14:30:00Z" + user_id: "00000000-0000-0000-0000-000000000001" + version_number: 3 + id: "550e8400-e29b-41d4-a716-446655440005" + type: "change-events" + links: + first: "https://api.datadoghq.com/api/v2/feature-flags/history?page%5Blimit%5D=25&page%5Boffset%5D=0" + last: "https://api.datadoghq.com/api/v2/feature-flags/history?page%5Blimit%5D=25&page%5Boffset%5D=0" + self: "https://api.datadoghq.com/api/v2/feature-flags/history?page%5Blimit%5D=25&page%5Boffset%5D=0" + meta: + page: + first_offset: 0 + last_offset: 0 + limit: 25 + offset: 0 + total: 1 + type: offset_limit + schema: + $ref: "#/components/schemas/ListFeatureFlagHistoryResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - feature_flag_config_read + summary: List feature flag change history + tags: + - Feature Flags + x-permission: + operator: AND + permissions: + - feature_flag_config_read + /api/v2/feature-flags/history/export: + get: + description: |- + Exports the organization's feature flag change events as a CSV file, newest first, without pagination. + It accepts the same filters as the List feature flag change history endpoint, and its columns match the CSV export on the flag history page: + Flag Version, Flag Name, Flag Key, Flag UUID, Action, User Name, User Email, User Type, Environment, and Timestamp. + + If an export fails before the file starts, the response is a JSON:API error. Large exports stream as they are read. + If an export fails after streaming starts, the connection closes before the file ends, so the download fails instead of + returning a file with missing rows. An export must finish within the 60-second request timeout. If an export times out, + narrow the date range. + operationId: ExportFeatureFlagHistory + parameters: + - $ref: "#/components/parameters/feature_flag_history_start_date" + - $ref: "#/components/parameters/feature_flag_history_end_date" + - $ref: "#/components/parameters/feature_flag_history_teams" + - $ref: "#/components/parameters/feature_flag_history_tags" + - $ref: "#/components/parameters/feature_flag_history_feature_flag_id" + - $ref: "#/components/parameters/feature_flag_history_environment_id" + - $ref: "#/components/parameters/feature_flag_history_include_suggestion_events" + responses: + "200": + content: + text/csv: + examples: + default: + value: "Flag Version,Flag Name,Flag Key,Flag UUID,Action,User Name,User Email,User Type,Environment,Timestamp\n3,Mobile Feature Toggle,mobile-feature-toggle,550e8400-e29b-41d4-a716-446655440000,\"Changed flag name from \"\"Mobile Feature Rollout\"\" to \"\"Mobile Feature Toggle\"\".\",Jane Doe,jane.doe@example.com,User,All,\"Mon, Oct 2, 2023, 2:30:00 pm UTC\"" + schema: + type: string + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - feature_flag_config_read + summary: Export feature flag change history + tags: + - Feature Flags + x-permission: + operator: AND + permissions: + - feature_flag_config_read /api/v2/feature-flags/saved-filters/{saved_filter_id}: get: description: |- diff --git a/examples/v2/feature-flags/ExportFeatureFlagHistory.java b/examples/v2/feature-flags/ExportFeatureFlagHistory.java new file mode 100644 index 00000000000..9de784572ad --- /dev/null +++ b/examples/v2/feature-flags/ExportFeatureFlagHistory.java @@ -0,0 +1,24 @@ +// Export feature flag change history returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.FeatureFlagsApi; + +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 { + String result = apiInstance.exportFeatureFlagHistory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FeatureFlagsApi#exportFeatureFlagHistory"); + 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/ListFeatureFlagHistory.java b/examples/v2/feature-flags/ListFeatureFlagHistory.java new file mode 100644 index 00000000000..dc55849d6e2 --- /dev/null +++ b/examples/v2/feature-flags/ListFeatureFlagHistory.java @@ -0,0 +1,25 @@ +// List feature flag change history 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.ListFeatureFlagHistoryResponse; + +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 { + ListFeatureFlagHistoryResponse result = apiInstance.listFeatureFlagHistory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FeatureFlagsApi#listFeatureFlagHistory"); + 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 cc8fa6f8322..9580621ba51 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 @@ -17,6 +17,7 @@ import com.datadog.api.client.v2.model.FeatureFlagStalenessStatus; import com.datadog.api.client.v2.model.ListAllocationsResponse; import com.datadog.api.client.v2.model.ListEnvironmentsResponse; +import com.datadog.api.client.v2.model.ListFeatureFlagHistoryResponse; import com.datadog.api.client.v2.model.ListFeatureFlagsResponse; import com.datadog.api.client.v2.model.OverwriteAllocationsRequest; import com.datadog.api.client.v2.model.PatchSavedFilterRequest; @@ -28,6 +29,7 @@ import com.datadog.api.client.v2.model.Variant; import jakarta.ws.rs.client.Invocation; import jakarta.ws.rs.core.GenericType; +import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -1501,6 +1503,299 @@ public CompletableFuture> enableFeatureFlagEnvironmentWithHttp null); } + /** Manage optional parameters to exportFeatureFlagHistory. */ + public static class ExportFeatureFlagHistoryOptionalParameters { + private OffsetDateTime startDate; + private OffsetDateTime endDate; + private List teams; + private List tags; + private UUID featureFlagId; + private UUID environmentId; + private Boolean includeSuggestionEvents; + + /** + * Set startDate. + * + * @param startDate Only include changes made after this time, for example + * 2026-01-01T00:00:00Z. Omit for no lower bound. (optional) + * @return ExportFeatureFlagHistoryOptionalParameters + */ + public ExportFeatureFlagHistoryOptionalParameters startDate(OffsetDateTime startDate) { + this.startDate = startDate; + return this; + } + + /** + * Set endDate. + * + * @param endDate Only include changes made before this time, for example + * 2026-02-01T00:00:00Z. Omit for no upper bound. Must be after start_date + * when both are set. (optional) + * @return ExportFeatureFlagHistoryOptionalParameters + */ + public ExportFeatureFlagHistoryOptionalParameters endDate(OffsetDateTime endDate) { + this.endDate = endDate; + return this; + } + + /** + * Set teams. + * + * @param teams Only include changes to flags that belong to at least one of these teams. Use + * team handles without the team: prefix, as repeated parameters, such as + * teams=checkout&teams=payments. Handles from teams and + * team:<handle> values from tags are treated as one set. + * Handles that are empty, have surrounding white space, or include the team: + * prefix return a 400 Bad Request error. (optional) + * @return ExportFeatureFlagHistoryOptionalParameters + */ + public ExportFeatureFlagHistoryOptionalParameters teams(List teams) { + this.teams = teams; + return this; + } + + /** + * Set tags. + * + * @param tags Only include changes to flags that have all of these exact tags, as repeated + * parameters, such as tags=env:prod&tags=tier:1. Values of the form + * team:<handle> match any selected team and are combined with teams + * . Empty values are ignored. (optional) + * @return ExportFeatureFlagHistoryOptionalParameters + */ + public ExportFeatureFlagHistoryOptionalParameters tags(List tags) { + this.tags = tags; + return this; + } + + /** + * Set featureFlagId. + * + * @param featureFlagId Only include changes to this feature flag. (optional) + * @return ExportFeatureFlagHistoryOptionalParameters + */ + public ExportFeatureFlagHistoryOptionalParameters featureFlagId(UUID featureFlagId) { + this.featureFlagId = featureFlagId; + return this; + } + + /** + * Set environmentId. + * + * @param environmentId Only include changes to this environment. Changes to the flag itself, + * which have no environment, are always included. (optional) + * @return ExportFeatureFlagHistoryOptionalParameters + */ + public ExportFeatureFlagHistoryOptionalParameters environmentId(UUID environmentId) { + this.environmentId = environmentId; + return this; + } + + /** + * Set includeSuggestionEvents. + * + * @param includeSuggestionEvents Also include review events for change requests that needed + * approval: rejected requests and requests still pending review. Applies only to + * organizations with flag approvals enabled. (optional, default to false) + * @return ExportFeatureFlagHistoryOptionalParameters + */ + public ExportFeatureFlagHistoryOptionalParameters includeSuggestionEvents( + Boolean includeSuggestionEvents) { + this.includeSuggestionEvents = includeSuggestionEvents; + return this; + } + } + + /** + * Export feature flag change history. + * + *

See {@link #exportFeatureFlagHistoryWithHttpInfo}. + * + * @return String + * @throws ApiException if fails to make API call + */ + public String exportFeatureFlagHistory() throws ApiException { + return exportFeatureFlagHistoryWithHttpInfo(new ExportFeatureFlagHistoryOptionalParameters()) + .getData(); + } + + /** + * Export feature flag change history. + * + *

See {@link #exportFeatureFlagHistoryWithHttpInfoAsync}. + * + * @return CompletableFuture<String> + */ + public CompletableFuture exportFeatureFlagHistoryAsync() { + return exportFeatureFlagHistoryWithHttpInfoAsync( + new ExportFeatureFlagHistoryOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Export feature flag change history. + * + *

See {@link #exportFeatureFlagHistoryWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return String + * @throws ApiException if fails to make API call + */ + public String exportFeatureFlagHistory(ExportFeatureFlagHistoryOptionalParameters parameters) + throws ApiException { + return exportFeatureFlagHistoryWithHttpInfo(parameters).getData(); + } + + /** + * Export feature flag change history. + * + *

See {@link #exportFeatureFlagHistoryWithHttpInfoAsync}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<String> + */ + public CompletableFuture exportFeatureFlagHistoryAsync( + ExportFeatureFlagHistoryOptionalParameters parameters) { + return exportFeatureFlagHistoryWithHttpInfoAsync(parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Exports the organization's feature flag change events as a CSV file, newest first, without + * pagination. It accepts the same filters as the List feature flag change history endpoint, and + * its columns match the CSV export on the flag history page: Flag Version, Flag Name, Flag Key, + * Flag UUID, Action, User Name, User Email, User Type, Environment, and Timestamp. + * + *

If an export fails before the file starts, the response is a JSON:API error. Large exports + * stream as they are read. If an export fails after streaming starts, the connection closes + * before the file ends, so the download fails instead of returning a file with missing rows. An + * export must finish within the 60-second request timeout. If an export times out, narrow the + * date range. + * + * @param parameters Optional parameters for the request. + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse exportFeatureFlagHistoryWithHttpInfo( + ExportFeatureFlagHistoryOptionalParameters parameters) throws ApiException { + Object localVarPostBody = null; + OffsetDateTime startDate = parameters.startDate; + OffsetDateTime endDate = parameters.endDate; + List teams = parameters.teams; + List tags = parameters.tags; + UUID featureFlagId = parameters.featureFlagId; + UUID environmentId = parameters.environmentId; + Boolean includeSuggestionEvents = parameters.includeSuggestionEvents; + // create path and map variables + String localVarPath = "/api/v2/feature-flags/history/export"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "start_date", startDate)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_date", endDate)); + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "teams", teams)); + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "tags", tags)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "feature_flag_id", featureFlagId)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "environment_id", environmentId)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "include_suggestion_events", includeSuggestionEvents)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.FeatureFlagsApi.exportFeatureFlagHistory", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"text/csv", "application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Export feature flag change history. + * + *

See {@link #exportFeatureFlagHistoryWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<String>> + */ + public CompletableFuture> exportFeatureFlagHistoryWithHttpInfoAsync( + ExportFeatureFlagHistoryOptionalParameters parameters) { + Object localVarPostBody = null; + OffsetDateTime startDate = parameters.startDate; + OffsetDateTime endDate = parameters.endDate; + List teams = parameters.teams; + List tags = parameters.tags; + UUID featureFlagId = parameters.featureFlagId; + UUID environmentId = parameters.environmentId; + Boolean includeSuggestionEvents = parameters.includeSuggestionEvents; + // create path and map variables + String localVarPath = "/api/v2/feature-flags/history/export"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "start_date", startDate)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_date", endDate)); + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "teams", teams)); + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "tags", tags)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "feature_flag_id", featureFlagId)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "environment_id", environmentId)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "include_suggestion_events", includeSuggestionEvents)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.FeatureFlagsApi.exportFeatureFlagHistory", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"text/csv", "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 feature flag. * @@ -1925,6 +2220,331 @@ public CompletableFuture> getSavedFilterWithHtt new GenericType() {}); } + /** Manage optional parameters to listFeatureFlagHistory. */ + public static class ListFeatureFlagHistoryOptionalParameters { + private OffsetDateTime startDate; + private OffsetDateTime endDate; + private List teams; + private List tags; + private UUID featureFlagId; + private UUID environmentId; + private Boolean includeSuggestionEvents; + private Long pageLimit; + private Long pageOffset; + + /** + * Set startDate. + * + * @param startDate Only include changes made after this time, for example + * 2026-01-01T00:00:00Z. Omit for no lower bound. (optional) + * @return ListFeatureFlagHistoryOptionalParameters + */ + public ListFeatureFlagHistoryOptionalParameters startDate(OffsetDateTime startDate) { + this.startDate = startDate; + return this; + } + + /** + * Set endDate. + * + * @param endDate Only include changes made before this time, for example + * 2026-02-01T00:00:00Z. Omit for no upper bound. Must be after start_date + * when both are set. (optional) + * @return ListFeatureFlagHistoryOptionalParameters + */ + public ListFeatureFlagHistoryOptionalParameters endDate(OffsetDateTime endDate) { + this.endDate = endDate; + return this; + } + + /** + * Set teams. + * + * @param teams Only include changes to flags that belong to at least one of these teams. Use + * team handles without the team: prefix, as repeated parameters, such as + * teams=checkout&teams=payments. Handles from teams and + * team:<handle> values from tags are treated as one set. + * Handles that are empty, have surrounding white space, or include the team: + * prefix return a 400 Bad Request error. (optional) + * @return ListFeatureFlagHistoryOptionalParameters + */ + public ListFeatureFlagHistoryOptionalParameters teams(List teams) { + this.teams = teams; + return this; + } + + /** + * Set tags. + * + * @param tags Only include changes to flags that have all of these exact tags, as repeated + * parameters, such as tags=env:prod&tags=tier:1. Values of the form + * team:<handle> match any selected team and are combined with teams + * . Empty values are ignored. (optional) + * @return ListFeatureFlagHistoryOptionalParameters + */ + public ListFeatureFlagHistoryOptionalParameters tags(List tags) { + this.tags = tags; + return this; + } + + /** + * Set featureFlagId. + * + * @param featureFlagId Only include changes to this feature flag. (optional) + * @return ListFeatureFlagHistoryOptionalParameters + */ + public ListFeatureFlagHistoryOptionalParameters featureFlagId(UUID featureFlagId) { + this.featureFlagId = featureFlagId; + return this; + } + + /** + * Set environmentId. + * + * @param environmentId Only include changes to this environment. Changes to the flag itself, + * which have no environment, are always included. (optional) + * @return ListFeatureFlagHistoryOptionalParameters + */ + public ListFeatureFlagHistoryOptionalParameters environmentId(UUID environmentId) { + this.environmentId = environmentId; + return this; + } + + /** + * Set includeSuggestionEvents. + * + * @param includeSuggestionEvents Also include review events for change requests that needed + * approval: rejected requests and requests still pending review. Applies only to + * organizations with flag approvals enabled. (optional, default to false) + * @return ListFeatureFlagHistoryOptionalParameters + */ + public ListFeatureFlagHistoryOptionalParameters includeSuggestionEvents( + Boolean includeSuggestionEvents) { + this.includeSuggestionEvents = includeSuggestionEvents; + return this; + } + + /** + * Set pageLimit. + * + * @param pageLimit Maximum number of events to return. Defaults to 25. Values + * above 50 return 50 events. Non-positive or empty values use the + * default. A non-integer value returns a 400 Bad Request error. (optional, + * default to 25) + * @return ListFeatureFlagHistoryOptionalParameters + */ + public ListFeatureFlagHistoryOptionalParameters pageLimit(Long pageLimit) { + this.pageLimit = pageLimit; + return this; + } + + /** + * Set pageOffset. + * + * @param pageOffset Number of matching events to skip before returning results. Defaults to + * 0. Negative or empty values are set to 0. A non-integer value + * returns a 400 Bad Request error. (optional, default to 0) + * @return ListFeatureFlagHistoryOptionalParameters + */ + public ListFeatureFlagHistoryOptionalParameters pageOffset(Long pageOffset) { + this.pageOffset = pageOffset; + return this; + } + } + + /** + * List feature flag change history. + * + *

See {@link #listFeatureFlagHistoryWithHttpInfo}. + * + * @return ListFeatureFlagHistoryResponse + * @throws ApiException if fails to make API call + */ + public ListFeatureFlagHistoryResponse listFeatureFlagHistory() throws ApiException { + return listFeatureFlagHistoryWithHttpInfo(new ListFeatureFlagHistoryOptionalParameters()) + .getData(); + } + + /** + * List feature flag change history. + * + *

See {@link #listFeatureFlagHistoryWithHttpInfoAsync}. + * + * @return CompletableFuture<ListFeatureFlagHistoryResponse> + */ + public CompletableFuture listFeatureFlagHistoryAsync() { + return listFeatureFlagHistoryWithHttpInfoAsync(new ListFeatureFlagHistoryOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List feature flag change history. + * + *

See {@link #listFeatureFlagHistoryWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return ListFeatureFlagHistoryResponse + * @throws ApiException if fails to make API call + */ + public ListFeatureFlagHistoryResponse listFeatureFlagHistory( + ListFeatureFlagHistoryOptionalParameters parameters) throws ApiException { + return listFeatureFlagHistoryWithHttpInfo(parameters).getData(); + } + + /** + * List feature flag change history. + * + *

See {@link #listFeatureFlagHistoryWithHttpInfoAsync}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ListFeatureFlagHistoryResponse> + */ + public CompletableFuture listFeatureFlagHistoryAsync( + ListFeatureFlagHistoryOptionalParameters parameters) { + return listFeatureFlagHistoryWithHttpInfoAsync(parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Returns the organization's feature flag change events, newest first. Each event includes a + * readable description of the change. All filters are optional, and events must match every + * filter you set. Without a date range, the whole history is listed. Results are paginated with + * page[limit] and page[offset]; follow links.next to read + * further back. + * + * @param parameters Optional parameters for the request. + * @return ApiResponse<ListFeatureFlagHistoryResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse listFeatureFlagHistoryWithHttpInfo( + ListFeatureFlagHistoryOptionalParameters parameters) throws ApiException { + Object localVarPostBody = null; + OffsetDateTime startDate = parameters.startDate; + OffsetDateTime endDate = parameters.endDate; + List teams = parameters.teams; + List tags = parameters.tags; + UUID featureFlagId = parameters.featureFlagId; + UUID environmentId = parameters.environmentId; + Boolean includeSuggestionEvents = parameters.includeSuggestionEvents; + Long pageLimit = parameters.pageLimit; + Long pageOffset = parameters.pageOffset; + // create path and map variables + String localVarPath = "/api/v2/feature-flags/history"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "start_date", startDate)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_date", endDate)); + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "teams", teams)); + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "tags", tags)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "feature_flag_id", featureFlagId)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "environment_id", environmentId)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "include_suggestion_events", includeSuggestionEvents)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[limit]", pageLimit)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[offset]", pageOffset)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.FeatureFlagsApi.listFeatureFlagHistory", + localVarPath, + localVarQueryParams, + 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() {}); + } + + /** + * List feature flag change history. + * + *

See {@link #listFeatureFlagHistoryWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<ListFeatureFlagHistoryResponse>> + */ + public CompletableFuture> + listFeatureFlagHistoryWithHttpInfoAsync(ListFeatureFlagHistoryOptionalParameters parameters) { + Object localVarPostBody = null; + OffsetDateTime startDate = parameters.startDate; + OffsetDateTime endDate = parameters.endDate; + List teams = parameters.teams; + List tags = parameters.tags; + UUID featureFlagId = parameters.featureFlagId; + UUID environmentId = parameters.environmentId; + Boolean includeSuggestionEvents = parameters.includeSuggestionEvents; + Long pageLimit = parameters.pageLimit; + Long pageOffset = parameters.pageOffset; + // create path and map variables + String localVarPath = "/api/v2/feature-flags/history"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "start_date", startDate)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_date", endDate)); + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "teams", teams)); + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "tags", tags)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "feature_flag_id", featureFlagId)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "environment_id", environmentId)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "include_suggestion_events", includeSuggestionEvents)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[limit]", pageLimit)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[offset]", pageOffset)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.FeatureFlagsApi.listFeatureFlagHistory", + localVarPath, + localVarQueryParams, + 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() {}); + } + /** Manage optional parameters to listFeatureFlags. */ public static class ListFeatureFlagsOptionalParameters { private String key; diff --git a/src/main/java/com/datadog/api/client/v2/model/FeatureFlagChangeEvent.java b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagChangeEvent.java new file mode 100644 index 00000000000..fec7a2f5535 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagChangeEvent.java @@ -0,0 +1,213 @@ +/* + * 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 change made to a feature flag. */ +@JsonPropertyOrder({ + FeatureFlagChangeEvent.JSON_PROPERTY_ATTRIBUTES, + FeatureFlagChangeEvent.JSON_PROPERTY_ID, + FeatureFlagChangeEvent.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FeatureFlagChangeEvent { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private FeatureFlagChangeEventAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private FeatureFlagChangeEventType type; + + public FeatureFlagChangeEvent() {} + + @JsonCreator + public FeatureFlagChangeEvent( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + FeatureFlagChangeEventAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) UUID id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) FeatureFlagChangeEventType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public FeatureFlagChangeEvent attributes(FeatureFlagChangeEventAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of a feature flag change event. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FeatureFlagChangeEventAttributes getAttributes() { + return attributes; + } + + public void setAttributes(FeatureFlagChangeEventAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public FeatureFlagChangeEvent id(UUID id) { + this.id = id; + return this; + } + + /** + * The ID of the change event. + * + * @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 FeatureFlagChangeEvent type(FeatureFlagChangeEventType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FeatureFlagChangeEventType getType() { + return type; + } + + public void setType(FeatureFlagChangeEventType 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 FeatureFlagChangeEvent + */ + @JsonAnySetter + public FeatureFlagChangeEvent 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 FeatureFlagChangeEvent object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FeatureFlagChangeEvent featureFlagChangeEvent = (FeatureFlagChangeEvent) o; + return Objects.equals(this.attributes, featureFlagChangeEvent.attributes) + && Objects.equals(this.id, featureFlagChangeEvent.id) + && Objects.equals(this.type, featureFlagChangeEvent.type) + && Objects.equals(this.additionalProperties, featureFlagChangeEvent.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FeatureFlagChangeEvent {\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/FeatureFlagChangeEventAction.java b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagChangeEventAction.java new file mode 100644 index 00000000000..b511874c598 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagChangeEventAction.java @@ -0,0 +1,86 @@ +/* + * 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 kind of change. */ +@JsonSerialize(using = FeatureFlagChangeEventAction.FeatureFlagChangeEventActionSerializer.class) +public class FeatureFlagChangeEventAction extends ModelEnum { + + private static final Set allowedValues = + new HashSet( + Arrays.asList( + "created", + "updated", + "deleted", + "archived", + "unarchived", + "scheduled", + "started", + "paused", + "unpaused", + "stopped")); + + public static final FeatureFlagChangeEventAction CREATED = + new FeatureFlagChangeEventAction("created"); + public static final FeatureFlagChangeEventAction UPDATED = + new FeatureFlagChangeEventAction("updated"); + public static final FeatureFlagChangeEventAction DELETED = + new FeatureFlagChangeEventAction("deleted"); + public static final FeatureFlagChangeEventAction ARCHIVED = + new FeatureFlagChangeEventAction("archived"); + public static final FeatureFlagChangeEventAction UNARCHIVED = + new FeatureFlagChangeEventAction("unarchived"); + public static final FeatureFlagChangeEventAction SCHEDULED = + new FeatureFlagChangeEventAction("scheduled"); + public static final FeatureFlagChangeEventAction STARTED = + new FeatureFlagChangeEventAction("started"); + public static final FeatureFlagChangeEventAction PAUSED = + new FeatureFlagChangeEventAction("paused"); + public static final FeatureFlagChangeEventAction UNPAUSED = + new FeatureFlagChangeEventAction("unpaused"); + public static final FeatureFlagChangeEventAction STOPPED = + new FeatureFlagChangeEventAction("stopped"); + + FeatureFlagChangeEventAction(String value) { + super(value, allowedValues); + } + + public static class FeatureFlagChangeEventActionSerializer + extends StdSerializer { + public FeatureFlagChangeEventActionSerializer(Class t) { + super(t); + } + + public FeatureFlagChangeEventActionSerializer() { + this(null); + } + + @Override + public void serialize( + FeatureFlagChangeEventAction value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static FeatureFlagChangeEventAction fromValue(String value) { + return new FeatureFlagChangeEventAction(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FeatureFlagChangeEventAttributes.java b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagChangeEventAttributes.java new file mode 100644 index 00000000000..707d4aceaee --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagChangeEventAttributes.java @@ -0,0 +1,588 @@ +/* + * 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 org.openapitools.jackson.nullable.JsonNullable; + +/** Attributes of a feature flag change event. */ +@JsonPropertyOrder({ + FeatureFlagChangeEventAttributes.JSON_PROPERTY_ACTION, + FeatureFlagChangeEventAttributes.JSON_PROPERTY_CHANGE_METADATA, + FeatureFlagChangeEventAttributes.JSON_PROPERTY_CREATION_SOURCE, + FeatureFlagChangeEventAttributes.JSON_PROPERTY_DESCRIPTION, + FeatureFlagChangeEventAttributes.JSON_PROPERTY_ENVIRONMENT, + FeatureFlagChangeEventAttributes.JSON_PROPERTY_FEATURE_FLAG, + FeatureFlagChangeEventAttributes.JSON_PROPERTY_NEW_VALUE, + FeatureFlagChangeEventAttributes.JSON_PROPERTY_PREVIOUS_VALUE, + FeatureFlagChangeEventAttributes.JSON_PROPERTY_PROPERTY, + FeatureFlagChangeEventAttributes.JSON_PROPERTY_SUGGESTION_REVIEW, + FeatureFlagChangeEventAttributes.JSON_PROPERTY_TIMESTAMP, + FeatureFlagChangeEventAttributes.JSON_PROPERTY_USER_ID, + FeatureFlagChangeEventAttributes.JSON_PROPERTY_VERSION_NUMBER +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FeatureFlagChangeEventAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ACTION = "action"; + private FeatureFlagChangeEventAction action; + + public static final String JSON_PROPERTY_CHANGE_METADATA = "change_metadata"; + private JsonNullable changeMetadata = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_CREATION_SOURCE = "creation_source"; + private JsonNullable creationSource = + JsonNullable.undefined(); + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_ENVIRONMENT = "environment"; + private JsonNullable environment = + JsonNullable.undefined(); + + public static final String JSON_PROPERTY_FEATURE_FLAG = "feature_flag"; + private FeatureFlagChangeEventFlag featureFlag; + + public static final String JSON_PROPERTY_NEW_VALUE = "new_value"; + private JsonNullable newValue = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_PREVIOUS_VALUE = "previous_value"; + private JsonNullable previousValue = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_PROPERTY = "property"; + private FeatureFlagChangeEventProperty property; + + public static final String JSON_PROPERTY_SUGGESTION_REVIEW = "suggestion_review"; + private FeatureFlagChangeEventSuggestionReview suggestionReview; + + public static final String JSON_PROPERTY_TIMESTAMP = "timestamp"; + private OffsetDateTime timestamp; + + public static final String JSON_PROPERTY_USER_ID = "user_id"; + private JsonNullable userId = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_VERSION_NUMBER = "version_number"; + private Long versionNumber; + + public FeatureFlagChangeEventAttributes() {} + + @JsonCreator + public FeatureFlagChangeEventAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_ACTION) + FeatureFlagChangeEventAction action, + @JsonProperty(required = true, value = JSON_PROPERTY_FEATURE_FLAG) + FeatureFlagChangeEventFlag featureFlag, + @JsonProperty(required = true, value = JSON_PROPERTY_PROPERTY) + FeatureFlagChangeEventProperty property, + @JsonProperty(required = true, value = JSON_PROPERTY_TIMESTAMP) OffsetDateTime timestamp, + @JsonProperty(required = true, value = JSON_PROPERTY_VERSION_NUMBER) Long versionNumber) { + this.action = action; + this.unparsed |= !action.isValid(); + this.featureFlag = featureFlag; + this.unparsed |= featureFlag.unparsed; + this.property = property; + this.unparsed |= !property.isValid(); + this.timestamp = timestamp; + this.versionNumber = versionNumber; + } + + public FeatureFlagChangeEventAttributes action(FeatureFlagChangeEventAction action) { + this.action = action; + this.unparsed |= !action.isValid(); + return this; + } + + /** + * The kind of change. + * + * @return action + */ + @JsonProperty(JSON_PROPERTY_ACTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FeatureFlagChangeEventAction getAction() { + return action; + } + + public void setAction(FeatureFlagChangeEventAction action) { + if (!action.isValid()) { + this.unparsed = true; + } + this.action = action; + } + + public FeatureFlagChangeEventAttributes changeMetadata(String changeMetadata) { + this.changeMetadata = JsonNullable.of(changeMetadata); + return this; + } + + /** + * Additional details about the change, as a JSON-encoded string. + * + * @return changeMetadata + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getChangeMetadata() { + return changeMetadata.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CHANGE_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getChangeMetadata_JsonNullable() { + return changeMetadata; + } + + @JsonProperty(JSON_PROPERTY_CHANGE_METADATA) + public void setChangeMetadata_JsonNullable(JsonNullable changeMetadata) { + this.changeMetadata = changeMetadata; + } + + public void setChangeMetadata(String changeMetadata) { + this.changeMetadata = JsonNullable.of(changeMetadata); + } + + public FeatureFlagChangeEventAttributes creationSource( + FeatureFlagChangeEventCreationSource creationSource) { + this.creationSource = JsonNullable.of(creationSource); + return this; + } + + /** + * Where the change was made: UI for the Datadog app, or MCP for a Model + * Context Protocol (MCP) client. + * + * @return creationSource + */ + @jakarta.annotation.Nullable + @JsonIgnore + public FeatureFlagChangeEventCreationSource getCreationSource() { + return creationSource.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CREATION_SOURCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getCreationSource_JsonNullable() { + return creationSource; + } + + @JsonProperty(JSON_PROPERTY_CREATION_SOURCE) + public void setCreationSource_JsonNullable( + JsonNullable creationSource) { + this.creationSource = creationSource; + } + + public void setCreationSource(FeatureFlagChangeEventCreationSource creationSource) { + if (!creationSource.isValid()) { + this.unparsed = true; + } + this.creationSource = JsonNullable.of(creationSource); + } + + public FeatureFlagChangeEventAttributes description(String description) { + this.description = description; + return this; + } + + /** + * A readable sentence describing the change, as shown on the flag history page and in the Action + * column of the CSV export. + * + * @return description + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public FeatureFlagChangeEventAttributes environment( + FeatureFlagChangeEventEnvironment environment) { + this.environment = JsonNullable.of(environment); + return this; + } + + /** + * The environment the change applies to. Null for a change to the flag itself rather than to one + * environment. + * + * @return environment + */ + @jakarta.annotation.Nullable + @JsonIgnore + public FeatureFlagChangeEventEnvironment getEnvironment() { + return environment.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ENVIRONMENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getEnvironment_JsonNullable() { + return environment; + } + + @JsonProperty(JSON_PROPERTY_ENVIRONMENT) + public void setEnvironment_JsonNullable( + JsonNullable environment) { + this.environment = environment; + } + + public void setEnvironment(FeatureFlagChangeEventEnvironment environment) { + this.environment = JsonNullable.of(environment); + } + + public FeatureFlagChangeEventAttributes featureFlag(FeatureFlagChangeEventFlag featureFlag) { + this.featureFlag = featureFlag; + this.unparsed |= featureFlag.unparsed; + return this; + } + + /** + * The feature flag the change applies to. + * + * @return featureFlag + */ + @JsonProperty(JSON_PROPERTY_FEATURE_FLAG) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FeatureFlagChangeEventFlag getFeatureFlag() { + return featureFlag; + } + + public void setFeatureFlag(FeatureFlagChangeEventFlag featureFlag) { + this.featureFlag = featureFlag; + if (featureFlag != null) { + this.unparsed |= featureFlag.unparsed; + } + } + + public FeatureFlagChangeEventAttributes newValue(String newValue) { + this.newValue = JsonNullable.of(newValue); + return this; + } + + /** + * The value after the change, serialized as a string. + * + * @return newValue + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getNewValue() { + return newValue.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NEW_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getNewValue_JsonNullable() { + return newValue; + } + + @JsonProperty(JSON_PROPERTY_NEW_VALUE) + public void setNewValue_JsonNullable(JsonNullable newValue) { + this.newValue = newValue; + } + + public void setNewValue(String newValue) { + this.newValue = JsonNullable.of(newValue); + } + + public FeatureFlagChangeEventAttributes previousValue(String previousValue) { + this.previousValue = JsonNullable.of(previousValue); + return this; + } + + /** + * The value before the change, serialized as a string. + * + * @return previousValue + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getPreviousValue() { + return previousValue.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_PREVIOUS_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getPreviousValue_JsonNullable() { + return previousValue; + } + + @JsonProperty(JSON_PROPERTY_PREVIOUS_VALUE) + public void setPreviousValue_JsonNullable(JsonNullable previousValue) { + this.previousValue = previousValue; + } + + public void setPreviousValue(String previousValue) { + this.previousValue = JsonNullable.of(previousValue); + } + + public FeatureFlagChangeEventAttributes property(FeatureFlagChangeEventProperty property) { + this.property = property; + this.unparsed |= !property.isValid(); + return this; + } + + /** + * The part of the feature flag the change applies to. + * + * @return property + */ + @JsonProperty(JSON_PROPERTY_PROPERTY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FeatureFlagChangeEventProperty getProperty() { + return property; + } + + public void setProperty(FeatureFlagChangeEventProperty property) { + if (!property.isValid()) { + this.unparsed = true; + } + this.property = property; + } + + public FeatureFlagChangeEventAttributes suggestionReview( + FeatureFlagChangeEventSuggestionReview suggestionReview) { + this.suggestionReview = suggestionReview; + this.unparsed |= suggestionReview.unparsed; + return this; + } + + /** + * Review details of a change request that needed approval. Present on review events, which + * include_suggestion_events adds. Also present on a change that an approved change request + * applied, even when include_suggestion_events is false. + * + * @return suggestionReview + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SUGGESTION_REVIEW) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public FeatureFlagChangeEventSuggestionReview getSuggestionReview() { + return suggestionReview; + } + + public void setSuggestionReview(FeatureFlagChangeEventSuggestionReview suggestionReview) { + this.suggestionReview = suggestionReview; + if (suggestionReview != null) { + this.unparsed |= suggestionReview.unparsed; + } + } + + public FeatureFlagChangeEventAttributes timestamp(OffsetDateTime timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * When the change was made. + * + * @return timestamp + */ + @JsonProperty(JSON_PROPERTY_TIMESTAMP) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getTimestamp() { + return timestamp; + } + + public void setTimestamp(OffsetDateTime timestamp) { + this.timestamp = timestamp; + } + + public FeatureFlagChangeEventAttributes userId(String userId) { + this.userId = JsonNullable.of(userId); + return this; + } + + /** + * The ID of the user who made the change. Null when no user made the change. + * + * @return userId + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getUserId() { + return userId.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_USER_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getUserId_JsonNullable() { + return userId; + } + + @JsonProperty(JSON_PROPERTY_USER_ID) + public void setUserId_JsonNullable(JsonNullable userId) { + this.userId = userId; + } + + public void setUserId(String userId) { + this.userId = JsonNullable.of(userId); + } + + public FeatureFlagChangeEventAttributes versionNumber(Long versionNumber) { + this.versionNumber = versionNumber; + return this; + } + + /** + * The version of the feature flag the change produced. + * + * @return versionNumber + */ + @JsonProperty(JSON_PROPERTY_VERSION_NUMBER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getVersionNumber() { + return versionNumber; + } + + public void setVersionNumber(Long versionNumber) { + this.versionNumber = versionNumber; + } + + /** + * 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 FeatureFlagChangeEventAttributes + */ + @JsonAnySetter + public FeatureFlagChangeEventAttributes 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 FeatureFlagChangeEventAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FeatureFlagChangeEventAttributes featureFlagChangeEventAttributes = + (FeatureFlagChangeEventAttributes) o; + return Objects.equals(this.action, featureFlagChangeEventAttributes.action) + && Objects.equals(this.changeMetadata, featureFlagChangeEventAttributes.changeMetadata) + && Objects.equals(this.creationSource, featureFlagChangeEventAttributes.creationSource) + && Objects.equals(this.description, featureFlagChangeEventAttributes.description) + && Objects.equals(this.environment, featureFlagChangeEventAttributes.environment) + && Objects.equals(this.featureFlag, featureFlagChangeEventAttributes.featureFlag) + && Objects.equals(this.newValue, featureFlagChangeEventAttributes.newValue) + && Objects.equals(this.previousValue, featureFlagChangeEventAttributes.previousValue) + && Objects.equals(this.property, featureFlagChangeEventAttributes.property) + && Objects.equals(this.suggestionReview, featureFlagChangeEventAttributes.suggestionReview) + && Objects.equals(this.timestamp, featureFlagChangeEventAttributes.timestamp) + && Objects.equals(this.userId, featureFlagChangeEventAttributes.userId) + && Objects.equals(this.versionNumber, featureFlagChangeEventAttributes.versionNumber) + && Objects.equals( + this.additionalProperties, featureFlagChangeEventAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + action, + changeMetadata, + creationSource, + description, + environment, + featureFlag, + newValue, + previousValue, + property, + suggestionReview, + timestamp, + userId, + versionNumber, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FeatureFlagChangeEventAttributes {\n"); + sb.append(" action: ").append(toIndentedString(action)).append("\n"); + sb.append(" changeMetadata: ").append(toIndentedString(changeMetadata)).append("\n"); + sb.append(" creationSource: ").append(toIndentedString(creationSource)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" environment: ").append(toIndentedString(environment)).append("\n"); + sb.append(" featureFlag: ").append(toIndentedString(featureFlag)).append("\n"); + sb.append(" newValue: ").append(toIndentedString(newValue)).append("\n"); + sb.append(" previousValue: ").append(toIndentedString(previousValue)).append("\n"); + sb.append(" property: ").append(toIndentedString(property)).append("\n"); + sb.append(" suggestionReview: ").append(toIndentedString(suggestionReview)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); + sb.append(" versionNumber: ").append(toIndentedString(versionNumber)).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/FeatureFlagChangeEventCreationSource.java b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagChangeEventCreationSource.java new file mode 100644 index 00000000000..482be53eb64 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagChangeEventCreationSource.java @@ -0,0 +1,64 @@ +/* + * 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; + +/** + * Where the change was made: UI for the Datadog app, or MCP for a Model + * Context Protocol (MCP) client. + */ +@JsonSerialize( + using = + FeatureFlagChangeEventCreationSource.FeatureFlagChangeEventCreationSourceSerializer.class) +public class FeatureFlagChangeEventCreationSource extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("UI", "MCP")); + + public static final FeatureFlagChangeEventCreationSource UI = + new FeatureFlagChangeEventCreationSource("UI"); + public static final FeatureFlagChangeEventCreationSource MCP = + new FeatureFlagChangeEventCreationSource("MCP"); + + FeatureFlagChangeEventCreationSource(String value) { + super(value, allowedValues); + } + + public static class FeatureFlagChangeEventCreationSourceSerializer + extends StdSerializer { + public FeatureFlagChangeEventCreationSourceSerializer( + Class t) { + super(t); + } + + public FeatureFlagChangeEventCreationSourceSerializer() { + this(null); + } + + @Override + public void serialize( + FeatureFlagChangeEventCreationSource value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static FeatureFlagChangeEventCreationSource fromValue(String value) { + return new FeatureFlagChangeEventCreationSource(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FeatureFlagChangeEventEnvironment.java b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagChangeEventEnvironment.java new file mode 100644 index 00000000000..22b2d298622 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagChangeEventEnvironment.java @@ -0,0 +1,207 @@ +/* + * 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 environment the change applies to. Null for a change to the flag itself rather than to one + * environment. + */ +@JsonPropertyOrder({ + FeatureFlagChangeEventEnvironment.JSON_PROPERTY_ID, + FeatureFlagChangeEventEnvironment.JSON_PROPERTY_IS_PRODUCTION, + FeatureFlagChangeEventEnvironment.JSON_PROPERTY_NAME +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FeatureFlagChangeEventEnvironment { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_IS_PRODUCTION = "is_production"; + private Boolean isProduction; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public FeatureFlagChangeEventEnvironment() {} + + @JsonCreator + public FeatureFlagChangeEventEnvironment( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) UUID id, + @JsonProperty(required = true, value = JSON_PROPERTY_IS_PRODUCTION) Boolean isProduction, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name) { + this.id = id; + this.isProduction = isProduction; + this.name = name; + } + + public FeatureFlagChangeEventEnvironment id(UUID id) { + this.id = id; + return this; + } + + /** + * The ID of the environment. + * + * @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 FeatureFlagChangeEventEnvironment isProduction(Boolean isProduction) { + this.isProduction = isProduction; + return this; + } + + /** + * Whether the environment is a production environment. + * + * @return isProduction + */ + @JsonProperty(JSON_PROPERTY_IS_PRODUCTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getIsProduction() { + return isProduction; + } + + public void setIsProduction(Boolean isProduction) { + this.isProduction = isProduction; + } + + public FeatureFlagChangeEventEnvironment name(String name) { + this.name = name; + return this; + } + + /** + * The name of the environment. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * 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 FeatureFlagChangeEventEnvironment + */ + @JsonAnySetter + public FeatureFlagChangeEventEnvironment 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 FeatureFlagChangeEventEnvironment object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FeatureFlagChangeEventEnvironment featureFlagChangeEventEnvironment = + (FeatureFlagChangeEventEnvironment) o; + return Objects.equals(this.id, featureFlagChangeEventEnvironment.id) + && Objects.equals(this.isProduction, featureFlagChangeEventEnvironment.isProduction) + && Objects.equals(this.name, featureFlagChangeEventEnvironment.name) + && Objects.equals( + this.additionalProperties, featureFlagChangeEventEnvironment.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, isProduction, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FeatureFlagChangeEventEnvironment {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" isProduction: ").append(toIndentedString(isProduction)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).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/FeatureFlagChangeEventFlag.java b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagChangeEventFlag.java new file mode 100644 index 00000000000..de9488062d6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagChangeEventFlag.java @@ -0,0 +1,203 @@ +/* + * 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 feature flag the change applies to. */ +@JsonPropertyOrder({ + FeatureFlagChangeEventFlag.JSON_PROPERTY_ID, + FeatureFlagChangeEventFlag.JSON_PROPERTY_KEY, + FeatureFlagChangeEventFlag.JSON_PROPERTY_NAME +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FeatureFlagChangeEventFlag { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_KEY = "key"; + private String key; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public FeatureFlagChangeEventFlag() {} + + @JsonCreator + public FeatureFlagChangeEventFlag( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) UUID id, + @JsonProperty(required = true, value = JSON_PROPERTY_KEY) String key, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name) { + this.id = id; + this.key = key; + this.name = name; + } + + public FeatureFlagChangeEventFlag id(UUID id) { + this.id = id; + return this; + } + + /** + * The ID of the feature flag. + * + * @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 FeatureFlagChangeEventFlag key(String key) { + this.key = key; + return this; + } + + /** + * The key of the feature flag. + * + * @return key + */ + @JsonProperty(JSON_PROPERTY_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public FeatureFlagChangeEventFlag name(String name) { + this.name = name; + return this; + } + + /** + * The name of the feature flag. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * 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 FeatureFlagChangeEventFlag + */ + @JsonAnySetter + public FeatureFlagChangeEventFlag 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 FeatureFlagChangeEventFlag object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FeatureFlagChangeEventFlag featureFlagChangeEventFlag = (FeatureFlagChangeEventFlag) o; + return Objects.equals(this.id, featureFlagChangeEventFlag.id) + && Objects.equals(this.key, featureFlagChangeEventFlag.key) + && Objects.equals(this.name, featureFlagChangeEventFlag.name) + && Objects.equals( + this.additionalProperties, featureFlagChangeEventFlag.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, key, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FeatureFlagChangeEventFlag {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).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/FeatureFlagChangeEventProperty.java b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagChangeEventProperty.java new file mode 100644 index 00000000000..e9caabe4a49 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagChangeEventProperty.java @@ -0,0 +1,105 @@ +/* + * 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 part of the feature flag the change applies to. */ +@JsonSerialize( + using = FeatureFlagChangeEventProperty.FeatureFlagChangeEventPropertySerializer.class) +public class FeatureFlagChangeEventProperty extends ModelEnum { + + private static final Set allowedValues = + new HashSet( + Arrays.asList( + "FLAG", + "FLAG_NAME", + "FLAG_DESCRIPTION", + "JSON_SCHEMA", + "DISTRIBUTION_CHANNEL", + "REQUIRE_APPROVAL", + "VARIANT", + "VARIANT_NAME", + "VARIANT_VALUE", + "ALLOCATIONS", + "ROLLOUT", + "ENVIRONMENT_STATUS", + "DEFAULT_VARIANT", + "OVERRIDE_VARIANT", + "STALENESS_STATUS", + "SAVED_FILTER")); + + public static final FeatureFlagChangeEventProperty FLAG = + new FeatureFlagChangeEventProperty("FLAG"); + public static final FeatureFlagChangeEventProperty FLAG_NAME = + new FeatureFlagChangeEventProperty("FLAG_NAME"); + public static final FeatureFlagChangeEventProperty FLAG_DESCRIPTION = + new FeatureFlagChangeEventProperty("FLAG_DESCRIPTION"); + public static final FeatureFlagChangeEventProperty JSON_SCHEMA = + new FeatureFlagChangeEventProperty("JSON_SCHEMA"); + public static final FeatureFlagChangeEventProperty DISTRIBUTION_CHANNEL = + new FeatureFlagChangeEventProperty("DISTRIBUTION_CHANNEL"); + public static final FeatureFlagChangeEventProperty REQUIRE_APPROVAL = + new FeatureFlagChangeEventProperty("REQUIRE_APPROVAL"); + public static final FeatureFlagChangeEventProperty VARIANT = + new FeatureFlagChangeEventProperty("VARIANT"); + public static final FeatureFlagChangeEventProperty VARIANT_NAME = + new FeatureFlagChangeEventProperty("VARIANT_NAME"); + public static final FeatureFlagChangeEventProperty VARIANT_VALUE = + new FeatureFlagChangeEventProperty("VARIANT_VALUE"); + public static final FeatureFlagChangeEventProperty ALLOCATIONS = + new FeatureFlagChangeEventProperty("ALLOCATIONS"); + public static final FeatureFlagChangeEventProperty ROLLOUT = + new FeatureFlagChangeEventProperty("ROLLOUT"); + public static final FeatureFlagChangeEventProperty ENVIRONMENT_STATUS = + new FeatureFlagChangeEventProperty("ENVIRONMENT_STATUS"); + public static final FeatureFlagChangeEventProperty DEFAULT_VARIANT = + new FeatureFlagChangeEventProperty("DEFAULT_VARIANT"); + public static final FeatureFlagChangeEventProperty OVERRIDE_VARIANT = + new FeatureFlagChangeEventProperty("OVERRIDE_VARIANT"); + public static final FeatureFlagChangeEventProperty STALENESS_STATUS = + new FeatureFlagChangeEventProperty("STALENESS_STATUS"); + public static final FeatureFlagChangeEventProperty SAVED_FILTER = + new FeatureFlagChangeEventProperty("SAVED_FILTER"); + + FeatureFlagChangeEventProperty(String value) { + super(value, allowedValues); + } + + public static class FeatureFlagChangeEventPropertySerializer + extends StdSerializer { + public FeatureFlagChangeEventPropertySerializer(Class t) { + super(t); + } + + public FeatureFlagChangeEventPropertySerializer() { + this(null); + } + + @Override + public void serialize( + FeatureFlagChangeEventProperty value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static FeatureFlagChangeEventProperty fromValue(String value) { + return new FeatureFlagChangeEventProperty(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FeatureFlagChangeEventSuggestionLifecycleStatus.java b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagChangeEventSuggestionLifecycleStatus.java new file mode 100644 index 00000000000..22c74cc2ea9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagChangeEventSuggestionLifecycleStatus.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; + +/** Where the change request is in its lifecycle. */ +@JsonSerialize( + using = + FeatureFlagChangeEventSuggestionLifecycleStatus + .FeatureFlagChangeEventSuggestionLifecycleStatusSerializer.class) +public class FeatureFlagChangeEventSuggestionLifecycleStatus extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("pending", "approved", "applied", "rejected", "discarded")); + + public static final FeatureFlagChangeEventSuggestionLifecycleStatus PENDING = + new FeatureFlagChangeEventSuggestionLifecycleStatus("pending"); + public static final FeatureFlagChangeEventSuggestionLifecycleStatus APPROVED = + new FeatureFlagChangeEventSuggestionLifecycleStatus("approved"); + public static final FeatureFlagChangeEventSuggestionLifecycleStatus APPLIED = + new FeatureFlagChangeEventSuggestionLifecycleStatus("applied"); + public static final FeatureFlagChangeEventSuggestionLifecycleStatus REJECTED = + new FeatureFlagChangeEventSuggestionLifecycleStatus("rejected"); + public static final FeatureFlagChangeEventSuggestionLifecycleStatus DISCARDED = + new FeatureFlagChangeEventSuggestionLifecycleStatus("discarded"); + + FeatureFlagChangeEventSuggestionLifecycleStatus(String value) { + super(value, allowedValues); + } + + public static class FeatureFlagChangeEventSuggestionLifecycleStatusSerializer + extends StdSerializer { + public FeatureFlagChangeEventSuggestionLifecycleStatusSerializer( + Class t) { + super(t); + } + + public FeatureFlagChangeEventSuggestionLifecycleStatusSerializer() { + this(null); + } + + @Override + public void serialize( + FeatureFlagChangeEventSuggestionLifecycleStatus value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static FeatureFlagChangeEventSuggestionLifecycleStatus fromValue(String value) { + return new FeatureFlagChangeEventSuggestionLifecycleStatus(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FeatureFlagChangeEventSuggestionReview.java b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagChangeEventSuggestionReview.java new file mode 100644 index 00000000000..f8b42077fb2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagChangeEventSuggestionReview.java @@ -0,0 +1,286 @@ +/* + * 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; + +/** + * Review details of a change request that needed approval. Present on review events, which + * include_suggestion_events adds. Also present on a change that an approved change request + * applied, even when include_suggestion_events is false. + */ +@JsonPropertyOrder({ + FeatureFlagChangeEventSuggestionReview.JSON_PROPERTY_LIFECYCLE_STATUS, + FeatureFlagChangeEventSuggestionReview.JSON_PROPERTY_REQUESTER_COMMENT, + FeatureFlagChangeEventSuggestionReview.JSON_PROPERTY_REVIEWER_COMMENT, + FeatureFlagChangeEventSuggestionReview.JSON_PROPERTY_STATUS, + FeatureFlagChangeEventSuggestionReview.JSON_PROPERTY_SUGGESTION_CREATED_BY +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FeatureFlagChangeEventSuggestionReview { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_LIFECYCLE_STATUS = "lifecycle_status"; + private FeatureFlagChangeEventSuggestionLifecycleStatus lifecycleStatus; + + public static final String JSON_PROPERTY_REQUESTER_COMMENT = "requester_comment"; + private String requesterComment; + + public static final String JSON_PROPERTY_REVIEWER_COMMENT = "reviewer_comment"; + private String reviewerComment; + + public static final String JSON_PROPERTY_STATUS = "status"; + private FeatureFlagChangeEventSuggestionStatus status; + + public static final String JSON_PROPERTY_SUGGESTION_CREATED_BY = "suggestion_created_by"; + private String suggestionCreatedBy; + + public FeatureFlagChangeEventSuggestionReview() {} + + @JsonCreator + public FeatureFlagChangeEventSuggestionReview( + @JsonProperty(required = true, value = JSON_PROPERTY_LIFECYCLE_STATUS) + FeatureFlagChangeEventSuggestionLifecycleStatus lifecycleStatus, + @JsonProperty(required = true, value = JSON_PROPERTY_STATUS) + FeatureFlagChangeEventSuggestionStatus status) { + this.lifecycleStatus = lifecycleStatus; + this.unparsed |= !lifecycleStatus.isValid(); + this.status = status; + this.unparsed |= !status.isValid(); + } + + public FeatureFlagChangeEventSuggestionReview lifecycleStatus( + FeatureFlagChangeEventSuggestionLifecycleStatus lifecycleStatus) { + this.lifecycleStatus = lifecycleStatus; + this.unparsed |= !lifecycleStatus.isValid(); + return this; + } + + /** + * Where the change request is in its lifecycle. + * + * @return lifecycleStatus + */ + @JsonProperty(JSON_PROPERTY_LIFECYCLE_STATUS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FeatureFlagChangeEventSuggestionLifecycleStatus getLifecycleStatus() { + return lifecycleStatus; + } + + public void setLifecycleStatus(FeatureFlagChangeEventSuggestionLifecycleStatus lifecycleStatus) { + if (!lifecycleStatus.isValid()) { + this.unparsed = true; + } + this.lifecycleStatus = lifecycleStatus; + } + + public FeatureFlagChangeEventSuggestionReview requesterComment(String requesterComment) { + this.requesterComment = requesterComment; + return this; + } + + /** + * The comment left by the person who requested the change. + * + * @return requesterComment + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_REQUESTER_COMMENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getRequesterComment() { + return requesterComment; + } + + public void setRequesterComment(String requesterComment) { + this.requesterComment = requesterComment; + } + + public FeatureFlagChangeEventSuggestionReview reviewerComment(String reviewerComment) { + this.reviewerComment = reviewerComment; + return this; + } + + /** + * The comment left by the reviewer. + * + * @return reviewerComment + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_REVIEWER_COMMENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getReviewerComment() { + return reviewerComment; + } + + public void setReviewerComment(String reviewerComment) { + this.reviewerComment = reviewerComment; + } + + public FeatureFlagChangeEventSuggestionReview status( + FeatureFlagChangeEventSuggestionStatus status) { + this.status = status; + this.unparsed |= !status.isValid(); + return this; + } + + /** + * The review status of the change request. + * + * @return status + */ + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public FeatureFlagChangeEventSuggestionStatus getStatus() { + return status; + } + + public void setStatus(FeatureFlagChangeEventSuggestionStatus status) { + if (!status.isValid()) { + this.unparsed = true; + } + this.status = status; + } + + public FeatureFlagChangeEventSuggestionReview suggestionCreatedBy(String suggestionCreatedBy) { + this.suggestionCreatedBy = suggestionCreatedBy; + return this; + } + + /** + * The ID of the user who requested the change. + * + * @return suggestionCreatedBy + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SUGGESTION_CREATED_BY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getSuggestionCreatedBy() { + return suggestionCreatedBy; + } + + public void setSuggestionCreatedBy(String suggestionCreatedBy) { + this.suggestionCreatedBy = suggestionCreatedBy; + } + + /** + * 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 FeatureFlagChangeEventSuggestionReview + */ + @JsonAnySetter + public FeatureFlagChangeEventSuggestionReview 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 FeatureFlagChangeEventSuggestionReview object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FeatureFlagChangeEventSuggestionReview featureFlagChangeEventSuggestionReview = + (FeatureFlagChangeEventSuggestionReview) o; + return Objects.equals( + this.lifecycleStatus, featureFlagChangeEventSuggestionReview.lifecycleStatus) + && Objects.equals( + this.requesterComment, featureFlagChangeEventSuggestionReview.requesterComment) + && Objects.equals( + this.reviewerComment, featureFlagChangeEventSuggestionReview.reviewerComment) + && Objects.equals(this.status, featureFlagChangeEventSuggestionReview.status) + && Objects.equals( + this.suggestionCreatedBy, featureFlagChangeEventSuggestionReview.suggestionCreatedBy) + && Objects.equals( + this.additionalProperties, featureFlagChangeEventSuggestionReview.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + lifecycleStatus, + requesterComment, + reviewerComment, + status, + suggestionCreatedBy, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FeatureFlagChangeEventSuggestionReview {\n"); + sb.append(" lifecycleStatus: ").append(toIndentedString(lifecycleStatus)).append("\n"); + sb.append(" requesterComment: ").append(toIndentedString(requesterComment)).append("\n"); + sb.append(" reviewerComment: ").append(toIndentedString(reviewerComment)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" suggestionCreatedBy: ") + .append(toIndentedString(suggestionCreatedBy)) + .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/FeatureFlagChangeEventSuggestionStatus.java b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagChangeEventSuggestionStatus.java new file mode 100644 index 00000000000..07eeec82a42 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagChangeEventSuggestionStatus.java @@ -0,0 +1,67 @@ +/* + * 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 review status of the change request. */ +@JsonSerialize( + using = + FeatureFlagChangeEventSuggestionStatus.FeatureFlagChangeEventSuggestionStatusSerializer + .class) +public class FeatureFlagChangeEventSuggestionStatus extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("pending", "approved", "rejected")); + + public static final FeatureFlagChangeEventSuggestionStatus PENDING = + new FeatureFlagChangeEventSuggestionStatus("pending"); + public static final FeatureFlagChangeEventSuggestionStatus APPROVED = + new FeatureFlagChangeEventSuggestionStatus("approved"); + public static final FeatureFlagChangeEventSuggestionStatus REJECTED = + new FeatureFlagChangeEventSuggestionStatus("rejected"); + + FeatureFlagChangeEventSuggestionStatus(String value) { + super(value, allowedValues); + } + + public static class FeatureFlagChangeEventSuggestionStatusSerializer + extends StdSerializer { + public FeatureFlagChangeEventSuggestionStatusSerializer( + Class t) { + super(t); + } + + public FeatureFlagChangeEventSuggestionStatusSerializer() { + this(null); + } + + @Override + public void serialize( + FeatureFlagChangeEventSuggestionStatus value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static FeatureFlagChangeEventSuggestionStatus fromValue(String value) { + return new FeatureFlagChangeEventSuggestionStatus(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FeatureFlagChangeEventType.java b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagChangeEventType.java new file mode 100644 index 00000000000..d5ba13f1ded --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagChangeEventType.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. */ +@JsonSerialize(using = FeatureFlagChangeEventType.FeatureFlagChangeEventTypeSerializer.class) +public class FeatureFlagChangeEventType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("change-events")); + + public static final FeatureFlagChangeEventType CHANGE_EVENTS = + new FeatureFlagChangeEventType("change-events"); + + FeatureFlagChangeEventType(String value) { + super(value, allowedValues); + } + + public static class FeatureFlagChangeEventTypeSerializer + extends StdSerializer { + public FeatureFlagChangeEventTypeSerializer(Class t) { + super(t); + } + + public FeatureFlagChangeEventTypeSerializer() { + this(null); + } + + @Override + public void serialize( + FeatureFlagChangeEventType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static FeatureFlagChangeEventType fromValue(String value) { + return new FeatureFlagChangeEventType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FeatureFlagHistoryPaginationMeta.java b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagHistoryPaginationMeta.java new file mode 100644 index 00000000000..5806f94e68c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagHistoryPaginationMeta.java @@ -0,0 +1,141 @@ +/* + * 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; + +/** Pagination metadata for feature flag change history. */ +@JsonPropertyOrder({FeatureFlagHistoryPaginationMeta.JSON_PROPERTY_PAGE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FeatureFlagHistoryPaginationMeta { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_PAGE = "page"; + private FeatureFlagHistoryPaginationMetaPage page; + + public FeatureFlagHistoryPaginationMeta page(FeatureFlagHistoryPaginationMetaPage page) { + this.page = page; + this.unparsed |= page.unparsed; + return this; + } + + /** + * Pagination metadata for feature flag change history responses. + * + * @return page + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public FeatureFlagHistoryPaginationMetaPage getPage() { + return page; + } + + public void setPage(FeatureFlagHistoryPaginationMetaPage page) { + this.page = page; + if (page != null) { + this.unparsed |= page.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 FeatureFlagHistoryPaginationMeta + */ + @JsonAnySetter + public FeatureFlagHistoryPaginationMeta 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 FeatureFlagHistoryPaginationMeta object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FeatureFlagHistoryPaginationMeta featureFlagHistoryPaginationMeta = + (FeatureFlagHistoryPaginationMeta) o; + return Objects.equals(this.page, featureFlagHistoryPaginationMeta.page) + && Objects.equals( + this.additionalProperties, featureFlagHistoryPaginationMeta.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(page, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FeatureFlagHistoryPaginationMeta {\n"); + sb.append(" page: ").append(toIndentedString(page)).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/FeatureFlagHistoryPaginationMetaPage.java b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagHistoryPaginationMetaPage.java new file mode 100644 index 00000000000..1e5ca6ec895 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagHistoryPaginationMetaPage.java @@ -0,0 +1,370 @@ +/* + * 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 org.openapitools.jackson.nullable.JsonNullable; + +/** Pagination metadata for feature flag change history responses. */ +@JsonPropertyOrder({ + FeatureFlagHistoryPaginationMetaPage.JSON_PROPERTY_FIRST_OFFSET, + FeatureFlagHistoryPaginationMetaPage.JSON_PROPERTY_LAST_OFFSET, + FeatureFlagHistoryPaginationMetaPage.JSON_PROPERTY_LIMIT, + FeatureFlagHistoryPaginationMetaPage.JSON_PROPERTY_NEXT_OFFSET, + FeatureFlagHistoryPaginationMetaPage.JSON_PROPERTY_OFFSET, + FeatureFlagHistoryPaginationMetaPage.JSON_PROPERTY_PREV_OFFSET, + FeatureFlagHistoryPaginationMetaPage.JSON_PROPERTY_TOTAL, + FeatureFlagHistoryPaginationMetaPage.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class FeatureFlagHistoryPaginationMetaPage { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_FIRST_OFFSET = "first_offset"; + private Long firstOffset; + + public static final String JSON_PROPERTY_LAST_OFFSET = "last_offset"; + private JsonNullable lastOffset = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_LIMIT = "limit"; + private Long limit; + + public static final String JSON_PROPERTY_NEXT_OFFSET = "next_offset"; + private JsonNullable nextOffset = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_OFFSET = "offset"; + private Long offset; + + public static final String JSON_PROPERTY_PREV_OFFSET = "prev_offset"; + private JsonNullable prevOffset = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_TOTAL = "total"; + private Long total; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public FeatureFlagHistoryPaginationMetaPage firstOffset(Long firstOffset) { + this.firstOffset = firstOffset; + return this; + } + + /** + * Offset of the first page. + * + * @return firstOffset + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_FIRST_OFFSET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getFirstOffset() { + return firstOffset; + } + + public void setFirstOffset(Long firstOffset) { + this.firstOffset = firstOffset; + } + + public FeatureFlagHistoryPaginationMetaPage lastOffset(Long lastOffset) { + this.lastOffset = JsonNullable.of(lastOffset); + return this; + } + + /** + * Offset of the last page. + * + * @return lastOffset + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Long getLastOffset() { + return lastOffset.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_LAST_OFFSET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getLastOffset_JsonNullable() { + return lastOffset; + } + + @JsonProperty(JSON_PROPERTY_LAST_OFFSET) + public void setLastOffset_JsonNullable(JsonNullable lastOffset) { + this.lastOffset = lastOffset; + } + + public void setLastOffset(Long lastOffset) { + this.lastOffset = JsonNullable.of(lastOffset); + } + + public FeatureFlagHistoryPaginationMetaPage limit(Long limit) { + this.limit = limit; + return this; + } + + /** + * Maximum number of events returned on this page. + * + * @return limit + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LIMIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getLimit() { + return limit; + } + + public void setLimit(Long limit) { + this.limit = limit; + } + + public FeatureFlagHistoryPaginationMetaPage nextOffset(Long nextOffset) { + this.nextOffset = JsonNullable.of(nextOffset); + return this; + } + + /** + * Offset of the next page, or null when there is no next page. + * + * @return nextOffset + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Long getNextOffset() { + return nextOffset.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NEXT_OFFSET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getNextOffset_JsonNullable() { + return nextOffset; + } + + @JsonProperty(JSON_PROPERTY_NEXT_OFFSET) + public void setNextOffset_JsonNullable(JsonNullable nextOffset) { + this.nextOffset = nextOffset; + } + + public void setNextOffset(Long nextOffset) { + this.nextOffset = JsonNullable.of(nextOffset); + } + + public FeatureFlagHistoryPaginationMetaPage offset(Long offset) { + this.offset = offset; + return this; + } + + /** + * Number of matching events skipped before this page. + * + * @return offset + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_OFFSET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getOffset() { + return offset; + } + + public void setOffset(Long offset) { + this.offset = offset; + } + + public FeatureFlagHistoryPaginationMetaPage prevOffset(Long prevOffset) { + this.prevOffset = JsonNullable.of(prevOffset); + return this; + } + + /** + * Offset of the previous page, or null when there is no previous page. + * + * @return prevOffset + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Long getPrevOffset() { + return prevOffset.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_PREV_OFFSET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getPrevOffset_JsonNullable() { + return prevOffset; + } + + @JsonProperty(JSON_PROPERTY_PREV_OFFSET) + public void setPrevOffset_JsonNullable(JsonNullable prevOffset) { + this.prevOffset = prevOffset; + } + + public void setPrevOffset(Long prevOffset) { + this.prevOffset = JsonNullable.of(prevOffset); + } + + public FeatureFlagHistoryPaginationMetaPage total(Long total) { + this.total = total; + return this; + } + + /** + * Total number of events matching the filters, independent of the page size. It counts experiment + * proposals that you cannot read, which are left out of the pages, so a page can hold fewer + * events than limit. + * + * @return total + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TOTAL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getTotal() { + return total; + } + + public void setTotal(Long total) { + this.total = total; + } + + public FeatureFlagHistoryPaginationMetaPage type(String type) { + this.type = type; + return this; + } + + /** + * The pagination method. Always offset_limit. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getType() { + return type; + } + + public void setType(String type) { + 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 FeatureFlagHistoryPaginationMetaPage + */ + @JsonAnySetter + public FeatureFlagHistoryPaginationMetaPage 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 FeatureFlagHistoryPaginationMetaPage object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FeatureFlagHistoryPaginationMetaPage featureFlagHistoryPaginationMetaPage = + (FeatureFlagHistoryPaginationMetaPage) o; + return Objects.equals(this.firstOffset, featureFlagHistoryPaginationMetaPage.firstOffset) + && Objects.equals(this.lastOffset, featureFlagHistoryPaginationMetaPage.lastOffset) + && Objects.equals(this.limit, featureFlagHistoryPaginationMetaPage.limit) + && Objects.equals(this.nextOffset, featureFlagHistoryPaginationMetaPage.nextOffset) + && Objects.equals(this.offset, featureFlagHistoryPaginationMetaPage.offset) + && Objects.equals(this.prevOffset, featureFlagHistoryPaginationMetaPage.prevOffset) + && Objects.equals(this.total, featureFlagHistoryPaginationMetaPage.total) + && Objects.equals(this.type, featureFlagHistoryPaginationMetaPage.type) + && Objects.equals( + this.additionalProperties, featureFlagHistoryPaginationMetaPage.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + firstOffset, + lastOffset, + limit, + nextOffset, + offset, + prevOffset, + total, + type, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FeatureFlagHistoryPaginationMetaPage {\n"); + sb.append(" firstOffset: ").append(toIndentedString(firstOffset)).append("\n"); + sb.append(" lastOffset: ").append(toIndentedString(lastOffset)).append("\n"); + sb.append(" limit: ").append(toIndentedString(limit)).append("\n"); + sb.append(" nextOffset: ").append(toIndentedString(nextOffset)).append("\n"); + sb.append(" offset: ").append(toIndentedString(offset)).append("\n"); + sb.append(" prevOffset: ").append(toIndentedString(prevOffset)).append("\n"); + sb.append(" total: ").append(toIndentedString(total)).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/ListFeatureFlagHistoryResponse.java b/src/main/java/com/datadog/api/client/v2/model/ListFeatureFlagHistoryResponse.java new file mode 100644 index 00000000000..27da8e0f1b6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ListFeatureFlagHistoryResponse.java @@ -0,0 +1,231 @@ +/* + * 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; + +/** Response containing feature flag change events, newest first. */ +@JsonPropertyOrder({ + ListFeatureFlagHistoryResponse.JSON_PROPERTY_DATA, + ListFeatureFlagHistoryResponse.JSON_PROPERTY_LINKS, + ListFeatureFlagHistoryResponse.JSON_PROPERTY_META +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ListFeatureFlagHistoryResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public static final String JSON_PROPERTY_LINKS = "links"; + private FeatureFlagsPaginationLinks links; + + public static final String JSON_PROPERTY_META = "meta"; + private FeatureFlagHistoryPaginationMeta meta; + + public ListFeatureFlagHistoryResponse() {} + + @JsonCreator + public ListFeatureFlagHistoryResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + List data) { + this.data = data; + for (FeatureFlagChangeEvent item : data) { + this.unparsed |= item.unparsed; + } + } + + public ListFeatureFlagHistoryResponse data(List data) { + this.data = data; + for (FeatureFlagChangeEvent item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public ListFeatureFlagHistoryResponse addDataItem(FeatureFlagChangeEvent dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * The change events. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + if (data != null) { + for (FeatureFlagChangeEvent item : data) { + this.unparsed |= item.unparsed; + } + } + } + + public ListFeatureFlagHistoryResponse links(FeatureFlagsPaginationLinks links) { + this.links = links; + this.unparsed |= links.unparsed; + return this; + } + + /** + * 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. + * + * @return links + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LINKS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public FeatureFlagsPaginationLinks getLinks() { + return links; + } + + public void setLinks(FeatureFlagsPaginationLinks links) { + this.links = links; + if (links != null) { + this.unparsed |= links.unparsed; + } + } + + public ListFeatureFlagHistoryResponse meta(FeatureFlagHistoryPaginationMeta meta) { + this.meta = meta; + this.unparsed |= meta.unparsed; + return this; + } + + /** + * Pagination metadata for feature flag change history. + * + * @return meta + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_META) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public FeatureFlagHistoryPaginationMeta getMeta() { + return meta; + } + + public void setMeta(FeatureFlagHistoryPaginationMeta meta) { + this.meta = meta; + if (meta != null) { + this.unparsed |= meta.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 ListFeatureFlagHistoryResponse + */ + @JsonAnySetter + public ListFeatureFlagHistoryResponse 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 ListFeatureFlagHistoryResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListFeatureFlagHistoryResponse listFeatureFlagHistoryResponse = + (ListFeatureFlagHistoryResponse) o; + return Objects.equals(this.data, listFeatureFlagHistoryResponse.data) + && Objects.equals(this.links, listFeatureFlagHistoryResponse.links) + && Objects.equals(this.meta, listFeatureFlagHistoryResponse.meta) + && Objects.equals( + this.additionalProperties, listFeatureFlagHistoryResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, links, meta, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListFeatureFlagHistoryResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/feature_flags.feature b/src/test/resources/com/datadog/api/client/v2/api/feature_flags.feature index c2a82ad2841..c8ac74f56ae 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 @@ -269,6 +269,18 @@ Feature: Feature Flags When the request is sent Then the response status is 200 OK + @generated @skip @team:ddoghq/feature-flags + Scenario: Export feature flag change history returns "Bad Request" response + Given new "ExportFeatureFlagHistory" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/feature-flags + Scenario: Export feature flag change history returns "OK" response + Given new "ExportFeatureFlagHistory" request + When the request is sent + Then the response status is 200 OK + @skip @team:ddoghq/feature-flags Scenario: Get a feature flag returns "Not Found" response Given new "GetFeatureFlag" request @@ -360,6 +372,18 @@ Feature: Feature Flags When the request is sent Then the response status is 200 OK + @generated @skip @team:ddoghq/feature-flags + Scenario: List feature flag change history returns "Bad Request" response + Given new "ListFeatureFlagHistory" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/feature-flags + Scenario: List feature flag change history returns "OK" response + Given new "ListFeatureFlagHistory" request + When the request is sent + Then the response status is 200 OK + @team:ddoghq/feature-flags Scenario: List feature flags applies default pagination Given new "ListFeatureFlags" request diff --git a/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index 559ffe28c2b..89bfd970d02 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 @@ -3221,6 +3221,18 @@ "type": "idempotent" } }, + "ListFeatureFlagHistory": { + "tag": "Feature Flags", + "undo": { + "type": "safe" + } + }, + "ExportFeatureFlagHistory": { + "tag": "Feature Flags", + "undo": { + "type": "safe" + } + }, "GetSavedFilter": { "tag": "Feature Flags", "undo": {