Skip to content

Commit 33d024f

Browse files
committed
implement timestamp template helpers
1 parent 49d755a commit 33d024f

File tree

1,347 files changed

+6079
-892
lines changed

Some content is hidden

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

1,347 files changed

+6079
-892
lines changed

.generator/src/generator/templates/function_mappings.j2

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,19 @@ pub fn collect_function_calls(world: &mut DatadogWorld) {
5454
fn test_{{version}}_{{ operation['operationId'] | snake_case }}(world: &mut DatadogWorld, _parameters: &HashMap<String, Value>) {
5555
let api = world.api_instances.{{version}}_{{ apiName }}.as_ref().expect("api instance not found");
5656
{%- if operationParams|length > 0 -%}
57+
{%- for parameter in operationParams %}
58+
{%- if parameter[1].required %}
59+
let {{ parameter[0] | variable_name }} = serde_json::from_value(_parameters.get("{{ parameter[0] }}").unwrap().clone()).unwrap();
60+
{%- else %}
61+
let {{ parameter[0] | variable_name }} = match _parameters.get("{{ parameter[0] }}").is_some() {
62+
true => serde_json::from_value(_parameters.get("{{ parameter[0] }}").unwrap().clone()).unwrap(),
63+
false => None,
64+
};
65+
{%- endif %}
66+
{%- endfor %}
5767
let params = datadog{{ version.upper() }}::api::{{ apiName }}::{{ operation['operationId'] }}Params {
5868
{%- for param in operationParams %}
59-
{{ param[0] | variable_name }}: serde_json::from_value(_parameters.get("{{ param[0] }}").unwrap().clone()).unwrap(),
69+
{{ param[0] | variable_name }},
6070
{%- endfor %}
6171
};
6272
let response = match block_on(api.{{ operation['operationId'] | snake_case}}_with_http_info(params)) {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2022-01-06T00:50:20.672Z
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"http_interactions": [{"request": {"body": "", "headers": {"Accept": ["application/json"]}, "method": "get", "uri": "https://api.datadoghq.com/api/v1/validate"}, "response": {"body": {"string": "{\"errors\":[\"API key required\"]}", "encoding": null}, "headers": {"Content-Type": ["application/json"]}, "status": {"code": 403, "message": "Forbidden"}}, "recorded_at": "Thu, 06 Jan 2022 00:50:20 GMT"}], "recorded_with": "VCR 6.0.0"}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2022-01-06T00:50:20.920Z
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"http_interactions": [{"request": {"body": "", "headers": {"Accept": ["application/json"]}, "method": "get", "uri": "https://api.datadoghq.com/api/v1/validate"}, "response": {"body": {"string": "{\"valid\":true}", "encoding": null}, "headers": {"Content-Type": ["application/json"]}, "status": {"code": 200, "message": "OK"}}, "recorded_at": "Thu, 06 Jan 2022 00:50:20 GMT"}], "recorded_with": "VCR 6.0.0"}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2022-05-17T15:38:07.190Z
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"http_interactions": [{"request": {"body": {"string": "{\"account_id\":\"123456789012\",\"account_specific_namespace_rules\":{\"auto_scaling\":false},\"cspm_resource_collection_enabled\":true,\"excluded_regions\":[\"us-east-1\",\"us-west-2\"],\"filter_tags\":[\"$KEY:$VALUE\"],\"host_tags\":[\"$KEY:$VALUE\"],\"metrics_collection_enabled\":false,\"resource_collection_enabled\":true,\"role_name\":\"datadog-role\"}", "encoding": null}, "headers": {"Accept": ["application/json"], "Content-Type": ["application/json"]}, "method": "put", "uri": "https://api.datadoghq.com/api/v1/integration/aws?account_id=123456789012&role_name=datadog-role"}, "response": {"body": {"string": "{}", "encoding": null}, "headers": {"Content-Type": ["application/json;charset=utf-8"]}, "status": {"code": 200, "message": "OK"}}, "recorded_at": "Tue, 17 May 2022 15:38:07 GMT"}], "recorded_with": "VCR 6.0.0"}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2022-01-06T00:50:21.238Z
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"http_interactions": [{"request": {"body": {"string": "{\"name\":\"Test-Create_a_dashboard_list_returns_OK_response-1641430221\"}", "encoding": null}, "headers": {"Accept": ["application/json"], "Content-Type": ["application/json"]}, "method": "post", "uri": "https://api.datadoghq.com/api/v1/dashboard/lists/manual"}, "response": {"body": {"string": "{\"is_favorite\":false,\"name\":\"Test-Create_a_dashboard_list_returns_OK_response-1641430221\",\"dashboard_count\":0,\"author\":{\"handle\":\"[email protected]\",\"name\":null},\"created\":\"2022-01-06T00:50:21.382205+00:00\",\"type\":\"manual_dashboard_list\",\"dashboards\":null,\"modified\":\"2022-01-06T00:50:21.382231+00:00\",\"id\":269879}", "encoding": null}, "headers": {"Content-Type": ["application/json"]}, "status": {"code": 200, "message": "OK"}}, "recorded_at": "Thu, 06 Jan 2022 00:50:21 GMT"}, {"request": {"body": "", "headers": {"Accept": ["application/json"]}, "method": "delete", "uri": "https://api.datadoghq.com/api/v1/dashboard/lists/manual/269879"}, "response": {"body": {"string": "{\"deleted_dashboard_list_id\":269879}", "encoding": null}, "headers": {"Content-Type": ["application/json"]}, "status": {"code": 200, "message": "OK"}}, "recorded_at": "Thu, 06 Jan 2022 00:50:21 GMT"}], "recorded_with": "VCR 6.0.0"}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2022-01-06T00:50:21.689Z

0 commit comments

Comments
 (0)