From 91b40697512a8d6705990a5cf3e0499e9042d077 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 8 May 2026 16:46:48 +0000 Subject: [PATCH] Regenerate client from commit 3f0117f of spec repo --- .generator/schemas/v2/openapi.yaml | 281 ++++++++++++++++++ .../ListDatasetRestrictions.rb | 8 + .../UpdateDatasetRestriction.rb | 19 ++ features/scenarios_model_mapping.rb | 4 + features/v2/dataset_restrictions.feature | 51 ++++ features/v2/undo.json | 13 + lib/datadog_api_client/configuration.rb | 2 + lib/datadog_api_client/inflector.rb | 12 + .../v2/api/dataset_restrictions_api.rb | 176 +++++++++++ .../dataset_restriction_ownership_mode.rb | 29 ++ .../models/dataset_restriction_principal.rb | 167 +++++++++++ .../v2/models/dataset_restriction_response.rb | 123 ++++++++ ...dataset_restriction_response_attributes.rb | 161 ++++++++++ .../dataset_restriction_response_data.rb | 166 +++++++++++ .../dataset_restriction_restriction_mode.rb | 29 ++ .../dataset_restriction_update_request.rb | 123 ++++++++ ...t_restriction_update_request_attributes.rb | 151 ++++++++++ ...dataset_restriction_update_request_data.rb | 145 +++++++++ .../dataset_restrictions_list_response.rb | 126 ++++++++ .../v2/models/dataset_restrictions_type.rb | 26 ++ 20 files changed, 1812 insertions(+) create mode 100644 examples/v2/dataset-restrictions/ListDatasetRestrictions.rb create mode 100644 examples/v2/dataset-restrictions/UpdateDatasetRestriction.rb create mode 100644 features/v2/dataset_restrictions.feature create mode 100644 lib/datadog_api_client/v2/api/dataset_restrictions_api.rb create mode 100644 lib/datadog_api_client/v2/models/dataset_restriction_ownership_mode.rb create mode 100644 lib/datadog_api_client/v2/models/dataset_restriction_principal.rb create mode 100644 lib/datadog_api_client/v2/models/dataset_restriction_response.rb create mode 100644 lib/datadog_api_client/v2/models/dataset_restriction_response_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/dataset_restriction_response_data.rb create mode 100644 lib/datadog_api_client/v2/models/dataset_restriction_restriction_mode.rb create mode 100644 lib/datadog_api_client/v2/models/dataset_restriction_update_request.rb create mode 100644 lib/datadog_api_client/v2/models/dataset_restriction_update_request_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/dataset_restriction_update_request_data.rb create mode 100644 lib/datadog_api_client/v2/models/dataset_restrictions_list_response.rb create mode 100644 lib/datadog_api_client/v2/models/dataset_restrictions_type.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 18755c0511d9..60073dd5381c 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -21475,6 +21475,162 @@ components: data: $ref: "#/components/schemas/DatasetResponse" type: object + DatasetRestrictionOwnershipMode: + description: |- + Controls how dataset ownership is determined. `disabled` turns off ownership-based access + entirely. `team_tag_based` assigns dataset ownership based on the team tags applied to the + data, allowing team members to see their own team's datasets. + enum: + - disabled + - team_tag_based + example: "team_tag_based" + type: string + x-enum-varnames: + - DISABLED + - TEAM_TAG_BASED + DatasetRestrictionPrincipal: + description: |- + A user or role that is exempt from dataset restrictions and retains unrestricted + access to all datasets for the product type. + properties: + id: + description: The unique identifier of the principal (a user UUID or role ID). + example: "abc123" + type: string + name: + description: The human-readable display name of the principal as shown in the Datadog UI. + example: "Datadog Admin Role" + type: string + type: + description: |- + The kind of principal, such as `user` for an individual user account or `role` + for a Datadog role. + example: "role" + type: string + required: + - type + - id + - name + type: object + DatasetRestrictionResponse: + description: Response containing the updated dataset restriction. + properties: + data: + $ref: "#/components/schemas/DatasetRestrictionResponseData" + required: + - data + type: object + DatasetRestrictionResponseAttributes: + description: |- + The current configuration of a dataset restriction, including restriction mode, + ownership mode, and exempt principals. + properties: + ownership_mode: + $ref: "#/components/schemas/DatasetRestrictionOwnershipMode" + restriction_key: + description: Internal key used by the restriction enforcement system to identify this restriction rule. + type: string + restriction_mode: + $ref: "#/components/schemas/DatasetRestrictionRestrictionMode" + unrestricted_principals: + description: |- + Principals (users or roles) that are exempt from this restriction and retain + full data access regardless of the restriction mode. + items: + $ref: "#/components/schemas/DatasetRestrictionPrincipal" + type: array + required: + - restriction_mode + type: object + DatasetRestrictionResponseData: + description: A single dataset restriction configuration for one product type. + properties: + attributes: + $ref: "#/components/schemas/DatasetRestrictionResponseAttributes" + id: + description: The Datadog product type this restriction applies to (for example, `rum`, `apm`, or `logs`). + example: "rum" + type: string + type: + $ref: "#/components/schemas/DatasetRestrictionsType" + required: + - type + - id + - attributes + type: object + DatasetRestrictionRestrictionMode: + description: |- + Controls the default data visibility for the product type. `standard` makes data visible + to all users with appropriate product access. `default_hide` hides data by default and + requires explicit grants for each dataset. + enum: + - standard + - default_hide + example: "default_hide" + type: string + x-enum-varnames: + - STANDARD + - DEFAULT_HIDE + DatasetRestrictionUpdateRequest: + description: Payload for updating a dataset restriction configuration. + properties: + data: + $ref: "#/components/schemas/DatasetRestrictionUpdateRequestData" + required: + - data + type: object + DatasetRestrictionUpdateRequestAttributes: + description: |- + Editable attributes of a dataset restriction. Only `restriction_mode` is required; + omitted optional fields retain their current values. + properties: + ownership_mode: + $ref: "#/components/schemas/DatasetRestrictionOwnershipMode" + restriction_mode: + $ref: "#/components/schemas/DatasetRestrictionRestrictionMode" + unrestricted_principals: + description: |- + Principal identifiers (users or roles) that are exempt from the restriction and + can always access all datasets for this product type. + items: + description: A unique identifier of a user or role principal. + type: string + type: array + required: + - restriction_mode + type: object + DatasetRestrictionUpdateRequestData: + description: Data object for a dataset restriction update. + properties: + attributes: + $ref: "#/components/schemas/DatasetRestrictionUpdateRequestAttributes" + type: + $ref: "#/components/schemas/DatasetRestrictionsType" + required: + - type + - attributes + type: object + DatasetRestrictionsListResponse: + description: |- + Response containing the list of all dataset restriction configurations for the + organization, one per product type. + properties: + data: + description: An array of dataset restriction objects, one for each configured product type. + items: + $ref: "#/components/schemas/DatasetRestrictionResponseData" + type: array + required: + - data + type: object + DatasetRestrictionsType: + description: JSON:API resource type for dataset restrictions. + enum: + - dataset_restrictions + example: "dataset_restrictions" + type: string + x-enum-varnames: + - DATASET_RESTRICTIONS DatasetType: default: dataset description: Resource type, always set to `dataset`. @@ -97605,6 +97761,126 @@ paths: x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/dataset_restrictions: + get: + description: |- + Retrieve all dataset restriction configurations for the organization. + Returns one restriction object per configured product type (for example, RUM, APM, or Logs), + including the current restriction mode, ownership mode, and any unrestricted principals. + Requires the `user_access_read` permission. + operationId: ListDatasetRestrictions + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + restriction_mode: "standard" + id: "rum" + type: "dataset_restrictions" + - attributes: + ownership_mode: "team_tag_based" + restriction_mode: "default_hide" + id: "apm" + type: "dataset_restrictions" + schema: + $ref: "#/components/schemas/DatasetRestrictionsListResponse" + description: OK + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: List dataset restrictions + tags: + - Dataset Restrictions + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/dataset_restrictions/{product_type}: + post: + description: |- + Update the dataset restriction configuration for a specific product type. + Sets the restriction mode, optional ownership mode, and the list of principals + that are exempt from restrictions. Requires the `user_access_manage` permission. + Changes are audited and take effect immediately. + operationId: UpdateDatasetRestriction + parameters: + - description: The Datadog product type to configure restrictions for (for example, `rum`, `apm`, or `logs`). + example: "rum" + in: path + name: product_type + required: true + schema: + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + ownership_mode: "team_tag_based" + restriction_mode: "default_hide" + type: "dataset_restrictions" + schema: + $ref: "#/components/schemas/DatasetRestrictionUpdateRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + ownership_mode: "team_tag_based" + restriction_mode: "default_hide" + id: "rum" + type: "dataset_restrictions" + schema: + $ref: "#/components/schemas/DatasetRestrictionResponse" + 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 + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Update a dataset restriction + tags: + - Dataset Restrictions + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/datasets: get: description: Get all datasets that have been configured for an organization. @@ -146005,6 +146281,11 @@ tags: - description: |- The Data Deletion API allows the user to target and delete data from the allowed products. It's currently enabled for Logs and RUM and depends on `logs_delete_data` and `rum_delete_data` permissions respectively. name: Data Deletion + - description: |- + Configure dataset-level access restrictions per Datadog product type. Dataset restrictions + control whether data is visible by default or hidden until explicitly granted, and how + ownership-based access is determined. + name: Dataset Restrictions - description: |- Data Access Controls in Datadog is a feature that allows administrators and access managers to regulate access to sensitive data. By defining Restricted Datasets, you can ensure that only specific teams or roles can diff --git a/examples/v2/dataset-restrictions/ListDatasetRestrictions.rb b/examples/v2/dataset-restrictions/ListDatasetRestrictions.rb new file mode 100644 index 000000000000..fa5fdf27c08e --- /dev/null +++ b/examples/v2/dataset-restrictions/ListDatasetRestrictions.rb @@ -0,0 +1,8 @@ +# List dataset restrictions returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.list_dataset_restrictions".to_sym] = true +end +api_instance = DatadogAPIClient::V2::DatasetRestrictionsAPI.new +p api_instance.list_dataset_restrictions() diff --git a/examples/v2/dataset-restrictions/UpdateDatasetRestriction.rb b/examples/v2/dataset-restrictions/UpdateDatasetRestriction.rb new file mode 100644 index 000000000000..dfaa848b4197 --- /dev/null +++ b/examples/v2/dataset-restrictions/UpdateDatasetRestriction.rb @@ -0,0 +1,19 @@ +# Update a dataset restriction returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.update_dataset_restriction".to_sym] = true +end +api_instance = DatadogAPIClient::V2::DatasetRestrictionsAPI.new + +body = DatadogAPIClient::V2::DatasetRestrictionUpdateRequest.new({ + data: DatadogAPIClient::V2::DatasetRestrictionUpdateRequestData.new({ + attributes: DatadogAPIClient::V2::DatasetRestrictionUpdateRequestAttributes.new({ + ownership_mode: DatadogAPIClient::V2::DatasetRestrictionOwnershipMode::TEAM_TAG_BASED, + restriction_mode: DatadogAPIClient::V2::DatasetRestrictionRestrictionMode::DEFAULT_HIDE, + unrestricted_principals: [], + }), + type: DatadogAPIClient::V2::DatasetRestrictionsType::DATASET_RESTRICTIONS, + }), +}) +p api_instance.update_dataset_restriction("product_type", body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index a0c4193084bc..df76127c2086 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -2305,6 +2305,10 @@ "token" => "String", "body" => "SecureEmbedUpdateRequest", }, + "v2.UpdateDatasetRestriction" => { + "product_type" => "String", + "body" => "DatasetRestrictionUpdateRequest", + }, "v2.CreateDataset" => { "body" => "DatasetCreateRequest", }, diff --git a/features/v2/dataset_restrictions.feature b/features/v2/dataset_restrictions.feature new file mode 100644 index 000000000000..6a08480abd69 --- /dev/null +++ b/features/v2/dataset_restrictions.feature @@ -0,0 +1,51 @@ +@endpoint(dataset-restrictions) @endpoint(dataset-restrictions-v2) +Feature: Dataset Restrictions + Configure dataset-level access restrictions per Datadog product type. + Dataset restrictions control whether data is visible by default or hidden + until explicitly granted, and how ownership-based access is determined. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "DatasetRestrictions" API + + @generated @skip @team:DataDog/access-enforcement + Scenario: List dataset restrictions returns "Not Found" response + Given operation "ListDatasetRestrictions" enabled + And new "ListDatasetRestrictions" request + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/access-enforcement + Scenario: List dataset restrictions returns "OK" response + Given operation "ListDatasetRestrictions" enabled + And new "ListDatasetRestrictions" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/access-enforcement + Scenario: Update a dataset restriction returns "Bad Request" response + Given operation "UpdateDatasetRestriction" enabled + And new "UpdateDatasetRestriction" request + And request contains "product_type" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"ownership_mode": "team_tag_based", "restriction_mode": "default_hide", "unrestricted_principals": []}, "type": "dataset_restrictions"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/access-enforcement + Scenario: Update a dataset restriction returns "Not Found" response + Given operation "UpdateDatasetRestriction" enabled + And new "UpdateDatasetRestriction" request + And request contains "product_type" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"ownership_mode": "team_tag_based", "restriction_mode": "default_hide", "unrestricted_principals": []}, "type": "dataset_restrictions"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/access-enforcement + Scenario: Update a dataset restriction returns "OK" response + Given operation "UpdateDatasetRestriction" enabled + And new "UpdateDatasetRestriction" request + And request contains "product_type" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"ownership_mode": "team_tag_based", "restriction_mode": "default_hide", "unrestricted_principals": []}, "type": "dataset_restrictions"}} + When the request is sent + Then the response status is 200 OK diff --git a/features/v2/undo.json b/features/v2/undo.json index 8f3cc28492de..71f8bfc1b524 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -1602,6 +1602,19 @@ "type": "idempotent" } }, + "ListDatasetRestrictions": { + "tag": "Dataset Restrictions", + "undo": { + "type": "safe" + } + }, + "UpdateDatasetRestriction": { + "tag": "Dataset Restrictions", + "undo": { + "operationId": "UpdateDatasetRestriction", + "type": "idempotent" + } + }, "GetAllDatasets": { "tag": "Datasets", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 8860f22b1727..907c9ec3748b 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -296,6 +296,8 @@ def initialize "v2.delete_dashboard_secure_embed": false, "v2.get_dashboard_secure_embed": false, "v2.update_dashboard_secure_embed": false, + "v2.list_dataset_restrictions": false, + "v2.update_dataset_restriction": false, "v2.create_dataset": false, "v2.delete_dataset": false, "v2.get_all_datasets": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index cf3079d38d1a..176f129226b3 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -2286,6 +2286,17 @@ def overrides "v2.dataset_response" => "DatasetResponse", "v2.dataset_response_multi" => "DatasetResponseMulti", "v2.dataset_response_single" => "DatasetResponseSingle", + "v2.dataset_restriction_ownership_mode" => "DatasetRestrictionOwnershipMode", + "v2.dataset_restriction_principal" => "DatasetRestrictionPrincipal", + "v2.dataset_restriction_response" => "DatasetRestrictionResponse", + "v2.dataset_restriction_response_attributes" => "DatasetRestrictionResponseAttributes", + "v2.dataset_restriction_response_data" => "DatasetRestrictionResponseData", + "v2.dataset_restriction_restriction_mode" => "DatasetRestrictionRestrictionMode", + "v2.dataset_restrictions_list_response" => "DatasetRestrictionsListResponse", + "v2.dataset_restrictions_type" => "DatasetRestrictionsType", + "v2.dataset_restriction_update_request" => "DatasetRestrictionUpdateRequest", + "v2.dataset_restriction_update_request_attributes" => "DatasetRestrictionUpdateRequestAttributes", + "v2.dataset_restriction_update_request_data" => "DatasetRestrictionUpdateRequestData", "v2.dataset_type" => "DatasetType", "v2.dataset_update_request" => "DatasetUpdateRequest", "v2.datastore" => "Datastore", @@ -6419,6 +6430,7 @@ def overrides "v2.dashboard_lists_api" => "DashboardListsAPI", "v2.dashboard_secure_embed_api" => "DashboardSecureEmbedAPI", "v2.data_deletion_api" => "DataDeletionAPI", + "v2.dataset_restrictions_api" => "DatasetRestrictionsAPI", "v2.datasets_api" => "DatasetsAPI", "v2.deployment_gates_api" => "DeploymentGatesAPI", "v2.domain_allowlist_api" => "DomainAllowlistAPI", diff --git a/lib/datadog_api_client/v2/api/dataset_restrictions_api.rb b/lib/datadog_api_client/v2/api/dataset_restrictions_api.rb new file mode 100644 index 000000000000..0292731c34d7 --- /dev/null +++ b/lib/datadog_api_client/v2/api/dataset_restrictions_api.rb @@ -0,0 +1,176 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'cgi' + +module DatadogAPIClient::V2 + class DatasetRestrictionsAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # List dataset restrictions. + # + # @see #list_dataset_restrictions_with_http_info + def list_dataset_restrictions(opts = {}) + data, _status_code, _headers = list_dataset_restrictions_with_http_info(opts) + data + end + + # List dataset restrictions. + # + # Retrieve all dataset restriction configurations for the organization. + # Returns one restriction object per configured product type (for example, RUM, APM, or Logs), + # including the current restriction mode, ownership mode, and any unrestricted principals. + # Requires the `user_access_read` permission. + # + # @param opts [Hash] the optional parameters + # @return [Array<(DatasetRestrictionsListResponse, Integer, Hash)>] DatasetRestrictionsListResponse data, response status code and response headers + def list_dataset_restrictions_with_http_info(opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_dataset_restrictions".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_dataset_restrictions") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_dataset_restrictions")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DatasetRestrictionsAPI.list_dataset_restrictions ...' + end + # resource path + local_var_path = '/api/v2/dataset_restrictions' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'DatasetRestrictionsListResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :list_dataset_restrictions, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DatasetRestrictionsAPI#list_dataset_restrictions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update a dataset restriction. + # + # @see #update_dataset_restriction_with_http_info + def update_dataset_restriction(product_type, body, opts = {}) + data, _status_code, _headers = update_dataset_restriction_with_http_info(product_type, body, opts) + data + end + + # Update a dataset restriction. + # + # Update the dataset restriction configuration for a specific product type. + # Sets the restriction mode, optional ownership mode, and the list of principals + # that are exempt from restrictions. Requires the `user_access_manage` permission. + # Changes are audited and take effect immediately. + # + # @param product_type [String] The Datadog product type to configure restrictions for (for example, `rum`, `apm`, or `logs`). + # @param body [DatasetRestrictionUpdateRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(DatasetRestrictionResponse, Integer, Hash)>] DatasetRestrictionResponse data, response status code and response headers + def update_dataset_restriction_with_http_info(product_type, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.update_dataset_restriction".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.update_dataset_restriction") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.update_dataset_restriction")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DatasetRestrictionsAPI.update_dataset_restriction ...' + end + # verify the required parameter 'product_type' is set + if @api_client.config.client_side_validation && product_type.nil? + fail ArgumentError, "Missing the required parameter 'product_type' when calling DatasetRestrictionsAPI.update_dataset_restriction" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling DatasetRestrictionsAPI.update_dataset_restriction" + end + # resource path + local_var_path = '/api/v2/dataset_restrictions/{product_type}'.sub('{product_type}', CGI.escape(product_type.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'DatasetRestrictionResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :update_dataset_restriction, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DatasetRestrictionsAPI#update_dataset_restriction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/datadog_api_client/v2/models/dataset_restriction_ownership_mode.rb b/lib/datadog_api_client/v2/models/dataset_restriction_ownership_mode.rb new file mode 100644 index 000000000000..364683c98dc9 --- /dev/null +++ b/lib/datadog_api_client/v2/models/dataset_restriction_ownership_mode.rb @@ -0,0 +1,29 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Controls how dataset ownership is determined. `disabled` turns off ownership-based access + # entirely. `team_tag_based` assigns dataset ownership based on the team tags applied to the + # data, allowing team members to see their own team's datasets. + class DatasetRestrictionOwnershipMode + include BaseEnumModel + + DISABLED = "disabled".freeze + TEAM_TAG_BASED = "team_tag_based".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/dataset_restriction_principal.rb b/lib/datadog_api_client/v2/models/dataset_restriction_principal.rb new file mode 100644 index 000000000000..2f792d9c11fa --- /dev/null +++ b/lib/datadog_api_client/v2/models/dataset_restriction_principal.rb @@ -0,0 +1,167 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A user or role that is exempt from dataset restrictions and retains unrestricted + # access to all datasets for the product type. + class DatasetRestrictionPrincipal + include BaseGenericModel + + # The unique identifier of the principal (a user UUID or role ID). + attr_reader :id + + # The human-readable display name of the principal as shown in the Datadog UI. + attr_reader :name + + # The kind of principal, such as `user` for an individual user account or `role` + # for a Datadog role. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'type' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DatasetRestrictionPrincipal` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @id.nil? + return false if @name.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [id, name, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/dataset_restriction_response.rb b/lib/datadog_api_client/v2/models/dataset_restriction_response.rb new file mode 100644 index 000000000000..ed08cb6b8a17 --- /dev/null +++ b/lib/datadog_api_client/v2/models/dataset_restriction_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing the updated dataset restriction. + class DatasetRestrictionResponse + include BaseGenericModel + + # A single dataset restriction configuration for one product type. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'DatasetRestrictionResponseData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DatasetRestrictionResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/dataset_restriction_response_attributes.rb b/lib/datadog_api_client/v2/models/dataset_restriction_response_attributes.rb new file mode 100644 index 000000000000..37cdf7b8bc4f --- /dev/null +++ b/lib/datadog_api_client/v2/models/dataset_restriction_response_attributes.rb @@ -0,0 +1,161 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The current configuration of a dataset restriction, including restriction mode, + # ownership mode, and exempt principals. + class DatasetRestrictionResponseAttributes + include BaseGenericModel + + # Controls how dataset ownership is determined. `disabled` turns off ownership-based access + # entirely. `team_tag_based` assigns dataset ownership based on the team tags applied to the + # data, allowing team members to see their own team's datasets. + attr_accessor :ownership_mode + + # Internal key used by the restriction enforcement system to identify this restriction rule. + attr_accessor :restriction_key + + # Controls the default data visibility for the product type. `standard` makes data visible + # to all users with appropriate product access. `default_hide` hides data by default and + # requires explicit grants for each dataset. + attr_reader :restriction_mode + + # Principals (users or roles) that are exempt from this restriction and retain + # full data access regardless of the restriction mode. + attr_accessor :unrestricted_principals + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'ownership_mode' => :'ownership_mode', + :'restriction_key' => :'restriction_key', + :'restriction_mode' => :'restriction_mode', + :'unrestricted_principals' => :'unrestricted_principals' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'ownership_mode' => :'DatasetRestrictionOwnershipMode', + :'restriction_key' => :'String', + :'restriction_mode' => :'DatasetRestrictionRestrictionMode', + :'unrestricted_principals' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DatasetRestrictionResponseAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'ownership_mode') + self.ownership_mode = attributes[:'ownership_mode'] + end + + if attributes.key?(:'restriction_key') + self.restriction_key = attributes[:'restriction_key'] + end + + if attributes.key?(:'restriction_mode') + self.restriction_mode = attributes[:'restriction_mode'] + end + + if attributes.key?(:'unrestricted_principals') + if (value = attributes[:'unrestricted_principals']).is_a?(Array) + self.unrestricted_principals = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @restriction_mode.nil? + true + end + + # Custom attribute writer method with validation + # @param restriction_mode [Object] Object to be assigned + # @!visibility private + def restriction_mode=(restriction_mode) + if restriction_mode.nil? + fail ArgumentError, 'invalid value for "restriction_mode", restriction_mode cannot be nil.' + end + @restriction_mode = restriction_mode + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + ownership_mode == o.ownership_mode && + restriction_key == o.restriction_key && + restriction_mode == o.restriction_mode && + unrestricted_principals == o.unrestricted_principals && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [ownership_mode, restriction_key, restriction_mode, unrestricted_principals, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/dataset_restriction_response_data.rb b/lib/datadog_api_client/v2/models/dataset_restriction_response_data.rb new file mode 100644 index 000000000000..abec5a90d015 --- /dev/null +++ b/lib/datadog_api_client/v2/models/dataset_restriction_response_data.rb @@ -0,0 +1,166 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A single dataset restriction configuration for one product type. + class DatasetRestrictionResponseData + include BaseGenericModel + + # The current configuration of a dataset restriction, including restriction mode, + # ownership mode, and exempt principals. + attr_reader :attributes + + # The Datadog product type this restriction applies to (for example, `rum`, `apm`, or `logs`). + attr_reader :id + + # JSON:API resource type for dataset restrictions. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'DatasetRestrictionResponseAttributes', + :'id' => :'String', + :'type' => :'DatasetRestrictionsType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DatasetRestrictionResponseData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/dataset_restriction_restriction_mode.rb b/lib/datadog_api_client/v2/models/dataset_restriction_restriction_mode.rb new file mode 100644 index 000000000000..1fa4cc6c1acb --- /dev/null +++ b/lib/datadog_api_client/v2/models/dataset_restriction_restriction_mode.rb @@ -0,0 +1,29 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Controls the default data visibility for the product type. `standard` makes data visible + # to all users with appropriate product access. `default_hide` hides data by default and + # requires explicit grants for each dataset. + class DatasetRestrictionRestrictionMode + include BaseEnumModel + + STANDARD = "standard".freeze + DEFAULT_HIDE = "default_hide".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/dataset_restriction_update_request.rb b/lib/datadog_api_client/v2/models/dataset_restriction_update_request.rb new file mode 100644 index 000000000000..930bc0457a22 --- /dev/null +++ b/lib/datadog_api_client/v2/models/dataset_restriction_update_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Payload for updating a dataset restriction configuration. + class DatasetRestrictionUpdateRequest + include BaseGenericModel + + # Data object for a dataset restriction update. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'DatasetRestrictionUpdateRequestData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DatasetRestrictionUpdateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/dataset_restriction_update_request_attributes.rb b/lib/datadog_api_client/v2/models/dataset_restriction_update_request_attributes.rb new file mode 100644 index 000000000000..0a677bb9fcc1 --- /dev/null +++ b/lib/datadog_api_client/v2/models/dataset_restriction_update_request_attributes.rb @@ -0,0 +1,151 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Editable attributes of a dataset restriction. Only `restriction_mode` is required; + # omitted optional fields retain their current values. + class DatasetRestrictionUpdateRequestAttributes + include BaseGenericModel + + # Controls how dataset ownership is determined. `disabled` turns off ownership-based access + # entirely. `team_tag_based` assigns dataset ownership based on the team tags applied to the + # data, allowing team members to see their own team's datasets. + attr_accessor :ownership_mode + + # Controls the default data visibility for the product type. `standard` makes data visible + # to all users with appropriate product access. `default_hide` hides data by default and + # requires explicit grants for each dataset. + attr_reader :restriction_mode + + # Principal identifiers (users or roles) that are exempt from the restriction and + # can always access all datasets for this product type. + attr_accessor :unrestricted_principals + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'ownership_mode' => :'ownership_mode', + :'restriction_mode' => :'restriction_mode', + :'unrestricted_principals' => :'unrestricted_principals' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'ownership_mode' => :'DatasetRestrictionOwnershipMode', + :'restriction_mode' => :'DatasetRestrictionRestrictionMode', + :'unrestricted_principals' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DatasetRestrictionUpdateRequestAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'ownership_mode') + self.ownership_mode = attributes[:'ownership_mode'] + end + + if attributes.key?(:'restriction_mode') + self.restriction_mode = attributes[:'restriction_mode'] + end + + if attributes.key?(:'unrestricted_principals') + if (value = attributes[:'unrestricted_principals']).is_a?(Array) + self.unrestricted_principals = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @restriction_mode.nil? + true + end + + # Custom attribute writer method with validation + # @param restriction_mode [Object] Object to be assigned + # @!visibility private + def restriction_mode=(restriction_mode) + if restriction_mode.nil? + fail ArgumentError, 'invalid value for "restriction_mode", restriction_mode cannot be nil.' + end + @restriction_mode = restriction_mode + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + ownership_mode == o.ownership_mode && + restriction_mode == o.restriction_mode && + unrestricted_principals == o.unrestricted_principals && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [ownership_mode, restriction_mode, unrestricted_principals, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/dataset_restriction_update_request_data.rb b/lib/datadog_api_client/v2/models/dataset_restriction_update_request_data.rb new file mode 100644 index 000000000000..7e5090b10791 --- /dev/null +++ b/lib/datadog_api_client/v2/models/dataset_restriction_update_request_data.rb @@ -0,0 +1,145 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data object for a dataset restriction update. + class DatasetRestrictionUpdateRequestData + include BaseGenericModel + + # Editable attributes of a dataset restriction. Only `restriction_mode` is required; + # omitted optional fields retain their current values. + attr_reader :attributes + + # JSON:API resource type for dataset restrictions. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'DatasetRestrictionUpdateRequestAttributes', + :'type' => :'DatasetRestrictionsType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DatasetRestrictionUpdateRequestData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/dataset_restrictions_list_response.rb b/lib/datadog_api_client/v2/models/dataset_restrictions_list_response.rb new file mode 100644 index 000000000000..ac928814dc6c --- /dev/null +++ b/lib/datadog_api_client/v2/models/dataset_restrictions_list_response.rb @@ -0,0 +1,126 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing the list of all dataset restriction configurations for the + # organization, one per product type. + class DatasetRestrictionsListResponse + include BaseGenericModel + + # An array of dataset restriction objects, one for each configured product type. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DatasetRestrictionsListResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/dataset_restrictions_type.rb b/lib/datadog_api_client/v2/models/dataset_restrictions_type.rb new file mode 100644 index 000000000000..f71ea3161eb7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/dataset_restrictions_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # JSON:API resource type for dataset restrictions. + class DatasetRestrictionsType + include BaseEnumModel + + DATASET_RESTRICTIONS = "dataset_restrictions".freeze + end +end