Skip to content

Enumerate accepted values for fields parameter in usage attr requests #428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
1 change: 1 addition & 0 deletions docs/v1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 12 additions & 0 deletions docs/v1/UsageAttributionSupportedMetrics.md
Original file line number Diff line number Diff line change
@@ -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)


4 changes: 2 additions & 2 deletions docs/v1/UsageMeteringApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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]
Expand Down
5 changes: 3 additions & 2 deletions src/datadog_api_client/v1/api/usage_metering_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,),
Expand Down Expand Up @@ -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]
Expand Down
Original file line number Diff line number Diff line change
@@ -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__,),
)
1 change: 1 addition & 0 deletions src/datadog_api_client/v1/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
69 changes: 67 additions & 2 deletions src/datadog_api_client/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
Loading