Skip to content

Commit 5b16546

Browse files
authored
Add deprecation warnings to API and models (#1111)
* Add deprecation warnings to API and models * Fix oneOf doc
1 parent a70312c commit 5b16546

File tree

56 files changed

+97
-44
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+97
-44
lines changed

.generator/src/generator/templates/api.j2

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ module {{ module_name }}::{{ version|upper }}
3131
{{ operation.description|block_comment|indent(4) }}
3232
#
3333
{%- endif %}
34+
{%- if operation.deprecated %}
35+
# @deprecated This API is deprecated.
36+
#
37+
{%- endif %}
3438
{%- for name, parameter in operation|parameters if parameter.required %}
3539
# @param {{ name|attribute_name }} [{{ get_type_for_parameter(parameter) }}] {{ parameter.get("description", "").replace('\n', ' ') }}
3640
{%- endfor %}
@@ -40,6 +44,9 @@ module {{ module_name }}::{{ version|upper }}
4044
{%- endfor %}
4145
# @return [Array<({% if returnType %}{{ returnType }}{% else %}nil{% endif %}, Integer, Hash)>] {% if returnType %}{{ returnType }} data{% else %}nil{% endif %}, response status code and response headers
4246
def {{ operation.operationId|snake_case }}_with_http_info({% for name, parameter in operation|parameters if parameter.required %}{{ name|attribute_name }}, {% endfor %}opts = {})
47+
{%- if operation.deprecated %}
48+
warn "[DEPRECATION] `{{ operation.operationId }}` is deprecated."
49+
{%- endif %}
4350
{%- if "x-unstable" in operation %}
4451
unstable_enabled = @api_client.config.unstable_operations["{{ version }}.{{ operation.operationId|snake_case }}".to_sym]
4552
if unstable_enabled

.generator/src/generator/templates/model.j2

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ require 'time'
77

88
module {{ module_name }}::{{ version|upper }}
99
# {{ model.description.rstrip()|replace('\n', '\n# ')|indent(2) }}
10+
{%- if model.deprecated %}
11+
#
12+
# @deprecated This model is deprecated.
13+
{%- endif %}
1014
{% if "enum" in model -%}
1115
{% include "model_enum.j2" %}
1216
{%- elif "oneOf" in model -%}

.generator/src/generator/templates/model_generic.j2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@
4848
# @param attributes [Hash] Model attributes in the form of hash
4949
# @!visibility private
5050
def initialize(attributes = {})
51+
{%- if model.deprecated %}
52+
warn "[DEPRECATION] `{{ name }}` is deprecated."
53+
{%- endif %}
5154
if (!attributes.is_a?(Hash))
5255
fail ArgumentError, "The input argument (attributes) must be a hash in `{{ module_name }}::{{ version|upper }}::{{ name }}` initialize method"
5356
end

.generator/src/generator/templates/model_oneof.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#}
4040
{%- endif %}
4141
# Builds the object
42-
# @param [Mixed] Data to be matched against the list of oneOf items
42+
# @param data [Mixed] Data to be matched against the list of oneOf items
4343
# @return [Object] Returns the model or the data itself
4444
def build(data)
4545
{%- if model.discriminator %}

lib/datadog_api_client/v1/api/logs_api.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,15 @@ def submit_log(body, opts = {})
128128
# - 413: Payload too large (batch is above 5MB uncompressed)
129129
# - 5xx: Internal error, request should be retried after some time
130130
#
131+
# @deprecated This API is deprecated.
132+
#
131133
# @param body [Array<HTTPLogItem>] Log to send (JSON format).
132134
# @param opts [Hash] the optional parameters
133135
# @option opts [ContentEncoding] :content_encoding HTTP header used to compress the media-type.
134136
# @option opts [String] :ddtags Log tags can be passed as query parameters with `text/plain` content type.
135137
# @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
136138
def submit_log_with_http_info(body, opts = {})
139+
warn "[DEPRECATION] `SubmitLog` is deprecated."
137140

138141
if @api_client.config.debugging
139142
@api_client.config.logger.debug 'Calling API: LogsAPI.submit_log ...'

lib/datadog_api_client/v1/api/usage_metering_api.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,16 @@ def get_daily_custom_reports(opts = {})
3737
# **Note:** This endpoint will be fully deprecated on December 1, 2022.
3838
# Refer to [Migrating from v1 to v2 of the Usage Attribution API](https://docs.datadoghq.com/account_management/guide/usage-attribution-migration/) for the associated migration guide.
3939
#
40+
# @deprecated This API is deprecated.
41+
#
4042
# @param opts [Hash] the optional parameters
4143
# @option opts [Integer] :page_size The number of files to return in the response. `[default=60]`.
4244
# @option opts [Integer] :page_number The identifier of the first page to return. This parameter is used for the pagination feature `[default=0]`.
4345
# @option opts [UsageSortDirection] :sort_dir The direction to sort by: `[desc, asc]`.
4446
# @option opts [UsageSort] :sort The field to sort by: `[computed_on, size, start_date, end_date]`.
4547
# @return [Array<(UsageCustomReportsResponse, Integer, Hash)>] UsageCustomReportsResponse data, response status code and response headers
4648
def get_daily_custom_reports_with_http_info(opts = {})
49+
warn "[DEPRECATION] `GetDailyCustomReports` is deprecated."
4750

4851
if @api_client.config.debugging
4952
@api_client.config.logger.debug 'Calling API: UsageMeteringAPI.get_daily_custom_reports ...'
@@ -352,13 +355,16 @@ def get_monthly_custom_reports(opts = {})
352355
# **Note:** This endpoint will be fully deprecated on December 1, 2022.
353356
# Refer to [Migrating from v1 to v2 of the Usage Attribution API](https://docs.datadoghq.com/account_management/guide/usage-attribution-migration/) for the associated migration guide.
354357
#
358+
# @deprecated This API is deprecated.
359+
#
355360
# @param opts [Hash] the optional parameters
356361
# @option opts [Integer] :page_size The number of files to return in the response `[default=60].`
357362
# @option opts [Integer] :page_number The identifier of the first page to return. This parameter is used for the pagination feature `[default=0]`.
358363
# @option opts [UsageSortDirection] :sort_dir The direction to sort by: `[desc, asc]`.
359364
# @option opts [UsageSort] :sort The field to sort by: `[computed_on, size, start_date, end_date]`.
360365
# @return [Array<(UsageCustomReportsResponse, Integer, Hash)>] UsageCustomReportsResponse data, response status code and response headers
361366
def get_monthly_custom_reports_with_http_info(opts = {})
367+
warn "[DEPRECATION] `GetMonthlyCustomReports` is deprecated."
362368

363369
if @api_client.config.debugging
364370
@api_client.config.logger.debug 'Calling API: UsageMeteringAPI.get_monthly_custom_reports ...'
@@ -541,10 +547,13 @@ def get_specified_daily_custom_reports(report_id, opts = {})
541547
# **Note:** This endpoint will be fully deprecated on December 1, 2022.
542548
# Refer to [Migrating from v1 to v2 of the Usage Attribution API](https://docs.datadoghq.com/account_management/guide/usage-attribution-migration/) for the associated migration guide.
543549
#
550+
# @deprecated This API is deprecated.
551+
#
544552
# @param report_id [String] Date of the report in the format `YYYY-MM-DD`.
545553
# @param opts [Hash] the optional parameters
546554
# @return [Array<(UsageSpecifiedCustomReportsResponse, Integer, Hash)>] UsageSpecifiedCustomReportsResponse data, response status code and response headers
547555
def get_specified_daily_custom_reports_with_http_info(report_id, opts = {})
556+
warn "[DEPRECATION] `GetSpecifiedDailyCustomReports` is deprecated."
548557

549558
if @api_client.config.debugging
550559
@api_client.config.logger.debug 'Calling API: UsageMeteringAPI.get_specified_daily_custom_reports ...'
@@ -608,10 +617,13 @@ def get_specified_monthly_custom_reports(report_id, opts = {})
608617
# **Note:** This endpoint will be fully deprecated on December 1, 2022.
609618
# Refer to [Migrating from v1 to v2 of the Usage Attribution API](https://docs.datadoghq.com/account_management/guide/usage-attribution-migration/) for the associated migration guide.
610619
#
620+
# @deprecated This API is deprecated.
621+
#
611622
# @param report_id [String] Date of the report in the format `YYYY-MM-DD`.
612623
# @param opts [Hash] the optional parameters
613624
# @return [Array<(UsageSpecifiedCustomReportsResponse, Integer, Hash)>] UsageSpecifiedCustomReportsResponse data, response status code and response headers
614625
def get_specified_monthly_custom_reports_with_http_info(report_id, opts = {})
626+
warn "[DEPRECATION] `GetSpecifiedMonthlyCustomReports` is deprecated."
615627

616628
if @api_client.config.debugging
617629
@api_client.config.logger.debug 'Calling API: UsageMeteringAPI.get_specified_monthly_custom_reports ...'
@@ -744,6 +756,8 @@ def get_usage_attribution(start_month, fields, opts = {})
744756
# **Note:** This endpoint will be fully deprecated on December 1, 2022.
745757
# Refer to [Migrating from v1 to v2 of the Usage Attribution API](https://docs.datadoghq.com/account_management/guide/usage-attribution-migration/) for the associated migration guide.
746758
#
759+
# @deprecated This API is deprecated.
760+
#
747761
# @param start_month [Time] Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for usage beginning in this month. Maximum of 15 months ago.
748762
# @param fields [UsageAttributionSupportedMetrics] Comma-separated list of usage types to return, or `*` for all usage types.
749763
# @param opts [Hash] the optional parameters
@@ -755,6 +769,7 @@ def get_usage_attribution(start_month, fields, opts = {})
755769
# @option opts [Integer] :limit Maximum number of records to be returned.
756770
# @return [Array<(UsageAttributionResponse, Integer, Hash)>] UsageAttributionResponse data, response status code and response headers
757771
def get_usage_attribution_with_http_info(start_month, fields, opts = {})
772+
warn "[DEPRECATION] `GetUsageAttribution` is deprecated."
758773

759774
if @api_client.config.debugging
760775
@api_client.config.logger.debug 'Calling API: UsageMeteringAPI.get_usage_attribution ...'
@@ -2426,11 +2441,14 @@ def get_usage_synthetics(start_hr, opts = {})
24262441
# Get hourly usage for [synthetics checks](https://docs.datadoghq.com/synthetics/).
24272442
# **Note:** hourly usage data for all products is now available in the [Get hourly usage by product family API](https://docs.datadoghq.com/api/latest/usage-metering/#get-hourly-usage-by-product-family). Refer to [Migrating from the V1 Hourly Usage APIs to V2](https://docs.datadoghq.com/account_management/guide/hourly-usage-migration/) for the associated migration guide.
24282443
#
2444+
# @deprecated This API is deprecated.
2445+
#
24292446
# @param start_hr [Time] Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.
24302447
# @param opts [Hash] the optional parameters
24312448
# @option opts [Time] :end_hr Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending **before** this hour.
24322449
# @return [Array<(UsageSyntheticsResponse, Integer, Hash)>] UsageSyntheticsResponse data, response status code and response headers
24332450
def get_usage_synthetics_with_http_info(start_hr, opts = {})
2451+
warn "[DEPRECATION] `GetUsageSynthetics` is deprecated."
24342452

24352453
if @api_client.config.debugging
24362454
@api_client.config.logger.debug 'Calling API: UsageMeteringAPI.get_usage_synthetics ...'

lib/datadog_api_client/v1/models/distribution_point_item.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def openapi_one_of
3131
]
3232
end
3333
# Builds the object
34-
# @param [Mixed] Data to be matched against the list of oneOf items
34+
# @param data [Mixed] Data to be matched against the list of oneOf items
3535
# @return [Object] Returns the model or the data itself
3636
def build(data)
3737
# Go through the list of oneOf items and attempt to identify the appropriate one.

