Sha256: c27864c085a2b67e1a42bb8791bc19c19c5894961f81b43bee932d6b19d9f3d4

Contents?: true

Size: 1.31 KB

Versions: 3

Compression:

Stored size: 1.31 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[:{{ operation|snake_case }}] = 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.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 %}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
datadog_api_client-1.11.0 .generator/src/generator/templates/example.j2
datadog_api_client-1.10.0 .generator/src/generator/templates/example.j2
datadog_api_client-1.9.0 .generator/src/generator/templates/example.j2