Sha256: b77e5a3f299b5f7ee80cb65b2e456b4cbca10fab4b1fddef9a5c0ab34f973198

Contents?: true

Size: 1.5 KB

Versions: 1

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.configure do |config|
{%- for operation in context._enable_operations|sort %}
  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

1 entries across 1 versions & 1 rubygems

Version Path
datadog_api_client-2.29.1 .generator/src/generator/templates/example.j2