lib/datadog_api_client/v1/models/distribution_widget_histogram_request_query.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def openapi_one_of
3232
]
3333
end
3434
# Builds the object
35-
# @param [Mixed] Data to be matched against the list of oneOf items
35+
# @param data [Mixed] Data to be matched against the list of oneOf items
3636
# @return [Object] Returns the model or the data itself
3737
def build(data)
3838
# Go through the list of oneOf items and attempt to identify the appropriate one.

lib/datadog_api_client/v1/models/formula_and_function_query_definition.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def openapi_one_of
3434
]
3535
end
3636
# Builds the object
37-
# @param [Mixed] Data to be matched against the list of oneOf items
37+
# @param data [Mixed] Data to be matched against the list of oneOf items
3838
# @return [Object] Returns the model or the data itself
3939
def build(data)
4040
# Go through the list of oneOf items and attempt to identify the appropriate one.

lib/datadog_api_client/v1/models/logs_processor.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def openapi_one_of
4444
]
4545
end
4646
# Builds the object
47-
# @param [Mixed] Data to be matched against the list of oneOf items
47+
# @param data [Mixed] Data to be matched against the list of oneOf items
4848
# @return [Object] Returns the model or the data itself
4949
def build(data)
5050
# Go through the list of oneOf items and attempt to identify the appropriate one.

0 commit comments

Comments
 (0)