diff --git a/.apigentools-info b/.apigentools-info index 3f012913d258..48617aa30e03 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-07-23 18:14:12.683565", - "spec_repo_commit": "9e027051" + "regenerated": "2024-07-25 19:27:13.521590", + "spec_repo_commit": "5395c968" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-07-23 18:14:12.701847", - "spec_repo_commit": "9e027051" + "regenerated": "2024-07-25 19:27:13.539764", + "spec_repo_commit": "5395c968" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index d921feb3775d..8dab6972d124 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -216,6 +216,13 @@ components: required: true schema: type: string + FileID: + description: File id. + in: path + name: file_id + required: true + schema: + type: string GCPSTSServiceAccountID: description: Your GCP STS enabled service account's unique ID. in: path @@ -5516,6 +5523,234 @@ components: nullable: true type: string type: object + CustomCostGetResponseMeta: + description: Meta for the response from the Get Custom Costs endpoints. + properties: + version: + description: Version of Custom Costs file + type: string + type: object + CustomCostListResponseMeta: + description: Meta for the response from the List Custom Costs endpoints. + properties: + total_filtered_count: + description: Number of Custom Costs files returned by the List Custom Costs + endpoint + format: int64 + type: integer + version: + description: Version of Custom Costs file + type: string + type: object + CustomCostUploadResponseMeta: + description: Meta for the response from the Upload Custom Costs endpoints. + properties: + version: + description: Version of Custom Costs file + type: string + type: object + CustomCostsFileGetResponse: + description: Response for Get Custom Costs Files. + properties: + data: + $ref: '#/components/schemas/CustomCostsFileMetadataWithContentHighLevel' + meta: + $ref: '#/components/schemas/CustomCostGetResponseMeta' + type: object + CustomCostsFileLineItem: + description: Line item details from a Custom Costs file. + properties: + BilledCost: + description: Total cost in the cost file. + example: 100.5 + format: double + type: number + BillingCurrency: + description: Currency used in the Custom Costs file. + example: USD + type: string + ChargeDescription: + description: Description for the line item cost. + example: monthly usage charge for my service + type: string + ChargePeriodEnd: + description: End date of the usage charge. + example: '2023-02-28' + pattern: ^\d{4}-\d{2}-\d{2}$ + type: string + ChargePeriodStart: + description: Start date of the usage charge. + example: '2023-02-01' + pattern: ^\d{4}-\d{2}-\d{2}$ + type: string + ProviderName: + description: Name of the provider for the line item. + type: string + Tags: + additionalProperties: + type: string + description: Additional tags for the line item. + type: object + type: object + CustomCostsFileListResponse: + description: Response for List Custom Costs Files. + properties: + data: + description: List of Custom Costs Files. + items: + $ref: '#/components/schemas/CustomCostsFileMetadataHighLevel' + type: array + meta: + $ref: '#/components/schemas/CustomCostListResponseMeta' + type: object + CustomCostsFileMetadata: + description: Schema of a Custom Costs metadata. + properties: + billed_cost: + description: Total cost in the cost file. + example: 100.5 + format: double + type: number + billing_currency: + description: Currency used in the Custom Costs file. + example: USD + type: string + charge_period: + $ref: '#/components/schemas/CustomCostsFileUsageChargePeriod' + name: + description: Name of the Custom Costs file. + example: my_file.json + type: string + provider_names: + description: Providers contains in the Custom Costs file. + items: + description: Name of a provider. + example: my_provider + type: string + type: array + status: + description: Status of the Custom Costs file. + example: active + type: string + uploaded_at: + description: Timestamp in millisecond of the upload time of the Custom Costs + file. + example: 1704067200000 + format: double + type: number + uploaded_by: + $ref: '#/components/schemas/CustomCostsUser' + type: object + CustomCostsFileMetadataHighLevel: + description: JSON API format of for a Custom Costs file. + properties: + attributes: + $ref: '#/components/schemas/CustomCostsFileMetadata' + id: + description: ID of the Custom Costs metadata. + type: string + type: + description: Type of the Custom Costs file metadata. + type: string + type: object + CustomCostsFileMetadataWithContent: + description: Schema of a cost file metadata. + properties: + billed_cost: + description: Total cost in the cost file. + example: 100.5 + format: double + type: number + billing_currency: + description: Currency used in the Custom Costs file. + example: USD + type: string + charge_period: + $ref: '#/components/schemas/CustomCostsFileUsageChargePeriod' + content: + description: Detail of the line items from the Custom Costs file. + items: + $ref: '#/components/schemas/CustomCostsFileLineItem' + type: array + name: + description: Name of the Custom Costs file. + example: my_file.json + type: string + provider_names: + description: Providers contains in the Custom Costs file. + items: + description: Name of a provider. + example: my_provider + type: string + type: array + status: + description: Status of the Custom Costs file. + example: active + type: string + uploaded_at: + description: Timestamp in millisecond of the upload time of the Custom Costs + file. + example: 1704067200000 + format: double + type: number + uploaded_by: + $ref: '#/components/schemas/CustomCostsUser' + type: object + CustomCostsFileMetadataWithContentHighLevel: + description: JSON API format of for a Custom Costs file with content. + properties: + attributes: + $ref: '#/components/schemas/CustomCostsFileMetadataWithContent' + id: + description: ID of the Custom Costs metadata. + type: string + type: + description: Type of the Custom Costs file metadata. + type: string + type: object + CustomCostsFileUploadRequest: + description: Request for uploading a Custom Costs file. + items: + $ref: '#/components/schemas/CustomCostsFileLineItem' + type: array + CustomCostsFileUploadResponse: + description: Response for Uploaded Custom Costs Files. + properties: + data: + $ref: '#/components/schemas/CustomCostsFileMetadataHighLevel' + meta: + $ref: '#/components/schemas/CustomCostUploadResponseMeta' + type: object + CustomCostsFileUsageChargePeriod: + description: Usage charge period of a Custom Costs file. + properties: + end: + description: End of the usage of the Custom Costs file. + example: 1706745600000 + format: double + type: number + start: + description: Start of the usage of the Custom Costs file. + example: 1704067200000 + format: double + type: number + type: object + CustomCostsUser: + description: Metadata of the user that has uploaded the Custom Costs file. + properties: + email: + description: The name of the Custom Costs file. + example: email.test@datadohq.com + type: string + icon: + description: The name of the Custom Costs file. + example: icon.png + type: string + name: + description: Name of the user. + example: Test User + type: string + type: object CustomDestinationAttributeTagsRestrictionListType: default: ALLOW_LIST description: 'How `forward_tags_restriction_list` parameter should be interpreted. @@ -26224,6 +26459,118 @@ paths: summary: Update Cloud Cost Management Azure config tags: - Cloud Cost Management + /api/v2/cost/custom_costs: + get: + description: List the Custom Costs files. + operationId: ListCustomCostsFiles + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/CustomCostsFileListResponse' + description: OK + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cloud_cost_management_read + summary: List Custom Costs Files + tags: + - Cloud Cost Management + put: + description: Upload a Custom Costs file. + operationId: UploadCustomCostsFile + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CustomCostsFileUploadRequest' + required: true + responses: + '202': + content: + application/json: + schema: + $ref: '#/components/schemas/CustomCostsFileUploadResponse' + description: Accepted + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cloud_cost_management_write + summary: Upload Custom Costs File + tags: + - Cloud Cost Management + /api/v2/cost/custom_costs/{file_id}: + delete: + description: Delete the specified Custom Costs file. + operationId: DeleteCustomCostsFile + parameters: + - $ref: '#/components/parameters/FileID' + responses: + '204': + description: No Content + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cloud_cost_management_write + summary: Delete Custom Costs File + tags: + - Cloud Cost Management + get: + description: Fetch the specified Custom Costs file. + operationId: GetCustomCostsFile + parameters: + - $ref: '#/components/parameters/FileID' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/CustomCostsFileGetResponse' + description: OK + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cloud_cost_management_read + summary: Get Custom Costs File + tags: + - Cloud Cost Management /api/v2/cost/enabled: get: description: Get the Cloud Cost Management activity. diff --git a/cassettes/features/v2/cloud_cost_management/Delete-Custom-Costs-File-returns-No-Content-response.frozen b/cassettes/features/v2/cloud_cost_management/Delete-Custom-Costs-File-returns-No-Content-response.frozen new file mode 100644 index 000000000000..0d8912bb1dd7 --- /dev/null +++ b/cassettes/features/v2/cloud_cost_management/Delete-Custom-Costs-File-returns-No-Content-response.frozen @@ -0,0 +1 @@ +2024-07-22T12:40:43.508Z \ No newline at end of file diff --git a/cassettes/features/v2/cloud_cost_management/Delete-Custom-Costs-File-returns-No-Content-response.yml b/cassettes/features/v2/cloud_cost_management/Delete-Custom-Costs-File-returns-No-Content-response.yml new file mode 100644 index 000000000000..653f5aec703e --- /dev/null +++ b/cassettes/features/v2/cloud_cost_management/Delete-Custom-Costs-File-returns-No-Content-response.yml @@ -0,0 +1,20 @@ +http_interactions: +- recorded_at: Mon, 22 Jul 2024 12:40:43 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/cost/custom_costs/9d055d22-a838-4e9f-bc34-a4f9ab66280c + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/cloud_cost_management/Get-Custom-Costs-File-returns-OK-response.frozen b/cassettes/features/v2/cloud_cost_management/Get-Custom-Costs-File-returns-OK-response.frozen new file mode 100644 index 000000000000..198bbdbc3d8c --- /dev/null +++ b/cassettes/features/v2/cloud_cost_management/Get-Custom-Costs-File-returns-OK-response.frozen @@ -0,0 +1 @@ +2024-07-22T12:06:05.860Z \ No newline at end of file diff --git a/cassettes/features/v2/cloud_cost_management/Get-Custom-Costs-File-returns-OK-response.yml b/cassettes/features/v2/cloud_cost_management/Get-Custom-Costs-File-returns-OK-response.yml new file mode 100644 index 000000000000..a0a963b5fbfd --- /dev/null +++ b/cassettes/features/v2/cloud_cost_management/Get-Custom-Costs-File-returns-OK-response.yml @@ -0,0 +1,21 @@ +http_interactions: +- recorded_at: Mon, 22 Jul 2024 12:06:05 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/cost/custom_costs/9d055d22-a838-4e9f-bc34-a4f9ab66280c + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"9d055d22-a838-4e9f-bc34-a4f9ab66280c","type":"cost_metadata","attributes":{"billed_cost":250,"billing_currency":"USD","charge_period":{"start":1683331200000,"end":1686009600000},"content":[{"BilledCost":250,"BillingCurrency":"USD","ChargeDescription":"my_description","Tags":{"key":"value"},"ProviderName":"my_provider","ChargePeriodStart":"2023-05-06","ChargePeriodEnd":"2023-06-06"}],"name":"data.json","provider_names":["my_provider"],"status":"ACTIVE","uploaded_at":1721322924169,"uploaded_by":{"name":"Julien + Hemery","icon":"https://secure.gravatar.com/avatar/f12684c6ebe1bdd70c36789c5270aac0?d=retro\u0026s=48","email":"julien.hemery@datadoghq.com"}}},"meta":{"version":"1.0"}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/cloud_cost_management/List-Custom-Costs-Files-returns-OK-response.frozen b/cassettes/features/v2/cloud_cost_management/List-Custom-Costs-Files-returns-OK-response.frozen new file mode 100644 index 000000000000..14e85f57fe06 --- /dev/null +++ b/cassettes/features/v2/cloud_cost_management/List-Custom-Costs-Files-returns-OK-response.frozen @@ -0,0 +1 @@ +2024-07-22T12:06:38.368Z \ No newline at end of file diff --git a/cassettes/features/v2/cloud_cost_management/List-Custom-Costs-Files-returns-OK-response.yml b/cassettes/features/v2/cloud_cost_management/List-Custom-Costs-Files-returns-OK-response.yml new file mode 100644 index 000000000000..2b9454591d81 --- /dev/null +++ b/cassettes/features/v2/cloud_cost_management/List-Custom-Costs-Files-returns-OK-response.yml @@ -0,0 +1,21 @@ +http_interactions: +- recorded_at: Mon, 22 Jul 2024 12:06:38 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/cost/custom_costs + response: + body: + encoding: UTF-8 + string: '{"data":[{"id":"9d055d22-a838-4e9f-bc34-a4f9ab66280c","type":"cost_metadata","attributes":{"billed_cost":250,"billing_currency":"USD","charge_period":{"start":1683331200000,"end":1686009600000},"name":"data.json","provider_names":["my_provider"],"status":"ACTIVE","uploaded_at":1721322924169,"uploaded_by":{"name":"Julien + Hemery","icon":"https://secure.gravatar.com/avatar/f12684c6ebe1bdd70c36789c5270aac0?d=retro\u0026s=48","email":"julien.hemery@datadoghq.com"}}}],"meta":{"version":"1.0","total_filtered_count":766}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/cloud_cost_management/Upload-Custom-Costs-File-returns-Accepted-response.frozen b/cassettes/features/v2/cloud_cost_management/Upload-Custom-Costs-File-returns-Accepted-response.frozen new file mode 100644 index 000000000000..1a10998b748b --- /dev/null +++ b/cassettes/features/v2/cloud_cost_management/Upload-Custom-Costs-File-returns-Accepted-response.frozen @@ -0,0 +1 @@ +2024-07-18T17:15:23.344Z \ No newline at end of file diff --git a/cassettes/features/v2/cloud_cost_management/Upload-Custom-Costs-File-returns-Accepted-response.yml b/cassettes/features/v2/cloud_cost_management/Upload-Custom-Costs-File-returns-Accepted-response.yml new file mode 100644 index 000000000000..36fb4bdcc938 --- /dev/null +++ b/cassettes/features/v2/cloud_cost_management/Upload-Custom-Costs-File-returns-Accepted-response.yml @@ -0,0 +1,25 @@ +http_interactions: +- recorded_at: Thu, 18 Jul 2024 17:15:23 GMT + request: + body: + encoding: UTF-8 + string: '[{"BilledCost":250,"BillingCurrency":"USD","ChargeDescription":"my_description","ChargePeriodEnd":"2023-06-06","ChargePeriodStart":"2023-05-06","ProviderName":"my_provider","Tags":{"key":"value"}}]' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PUT + uri: https://api.datadoghq.com/api/v2/cost/custom_costs + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"9d055d22-a838-4e9f-bc34-a4f9ab66280c","type":"cost_metadata","attributes":{"billed_cost":250,"billing_currency":"USD","charge_period":{"start":1683331200000,"end":1686009600000},"name":"data.json","provider_names":["my_provider"],"status":"UPLOADING","uploaded_at":1721322923888,"uploaded_by":{"name":"Julien + Hemery","icon":"https://secure.gravatar.com/avatar/f12684c6ebe1bdd70c36789c5270aac0?d=retro\u0026s=48","email":"julien.hemery@datadoghq.com"}}},"meta":{"version":"1.0"}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 202 + message: Accepted +recorded_with: VCR 6.0.0 diff --git a/examples/v2/cloud-cost-management/DeleteCustomCostsFile.rb b/examples/v2/cloud-cost-management/DeleteCustomCostsFile.rb new file mode 100644 index 000000000000..cf58fc945aa9 --- /dev/null +++ b/examples/v2/cloud-cost-management/DeleteCustomCostsFile.rb @@ -0,0 +1,5 @@ +# Delete Custom Costs File returns "No Content" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new +api_instance.delete_custom_costs_file("9d055d22-a838-4e9f-bc34-a4f9ab66280c") diff --git a/examples/v2/cloud-cost-management/GetCustomCostsFile.rb b/examples/v2/cloud-cost-management/GetCustomCostsFile.rb new file mode 100644 index 000000000000..5d9827ed174f --- /dev/null +++ b/examples/v2/cloud-cost-management/GetCustomCostsFile.rb @@ -0,0 +1,5 @@ +# Get Custom Costs File returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new +p api_instance.get_custom_costs_file("9d055d22-a838-4e9f-bc34-a4f9ab66280c") diff --git a/examples/v2/cloud-cost-management/ListCustomCostsFiles.rb b/examples/v2/cloud-cost-management/ListCustomCostsFiles.rb new file mode 100644 index 000000000000..cf908b34861c --- /dev/null +++ b/examples/v2/cloud-cost-management/ListCustomCostsFiles.rb @@ -0,0 +1,5 @@ +# List Custom Costs Files returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new +p api_instance.list_custom_costs_files() diff --git a/examples/v2/cloud-cost-management/UploadCustomCostsFile.rb b/examples/v2/cloud-cost-management/UploadCustomCostsFile.rb new file mode 100644 index 000000000000..e4ebb491ca10 --- /dev/null +++ b/examples/v2/cloud-cost-management/UploadCustomCostsFile.rb @@ -0,0 +1,19 @@ +# Upload Custom Costs File returns "Accepted" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new + +body = [ + DatadogAPIClient::V2::CustomCostsFileLineItem.new({ + provider_name: "my_provider", + charge_period_start: "2023-05-06", + charge_period_end: "2023-06-06", + charge_description: "my_description", + billed_cost: 250, + billing_currency: "USD", + tags: { + key: "value", + }, + }), +] +p api_instance.upload_custom_costs_file(body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 461f1813dc95..5fb940adffe2 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -1075,6 +1075,15 @@ "cloud_account_id" => "String", "body" => "AzureUCConfigPatchRequest", }, + "v2.UploadCustomCostsFile" => { + "body" => "Array", + }, + "v2.DeleteCustomCostsFile" => { + "file_id" => "String", + }, + "v2.GetCustomCostsFile" => { + "file_id" => "String", + }, "v2.GetMonthlyCostAttribution" => { "start_month" => "Time", "end_month" => "Time", diff --git a/features/v2/cloud_cost_management.feature b/features/v2/cloud_cost_management.feature index 867531c0a9f5..15f447f8d316 100644 --- a/features/v2/cloud_cost_management.feature +++ b/features/v2/cloud_cost_management.feature @@ -88,6 +88,22 @@ Feature: Cloud Cost Management When the request is sent Then the response status is 404 Not Found + @replay-only @team:Datadog/cloud-cost-management + Scenario: Delete Custom Costs File returns "No Content" response + Given new "DeleteCustomCostsFile" request + And request contains "file_id" parameter with value "9d055d22-a838-4e9f-bc34-a4f9ab66280c" + When the request is sent + Then the response status is 204 No Content + + @replay-only @team:Datadog/cloud-cost-management + Scenario: Get Custom Costs File returns "OK" response + Given new "GetCustomCostsFile" request + And request contains "file_id" parameter with value "9d055d22-a838-4e9f-bc34-a4f9ab66280c" + When the request is sent + Then the response status is 200 OK + And the response "data.attributes.name" is equal to "data.json" + And the response "data.attributes.content[0].ChargeDescription" is equal to "my_description" + @replay-only @team:Datadog/cloud-cost-management Scenario: List Cloud Cost Management AWS CUR configs returns "OK" response Given new "ListCostAWSCURConfigs" request @@ -102,6 +118,13 @@ Feature: Cloud Cost Management Then the response status is 200 OK And the response "data[0].attributes.configs[0].export_name" is equal to "test_export_name" + @replay-only @team:Datadog/cloud-cost-management + Scenario: List Custom Costs Files returns "OK" response + Given new "ListCustomCostsFiles" request + When the request is sent + Then the response status is 200 OK + And the response "data[0].attributes.name" is equal to "data.json" + @generated @skip @team:Datadog/cloud-cost-management Scenario: List related AWS accounts returns "Bad Request" response Given new "ListAWSRelatedAccounts" request @@ -142,3 +165,11 @@ Feature: Cloud Cost Management When the request is sent Then the response status is 200 OK And the response "data.type" is equal to "azure_uc_configs" + + @replay-only @team:Datadog/cloud-cost-management + Scenario: Upload Custom Costs File returns "Accepted" response + Given new "UploadCustomCostsFile" request + And body with value [{ "ProviderName": "my_provider", "ChargePeriodStart": "2023-05-06", "ChargePeriodEnd": "2023-06-06","ChargeDescription": "my_description","BilledCost": 250,"BillingCurrency": "USD","Tags": {"key": "value"}}] + When the request is sent + Then the response status is 202 Accepted + And the response "data.attributes.name" is equal to "data.json" diff --git a/features/v2/undo.json b/features/v2/undo.json index 170f9c4e65a5..c97bab6f784d 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -419,6 +419,30 @@ "type": "idempotent" } }, + "ListCustomCostsFiles": { + "tag": "Cloud Cost Management", + "undo": { + "type": "safe" + } + }, + "UploadCustomCostsFile": { + "tag": "Cloud Cost Management", + "undo": { + "type": "idempotent" + } + }, + "DeleteCustomCostsFile": { + "tag": "Cloud Cost Management", + "undo": { + "type": "idempotent" + } + }, + "GetCustomCostsFile": { + "tag": "Cloud Cost Management", + "undo": { + "type": "safe" + } + }, "GetCloudCostActivity": { "tag": "Cloud Cost Management", "undo": { diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 22cf57fe8e23..a605b8cba619 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1171,6 +1171,19 @@ def overrides "v2.create_rule_response" => "CreateRuleResponse", "v2.create_rule_response_data" => "CreateRuleResponseData", "v2.creator" => "Creator", + "v2.custom_cost_get_response_meta" => "CustomCostGetResponseMeta", + "v2.custom_cost_list_response_meta" => "CustomCostListResponseMeta", + "v2.custom_costs_file_get_response" => "CustomCostsFileGetResponse", + "v2.custom_costs_file_line_item" => "CustomCostsFileLineItem", + "v2.custom_costs_file_list_response" => "CustomCostsFileListResponse", + "v2.custom_costs_file_metadata" => "CustomCostsFileMetadata", + "v2.custom_costs_file_metadata_high_level" => "CustomCostsFileMetadataHighLevel", + "v2.custom_costs_file_metadata_with_content" => "CustomCostsFileMetadataWithContent", + "v2.custom_costs_file_metadata_with_content_high_level" => "CustomCostsFileMetadataWithContentHighLevel", + "v2.custom_costs_file_upload_response" => "CustomCostsFileUploadResponse", + "v2.custom_costs_file_usage_charge_period" => "CustomCostsFileUsageChargePeriod", + "v2.custom_costs_user" => "CustomCostsUser", + "v2.custom_cost_upload_response_meta" => "CustomCostUploadResponseMeta", "v2.custom_destination_attribute_tags_restriction_list_type" => "CustomDestinationAttributeTagsRestrictionListType", "v2.custom_destination_create_request" => "CustomDestinationCreateRequest", "v2.custom_destination_create_request_attributes" => "CustomDestinationCreateRequestAttributes", diff --git a/lib/datadog_api_client/v2/api/cloud_cost_management_api.rb b/lib/datadog_api_client/v2/api/cloud_cost_management_api.rb index c735a4a1ee84..481544818fa4 100644 --- a/lib/datadog_api_client/v2/api/cloud_cost_management_api.rb +++ b/lib/datadog_api_client/v2/api/cloud_cost_management_api.rb @@ -287,6 +287,71 @@ def delete_cost_azure_uc_config_with_http_info(cloud_account_id, opts = {}) return data, status_code, headers end + # Delete Custom Costs File. + # + # @see #delete_custom_costs_file_with_http_info + def delete_custom_costs_file(file_id, opts = {}) + delete_custom_costs_file_with_http_info(file_id, opts) + nil + end + + # Delete Custom Costs File. + # + # Delete the specified Custom Costs file. + # + # @param file_id [String] File id. + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_custom_costs_file_with_http_info(file_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CloudCostManagementAPI.delete_custom_costs_file ...' + end + # verify the required parameter 'file_id' is set + if @api_client.config.client_side_validation && file_id.nil? + fail ArgumentError, "Missing the required parameter 'file_id' when calling CloudCostManagementAPI.delete_custom_costs_file" + end + # resource path + local_var_path = '/api/v2/cost/custom_costs/{file_id}'.sub('{file_id}', CGI.escape(file_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_custom_costs_file, + :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: CloudCostManagementAPI#delete_custom_costs_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Cloud Cost Enabled. # # @see #get_cloud_cost_activity_with_http_info @@ -347,6 +412,71 @@ def get_cloud_cost_activity_with_http_info(opts = {}) return data, status_code, headers end + # Get Custom Costs File. + # + # @see #get_custom_costs_file_with_http_info + def get_custom_costs_file(file_id, opts = {}) + data, _status_code, _headers = get_custom_costs_file_with_http_info(file_id, opts) + data + end + + # Get Custom Costs File. + # + # Fetch the specified Custom Costs file. + # + # @param file_id [String] File id. + # @param opts [Hash] the optional parameters + # @return [Array<(CustomCostsFileGetResponse, Integer, Hash)>] CustomCostsFileGetResponse data, response status code and response headers + def get_custom_costs_file_with_http_info(file_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CloudCostManagementAPI.get_custom_costs_file ...' + end + # verify the required parameter 'file_id' is set + if @api_client.config.client_side_validation && file_id.nil? + fail ArgumentError, "Missing the required parameter 'file_id' when calling CloudCostManagementAPI.get_custom_costs_file" + end + # resource path + local_var_path = '/api/v2/cost/custom_costs/{file_id}'.sub('{file_id}', CGI.escape(file_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] || 'CustomCostsFileGetResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_custom_costs_file, + :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: CloudCostManagementAPI#get_custom_costs_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # List related AWS accounts. # # @see #list_aws_related_accounts_with_http_info @@ -536,6 +666,66 @@ def list_cost_azure_uc_configs_with_http_info(opts = {}) return data, status_code, headers end + # List Custom Costs Files. + # + # @see #list_custom_costs_files_with_http_info + def list_custom_costs_files(opts = {}) + data, _status_code, _headers = list_custom_costs_files_with_http_info(opts) + data + end + + # List Custom Costs Files. + # + # List the Custom Costs files. + # + # @param opts [Hash] the optional parameters + # @return [Array<(CustomCostsFileListResponse, Integer, Hash)>] CustomCostsFileListResponse data, response status code and response headers + def list_custom_costs_files_with_http_info(opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CloudCostManagementAPI.list_custom_costs_files ...' + end + # resource path + local_var_path = '/api/v2/cost/custom_costs' + + # 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] || 'CustomCostsFileListResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :list_custom_costs_files, + :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: CloudCostManagementAPI#list_custom_costs_files\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Update Cloud Cost Management AWS CUR config. # # @see #update_cost_awscur_config_with_http_info @@ -679,5 +869,72 @@ def update_cost_azure_uc_configs_with_http_info(cloud_account_id, body, opts = { end return data, status_code, headers end + + # Upload Custom Costs File. + # + # @see #upload_custom_costs_file_with_http_info + def upload_custom_costs_file(body, opts = {}) + data, _status_code, _headers = upload_custom_costs_file_with_http_info(body, opts) + data + end + + # Upload Custom Costs File. + # + # Upload a Custom Costs file. + # + # @param body [Array] + # @param opts [Hash] the optional parameters + # @return [Array<(CustomCostsFileUploadResponse, Integer, Hash)>] CustomCostsFileUploadResponse data, response status code and response headers + def upload_custom_costs_file_with_http_info(body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CloudCostManagementAPI.upload_custom_costs_file ...' + 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 CloudCostManagementAPI.upload_custom_costs_file" + end + # resource path + local_var_path = '/api/v2/cost/custom_costs' + + # 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] || 'CustomCostsFileUploadResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :upload_custom_costs_file, + :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: CloudCostManagementAPI#upload_custom_costs_file\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/custom_cost_get_response_meta.rb b/lib/datadog_api_client/v2/models/custom_cost_get_response_meta.rb new file mode 100644 index 000000000000..532bf702ad8e --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_cost_get_response_meta.rb @@ -0,0 +1,80 @@ +=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 + # Meta for the response from the Get Custom Costs endpoints. + class CustomCostGetResponseMeta + include BaseGenericModel + + # Version of Custom Costs file + attr_accessor :version + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'version' => :'version' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'version' => :'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::CustomCostGetResponseMeta` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CustomCostGetResponseMeta`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'version') + self.version = attributes[:'version'] + end + 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 && + version == o.version + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [version].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_cost_list_response_meta.rb b/lib/datadog_api_client/v2/models/custom_cost_list_response_meta.rb new file mode 100644 index 000000000000..fa91569162ee --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_cost_list_response_meta.rb @@ -0,0 +1,90 @@ +=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 + # Meta for the response from the List Custom Costs endpoints. + class CustomCostListResponseMeta + include BaseGenericModel + + # Number of Custom Costs files returned by the List Custom Costs endpoint + attr_accessor :total_filtered_count + + # Version of Custom Costs file + attr_accessor :version + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'total_filtered_count' => :'total_filtered_count', + :'version' => :'version' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'total_filtered_count' => :'Integer', + :'version' => :'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::CustomCostListResponseMeta` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CustomCostListResponseMeta`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'total_filtered_count') + self.total_filtered_count = attributes[:'total_filtered_count'] + end + + if attributes.key?(:'version') + self.version = attributes[:'version'] + end + 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 && + total_filtered_count == o.total_filtered_count && + version == o.version + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [total_filtered_count, version].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_cost_upload_response_meta.rb b/lib/datadog_api_client/v2/models/custom_cost_upload_response_meta.rb new file mode 100644 index 000000000000..ddd3d4edda3f --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_cost_upload_response_meta.rb @@ -0,0 +1,80 @@ +=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 + # Meta for the response from the Upload Custom Costs endpoints. + class CustomCostUploadResponseMeta + include BaseGenericModel + + # Version of Custom Costs file + attr_accessor :version + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'version' => :'version' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'version' => :'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::CustomCostUploadResponseMeta` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CustomCostUploadResponseMeta`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'version') + self.version = attributes[:'version'] + end + 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 && + version == o.version + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [version].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_costs_file_get_response.rb b/lib/datadog_api_client/v2/models/custom_costs_file_get_response.rb new file mode 100644 index 000000000000..dd840c77c1d2 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_costs_file_get_response.rb @@ -0,0 +1,90 @@ +=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 for Get Custom Costs Files. + class CustomCostsFileGetResponse + include BaseGenericModel + + # JSON API format of for a Custom Costs file with content. + attr_accessor :data + + # Meta for the response from the Get Custom Costs endpoints. + attr_accessor :meta + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'meta' => :'meta' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'CustomCostsFileMetadataWithContentHighLevel', + :'meta' => :'CustomCostGetResponseMeta' + } + 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::CustomCostsFileGetResponse` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CustomCostsFileGetResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + end + 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 && + meta == o.meta + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, meta].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_costs_file_line_item.rb b/lib/datadog_api_client/v2/models/custom_costs_file_line_item.rb new file mode 100644 index 000000000000..bdceeee8fe80 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_costs_file_line_item.rb @@ -0,0 +1,173 @@ +=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 + # Line item details from a Custom Costs file. + class CustomCostsFileLineItem + include BaseGenericModel + + # Total cost in the cost file. + attr_accessor :billed_cost + + # Currency used in the Custom Costs file. + attr_accessor :billing_currency + + # Description for the line item cost. + attr_accessor :charge_description + + # End date of the usage charge. + attr_reader :charge_period_end + + # Start date of the usage charge. + attr_reader :charge_period_start + + # Name of the provider for the line item. + attr_accessor :provider_name + + # Additional tags for the line item. + attr_accessor :tags + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'billed_cost' => :'BilledCost', + :'billing_currency' => :'BillingCurrency', + :'charge_description' => :'ChargeDescription', + :'charge_period_end' => :'ChargePeriodEnd', + :'charge_period_start' => :'ChargePeriodStart', + :'provider_name' => :'ProviderName', + :'tags' => :'Tags' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'billed_cost' => :'Float', + :'billing_currency' => :'String', + :'charge_description' => :'String', + :'charge_period_end' => :'String', + :'charge_period_start' => :'String', + :'provider_name' => :'String', + :'tags' => :'Hash' + } + 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::CustomCostsFileLineItem` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CustomCostsFileLineItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'billed_cost') + self.billed_cost = attributes[:'billed_cost'] + end + + if attributes.key?(:'billing_currency') + self.billing_currency = attributes[:'billing_currency'] + end + + if attributes.key?(:'charge_description') + self.charge_description = attributes[:'charge_description'] + end + + if attributes.key?(:'charge_period_end') + self.charge_period_end = attributes[:'charge_period_end'] + end + + if attributes.key?(:'charge_period_start') + self.charge_period_start = attributes[:'charge_period_start'] + end + + if attributes.key?(:'provider_name') + self.provider_name = attributes[:'provider_name'] + end + + if attributes.key?(:'tags') + self.tags = attributes[:'tags'] + 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? + pattern = Regexp.new(/^\d{4}-\d{2}-\d{2}$/) + return false if !@charge_period_end.nil? && @charge_period_end !~ pattern + pattern = Regexp.new(/^\d{4}-\d{2}-\d{2}$/) + return false if !@charge_period_start.nil? && @charge_period_start !~ pattern + true + end + + # Custom attribute writer method with validation + # @param charge_period_end [Object] Object to be assigned + # @!visibility private + def charge_period_end=(charge_period_end) + pattern = Regexp.new(/^\d{4}-\d{2}-\d{2}$/) + if !charge_period_end.nil? && charge_period_end !~ pattern + fail ArgumentError, "invalid value for \"charge_period_end\", must conform to the pattern #{pattern}." + end + @charge_period_end = charge_period_end + end + + # Custom attribute writer method with validation + # @param charge_period_start [Object] Object to be assigned + # @!visibility private + def charge_period_start=(charge_period_start) + pattern = Regexp.new(/^\d{4}-\d{2}-\d{2}$/) + if !charge_period_start.nil? && charge_period_start !~ pattern + fail ArgumentError, "invalid value for \"charge_period_start\", must conform to the pattern #{pattern}." + end + @charge_period_start = charge_period_start + 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 && + billed_cost == o.billed_cost && + billing_currency == o.billing_currency && + charge_description == o.charge_description && + charge_period_end == o.charge_period_end && + charge_period_start == o.charge_period_start && + provider_name == o.provider_name && + tags == o.tags + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [billed_cost, billing_currency, charge_description, charge_period_end, charge_period_start, provider_name, tags].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_costs_file_list_response.rb b/lib/datadog_api_client/v2/models/custom_costs_file_list_response.rb new file mode 100644 index 000000000000..7af6e58d4de3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_costs_file_list_response.rb @@ -0,0 +1,92 @@ +=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 for List Custom Costs Files. + class CustomCostsFileListResponse + include BaseGenericModel + + # List of Custom Costs Files. + attr_accessor :data + + # Meta for the response from the List Custom Costs endpoints. + attr_accessor :meta + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'meta' => :'meta' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array', + :'meta' => :'CustomCostListResponseMeta' + } + 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::CustomCostsFileListResponse` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CustomCostsFileListResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + end + 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 && + meta == o.meta + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, meta].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_costs_file_metadata.rb b/lib/datadog_api_client/v2/models/custom_costs_file_metadata.rb new file mode 100644 index 000000000000..39554eee3b4d --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_costs_file_metadata.rb @@ -0,0 +1,152 @@ +=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 + # Schema of a Custom Costs metadata. + class CustomCostsFileMetadata + include BaseGenericModel + + # Total cost in the cost file. + attr_accessor :billed_cost + + # Currency used in the Custom Costs file. + attr_accessor :billing_currency + + # Usage charge period of a Custom Costs file. + attr_accessor :charge_period + + # Name of the Custom Costs file. + attr_accessor :name + + # Providers contains in the Custom Costs file. + attr_accessor :provider_names + + # Status of the Custom Costs file. + attr_accessor :status + + # Timestamp in millisecond of the upload time of the Custom Costs file. + attr_accessor :uploaded_at + + # Metadata of the user that has uploaded the Custom Costs file. + attr_accessor :uploaded_by + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'billed_cost' => :'billed_cost', + :'billing_currency' => :'billing_currency', + :'charge_period' => :'charge_period', + :'name' => :'name', + :'provider_names' => :'provider_names', + :'status' => :'status', + :'uploaded_at' => :'uploaded_at', + :'uploaded_by' => :'uploaded_by' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'billed_cost' => :'Float', + :'billing_currency' => :'String', + :'charge_period' => :'CustomCostsFileUsageChargePeriod', + :'name' => :'String', + :'provider_names' => :'Array', + :'status' => :'String', + :'uploaded_at' => :'Float', + :'uploaded_by' => :'CustomCostsUser' + } + 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::CustomCostsFileMetadata` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CustomCostsFileMetadata`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'billed_cost') + self.billed_cost = attributes[:'billed_cost'] + end + + if attributes.key?(:'billing_currency') + self.billing_currency = attributes[:'billing_currency'] + end + + if attributes.key?(:'charge_period') + self.charge_period = attributes[:'charge_period'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'provider_names') + if (value = attributes[:'provider_names']).is_a?(Array) + self.provider_names = value + end + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'uploaded_at') + self.uploaded_at = attributes[:'uploaded_at'] + end + + if attributes.key?(:'uploaded_by') + self.uploaded_by = attributes[:'uploaded_by'] + end + 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 && + billed_cost == o.billed_cost && + billing_currency == o.billing_currency && + charge_period == o.charge_period && + name == o.name && + provider_names == o.provider_names && + status == o.status && + uploaded_at == o.uploaded_at && + uploaded_by == o.uploaded_by + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [billed_cost, billing_currency, charge_period, name, provider_names, status, uploaded_at, uploaded_by].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_costs_file_metadata_high_level.rb b/lib/datadog_api_client/v2/models/custom_costs_file_metadata_high_level.rb new file mode 100644 index 000000000000..a839b4f0fb95 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_costs_file_metadata_high_level.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 'date' +require 'time' + +module DatadogAPIClient::V2 + # JSON API format of for a Custom Costs file. + class CustomCostsFileMetadataHighLevel + include BaseGenericModel + + # Schema of a Custom Costs metadata. + attr_accessor :attributes + + # ID of the Custom Costs metadata. + attr_accessor :id + + # Type of the Custom Costs file metadata. + attr_accessor :type + + # 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' => :'CustomCostsFileMetadata', + :'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::CustomCostsFileMetadataHighLevel` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CustomCostsFileMetadataHighLevel`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + 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 + + # 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 + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_costs_file_metadata_with_content.rb b/lib/datadog_api_client/v2/models/custom_costs_file_metadata_with_content.rb new file mode 100644 index 000000000000..5904521ccc2b --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_costs_file_metadata_with_content.rb @@ -0,0 +1,164 @@ +=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 + # Schema of a cost file metadata. + class CustomCostsFileMetadataWithContent + include BaseGenericModel + + # Total cost in the cost file. + attr_accessor :billed_cost + + # Currency used in the Custom Costs file. + attr_accessor :billing_currency + + # Usage charge period of a Custom Costs file. + attr_accessor :charge_period + + # Detail of the line items from the Custom Costs file. + attr_accessor :content + + # Name of the Custom Costs file. + attr_accessor :name + + # Providers contains in the Custom Costs file. + attr_accessor :provider_names + + # Status of the Custom Costs file. + attr_accessor :status + + # Timestamp in millisecond of the upload time of the Custom Costs file. + attr_accessor :uploaded_at + + # Metadata of the user that has uploaded the Custom Costs file. + attr_accessor :uploaded_by + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'billed_cost' => :'billed_cost', + :'billing_currency' => :'billing_currency', + :'charge_period' => :'charge_period', + :'content' => :'content', + :'name' => :'name', + :'provider_names' => :'provider_names', + :'status' => :'status', + :'uploaded_at' => :'uploaded_at', + :'uploaded_by' => :'uploaded_by' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'billed_cost' => :'Float', + :'billing_currency' => :'String', + :'charge_period' => :'CustomCostsFileUsageChargePeriod', + :'content' => :'Array', + :'name' => :'String', + :'provider_names' => :'Array', + :'status' => :'String', + :'uploaded_at' => :'Float', + :'uploaded_by' => :'CustomCostsUser' + } + 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::CustomCostsFileMetadataWithContent` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CustomCostsFileMetadataWithContent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'billed_cost') + self.billed_cost = attributes[:'billed_cost'] + end + + if attributes.key?(:'billing_currency') + self.billing_currency = attributes[:'billing_currency'] + end + + if attributes.key?(:'charge_period') + self.charge_period = attributes[:'charge_period'] + end + + if attributes.key?(:'content') + if (value = attributes[:'content']).is_a?(Array) + self.content = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'provider_names') + if (value = attributes[:'provider_names']).is_a?(Array) + self.provider_names = value + end + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'uploaded_at') + self.uploaded_at = attributes[:'uploaded_at'] + end + + if attributes.key?(:'uploaded_by') + self.uploaded_by = attributes[:'uploaded_by'] + end + 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 && + billed_cost == o.billed_cost && + billing_currency == o.billing_currency && + charge_period == o.charge_period && + content == o.content && + name == o.name && + provider_names == o.provider_names && + status == o.status && + uploaded_at == o.uploaded_at && + uploaded_by == o.uploaded_by + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [billed_cost, billing_currency, charge_period, content, name, provider_names, status, uploaded_at, uploaded_by].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_costs_file_metadata_with_content_high_level.rb b/lib/datadog_api_client/v2/models/custom_costs_file_metadata_with_content_high_level.rb new file mode 100644 index 000000000000..48e9d8ed8ce6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_costs_file_metadata_with_content_high_level.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 'date' +require 'time' + +module DatadogAPIClient::V2 + # JSON API format of for a Custom Costs file with content. + class CustomCostsFileMetadataWithContentHighLevel + include BaseGenericModel + + # Schema of a cost file metadata. + attr_accessor :attributes + + # ID of the Custom Costs metadata. + attr_accessor :id + + # Type of the Custom Costs file metadata. + attr_accessor :type + + # 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' => :'CustomCostsFileMetadataWithContent', + :'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::CustomCostsFileMetadataWithContentHighLevel` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CustomCostsFileMetadataWithContentHighLevel`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + 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 + + # 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 + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_costs_file_upload_response.rb b/lib/datadog_api_client/v2/models/custom_costs_file_upload_response.rb new file mode 100644 index 000000000000..0e50a253b410 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_costs_file_upload_response.rb @@ -0,0 +1,90 @@ +=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 for Uploaded Custom Costs Files. + class CustomCostsFileUploadResponse + include BaseGenericModel + + # JSON API format of for a Custom Costs file. + attr_accessor :data + + # Meta for the response from the Upload Custom Costs endpoints. + attr_accessor :meta + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'meta' => :'meta' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'CustomCostsFileMetadataHighLevel', + :'meta' => :'CustomCostUploadResponseMeta' + } + 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::CustomCostsFileUploadResponse` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CustomCostsFileUploadResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + end + 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 && + meta == o.meta + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, meta].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_costs_file_usage_charge_period.rb b/lib/datadog_api_client/v2/models/custom_costs_file_usage_charge_period.rb new file mode 100644 index 000000000000..413f2c52b919 --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_costs_file_usage_charge_period.rb @@ -0,0 +1,90 @@ +=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 + # Usage charge period of a Custom Costs file. + class CustomCostsFileUsageChargePeriod + include BaseGenericModel + + # End of the usage of the Custom Costs file. + attr_accessor :_end + + # Start of the usage of the Custom Costs file. + attr_accessor :start + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'_end' => :'end', + :'start' => :'start' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'_end' => :'Float', + :'start' => :'Float' + } + 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::CustomCostsFileUsageChargePeriod` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CustomCostsFileUsageChargePeriod`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'_end') + self._end = attributes[:'_end'] + end + + if attributes.key?(:'start') + self.start = attributes[:'start'] + end + 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 && + _end == o._end && + start == o.start + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [_end, start].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/custom_costs_user.rb b/lib/datadog_api_client/v2/models/custom_costs_user.rb new file mode 100644 index 000000000000..3c3f18dbddbb --- /dev/null +++ b/lib/datadog_api_client/v2/models/custom_costs_user.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 'date' +require 'time' + +module DatadogAPIClient::V2 + # Metadata of the user that has uploaded the Custom Costs file. + class CustomCostsUser + include BaseGenericModel + + # The name of the Custom Costs file. + attr_accessor :email + + # The name of the Custom Costs file. + attr_accessor :icon + + # Name of the user. + attr_accessor :name + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'email' => :'email', + :'icon' => :'icon', + :'name' => :'name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'email' => :'String', + :'icon' => :'String', + :'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::CustomCostsUser` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CustomCostsUser`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'icon') + self.icon = attributes[:'icon'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + 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 && + email == o.email && + icon == o.icon && + name == o.name + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [email, icon, name].hash + end + end +end