From c391de1d4b72af9181ae8eee3f2a46121d841253 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Mon, 14 Jul 2025 13:51:39 +0000 Subject: [PATCH] Regenerate client from commit a5e8c5b3 of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 256 ++++++++++++++++ examples/v2/datasets/CreateDataset.rb | 27 ++ examples/v2/datasets/DeleteDataset.rb | 5 + examples/v2/datasets/GetAllDatasets.rb | 5 + examples/v2/datasets/GetDataset.rb | 5 + features/scenarios_model_mapping.rb | 9 + features/v2/datasets.feature | 81 +++++ features/v2/undo.json | 31 ++ lib/datadog_api_client/inflector.rb | 7 + lib/datadog_api_client/v2/api/datasets_api.rb | 283 ++++++++++++++++++ lib/datadog_api_client/v2/models/dataset.rb | 154 ++++++++++ .../v2/models/dataset_attributes.rb | 197 ++++++++++++ .../v2/models/dataset_create_request.rb | 123 ++++++++ .../v2/models/dataset_response_multi.rb | 125 ++++++++ .../v2/models/dataset_response_single.rb | 123 ++++++++ .../v2/models/filters_per_product.rb | 150 ++++++++++ 17 files changed, 1585 insertions(+), 4 deletions(-) create mode 100644 examples/v2/datasets/CreateDataset.rb create mode 100644 examples/v2/datasets/DeleteDataset.rb create mode 100644 examples/v2/datasets/GetAllDatasets.rb create mode 100644 examples/v2/datasets/GetDataset.rb create mode 100644 features/v2/datasets.feature create mode 100644 lib/datadog_api_client/v2/api/datasets_api.rb create mode 100644 lib/datadog_api_client/v2/models/dataset.rb create mode 100644 lib/datadog_api_client/v2/models/dataset_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/dataset_create_request.rb create mode 100644 lib/datadog_api_client/v2/models/dataset_response_multi.rb create mode 100644 lib/datadog_api_client/v2/models/dataset_response_single.rb create mode 100644 lib/datadog_api_client/v2/models/filters_per_product.rb diff --git a/.apigentools-info b/.apigentools-info index 3958a026ac89..5f03678b7dad 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-07-11 20:58:11.027416", - "spec_repo_commit": "b5c3e077" + "regenerated": "2025-07-14 13:51:03.655484", + "spec_repo_commit": "a5e8c5b3" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-07-11 20:58:11.043237", - "spec_repo_commit": "b5c3e077" + "regenerated": "2025-07-14 13:51:03.672623", + "spec_repo_commit": "a5e8c5b3" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 347ca00003ec..cab25efed275 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -288,6 +288,14 @@ components: required: true schema: type: string + DatasetID: + description: The ID of a defined dataset. + example: 0879ce27-29a1-481f-a12e-bc2a48ec9ae1 + in: path + name: dataset_id + required: true + schema: + type: string EntityID: description: UUID or Entity Ref. in: path @@ -12178,6 +12186,85 @@ components: required: - databaseMonitoringTrigger type: object + Dataset: + description: Dataset object. + properties: + attributes: + $ref: '#/components/schemas/DatasetAttributes' + id: + description: Unique identifier for the dataset. + example: 123e4567-e89b-12d3-a456-426614174000 + type: string + type: + description: Resource type, always "dataset". + example: dataset + type: string + required: + - type + - attributes + type: object + DatasetAttributes: + description: Dataset metadata and configuration(s). + properties: + created_at: + description: Timestamp when the dataset was created. + format: date-time + nullable: true + type: string + created_by: + description: Unique ID of the user who created the dataset. + format: uuid + type: string + name: + description: Name of the dataset. + example: Security Audit Dataset + type: string + principals: + description: List of access principals, formatted as `principal_type:id`. + Principal can be 'team' or 'role'. + example: + - role:86245fce-0a4e-11f0-92bd-da7ad0900002 + items: + example: role:86245fce-0a4e-11f0-92bd-da7ad0900002 + type: string + type: array + product_filters: + description: List of product-specific filters. + items: + $ref: '#/components/schemas/FiltersPerProduct' + type: array + required: + - name + - product_filters + - principals + type: object + DatasetCreateRequest: + description: Create request for a dataset. + properties: + data: + $ref: '#/components/schemas/Dataset' + required: + - data + type: object + DatasetResponseMulti: + description: Response containing a list of datasets. + properties: + data: + description: The list of datasets returned in response. + items: + $ref: '#/components/schemas/Dataset' + type: array + required: + - data + type: object + DatasetResponseSingle: + description: Response containing a single dataset object. + properties: + data: + $ref: '#/components/schemas/Dataset' + required: + - data + type: object Date: description: Date as Unix timestamp in milliseconds. example: 1722439510282 @@ -15636,6 +15723,38 @@ components: $ref: '#/components/schemas/FastlyServiceData' type: array type: object + FiltersPerProduct: + description: Product-specific filters for the dataset. + properties: + filters: + description: 'Defines the list of tag-based filters used to restrict access + to telemetry data for a specific product. + + These filters act as access control rules. Each filter must follow the + tag query syntax used by + + Datadog (such as `@tag.key:value`), and only one tag or attribute may + be used to define the access strategy + + per telemetry type.' + example: + - '@application.id:ABCD' + items: + example: '@application.id:ABCD' + type: string + type: array + product: + description: 'Name of the product the dataset is for. Possible values are + ''apm'', ''rum'', ''synthetics'', + + ''metrics'', ''logs'', ''sd_repoinfo'', ''error_tracking'', ''cloud_cost'', + and ''ml_obs''.' + example: logs + type: string + required: + - product + - filters + type: object Finding: description: A single finding without the message and resource configuration. properties: @@ -47544,6 +47663,135 @@ paths: tags: - Dashboard Lists x-codegen-request-body-name: body + /api/v2/datasets: + get: + description: Get all datasets that have been configured for an organization. + operationId: GetAllDatasets + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DatasetResponseMulti' + description: OK + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Get all datasets + tags: + - Datasets + x-permission: + operator: OPEN + permissions: [] + post: + description: Create a dataset with the configurations in the request. + operationId: CreateDataset + requestBody: + content: + application/json: + example: + data: + attributes: + name: Test RUM Dataset + principals: + - role:23bacb30-1c59-11f0-a596-da7ad0900002 + product_filters: + - filters: + - '@application.id:application_123' + product: rum + type: dataset + schema: + $ref: '#/components/schemas/DatasetCreateRequest' + description: Dataset payload + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DatasetResponseSingle' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '409': + $ref: '#/components/responses/ConflictResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Create a dataset + tags: + - Datasets + x-codegen-request-body-name: body + x-permission: + operator: OPEN + permissions: [] + /api/v2/datasets/{dataset_id}: + delete: + description: Deletes the dataset associated with the ID. + operationId: DeleteDataset + parameters: + - $ref: '#/components/parameters/DatasetID' + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Delete a dataset + tags: + - Datasets + x-permission: + operator: OPEN + permissions: [] + get: + description: Retrieves the dataset associated with the ID. + operationId: GetDataset + parameters: + - $ref: '#/components/parameters/DatasetID' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DatasetResponseSingle' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Get a single dataset by ID + tags: + - Datasets + x-permission: + operator: OPEN + permissions: [] /api/v2/deletion/data/{product}: post: description: Creates a data deletion request by providing a query and a timeframe @@ -65102,6 +65350,14 @@ tags: 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: '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 + + view certain types of telemetry (for example, logs, traces, metrics, and RUM data).' + name: Datasets - description: 'Configure your Datadog Email Domain Allowlist directly through the Datadog API. diff --git a/examples/v2/datasets/CreateDataset.rb b/examples/v2/datasets/CreateDataset.rb new file mode 100644 index 000000000000..5285a960aca1 --- /dev/null +++ b/examples/v2/datasets/CreateDataset.rb @@ -0,0 +1,27 @@ +# Create a dataset returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::DatasetsAPI.new + +body = DatadogAPIClient::V2::DatasetCreateRequest.new({ + data: DatadogAPIClient::V2::Dataset.new({ + attributes: DatadogAPIClient::V2::DatasetAttributes.new({ + created_at: nil, + name: "Security Audit Dataset", + principals: [ + "role:86245fce-0a4e-11f0-92bd-da7ad0900002", + ], + product_filters: [ + DatadogAPIClient::V2::FiltersPerProduct.new({ + filters: [ + "@application.id:ABCD", + ], + product: "logs", + }), + ], + }), + id: "123e4567-e89b-12d3-a456-426614174000", + type: "dataset", + }), +}) +p api_instance.create_dataset(body) diff --git a/examples/v2/datasets/DeleteDataset.rb b/examples/v2/datasets/DeleteDataset.rb new file mode 100644 index 000000000000..8bf69f07354f --- /dev/null +++ b/examples/v2/datasets/DeleteDataset.rb @@ -0,0 +1,5 @@ +# Delete a dataset returns "No Content" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::DatasetsAPI.new +api_instance.delete_dataset("dataset_id") diff --git a/examples/v2/datasets/GetAllDatasets.rb b/examples/v2/datasets/GetAllDatasets.rb new file mode 100644 index 000000000000..0e8f1e762e76 --- /dev/null +++ b/examples/v2/datasets/GetAllDatasets.rb @@ -0,0 +1,5 @@ +# Get all datasets returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::DatasetsAPI.new +p api_instance.get_all_datasets() diff --git a/examples/v2/datasets/GetDataset.rb b/examples/v2/datasets/GetDataset.rb new file mode 100644 index 000000000000..fb7bfe55cb82 --- /dev/null +++ b/examples/v2/datasets/GetDataset.rb @@ -0,0 +1,5 @@ +# Get a single dataset by ID returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::DatasetsAPI.new +p api_instance.get_dataset("dataset_id") diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index ea53e25aad69..c4c57353da7e 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -1588,6 +1588,15 @@ "dashboard_list_id" => "Integer", "body" => "DashboardListUpdateItemsRequest", }, + "v2.CreateDataset" => { + "body" => "DatasetCreateRequest", + }, + "v2.DeleteDataset" => { + "dataset_id" => "String", + }, + "v2.GetDataset" => { + "dataset_id" => "String", + }, "v2.CreateDataDeletionRequest" => { "product" => "String", "body" => "CreateDataDeletionRequestBody", diff --git a/features/v2/datasets.feature b/features/v2/datasets.feature new file mode 100644 index 000000000000..7ce2e160a374 --- /dev/null +++ b/features/v2/datasets.feature @@ -0,0 +1,81 @@ +@endpoint(datasets) @endpoint(datasets-v2) +Feature: Datasets + 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 + view certain types of telemetry (for example, logs, traces, metrics, and + RUM data). + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "Datasets" API + + @generated @skip @team:DataDog/aaa-granular-access + Scenario: Create a dataset returns "Bad Request" response + Given new "CreateDataset" request + And body with value {"data": {"attributes": {"created_at": null, "name": "Security Audit Dataset", "principals": ["role:86245fce-0a4e-11f0-92bd-da7ad0900002"], "product_filters": [{"filters": ["@application.id:ABCD"], "product": "logs"}]}, "id": "123e4567-e89b-12d3-a456-426614174000", "type": "dataset"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-granular-access + Scenario: Create a dataset returns "Conflict" response + Given new "CreateDataset" request + And body with value {"data": {"attributes": {"created_at": null, "name": "Security Audit Dataset", "principals": ["role:86245fce-0a4e-11f0-92bd-da7ad0900002"], "product_filters": [{"filters": ["@application.id:ABCD"], "product": "logs"}]}, "id": "123e4567-e89b-12d3-a456-426614174000", "type": "dataset"}} + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/aaa-granular-access + Scenario: Create a dataset returns "OK" response + Given new "CreateDataset" request + And body with value {"data": {"attributes": {"created_at": null, "name": "Security Audit Dataset", "principals": ["role:86245fce-0a4e-11f0-92bd-da7ad0900002"], "product_filters": [{"filters": ["@application.id:ABCD"], "product": "logs"}]}, "id": "123e4567-e89b-12d3-a456-426614174000", "type": "dataset"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-granular-access + Scenario: Delete a dataset returns "Bad Request" response + Given new "DeleteDataset" request + And request contains "dataset_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-granular-access + Scenario: Delete a dataset returns "No Content" response + Given new "DeleteDataset" request + And request contains "dataset_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/aaa-granular-access + Scenario: Delete a dataset returns "Not Found" response + Given new "DeleteDataset" request + And request contains "dataset_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/aaa-granular-access + Scenario: Get a single dataset by ID returns "Bad Request" response + Given new "GetDataset" request + And request contains "dataset_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-granular-access + Scenario: Get a single dataset by ID returns "Not Found" response + Given new "GetDataset" request + And request contains "dataset_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/aaa-granular-access + Scenario: Get a single dataset by ID returns "OK" response + Given new "GetDataset" request + And request contains "dataset_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-granular-access + Scenario: Get all datasets returns "OK" response + Given new "GetAllDatasets" request + 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 5b4f718bb953..df87d8d6c901 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -857,6 +857,37 @@ "type": "safe" } }, + "GetAllDatasets": { + "tag": "Datasets", + "undo": { + "type": "safe" + } + }, + "CreateDataset": { + "tag": "Datasets", + "undo": { + "operationId": "DeleteDataset", + "parameters": [ + { + "name": "id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteDataset": { + "tag": "Datasets", + "undo": { + "type": "idempotent" + } + }, + "GetDataset": { + "tag": "Datasets", + "undo": { + "type": "safe" + } + }, "CreateDataDeletionRequest": { "tag": "Data Deletion", "undo": { diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 6e464807afd7..a94cb5e2b044 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1594,6 +1594,11 @@ def overrides "v2.data_relationships_teams_data_items" => "DataRelationshipsTeamsDataItems", "v2.data_relationships_teams_data_items_type" => "DataRelationshipsTeamsDataItemsType", "v2.data_scalar_column" => "DataScalarColumn", + "v2.dataset" => "Dataset", + "v2.dataset_attributes" => "DatasetAttributes", + "v2.dataset_create_request" => "DatasetCreateRequest", + "v2.dataset_response_multi" => "DatasetResponseMulti", + "v2.dataset_response_single" => "DatasetResponseSingle", "v2.data_transform" => "DataTransform", "v2.data_transform_properties" => "DataTransformProperties", "v2.data_transform_type" => "DataTransformType", @@ -1846,6 +1851,7 @@ def overrides "v2.fastly_service_response" => "FastlyServiceResponse", "v2.fastly_services_response" => "FastlyServicesResponse", "v2.fastly_service_type" => "FastlyServiceType", + "v2.filters_per_product" => "FiltersPerProduct", "v2.finding" => "Finding", "v2.finding_attributes" => "FindingAttributes", "v2.finding_evaluation" => "FindingEvaluation", @@ -3604,6 +3610,7 @@ def overrides "v2.csm_threats_api" => "CSMThreatsAPI", "v2.dashboard_lists_api" => "DashboardListsAPI", "v2.data_deletion_api" => "DataDeletionAPI", + "v2.datasets_api" => "DatasetsAPI", "v2.domain_allowlist_api" => "DomainAllowlistAPI", "v2.dora_metrics_api" => "DORAMetricsAPI", "v2.downtimes_api" => "DowntimesAPI", diff --git a/lib/datadog_api_client/v2/api/datasets_api.rb b/lib/datadog_api_client/v2/api/datasets_api.rb new file mode 100644 index 000000000000..b7e57a9d3611 --- /dev/null +++ b/lib/datadog_api_client/v2/api/datasets_api.rb @@ -0,0 +1,283 @@ +=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 DatasetsAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # Create a dataset. + # + # @see #create_dataset_with_http_info + def create_dataset(body, opts = {}) + data, _status_code, _headers = create_dataset_with_http_info(body, opts) + data + end + + # Create a dataset. + # + # Create a dataset with the configurations in the request. + # + # @param body [DatasetCreateRequest] Dataset payload + # @param opts [Hash] the optional parameters + # @return [Array<(DatasetResponseSingle, Integer, Hash)>] DatasetResponseSingle data, response status code and response headers + def create_dataset_with_http_info(body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DatasetsAPI.create_dataset ...' + 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 DatasetsAPI.create_dataset" + end + # resource path + local_var_path = '/api/v2/datasets' + + # 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] || 'DatasetResponseSingle' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :create_dataset, + :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: DatasetsAPI#create_dataset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete a dataset. + # + # @see #delete_dataset_with_http_info + def delete_dataset(dataset_id, opts = {}) + delete_dataset_with_http_info(dataset_id, opts) + nil + end + + # Delete a dataset. + # + # Deletes the dataset associated with the ID. + # + # @param dataset_id [String] The ID of a defined dataset. + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_dataset_with_http_info(dataset_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DatasetsAPI.delete_dataset ...' + end + # verify the required parameter 'dataset_id' is set + if @api_client.config.client_side_validation && dataset_id.nil? + fail ArgumentError, "Missing the required parameter 'dataset_id' when calling DatasetsAPI.delete_dataset" + end + # resource path + local_var_path = '/api/v2/datasets/{dataset_id}'.sub('{dataset_id}', CGI.escape(dataset_id.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(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :delete_dataset, + :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::Delete, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DatasetsAPI#delete_dataset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get all datasets. + # + # @see #get_all_datasets_with_http_info + def get_all_datasets(opts = {}) + data, _status_code, _headers = get_all_datasets_with_http_info(opts) + data + end + + # Get all datasets. + # + # Get all datasets that have been configured for an organization. + # + # @param opts [Hash] the optional parameters + # @return [Array<(DatasetResponseMulti, Integer, Hash)>] DatasetResponseMulti data, response status code and response headers + def get_all_datasets_with_http_info(opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DatasetsAPI.get_all_datasets ...' + end + # resource path + local_var_path = '/api/v2/datasets' + + # 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] || 'DatasetResponseMulti' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_all_datasets, + :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: DatasetsAPI#get_all_datasets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get a single dataset by ID. + # + # @see #get_dataset_with_http_info + def get_dataset(dataset_id, opts = {}) + data, _status_code, _headers = get_dataset_with_http_info(dataset_id, opts) + data + end + + # Get a single dataset by ID. + # + # Retrieves the dataset associated with the ID. + # + # @param dataset_id [String] The ID of a defined dataset. + # @param opts [Hash] the optional parameters + # @return [Array<(DatasetResponseSingle, Integer, Hash)>] DatasetResponseSingle data, response status code and response headers + def get_dataset_with_http_info(dataset_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DatasetsAPI.get_dataset ...' + end + # verify the required parameter 'dataset_id' is set + if @api_client.config.client_side_validation && dataset_id.nil? + fail ArgumentError, "Missing the required parameter 'dataset_id' when calling DatasetsAPI.get_dataset" + end + # resource path + local_var_path = '/api/v2/datasets/{dataset_id}'.sub('{dataset_id}', CGI.escape(dataset_id.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']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'DatasetResponseSingle' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_dataset, + :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: DatasetsAPI#get_dataset\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.rb b/lib/datadog_api_client/v2/models/dataset.rb new file mode 100644 index 000000000000..f079937a77ce --- /dev/null +++ b/lib/datadog_api_client/v2/models/dataset.rb @@ -0,0 +1,154 @@ +=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 + # Dataset object. + class Dataset + include BaseGenericModel + + # Dataset metadata and configuration(s). + attr_reader :attributes + + # Unique identifier for the dataset. + attr_accessor :id + + # Resource type, always "dataset". + 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' => :'DatasetAttributes', + :'id' => :'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::Dataset` 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 @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 && + 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_attributes.rb b/lib/datadog_api_client/v2/models/dataset_attributes.rb new file mode 100644 index 000000000000..5478296ce020 --- /dev/null +++ b/lib/datadog_api_client/v2/models/dataset_attributes.rb @@ -0,0 +1,197 @@ +=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 + # Dataset metadata and configuration(s). + class DatasetAttributes + include BaseGenericModel + + # Timestamp when the dataset was created. + attr_accessor :created_at + + # Unique ID of the user who created the dataset. + attr_accessor :created_by + + # Name of the dataset. + attr_reader :name + + # List of access principals, formatted as `principal_type:id`. Principal can be 'team' or 'role'. + attr_reader :principals + + # List of product-specific filters. + attr_reader :product_filters + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'created_at' => :'created_at', + :'created_by' => :'created_by', + :'name' => :'name', + :'principals' => :'principals', + :'product_filters' => :'product_filters' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'created_at' => :'Time', + :'created_by' => :'UUID', + :'name' => :'String', + :'principals' => :'Array', + :'product_filters' => :'Array' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'created_at', + ]) + 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::DatasetAttributes` 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?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'created_by') + self.created_by = attributes[:'created_by'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'principals') + if (value = attributes[:'principals']).is_a?(Array) + self.principals = value + end + end + + if attributes.key?(:'product_filters') + if (value = attributes[:'product_filters']).is_a?(Array) + self.product_filters = 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 @name.nil? + return false if @principals.nil? + return false if @product_filters.nil? + true + 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 principals [Object] Object to be assigned + # @!visibility private + def principals=(principals) + if principals.nil? + fail ArgumentError, 'invalid value for "principals", principals cannot be nil.' + end + @principals = principals + end + + # Custom attribute writer method with validation + # @param product_filters [Object] Object to be assigned + # @!visibility private + def product_filters=(product_filters) + if product_filters.nil? + fail ArgumentError, 'invalid value for "product_filters", product_filters cannot be nil.' + end + @product_filters = product_filters + 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 && + created_at == o.created_at && + created_by == o.created_by && + name == o.name && + principals == o.principals && + product_filters == o.product_filters && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [created_at, created_by, name, principals, product_filters, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/dataset_create_request.rb b/lib/datadog_api_client/v2/models/dataset_create_request.rb new file mode 100644 index 000000000000..b73c81bf6b42 --- /dev/null +++ b/lib/datadog_api_client/v2/models/dataset_create_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 + # Create request for a dataset. + class DatasetCreateRequest + include BaseGenericModel + + # Dataset object. + 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' => :'Dataset' + } + 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::DatasetCreateRequest` 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_response_multi.rb b/lib/datadog_api_client/v2/models/dataset_response_multi.rb new file mode 100644 index 000000000000..0ceb543339fb --- /dev/null +++ b/lib/datadog_api_client/v2/models/dataset_response_multi.rb @@ -0,0 +1,125 @@ +=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 a list of datasets. + class DatasetResponseMulti + include BaseGenericModel + + # The list of datasets returned in response. + 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::DatasetResponseMulti` 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_response_single.rb b/lib/datadog_api_client/v2/models/dataset_response_single.rb new file mode 100644 index 000000000000..a358d950714d --- /dev/null +++ b/lib/datadog_api_client/v2/models/dataset_response_single.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 a single dataset object. + class DatasetResponseSingle + include BaseGenericModel + + # Dataset object. + 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' => :'Dataset' + } + 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::DatasetResponseSingle` 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/filters_per_product.rb b/lib/datadog_api_client/v2/models/filters_per_product.rb new file mode 100644 index 000000000000..5fa5015c7cab --- /dev/null +++ b/lib/datadog_api_client/v2/models/filters_per_product.rb @@ -0,0 +1,150 @@ +=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 + # Product-specific filters for the dataset. + class FiltersPerProduct + include BaseGenericModel + + # Defines the list of tag-based filters used to restrict access to telemetry data for a specific product. + # These filters act as access control rules. Each filter must follow the tag query syntax used by + # Datadog (such as `@tag.key:value`), and only one tag or attribute may be used to define the access strategy + # per telemetry type. + attr_reader :filters + + # Name of the product the dataset is for. Possible values are 'apm', 'rum', 'synthetics', + # 'metrics', 'logs', 'sd_repoinfo', 'error_tracking', 'cloud_cost', and 'ml_obs'. + attr_reader :product + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'filters' => :'filters', + :'product' => :'product' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'filters' => :'Array', + :'product' => :'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::FiltersPerProduct` 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?(:'filters') + if (value = attributes[:'filters']).is_a?(Array) + self.filters = value + end + end + + if attributes.key?(:'product') + self.product = attributes[:'product'] + 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 @filters.nil? + return false if @product.nil? + true + end + + # Custom attribute writer method with validation + # @param filters [Object] Object to be assigned + # @!visibility private + def filters=(filters) + if filters.nil? + fail ArgumentError, 'invalid value for "filters", filters cannot be nil.' + end + @filters = filters + end + + # Custom attribute writer method with validation + # @param product [Object] Object to be assigned + # @!visibility private + def product=(product) + if product.nil? + fail ArgumentError, 'invalid value for "product", product cannot be nil.' + end + @product = product + 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 && + filters == o.filters && + product == o.product && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [filters, product, additional_properties].hash + end + end +end