diff --git a/.apigentools-info b/.apigentools-info index cce8b2f481..07ae59627f 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.4.1.dev6", - "regenerated": "2021-05-10 15:34:45.998508", - "spec_repo_commit": "8176bfc" + "regenerated": "2021-05-11 08:04:56.875189", + "spec_repo_commit": "8d8238a" }, "v2": { "apigentools_version": "1.4.1.dev6", - "regenerated": "2021-05-10 15:35:15.650080", - "spec_repo_commit": "8176bfc" + "regenerated": "2021-05-11 08:05:25.253365", + "spec_repo_commit": "8d8238a" } } } \ No newline at end of file diff --git a/docs/v1/README.md b/docs/v1/README.md index f0d3e9bf3f..34228a1dfe 100644 --- a/docs/v1/README.md +++ b/docs/v1/README.md @@ -700,6 +700,7 @@ Class | Method | HTTP request | Description - [UsageAttributionPagination](UsageAttributionPagination.md) - [UsageAttributionResponse](UsageAttributionResponse.md) - [UsageAttributionSort](UsageAttributionSort.md) + - [UsageAttributionSupportedMetrics](UsageAttributionSupportedMetrics.md) - [UsageAttributionTagNames](UsageAttributionTagNames.md) - [UsageAttributionValues](UsageAttributionValues.md) - [UsageBillableSummaryBody](UsageBillableSummaryBody.md) diff --git a/docs/v1/UsageAttributionSupportedMetrics.md b/docs/v1/UsageAttributionSupportedMetrics.md new file mode 100644 index 0000000000..7207849d4f --- /dev/null +++ b/docs/v1/UsageAttributionSupportedMetrics.md @@ -0,0 +1,12 @@ +# UsageAttributionSupportedMetrics + +Supported fields for usage attribution requests (valid requests contain one or more metrics, or `*` for all). + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**value** | **str** | Supported fields for usage attribution requests (valid requests contain one or more metrics, or `*` for all). | must be one of ["custom_timeseries_usage", "container_usage", "snmp_percentage", "apm_host_usage", "browser_usage", "npm_host_percentage", "infra_host_usage", "custom_timeseries_percentage", "container_percentage", "lambda_usage", "api_usage", "apm_host_percentage", "infra_host_percentage", "snmp_usage", "browser_percentage", "api_percentage", "lambda_percentage", "npm_host_usage", "lambda_functions_usage", "lambda_functions_percentage", "lambda_invocations_usage", "lambda_invocations_percentage", "fargate_usage", "fargate_percentage", "profiled_host_usage", "profiled_host_percentage", "profiled_container_usage", "profiled_container_percentage", "*", ] + +[[Back to Model list]](README.md#documentation-for-models) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to README]](README.md) + + diff --git a/docs/v1/UsageMeteringApi.md b/docs/v1/UsageMeteringApi.md index 9e5942d9b6..002c8bbd95 100644 --- a/docs/v1/UsageMeteringApi.md +++ b/docs/v1/UsageMeteringApi.md @@ -653,7 +653,7 @@ with ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = usage_metering_api.UsageMeteringApi(api_client) start_month = dateutil_parser('1970-01-01T00:00:00.00Z') # datetime | Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for usage beginning in this month. Maximum of 15 months ago. - fields = "fields_example" # str | The specified field to search results for. + fields = UsageAttributionSupportedMetrics("custom_timeseries_usage") # UsageAttributionSupportedMetrics | Comma-separated list of usage types to return, or `*` for all usage types. end_month = dateutil_parser('1970-01-01T00:00:00.00Z') # datetime | Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for usage ending this month. (optional) sort_direction = UsageSortDirection("desc") # UsageSortDirection | The direction to sort by: `[desc, asc]`. (optional) sort_name = UsageAttributionSort("custom_timeseries_usage") # UsageAttributionSort | The field to sort by. (optional) @@ -682,7 +682,7 @@ with ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **start_month** | **datetime**| Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for usage beginning in this month. Maximum of 15 months ago. | - **fields** | **str**| The specified field to search results for. | + **fields** | **UsageAttributionSupportedMetrics**| Comma-separated list of usage types to return, or `*` for all usage types. | **end_month** | **datetime**| Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for usage ending this month. | [optional] **sort_direction** | **UsageSortDirection**| The direction to sort by: `[desc, asc]`. | [optional] **sort_name** | **UsageAttributionSort**| The field to sort by. | [optional] diff --git a/src/datadog_api_client/v1/api/usage_metering_api.py b/src/datadog_api_client/v1/api/usage_metering_api.py index 86c83c1f9e..c7754e365d 100644 --- a/src/datadog_api_client/v1/api/usage_metering_api.py +++ b/src/datadog_api_client/v1/api/usage_metering_api.py @@ -20,6 +20,7 @@ from datadog_api_client.v1.model.usage_analyzed_logs_response import UsageAnalyzedLogsResponse from datadog_api_client.v1.model.usage_attribution_response import UsageAttributionResponse from datadog_api_client.v1.model.usage_attribution_sort import UsageAttributionSort +from datadog_api_client.v1.model.usage_attribution_supported_metrics import UsageAttributionSupportedMetrics from datadog_api_client.v1.model.usage_billable_summary_response import UsageBillableSummaryResponse from datadog_api_client.v1.model.usage_compliance_response import UsageComplianceResponse from datadog_api_client.v1.model.usage_custom_reports_response import UsageCustomReportsResponse @@ -457,7 +458,7 @@ def __init__(self, api_client=None): "allowed_values": {}, "openapi_types": { "start_month": (datetime,), - "fields": (str,), + "fields": (UsageAttributionSupportedMetrics,), "end_month": (datetime,), "sort_direction": (UsageSortDirection,), "sort_name": (UsageAttributionSort,), @@ -1860,7 +1861,7 @@ def get_usage_attribution(self, start_month, fields, **kwargs): Args: start_month (datetime): Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for usage beginning in this month. Maximum of 15 months ago. - fields (str): The specified field to search results for. + fields (UsageAttributionSupportedMetrics): Comma-separated list of usage types to return, or `*` for all usage types. Keyword Args: end_month (datetime): Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for usage ending this month.. [optional] diff --git a/src/datadog_api_client/v1/model/usage_attribution_supported_metrics.py b/src/datadog_api_client/v1/model/usage_attribution_supported_metrics.py new file mode 100644 index 0000000000..01adfc2d66 --- /dev/null +++ b/src/datadog_api_client/v1/model/usage_attribution_supported_metrics.py @@ -0,0 +1,207 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. + + +import re # noqa: F401 +import sys # noqa: F401 + +from datadog_api_client.v1.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) + + +class UsageAttributionSupportedMetrics(ModelSimple): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + ("value",): { + "CUSTOM_TIMESERIES_USAGE": "custom_timeseries_usage", + "CONTAINER_USAGE": "container_usage", + "SNMP_PERCENTAGE": "snmp_percentage", + "APM_HOST_USAGE": "apm_host_usage", + "BROWSER_USAGE": "browser_usage", + "NPM_HOST_PERCENTAGE": "npm_host_percentage", + "INFRA_HOST_USAGE": "infra_host_usage", + "CUSTOM_TIMESERIES_PERCENTAGE": "custom_timeseries_percentage", + "CONTAINER_PERCENTAGE": "container_percentage", + "LAMBDA_USAGE": "lambda_usage", + "API_USAGE": "api_usage", + "APM_HOST_PERCENTAGE": "apm_host_percentage", + "INFRA_HOST_PERCENTAGE": "infra_host_percentage", + "SNMP_USAGE": "snmp_usage", + "BROWSER_PERCENTAGE": "browser_percentage", + "API_PERCENTAGE": "api_percentage", + "LAMBDA_PERCENTAGE": "lambda_percentage", + "NPM_HOST_USAGE": "npm_host_usage", + "LAMBDA_FUNCTIONS_USAGE": "lambda_functions_usage", + "LAMBDA_FUNCTIONS_PERCENTAGE": "lambda_functions_percentage", + "LAMBDA_INVOCATIONS_USAGE": "lambda_invocations_usage", + "LAMBDA_INVOCATIONS_PERCENTAGE": "lambda_invocations_percentage", + "FARGATE_USAGE": "fargate_usage", + "FARGATE_PERCENTAGE": "fargate_percentage", + "PROFILED_HOST_USAGE": "profiled_host_usage", + "PROFILED_HOST_PERCENTAGE": "profiled_host_percentage", + "PROFILED_CONTAINER_USAGE": "profiled_container_usage", + "PROFILED_CONTAINER_PERCENTAGE": "profiled_container_percentage", + "ALL": "*", + }, + } + + validations = {} + + additional_properties_type = None + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + "value": (str,), + } + + @cached_property + def discriminator(): + return None + + attribute_map = {} + + _composed_schemas = None + + required_properties = set( + [ + "_data_store", + "_check_type", + "_spec_property_naming", + "_path_to_item", + "_configuration", + "_visited_composed_classes", + ] + ) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): + """UsageAttributionSupportedMetrics - a model defined in OpenAPI + + Note that value can be passed either in args or in kwargs, but not in both. + + Args: + args[0] (str): Supported fields for usage attribution requests (valid requests contain one or more metrics, or `*` for all).., must be one of ["custom_timeseries_usage", "container_usage", "snmp_percentage", "apm_host_usage", "browser_usage", "npm_host_percentage", "infra_host_usage", "custom_timeseries_percentage", "container_percentage", "lambda_usage", "api_usage", "apm_host_percentage", "infra_host_percentage", "snmp_usage", "browser_percentage", "api_percentage", "lambda_percentage", "npm_host_usage", "lambda_functions_usage", "lambda_functions_percentage", "lambda_invocations_usage", "lambda_invocations_percentage", "fargate_usage", "fargate_percentage", "profiled_host_usage", "profiled_host_percentage", "profiled_container_usage", "profiled_container_percentage", "*", ] # noqa: E501 + + Keyword Args: + value (str): Supported fields for usage attribution requests (valid requests contain one or more metrics, or `*` for all).., must be one of ["custom_timeseries_usage", "container_usage", "snmp_percentage", "apm_host_usage", "browser_usage", "npm_host_percentage", "infra_host_usage", "custom_timeseries_percentage", "container_percentage", "lambda_usage", "api_usage", "apm_host_percentage", "infra_host_percentage", "snmp_usage", "browser_percentage", "api_percentage", "lambda_percentage", "npm_host_usage", "lambda_functions_usage", "lambda_functions_percentage", "lambda_invocations_usage", "lambda_invocations_percentage", "fargate_usage", "fargate_percentage", "profiled_host_usage", "profiled_host_percentage", "profiled_container_usage", "profiled_container_percentage", "*", ] # noqa: E501 + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + # required up here when default value is not given + _path_to_item = kwargs.pop("_path_to_item", ()) + + if "value" in kwargs: + value = kwargs.pop("value") + elif args: + args = list(args) + value = args.pop(0) + else: + raise ApiTypeError( + "value is required, but not passed in args or kwargs and doesn't have default", + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + _check_type = kwargs.pop("_check_type", True) + _spec_property_naming = kwargs.pop("_spec_property_naming", False) + _configuration = kwargs.pop("_configuration", None) + _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." + % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + self.value = value + if kwargs: + raise ApiTypeError( + "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." + % ( + kwargs, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) diff --git a/src/datadog_api_client/v1/models/__init__.py b/src/datadog_api_client/v1/models/__init__.py index c567036fc3..0486feedd2 100644 --- a/src/datadog_api_client/v1/models/__init__.py +++ b/src/datadog_api_client/v1/models/__init__.py @@ -469,6 +469,7 @@ from datadog_api_client.v1.model.usage_attribution_pagination import UsageAttributionPagination from datadog_api_client.v1.model.usage_attribution_response import UsageAttributionResponse from datadog_api_client.v1.model.usage_attribution_sort import UsageAttributionSort +from datadog_api_client.v1.model.usage_attribution_supported_metrics import UsageAttributionSupportedMetrics from datadog_api_client.v1.model.usage_attribution_tag_names import UsageAttributionTagNames from datadog_api_client.v1.model.usage_attribution_values import UsageAttributionValues from datadog_api_client.v1.model.usage_billable_summary_body import UsageBillableSummaryBody diff --git a/src/datadog_api_client/v1/openapi.yaml b/src/datadog_api_client/v1/openapi.yaml index 18cf7d4d92..82713bc7ec 100644 --- a/src/datadog_api_client/v1/openapi.yaml +++ b/src/datadog_api_client/v1/openapi.yaml @@ -9465,6 +9465,70 @@ components: - LAMBDA_INVOCATIONS_PERCENTAGE - LAMBDA_USAGE - LAMBDA_PERCENTAGE + UsageAttributionSupportedMetrics: + description: Supported fields for usage attribution requests (valid requests + contain one or more metrics, or `*` for all). + enum: + - custom_timeseries_usage + - container_usage + - snmp_percentage + - apm_host_usage + - browser_usage + - npm_host_percentage + - infra_host_usage + - custom_timeseries_percentage + - container_percentage + - lambda_usage + - api_usage + - apm_host_percentage + - infra_host_percentage + - snmp_usage + - browser_percentage + - api_percentage + - lambda_percentage + - npm_host_usage + - lambda_functions_usage + - lambda_functions_percentage + - lambda_invocations_usage + - lambda_invocations_percentage + - fargate_usage + - fargate_percentage + - profiled_host_usage + - profiled_host_percentage + - profiled_container_usage + - profiled_container_percentage + - '*' + type: string + x-enum-varnames: + - CUSTOM_TIMESERIES_USAGE + - CONTAINER_USAGE + - SNMP_PERCENTAGE + - APM_HOST_USAGE + - BROWSER_USAGE + - NPM_HOST_PERCENTAGE + - INFRA_HOST_USAGE + - CUSTOM_TIMESERIES_PERCENTAGE + - CONTAINER_PERCENTAGE + - LAMBDA_USAGE + - API_USAGE + - APM_HOST_PERCENTAGE + - INFRA_HOST_PERCENTAGE + - SNMP_USAGE + - BROWSER_PERCENTAGE + - API_PERCENTAGE + - LAMBDA_PERCENTAGE + - NPM_HOST_USAGE + - LAMBDA_FUNCTIONS_USAGE + - LAMBDA_FUNCTIONS_PERCENTAGE + - LAMBDA_INVOCATIONS_USAGE + - LAMBDA_INVOCATIONS_PERCENTAGE + - FARGATE_USAGE + - FARGATE_PERCENTAGE + - PROFILED_HOST_USAGE + - PROFILED_HOST_PERCENTAGE + - PROFILED_CONTAINER_USAGE + - PROFILED_CONTAINER_PERCENTAGE + - ALL UsageAttributionTagNames: additionalProperties: description: A list of tag values. @@ -18931,12 +18995,13 @@ paths: schema: format: date-time type: string - - description: The specified field to search results for. + - description: Comma-separated list of usage types to return, or `*` for all + usage types. in: query name: fields required: true schema: - type: string + $ref: '#/components/schemas/UsageAttributionSupportedMetrics' - description: 'Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for usage ending this month.' in: query diff --git a/tests/v1/test_usage_attribution_supported_metrics.py b/tests/v1/test_usage_attribution_supported_metrics.py new file mode 100644 index 0000000000..6c99f66e9e --- /dev/null +++ b/tests/v1/test_usage_attribution_supported_metrics.py @@ -0,0 +1,30 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. + + +import sys +import unittest + +import datadog_api_client.v1 +from datadog_api_client.v1.model.usage_attribution_supported_metrics import UsageAttributionSupportedMetrics + + +class TestUsageAttributionSupportedMetrics(unittest.TestCase): + """UsageAttributionSupportedMetrics unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testUsageAttributionSupportedMetrics(self): + """Test UsageAttributionSupportedMetrics""" + # FIXME: construct object with mandatory attributes with example values + # model = UsageAttributionSupportedMetrics() # noqa: E501 + pass + + +if __name__ == "__main__": + unittest.main()