Sha256: e8a2ee10435c8975857170ba3b77a159f656c912d0b1cff2579a0a2821fd96b3

Contents?: true

Size: 1.5 KB

Versions: 10

Compression:

Stored size: 1.5 KB

Contents

# {{ scenario.name|wordwrap(width=120)}}
{%- set parameters, opts = format_parameters(context.api_request.kwargs, operation_spec, replace_values=context._replace_values, has_body=context.body) %}
{%- if context.body %}
{%- set body = format_data_with_schema(context.body.value, context.api_request.schema.spec, name_prefix="DatadogAPIClient::{}::".format(version.upper()), replace_values=context._replace_values)%}
{%- endif %}

require 'datadog_api_client'
{%- if context._enable_operations %}
DatadogAPIClient::V2.configure do |config|
{%- for operation in context._enable_operations %}
  config.unstable_operations["{{ version }}.{{ operation|snake_case }}".to_sym] = true
{%- endfor %}
end
{%- endif %}
api_instance = DatadogAPIClient::{{ version.upper() }}::{{ context.api_instance.name }}API.new

{%- for name, values in context._given.items() %}

# {{ name }}
{%- for value in values|sort %}
{{ value }} = ENV["{{ value }}"]
{%- endfor %}
{%- endfor %}

{%- if context.body %}

body = {{ body }}
{%- endif %}
{%- if opts %}
opts = {
{%- for key, value in opts.items()  %}
    {{ key }}: {{ value }},
{%- endfor %}
}
{%- endif %}

{%- if context.pagination %}
api_instance.{{ context.api_request.operation_id|snake_case }}_with_pagination({{ parameters }}) { |item| puts item }
{%- else %}
{%- if context.status_code != 204 %}
p api_instance.{{ context.api_request.operation_id|snake_case }}({{ parameters }})
{%- else %}
api_instance.{{ context.api_request.operation_id|snake_case }}({{ parameters }})
{%- endif %}
{%- endif %}

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
datadog_api_client-2.9.0 .generator/src/generator/templates/example.j2
datadog_api_client-2.8.0 .generator/src/generator/templates/example.j2
datadog_api_client-2.7.0 .generator/src/generator/templates/example.j2
datadog_api_client-2.6.0 .generator/src/generator/templates/example.j2
datadog_api_client-2.5.0 .generator/src/generator/templates/example.j2
datadog_api_client-2.4.0 .generator/src/generator/templates/example.j2
datadog_api_client-2.3.0 .generator/src/generator/templates/example.j2
datadog_api_client-2.2.0 .generator/src/generator/templates/example.j2
datadog_api_client-2.1.0 .generator/src/generator/templates/example.j2
datadog_api_client-2.0.2 .generator/src/generator/templates/example.j2