Sha256: b8ddac76c6ac79b44bb30b5d1627d3ef139e2bf469fd13bd826673e11d5d9a27

Contents?: true

Size: 1.33 KB

Versions: 2

Compression:

Stored size: 1.33 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.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

2 entries across 2 versions & 1 rubygems

Version Path
datadog_api_client-2.0.1 .generator/src/generator/templates/example.j2
datadog_api_client-2.0.0 .generator/src/generator/templates/example.j2