diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 382c9233aa58..93b41388a764 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -12652,6 +12652,219 @@ components: type: string x-enum-varnames: - CLOUD_CONFIGURATION + CloudInventoryCloudProviderId: + description: |- + Cloud provider for this sync configuration (`aws`, `gcp`, or `azure`). For requests, must match the provider block supplied under `attributes`. + enum: + - aws + - gcp + - azure + example: aws + type: string + x-enum-varnames: + - AWS + - GCP + - AZURE + CloudInventoryCloudProviderRequestType: + description: JSON:API type for upsert sync configuration requests. + enum: + - cloud_provider + example: cloud_provider + type: string + x-enum-varnames: + - CLOUD_PROVIDER + CloudInventorySyncConfigAWSRequestAttributes: + description: AWS settings for the customer bucket that stores inventory reports. + properties: + aws_account_id: + description: AWS account ID that owns the inventory bucket. + example: "123456789012" + type: string + destination_bucket_name: + description: Name of the S3 bucket containing inventory files. + example: my-inventory-bucket + type: string + destination_bucket_region: + description: AWS Region of the inventory bucket. + example: us-east-1 + type: string + destination_prefix: + description: Optional object key prefix for inventory files. Use `/` or omit for the entire bucket. + example: logs/ + type: string + required: + - aws_account_id + - destination_bucket_name + - destination_bucket_region + type: object + CloudInventorySyncConfigAttributes: + description: Attributes for a cloud inventory sync configuration. Values beyond `id` may be omitted immediately after upsert. + properties: + aws_account_id: + description: AWS account ID for the inventory bucket. + example: "123456789012" + type: string + aws_bucket_name: + description: AWS S3 bucket name for inventory files. + example: my-inventory-bucket + type: string + aws_region: + description: AWS Region for the inventory bucket. + example: us-east-1 + type: string + azure_client_id: + description: Azure AD application (client) ID. + example: 11111111-1111-1111-1111-111111111111 + type: string + azure_container_name: + description: Azure blob container name. + example: inventory-container + type: string + azure_storage_account_name: + description: Azure storage account name. + example: mystorageaccount + type: string + azure_tenant_id: + description: Azure AD tenant ID. + example: 22222222-2222-2222-2222-222222222222 + type: string + cloud_provider: + $ref: "#/components/schemas/CloudInventoryCloudProviderId" + error: + description: Human-readable error detail when sync is unhealthy. + example: "" + readOnly: true + type: string + error_code: + description: Machine-readable error code when sync is unhealthy. + example: "" + readOnly: true + type: string + gcp_bucket_name: + description: GCS bucket name for inventory files Datadog reads. + example: my-inventory-reports + type: string + gcp_project_id: + description: GCP project ID. + example: my-gcp-project + type: string + gcp_service_account_email: + description: Service account email for bucket access. + example: reader@my-gcp-project.iam.gserviceaccount.com + type: string + prefix: + description: Object key prefix or `/` when the entire bucket is synced. + example: logs/ + readOnly: true + type: string + required: + - aws_bucket_name + - aws_account_id + - aws_region + - azure_storage_account_name + - azure_container_name + - azure_client_id + - azure_tenant_id + - gcp_bucket_name + - gcp_project_id + - gcp_service_account_email + - cloud_provider + - prefix + - error + - error_code + type: object + CloudInventorySyncConfigAzureRequestAttributes: + description: Azure settings for the storage account and container with inventory data. + properties: + client_id: + description: Azure AD application (client) ID used for access. + example: 11111111-1111-1111-1111-111111111111 + type: string + container: + description: Blob container name. + example: inventory-container + type: string + resource_group: + description: Resource group containing the storage account. + example: my-resource-group + type: string + storage_account: + description: Storage account name. + example: mystorageaccount + type: string + subscription_id: + description: Azure subscription ID. + example: 33333333-3333-3333-3333-333333333333 + type: string + tenant_id: + description: Azure AD tenant ID. + example: 22222222-2222-2222-2222-222222222222 + type: string + required: + - client_id + - tenant_id + - subscription_id + - resource_group + - storage_account + - container + type: object + CloudInventorySyncConfigGCPRequestAttributes: + description: GCP settings for buckets involved in inventory reporting. + properties: + destination_bucket_name: + description: GCS bucket name where Datadog reads inventory reports. + example: my-inventory-reports + type: string + project_id: + description: GCP project ID for the inventory destination bucket. + example: my-gcp-project + type: string + service_account_email: + description: Service account email used to read the destination bucket. + example: reader@my-gcp-project.iam.gserviceaccount.com + type: string + source_bucket_name: + description: GCS bucket name that inventory reports are generated for. + example: my-monitored-bucket + type: string + required: + - project_id + - destination_bucket_name + - source_bucket_name + - service_account_email + type: object + CloudInventorySyncConfigResourceType: + description: JSON:API type for sync configuration resources. + enum: + - sync_configs + example: sync_configs + type: string + x-enum-varnames: + - SYNC_CONFIGS + CloudInventorySyncConfigResponse: + description: Response containing the upserted sync configuration. Additional read-only fields appear on list and get. + properties: + data: + $ref: "#/components/schemas/CloudInventorySyncConfigResponseData" + required: + - data + type: object + CloudInventorySyncConfigResponseData: + description: JSON:API data object for a sync configuration. + properties: + attributes: + $ref: "#/components/schemas/CloudInventorySyncConfigAttributes" + id: + description: Unique identifier for the recurring sync configuration. + example: abc123 + type: string + type: + $ref: "#/components/schemas/CloudInventorySyncConfigResourceType" + required: + - id + - type + - attributes + type: object CloudWorkloadSecurityAgentPoliciesListResponse: description: "Response object that includes a list of Agent policies" properties: @@ -80681,6 +80894,39 @@ components: meta: $ref: "#/components/schemas/KindResponseMeta" type: object + UpsertCloudInventorySyncConfigRequest: + description: Request body for creating or updating a cloud inventory sync configuration. + properties: + data: + $ref: "#/components/schemas/UpsertCloudInventorySyncConfigRequestData" + required: + - data + type: object + UpsertCloudInventorySyncConfigRequestAttributes: + description: |- + Provider-specific configuration. Include the object that matches `data.id` (`aws`, `gcp`, or `azure`). + properties: + aws: + $ref: "#/components/schemas/CloudInventorySyncConfigAWSRequestAttributes" + azure: + $ref: "#/components/schemas/CloudInventorySyncConfigAzureRequestAttributes" + gcp: + $ref: "#/components/schemas/CloudInventorySyncConfigGCPRequestAttributes" + type: object + UpsertCloudInventorySyncConfigRequestData: + description: JSON:API data envelope for an upsert sync configuration request. + properties: + attributes: + $ref: "#/components/schemas/UpsertCloudInventorySyncConfigRequestAttributes" + id: + $ref: "#/components/schemas/CloudInventoryCloudProviderId" + type: + $ref: "#/components/schemas/CloudInventoryCloudProviderRequestType" + required: + - type + - id + - attributes + type: object Urgency: description: Specifies the level of urgency for a routing rule (low, high, or dynamic). enum: @@ -82895,6 +83141,7 @@ components: apm_service_catalog_read: View service catalog and service definitions. apm_service_catalog_write: Add, modify, and delete service catalog definitions when those definitions are maintained by Datadog. appsec_vm_read: View infrastructure, application code, and library vulnerability findings. + aws_configurations_manage: Manage AWS integration account configurations and related integration settings. billing_read: View your organization's billing information. bits_investigations_read: View Bits AI investigations. bits_investigations_write: Create and manage Bits AI investigations. @@ -91595,6 +91842,59 @@ paths: operator: OR permissions: - security_monitoring_filters_write + /api/v2/cloudinventoryservice/syncconfigs: + put: + description: |- + Create or update a cloud inventory sync configuration. Specify the cloud provider in `data.id` + and provider-specific settings under `data.attributes`. This endpoint uses an upsert model. + operationId: UpsertSyncConfig + requestBody: + content: + application/json: + examples: + default: + summary: AWS inventory bucket + value: + data: + attributes: + aws: + aws_account_id: "123456789012" + destination_bucket_name: my-inventory-bucket + destination_bucket_region: us-east-1 + destination_prefix: logs/ + id: aws + type: cloud_provider + schema: + $ref: "#/components/schemas/UpsertCloudInventorySyncConfigRequest" + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/CloudInventorySyncConfigResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + $ref: "#/components/responses/ForbiddenResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Create or update a sync configuration + tags: + - Cloud Inventory Sync Configs + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - aws_configurations_manage + 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/code-coverage/branch/summary: post: description: |- @@ -134830,6 +135130,9 @@ tags: - description: |- The Cloud Cost Management API allows you to set up, edit, and delete Cloud Cost Management accounts for AWS, Azure, and Google Cloud. You can query your cost data by using the [Metrics endpoint](https://docs.datadoghq.com/api/latest/metrics/#query-timeseries-data-across-multiple-products) and the `cloud_cost` data source. For more information, see the [Cloud Cost Management documentation](https://docs.datadoghq.com/cloud_cost_management/). name: Cloud Cost Management + - description: |- + Configure cloud inventory file synchronization from your cloud storage to Datadog. + name: Cloud Inventory Sync Configs - description: |- The Cloud Network Monitoring API allows you to fetch aggregated connections and DNS traffic with their attributes. See the [Cloud Network Monitoring page](https://docs.datadoghq.com/network_monitoring/cloud_network_monitoring/) and [DNS Monitoring page](https://docs.datadoghq.com/network_monitoring/dns/) for more information. name: Cloud Network Monitoring diff --git a/examples/v2/cloud-inventory-sync-configs/UpsertSyncConfig.rb b/examples/v2/cloud-inventory-sync-configs/UpsertSyncConfig.rb new file mode 100644 index 000000000000..700ae04df0e9 --- /dev/null +++ b/examples/v2/cloud-inventory-sync-configs/UpsertSyncConfig.rb @@ -0,0 +1,37 @@ +# Create or update a sync configuration returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.upsert_sync_config".to_sym] = true +end +api_instance = DatadogAPIClient::V2::CloudInventorySyncConfigsAPI.new + +body = DatadogAPIClient::V2::UpsertCloudInventorySyncConfigRequest.new({ + data: DatadogAPIClient::V2::UpsertCloudInventorySyncConfigRequestData.new({ + attributes: DatadogAPIClient::V2::UpsertCloudInventorySyncConfigRequestAttributes.new({ + aws: DatadogAPIClient::V2::CloudInventorySyncConfigAWSRequestAttributes.new({ + aws_account_id: "123456789012", + destination_bucket_name: "my-inventory-bucket", + destination_bucket_region: "us-east-1", + destination_prefix: "logs/", + }), + azure: DatadogAPIClient::V2::CloudInventorySyncConfigAzureRequestAttributes.new({ + client_id: "11111111-1111-1111-1111-111111111111", + container: "inventory-container", + resource_group: "my-resource-group", + storage_account: "mystorageaccount", + subscription_id: "33333333-3333-3333-3333-333333333333", + tenant_id: "22222222-2222-2222-2222-222222222222", + }), + gcp: DatadogAPIClient::V2::CloudInventorySyncConfigGCPRequestAttributes.new({ + destination_bucket_name: "my-inventory-reports", + project_id: "my-gcp-project", + service_account_email: "reader@my-gcp-project.iam.gserviceaccount.com", + source_bucket_name: "my-monitored-bucket", + }), + }), + id: DatadogAPIClient::V2::CloudInventoryCloudProviderId::AWS, + type: DatadogAPIClient::V2::CloudInventoryCloudProviderRequestType::CLOUD_PROVIDER, + }), +}) +p api_instance.upsert_sync_config(body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index c4803c055c8c..b65548d5207d 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -2072,6 +2072,9 @@ "v2.ListMultipleRulesets" => { "body" => "GetMultipleRulesetsRequest", }, + "v2.UpsertSyncConfig" => { + "body" => "UpsertCloudInventorySyncConfigRequest", + }, "v2.GetCodeCoverageBranchSummary" => { "body" => "BranchCoverageSummaryRequest", }, diff --git a/features/v2/cloud_inventory_sync_configs.feature b/features/v2/cloud_inventory_sync_configs.feature new file mode 100644 index 000000000000..32a7d292efb2 --- /dev/null +++ b/features/v2/cloud_inventory_sync_configs.feature @@ -0,0 +1,22 @@ +@endpoint(cloud-inventory-sync-configs) @endpoint(cloud-inventory-sync-configs-v2) +Feature: Cloud Inventory Sync Configs + Configure cloud inventory file synchronization from your cloud storage to + Datadog. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "CloudInventorySyncConfigs" API + And operation "UpsertSyncConfig" enabled + And new "UpsertSyncConfig" request + And body with value {"data": {"attributes": {"aws": {"aws_account_id": "123456789012", "destination_bucket_name": "my-inventory-bucket", "destination_bucket_region": "us-east-1", "destination_prefix": "logs/"}, "azure": {"client_id": "11111111-1111-1111-1111-111111111111", "container": "inventory-container", "resource_group": "my-resource-group", "storage_account": "mystorageaccount", "subscription_id": "33333333-3333-3333-3333-333333333333", "tenant_id": "22222222-2222-2222-2222-222222222222"}, "gcp": {"destination_bucket_name": "my-inventory-reports", "project_id": "my-gcp-project", "service_account_email": "reader@my-gcp-project.iam.gserviceaccount.com", "source_bucket_name": "my-monitored-bucket"}}, "id": "aws", "type": "cloud_provider"}} + + @generated @skip @team:DataDog/storage-management + Scenario: Create or update a sync configuration returns "Bad Request" response + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/storage-management + Scenario: Create or update a sync configuration returns "OK" response + 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 f606e4a86587..4d694af5be3b 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -1235,6 +1235,12 @@ "type": "idempotent" } }, + "UpsertSyncConfig": { + "tag": "Cloud Inventory Sync Configs", + "undo": { + "type": "idempotent" + } + }, "GetCodeCoverageBranchSummary": { "tag": "Code Coverage", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index f30c088a932f..eb82106f5652 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -290,6 +290,7 @@ def initialize "v2.mute_security_findings": false, "v2.run_historical_job": false, "v2.search_security_monitoring_histsignals": false, + "v2.upsert_sync_config": false, "v2.get_code_coverage_branch_summary": false, "v2.get_code_coverage_commit_summary": false, "v2.create_dashboard_secure_embed": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 4ae62f21a88a..b22504705423 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1822,6 +1822,15 @@ def overrides "v2.cloudflare_integration" => "CloudflareIntegration", "v2.cloudflare_integration_type" => "CloudflareIntegrationType", "v2.cloudflare_integration_update" => "CloudflareIntegrationUpdate", + "v2.cloud_inventory_cloud_provider_id" => "CloudInventoryCloudProviderId", + "v2.cloud_inventory_cloud_provider_request_type" => "CloudInventoryCloudProviderRequestType", + "v2.cloud_inventory_sync_config_attributes" => "CloudInventorySyncConfigAttributes", + "v2.cloud_inventory_sync_config_aws_request_attributes" => "CloudInventorySyncConfigAWSRequestAttributes", + "v2.cloud_inventory_sync_config_azure_request_attributes" => "CloudInventorySyncConfigAzureRequestAttributes", + "v2.cloud_inventory_sync_config_gcp_request_attributes" => "CloudInventorySyncConfigGCPRequestAttributes", + "v2.cloud_inventory_sync_config_resource_type" => "CloudInventorySyncConfigResourceType", + "v2.cloud_inventory_sync_config_response" => "CloudInventorySyncConfigResponse", + "v2.cloud_inventory_sync_config_response_data" => "CloudInventorySyncConfigResponseData", "v2.cloud_workload_security_agent_policies_list_response" => "CloudWorkloadSecurityAgentPoliciesListResponse", "v2.cloud_workload_security_agent_policy_attributes" => "CloudWorkloadSecurityAgentPolicyAttributes", "v2.cloud_workload_security_agent_policy_create_attributes" => "CloudWorkloadSecurityAgentPolicyCreateAttributes", @@ -6168,6 +6177,9 @@ def overrides "v2.upsert_catalog_entity_response_included_item" => "UpsertCatalogEntityResponseIncludedItem", "v2.upsert_catalog_kind_request" => "UpsertCatalogKindRequest", "v2.upsert_catalog_kind_response" => "UpsertCatalogKindResponse", + "v2.upsert_cloud_inventory_sync_config_request" => "UpsertCloudInventorySyncConfigRequest", + "v2.upsert_cloud_inventory_sync_config_request_attributes" => "UpsertCloudInventorySyncConfigRequestAttributes", + "v2.upsert_cloud_inventory_sync_config_request_data" => "UpsertCloudInventorySyncConfigRequestData", "v2.urgency" => "Urgency", "v2.url_param" => "UrlParam", "v2.url_param_update" => "UrlParamUpdate", @@ -6371,6 +6383,7 @@ def overrides "v2.ci_visibility_tests_api" => "CIVisibilityTestsAPI", "v2.cloud_authentication_api" => "CloudAuthenticationAPI", "v2.cloud_cost_management_api" => "CloudCostManagementAPI", + "v2.cloud_inventory_sync_configs_api" => "CloudInventorySyncConfigsAPI", "v2.cloud_network_monitoring_api" => "CloudNetworkMonitoringAPI", "v2.cloudflare_integration_api" => "CloudflareIntegrationAPI", "v2.code_coverage_api" => "CodeCoverageAPI", diff --git a/lib/datadog_api_client/v2/api/cloud_inventory_sync_configs_api.rb b/lib/datadog_api_client/v2/api/cloud_inventory_sync_configs_api.rb new file mode 100644 index 000000000000..771f3d93a0c5 --- /dev/null +++ b/lib/datadog_api_client/v2/api/cloud_inventory_sync_configs_api.rb @@ -0,0 +1,100 @@ +=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 CloudInventorySyncConfigsAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # Create or update a sync configuration. + # + # @see #upsert_sync_config_with_http_info + def upsert_sync_config(body, opts = {}) + data, _status_code, _headers = upsert_sync_config_with_http_info(body, opts) + data + end + + # Create or update a sync configuration. + # + # Create or update a cloud inventory sync configuration. Specify the cloud provider in `data.id` + # and provider-specific settings under `data.attributes`. This endpoint uses an upsert model. + # + # @param body [UpsertCloudInventorySyncConfigRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(CloudInventorySyncConfigResponse, Integer, Hash)>] CloudInventorySyncConfigResponse data, response status code and response headers + def upsert_sync_config_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.upsert_sync_config".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.upsert_sync_config") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.upsert_sync_config")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CloudInventorySyncConfigsAPI.upsert_sync_config ...' + 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 CloudInventorySyncConfigsAPI.upsert_sync_config" + end + # resource path + local_var_path = '/api/v2/cloudinventoryservice/syncconfigs' + + # 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] || 'CloudInventorySyncConfigResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :upsert_sync_config, + :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::Put, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CloudInventorySyncConfigsAPI#upsert_sync_config\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/cloud_inventory_cloud_provider_id.rb b/lib/datadog_api_client/v2/models/cloud_inventory_cloud_provider_id.rb new file mode 100644 index 000000000000..b8649267c2c8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/cloud_inventory_cloud_provider_id.rb @@ -0,0 +1,28 @@ +=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 + # Cloud provider for this sync configuration (`aws`, `gcp`, or `azure`). For requests, must match the provider block supplied under `attributes`. + class CloudInventoryCloudProviderId + include BaseEnumModel + + AWS = "aws".freeze + GCP = "gcp".freeze + AZURE = "azure".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/cloud_inventory_cloud_provider_request_type.rb b/lib/datadog_api_client/v2/models/cloud_inventory_cloud_provider_request_type.rb new file mode 100644 index 000000000000..6bef2aea0b1a --- /dev/null +++ b/lib/datadog_api_client/v2/models/cloud_inventory_cloud_provider_request_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 type for upsert sync configuration requests. + class CloudInventoryCloudProviderRequestType + include BaseEnumModel + + CLOUD_PROVIDER = "cloud_provider".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/cloud_inventory_sync_config_attributes.rb b/lib/datadog_api_client/v2/models/cloud_inventory_sync_config_attributes.rb new file mode 100644 index 000000000000..86bd6760df1b --- /dev/null +++ b/lib/datadog_api_client/v2/models/cloud_inventory_sync_config_attributes.rb @@ -0,0 +1,396 @@ +=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 + # Attributes for a cloud inventory sync configuration. Values beyond `id` may be omitted immediately after upsert. + class CloudInventorySyncConfigAttributes + include BaseGenericModel + + # AWS account ID for the inventory bucket. + attr_reader :aws_account_id + + # AWS S3 bucket name for inventory files. + attr_reader :aws_bucket_name + + # AWS Region for the inventory bucket. + attr_reader :aws_region + + # Azure AD application (client) ID. + attr_reader :azure_client_id + + # Azure blob container name. + attr_reader :azure_container_name + + # Azure storage account name. + attr_reader :azure_storage_account_name + + # Azure AD tenant ID. + attr_reader :azure_tenant_id + + # Cloud provider for this sync configuration (`aws`, `gcp`, or `azure`). For requests, must match the provider block supplied under `attributes`. + attr_reader :cloud_provider + + # Human-readable error detail when sync is unhealthy. + attr_reader :error + + # Machine-readable error code when sync is unhealthy. + attr_reader :error_code + + # GCS bucket name for inventory files Datadog reads. + attr_reader :gcp_bucket_name + + # GCP project ID. + attr_reader :gcp_project_id + + # Service account email for bucket access. + attr_reader :gcp_service_account_email + + # Object key prefix or `/` when the entire bucket is synced. + attr_reader :prefix + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'aws_account_id' => :'aws_account_id', + :'aws_bucket_name' => :'aws_bucket_name', + :'aws_region' => :'aws_region', + :'azure_client_id' => :'azure_client_id', + :'azure_container_name' => :'azure_container_name', + :'azure_storage_account_name' => :'azure_storage_account_name', + :'azure_tenant_id' => :'azure_tenant_id', + :'cloud_provider' => :'cloud_provider', + :'error' => :'error', + :'error_code' => :'error_code', + :'gcp_bucket_name' => :'gcp_bucket_name', + :'gcp_project_id' => :'gcp_project_id', + :'gcp_service_account_email' => :'gcp_service_account_email', + :'prefix' => :'prefix' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'aws_account_id' => :'String', + :'aws_bucket_name' => :'String', + :'aws_region' => :'String', + :'azure_client_id' => :'String', + :'azure_container_name' => :'String', + :'azure_storage_account_name' => :'String', + :'azure_tenant_id' => :'String', + :'cloud_provider' => :'CloudInventoryCloudProviderId', + :'error' => :'String', + :'error_code' => :'String', + :'gcp_bucket_name' => :'String', + :'gcp_project_id' => :'String', + :'gcp_service_account_email' => :'String', + :'prefix' => :'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::CloudInventorySyncConfigAttributes` 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?(:'aws_account_id') + self.aws_account_id = attributes[:'aws_account_id'] + end + + if attributes.key?(:'aws_bucket_name') + self.aws_bucket_name = attributes[:'aws_bucket_name'] + end + + if attributes.key?(:'aws_region') + self.aws_region = attributes[:'aws_region'] + end + + if attributes.key?(:'azure_client_id') + self.azure_client_id = attributes[:'azure_client_id'] + end + + if attributes.key?(:'azure_container_name') + self.azure_container_name = attributes[:'azure_container_name'] + end + + if attributes.key?(:'azure_storage_account_name') + self.azure_storage_account_name = attributes[:'azure_storage_account_name'] + end + + if attributes.key?(:'azure_tenant_id') + self.azure_tenant_id = attributes[:'azure_tenant_id'] + end + + if attributes.key?(:'cloud_provider') + self.cloud_provider = attributes[:'cloud_provider'] + end + + if attributes.key?(:'error') + self.error = attributes[:'error'] + end + + if attributes.key?(:'error_code') + self.error_code = attributes[:'error_code'] + end + + if attributes.key?(:'gcp_bucket_name') + self.gcp_bucket_name = attributes[:'gcp_bucket_name'] + end + + if attributes.key?(:'gcp_project_id') + self.gcp_project_id = attributes[:'gcp_project_id'] + end + + if attributes.key?(:'gcp_service_account_email') + self.gcp_service_account_email = attributes[:'gcp_service_account_email'] + end + + if attributes.key?(:'prefix') + self.prefix = attributes[:'prefix'] + 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 @aws_account_id.nil? + return false if @aws_bucket_name.nil? + return false if @aws_region.nil? + return false if @azure_client_id.nil? + return false if @azure_container_name.nil? + return false if @azure_storage_account_name.nil? + return false if @azure_tenant_id.nil? + return false if @cloud_provider.nil? + return false if @error.nil? + return false if @error_code.nil? + return false if @gcp_bucket_name.nil? + return false if @gcp_project_id.nil? + return false if @gcp_service_account_email.nil? + return false if @prefix.nil? + true + end + + # Custom attribute writer method with validation + # @param aws_account_id [Object] Object to be assigned + # @!visibility private + def aws_account_id=(aws_account_id) + if aws_account_id.nil? + fail ArgumentError, 'invalid value for "aws_account_id", aws_account_id cannot be nil.' + end + @aws_account_id = aws_account_id + end + + # Custom attribute writer method with validation + # @param aws_bucket_name [Object] Object to be assigned + # @!visibility private + def aws_bucket_name=(aws_bucket_name) + if aws_bucket_name.nil? + fail ArgumentError, 'invalid value for "aws_bucket_name", aws_bucket_name cannot be nil.' + end + @aws_bucket_name = aws_bucket_name + end + + # Custom attribute writer method with validation + # @param aws_region [Object] Object to be assigned + # @!visibility private + def aws_region=(aws_region) + if aws_region.nil? + fail ArgumentError, 'invalid value for "aws_region", aws_region cannot be nil.' + end + @aws_region = aws_region + end + + # Custom attribute writer method with validation + # @param azure_client_id [Object] Object to be assigned + # @!visibility private + def azure_client_id=(azure_client_id) + if azure_client_id.nil? + fail ArgumentError, 'invalid value for "azure_client_id", azure_client_id cannot be nil.' + end + @azure_client_id = azure_client_id + end + + # Custom attribute writer method with validation + # @param azure_container_name [Object] Object to be assigned + # @!visibility private + def azure_container_name=(azure_container_name) + if azure_container_name.nil? + fail ArgumentError, 'invalid value for "azure_container_name", azure_container_name cannot be nil.' + end + @azure_container_name = azure_container_name + end + + # Custom attribute writer method with validation + # @param azure_storage_account_name [Object] Object to be assigned + # @!visibility private + def azure_storage_account_name=(azure_storage_account_name) + if azure_storage_account_name.nil? + fail ArgumentError, 'invalid value for "azure_storage_account_name", azure_storage_account_name cannot be nil.' + end + @azure_storage_account_name = azure_storage_account_name + end + + # Custom attribute writer method with validation + # @param azure_tenant_id [Object] Object to be assigned + # @!visibility private + def azure_tenant_id=(azure_tenant_id) + if azure_tenant_id.nil? + fail ArgumentError, 'invalid value for "azure_tenant_id", azure_tenant_id cannot be nil.' + end + @azure_tenant_id = azure_tenant_id + end + + # Custom attribute writer method with validation + # @param cloud_provider [Object] Object to be assigned + # @!visibility private + def cloud_provider=(cloud_provider) + if cloud_provider.nil? + fail ArgumentError, 'invalid value for "cloud_provider", cloud_provider cannot be nil.' + end + @cloud_provider = cloud_provider + end + + # Custom attribute writer method with validation + # @param error [Object] Object to be assigned + # @!visibility private + def error=(error) + if error.nil? + fail ArgumentError, 'invalid value for "error", error cannot be nil.' + end + @error = error + end + + # Custom attribute writer method with validation + # @param error_code [Object] Object to be assigned + # @!visibility private + def error_code=(error_code) + if error_code.nil? + fail ArgumentError, 'invalid value for "error_code", error_code cannot be nil.' + end + @error_code = error_code + end + + # Custom attribute writer method with validation + # @param gcp_bucket_name [Object] Object to be assigned + # @!visibility private + def gcp_bucket_name=(gcp_bucket_name) + if gcp_bucket_name.nil? + fail ArgumentError, 'invalid value for "gcp_bucket_name", gcp_bucket_name cannot be nil.' + end + @gcp_bucket_name = gcp_bucket_name + end + + # Custom attribute writer method with validation + # @param gcp_project_id [Object] Object to be assigned + # @!visibility private + def gcp_project_id=(gcp_project_id) + if gcp_project_id.nil? + fail ArgumentError, 'invalid value for "gcp_project_id", gcp_project_id cannot be nil.' + end + @gcp_project_id = gcp_project_id + end + + # Custom attribute writer method with validation + # @param gcp_service_account_email [Object] Object to be assigned + # @!visibility private + def gcp_service_account_email=(gcp_service_account_email) + if gcp_service_account_email.nil? + fail ArgumentError, 'invalid value for "gcp_service_account_email", gcp_service_account_email cannot be nil.' + end + @gcp_service_account_email = gcp_service_account_email + end + + # Custom attribute writer method with validation + # @param prefix [Object] Object to be assigned + # @!visibility private + def prefix=(prefix) + if prefix.nil? + fail ArgumentError, 'invalid value for "prefix", prefix cannot be nil.' + end + @prefix = prefix + 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 && + aws_account_id == o.aws_account_id && + aws_bucket_name == o.aws_bucket_name && + aws_region == o.aws_region && + azure_client_id == o.azure_client_id && + azure_container_name == o.azure_container_name && + azure_storage_account_name == o.azure_storage_account_name && + azure_tenant_id == o.azure_tenant_id && + cloud_provider == o.cloud_provider && + error == o.error && + error_code == o.error_code && + gcp_bucket_name == o.gcp_bucket_name && + gcp_project_id == o.gcp_project_id && + gcp_service_account_email == o.gcp_service_account_email && + prefix == o.prefix && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [aws_account_id, aws_bucket_name, aws_region, azure_client_id, azure_container_name, azure_storage_account_name, azure_tenant_id, cloud_provider, error, error_code, gcp_bucket_name, gcp_project_id, gcp_service_account_email, prefix, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/cloud_inventory_sync_config_aws_request_attributes.rb b/lib/datadog_api_client/v2/models/cloud_inventory_sync_config_aws_request_attributes.rb new file mode 100644 index 000000000000..a700757f895f --- /dev/null +++ b/lib/datadog_api_client/v2/models/cloud_inventory_sync_config_aws_request_attributes.rb @@ -0,0 +1,175 @@ +=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 + # AWS settings for the customer bucket that stores inventory reports. + class CloudInventorySyncConfigAWSRequestAttributes + include BaseGenericModel + + # AWS account ID that owns the inventory bucket. + attr_reader :aws_account_id + + # Name of the S3 bucket containing inventory files. + attr_reader :destination_bucket_name + + # AWS Region of the inventory bucket. + attr_reader :destination_bucket_region + + # Optional object key prefix for inventory files. Use `/` or omit for the entire bucket. + attr_accessor :destination_prefix + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'aws_account_id' => :'aws_account_id', + :'destination_bucket_name' => :'destination_bucket_name', + :'destination_bucket_region' => :'destination_bucket_region', + :'destination_prefix' => :'destination_prefix' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'aws_account_id' => :'String', + :'destination_bucket_name' => :'String', + :'destination_bucket_region' => :'String', + :'destination_prefix' => :'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::CloudInventorySyncConfigAWSRequestAttributes` 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?(:'aws_account_id') + self.aws_account_id = attributes[:'aws_account_id'] + end + + if attributes.key?(:'destination_bucket_name') + self.destination_bucket_name = attributes[:'destination_bucket_name'] + end + + if attributes.key?(:'destination_bucket_region') + self.destination_bucket_region = attributes[:'destination_bucket_region'] + end + + if attributes.key?(:'destination_prefix') + self.destination_prefix = attributes[:'destination_prefix'] + 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 @aws_account_id.nil? + return false if @destination_bucket_name.nil? + return false if @destination_bucket_region.nil? + true + end + + # Custom attribute writer method with validation + # @param aws_account_id [Object] Object to be assigned + # @!visibility private + def aws_account_id=(aws_account_id) + if aws_account_id.nil? + fail ArgumentError, 'invalid value for "aws_account_id", aws_account_id cannot be nil.' + end + @aws_account_id = aws_account_id + end + + # Custom attribute writer method with validation + # @param destination_bucket_name [Object] Object to be assigned + # @!visibility private + def destination_bucket_name=(destination_bucket_name) + if destination_bucket_name.nil? + fail ArgumentError, 'invalid value for "destination_bucket_name", destination_bucket_name cannot be nil.' + end + @destination_bucket_name = destination_bucket_name + end + + # Custom attribute writer method with validation + # @param destination_bucket_region [Object] Object to be assigned + # @!visibility private + def destination_bucket_region=(destination_bucket_region) + if destination_bucket_region.nil? + fail ArgumentError, 'invalid value for "destination_bucket_region", destination_bucket_region cannot be nil.' + end + @destination_bucket_region = destination_bucket_region + 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 && + aws_account_id == o.aws_account_id && + destination_bucket_name == o.destination_bucket_name && + destination_bucket_region == o.destination_bucket_region && + destination_prefix == o.destination_prefix && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [aws_account_id, destination_bucket_name, destination_bucket_region, destination_prefix, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/cloud_inventory_sync_config_azure_request_attributes.rb b/lib/datadog_api_client/v2/models/cloud_inventory_sync_config_azure_request_attributes.rb new file mode 100644 index 000000000000..331637a50266 --- /dev/null +++ b/lib/datadog_api_client/v2/models/cloud_inventory_sync_config_azure_request_attributes.rb @@ -0,0 +1,228 @@ +=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 + # Azure settings for the storage account and container with inventory data. + class CloudInventorySyncConfigAzureRequestAttributes + include BaseGenericModel + + # Azure AD application (client) ID used for access. + attr_reader :client_id + + # Blob container name. + attr_reader :container + + # Resource group containing the storage account. + attr_reader :resource_group + + # Storage account name. + attr_reader :storage_account + + # Azure subscription ID. + attr_reader :subscription_id + + # Azure AD tenant ID. + attr_reader :tenant_id + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'client_id' => :'client_id', + :'container' => :'container', + :'resource_group' => :'resource_group', + :'storage_account' => :'storage_account', + :'subscription_id' => :'subscription_id', + :'tenant_id' => :'tenant_id' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'client_id' => :'String', + :'container' => :'String', + :'resource_group' => :'String', + :'storage_account' => :'String', + :'subscription_id' => :'String', + :'tenant_id' => :'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::CloudInventorySyncConfigAzureRequestAttributes` 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?(:'client_id') + self.client_id = attributes[:'client_id'] + end + + if attributes.key?(:'container') + self.container = attributes[:'container'] + end + + if attributes.key?(:'resource_group') + self.resource_group = attributes[:'resource_group'] + end + + if attributes.key?(:'storage_account') + self.storage_account = attributes[:'storage_account'] + end + + if attributes.key?(:'subscription_id') + self.subscription_id = attributes[:'subscription_id'] + end + + if attributes.key?(:'tenant_id') + self.tenant_id = attributes[:'tenant_id'] + 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 @client_id.nil? + return false if @container.nil? + return false if @resource_group.nil? + return false if @storage_account.nil? + return false if @subscription_id.nil? + return false if @tenant_id.nil? + true + end + + # Custom attribute writer method with validation + # @param client_id [Object] Object to be assigned + # @!visibility private + def client_id=(client_id) + if client_id.nil? + fail ArgumentError, 'invalid value for "client_id", client_id cannot be nil.' + end + @client_id = client_id + end + + # Custom attribute writer method with validation + # @param container [Object] Object to be assigned + # @!visibility private + def container=(container) + if container.nil? + fail ArgumentError, 'invalid value for "container", container cannot be nil.' + end + @container = container + end + + # Custom attribute writer method with validation + # @param resource_group [Object] Object to be assigned + # @!visibility private + def resource_group=(resource_group) + if resource_group.nil? + fail ArgumentError, 'invalid value for "resource_group", resource_group cannot be nil.' + end + @resource_group = resource_group + end + + # Custom attribute writer method with validation + # @param storage_account [Object] Object to be assigned + # @!visibility private + def storage_account=(storage_account) + if storage_account.nil? + fail ArgumentError, 'invalid value for "storage_account", storage_account cannot be nil.' + end + @storage_account = storage_account + end + + # Custom attribute writer method with validation + # @param subscription_id [Object] Object to be assigned + # @!visibility private + def subscription_id=(subscription_id) + if subscription_id.nil? + fail ArgumentError, 'invalid value for "subscription_id", subscription_id cannot be nil.' + end + @subscription_id = subscription_id + end + + # Custom attribute writer method with validation + # @param tenant_id [Object] Object to be assigned + # @!visibility private + def tenant_id=(tenant_id) + if tenant_id.nil? + fail ArgumentError, 'invalid value for "tenant_id", tenant_id cannot be nil.' + end + @tenant_id = tenant_id + 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 && + client_id == o.client_id && + container == o.container && + resource_group == o.resource_group && + storage_account == o.storage_account && + subscription_id == o.subscription_id && + tenant_id == o.tenant_id && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [client_id, container, resource_group, storage_account, subscription_id, tenant_id, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/cloud_inventory_sync_config_gcp_request_attributes.rb b/lib/datadog_api_client/v2/models/cloud_inventory_sync_config_gcp_request_attributes.rb new file mode 100644 index 000000000000..84da229b26d7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/cloud_inventory_sync_config_gcp_request_attributes.rb @@ -0,0 +1,186 @@ +=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 + # GCP settings for buckets involved in inventory reporting. + class CloudInventorySyncConfigGCPRequestAttributes + include BaseGenericModel + + # GCS bucket name where Datadog reads inventory reports. + attr_reader :destination_bucket_name + + # GCP project ID for the inventory destination bucket. + attr_reader :project_id + + # Service account email used to read the destination bucket. + attr_reader :service_account_email + + # GCS bucket name that inventory reports are generated for. + attr_reader :source_bucket_name + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'destination_bucket_name' => :'destination_bucket_name', + :'project_id' => :'project_id', + :'service_account_email' => :'service_account_email', + :'source_bucket_name' => :'source_bucket_name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'destination_bucket_name' => :'String', + :'project_id' => :'String', + :'service_account_email' => :'String', + :'source_bucket_name' => :'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::CloudInventorySyncConfigGCPRequestAttributes` 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?(:'destination_bucket_name') + self.destination_bucket_name = attributes[:'destination_bucket_name'] + end + + if attributes.key?(:'project_id') + self.project_id = attributes[:'project_id'] + end + + if attributes.key?(:'service_account_email') + self.service_account_email = attributes[:'service_account_email'] + end + + if attributes.key?(:'source_bucket_name') + self.source_bucket_name = attributes[:'source_bucket_name'] + 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 @destination_bucket_name.nil? + return false if @project_id.nil? + return false if @service_account_email.nil? + return false if @source_bucket_name.nil? + true + end + + # Custom attribute writer method with validation + # @param destination_bucket_name [Object] Object to be assigned + # @!visibility private + def destination_bucket_name=(destination_bucket_name) + if destination_bucket_name.nil? + fail ArgumentError, 'invalid value for "destination_bucket_name", destination_bucket_name cannot be nil.' + end + @destination_bucket_name = destination_bucket_name + end + + # Custom attribute writer method with validation + # @param project_id [Object] Object to be assigned + # @!visibility private + def project_id=(project_id) + if project_id.nil? + fail ArgumentError, 'invalid value for "project_id", project_id cannot be nil.' + end + @project_id = project_id + end + + # Custom attribute writer method with validation + # @param service_account_email [Object] Object to be assigned + # @!visibility private + def service_account_email=(service_account_email) + if service_account_email.nil? + fail ArgumentError, 'invalid value for "service_account_email", service_account_email cannot be nil.' + end + @service_account_email = service_account_email + end + + # Custom attribute writer method with validation + # @param source_bucket_name [Object] Object to be assigned + # @!visibility private + def source_bucket_name=(source_bucket_name) + if source_bucket_name.nil? + fail ArgumentError, 'invalid value for "source_bucket_name", source_bucket_name cannot be nil.' + end + @source_bucket_name = source_bucket_name + 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 && + destination_bucket_name == o.destination_bucket_name && + project_id == o.project_id && + service_account_email == o.service_account_email && + source_bucket_name == o.source_bucket_name && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [destination_bucket_name, project_id, service_account_email, source_bucket_name, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/cloud_inventory_sync_config_resource_type.rb b/lib/datadog_api_client/v2/models/cloud_inventory_sync_config_resource_type.rb new file mode 100644 index 000000000000..8f88efa14af9 --- /dev/null +++ b/lib/datadog_api_client/v2/models/cloud_inventory_sync_config_resource_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 type for sync configuration resources. + class CloudInventorySyncConfigResourceType + include BaseEnumModel + + SYNC_CONFIGS = "sync_configs".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/cloud_inventory_sync_config_response.rb b/lib/datadog_api_client/v2/models/cloud_inventory_sync_config_response.rb new file mode 100644 index 000000000000..a76533c38942 --- /dev/null +++ b/lib/datadog_api_client/v2/models/cloud_inventory_sync_config_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 upserted sync configuration. Additional read-only fields appear on list and get. + class CloudInventorySyncConfigResponse + include BaseGenericModel + + # JSON:API data object for a sync configuration. + 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' => :'CloudInventorySyncConfigResponseData' + } + 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::CloudInventorySyncConfigResponse` 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/cloud_inventory_sync_config_response_data.rb b/lib/datadog_api_client/v2/models/cloud_inventory_sync_config_response_data.rb new file mode 100644 index 000000000000..a6292364ca33 --- /dev/null +++ b/lib/datadog_api_client/v2/models/cloud_inventory_sync_config_response_data.rb @@ -0,0 +1,165 @@ +=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 data object for a sync configuration. + class CloudInventorySyncConfigResponseData + include BaseGenericModel + + # Attributes for a cloud inventory sync configuration. Values beyond `id` may be omitted immediately after upsert. + attr_reader :attributes + + # Unique identifier for the recurring sync configuration. + attr_reader :id + + # JSON:API type for sync configuration resources. + 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' => :'CloudInventorySyncConfigAttributes', + :'id' => :'String', + :'type' => :'CloudInventorySyncConfigResourceType' + } + 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::CloudInventorySyncConfigResponseData` 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/upsert_cloud_inventory_sync_config_request.rb b/lib/datadog_api_client/v2/models/upsert_cloud_inventory_sync_config_request.rb new file mode 100644 index 000000000000..2fd11caea873 --- /dev/null +++ b/lib/datadog_api_client/v2/models/upsert_cloud_inventory_sync_config_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 + # Request body for creating or updating a cloud inventory sync configuration. + class UpsertCloudInventorySyncConfigRequest + include BaseGenericModel + + # JSON:API data envelope for an upsert sync configuration request. + 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' => :'UpsertCloudInventorySyncConfigRequestData' + } + 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::UpsertCloudInventorySyncConfigRequest` 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/upsert_cloud_inventory_sync_config_request_attributes.rb b/lib/datadog_api_client/v2/models/upsert_cloud_inventory_sync_config_request_attributes.rb new file mode 100644 index 000000000000..b4bc28430ba5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/upsert_cloud_inventory_sync_config_request_attributes.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 + # Provider-specific configuration. Include the object that matches `data.id` (`aws`, `gcp`, or `azure`). + class UpsertCloudInventorySyncConfigRequestAttributes + include BaseGenericModel + + # AWS settings for the customer bucket that stores inventory reports. + attr_accessor :aws + + # Azure settings for the storage account and container with inventory data. + attr_accessor :azure + + # GCP settings for buckets involved in inventory reporting. + attr_accessor :gcp + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'aws' => :'aws', + :'azure' => :'azure', + :'gcp' => :'gcp' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'aws' => :'CloudInventorySyncConfigAWSRequestAttributes', + :'azure' => :'CloudInventorySyncConfigAzureRequestAttributes', + :'gcp' => :'CloudInventorySyncConfigGCPRequestAttributes' + } + 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::UpsertCloudInventorySyncConfigRequestAttributes` 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?(:'aws') + self.aws = attributes[:'aws'] + end + + if attributes.key?(:'azure') + self.azure = attributes[:'azure'] + end + + if attributes.key?(:'gcp') + self.gcp = attributes[:'gcp'] + end + 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 && + aws == o.aws && + azure == o.azure && + gcp == o.gcp && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [aws, azure, gcp, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/upsert_cloud_inventory_sync_config_request_data.rb b/lib/datadog_api_client/v2/models/upsert_cloud_inventory_sync_config_request_data.rb new file mode 100644 index 000000000000..7053b673971f --- /dev/null +++ b/lib/datadog_api_client/v2/models/upsert_cloud_inventory_sync_config_request_data.rb @@ -0,0 +1,165 @@ +=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 data envelope for an upsert sync configuration request. + class UpsertCloudInventorySyncConfigRequestData + include BaseGenericModel + + # Provider-specific configuration. Include the object that matches `data.id` (`aws`, `gcp`, or `azure`). + attr_reader :attributes + + # Cloud provider for this sync configuration (`aws`, `gcp`, or `azure`). For requests, must match the provider block supplied under `attributes`. + attr_reader :id + + # JSON:API type for upsert sync configuration requests. + 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' => :'UpsertCloudInventorySyncConfigRequestAttributes', + :'id' => :'CloudInventoryCloudProviderId', + :'type' => :'CloudInventoryCloudProviderRequestType' + } + 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::UpsertCloudInventorySyncConfigRequestData` 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