Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document author_name in dashboard response #1130

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.5.1.dev2",
"regenerated": "2022-01-03 15:42:03.948955",
"spec_repo_commit": "e29fa5e"
"regenerated": "2022-01-03 20:48:48.986916",
"spec_repo_commit": "4c3cdd2"
},
"v2": {
"apigentools_version": "1.5.1.dev2",
"regenerated": "2022-01-03 15:42:04.928099",
"spec_repo_commit": "e29fa5e"
"regenerated": "2022-01-03 20:48:49.791118",
"spec_repo_commit": "4c3cdd2"
}
}
}
6 changes: 6 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,12 @@ components:
example: test@datadoghq.com
readOnly: true
type: string
author_name:
description: Name of the dashboard author.
example: John Doe
nullable: true
readOnly: true
type: string
created_at:
description: Creation date of the dashboard.
format: date-time
Expand Down
1 change: 1 addition & 0 deletions api_docs/v1/Dashboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ A dashboard is Datadog’s tool for visually tracking, analyzing, and displaying
| Name | Type | Description | Notes |
| --------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
| **authorHandle** | **String** | Identifier of the dashboard author. | [optional] [readonly] |
| **authorName** | **String** | Name of the dashboard author. | [optional] [readonly] |
| **createdAt** | **OffsetDateTime** | Creation date of the dashboard. | [optional] [readonly] |
| **description** | **String** | Description of the dashboard. | [optional] |
| **id** | **String** | ID of the dashboard. | [optional] [readonly] |
Expand Down
30 changes: 30 additions & 0 deletions examples/v1/dashboards/GetDashboard_4262333854.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Get a dashboard returns 'author_name'

import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.api.DashboardsApi;
import com.datadog.api.v1.client.model.Dashboard;
import java.time.*;
import java.util.*;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
DashboardsApi apiInstance = new DashboardsApi(defaultClient);

// there is a valid "dashboard" in the system
String DASHBOARD_ID = System.getenv("DASHBOARD_ID");

try {
Dashboard result = apiInstance.getDashboard(DASHBOARD_ID);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DashboardsApi#getDashboard");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
34 changes: 34 additions & 0 deletions src/main/java/com/datadog/api/v1/client/model/Dashboard.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
+ " infrastructure.")
@JsonPropertyOrder({
Dashboard.JSON_PROPERTY_AUTHOR_HANDLE,
Dashboard.JSON_PROPERTY_AUTHOR_NAME,
Dashboard.JSON_PROPERTY_CREATED_AT,
Dashboard.JSON_PROPERTY_DESCRIPTION,
Dashboard.JSON_PROPERTY_ID,
Expand All @@ -55,6 +56,9 @@ public class Dashboard {
public static final String JSON_PROPERTY_AUTHOR_HANDLE = "author_handle";
private String authorHandle;

public static final String JSON_PROPERTY_AUTHOR_NAME = "author_name";
private JsonNullable<String> authorName = JsonNullable.<String>undefined();

public static final String JSON_PROPERTY_CREATED_AT = "created_at";
private OffsetDateTime createdAt;

Expand Down Expand Up @@ -126,6 +130,33 @@ public String getAuthorHandle() {
return authorHandle;
}

/**
* Name of the dashboard author.
*
* @return authorName
*/
@javax.annotation.Nullable
@ApiModelProperty(example = "John Doe", value = "Name of the dashboard author.")
@JsonIgnore
public String getAuthorName() {

if (authorName == null) {
authorName = JsonNullable.<String>undefined();
}
return authorName.orElse(null);
}

@JsonProperty(JSON_PROPERTY_AUTHOR_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable<String> getAuthorName_JsonNullable() {
return authorName;
}

@JsonProperty(JSON_PROPERTY_AUTHOR_NAME)
private void setAuthorName_JsonNullable(JsonNullable<String> authorName) {
this.authorName = authorName;
}

/**
* Creation date of the dashboard.
*
Expand Down Expand Up @@ -534,6 +565,7 @@ public boolean equals(Object o) {
}
Dashboard dashboard = (Dashboard) o;
return Objects.equals(this.authorHandle, dashboard.authorHandle)
&& Objects.equals(this.authorName, dashboard.authorName)
&& Objects.equals(this.createdAt, dashboard.createdAt)
&& Objects.equals(this.description, dashboard.description)
&& Objects.equals(this.id, dashboard.id)
Expand All @@ -554,6 +586,7 @@ public boolean equals(Object o) {
public int hashCode() {
return Objects.hash(
authorHandle,
authorName,
createdAt,
description,
id,
Expand All @@ -575,6 +608,7 @@ public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Dashboard {\n");
sb.append(" authorHandle: ").append(toIndentedString(authorHandle)).append("\n");
sb.append(" authorName: ").append(toIndentedString(authorName)).append("\n");
sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n");
sb.append(" description: ").append(toIndentedString(description)).append("\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2021-12-30T21:04:23.650Z
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
[
{
"httpRequest": {
"body": {
"type": "JSON",
"json": "{\"layout_type\":\"ordered\",\"title\":\"Test-Get_a_dashboard_returns_author_name_-1640898263 with Profile Metrics Query\",\"widgets\":[{\"definition\":{\"requests\":[{\"profile_metrics_query\":{\"compute\":{\"aggregation\":\"sum\",\"facet\":\"@prof_core_cpu_cores\"},\"group_by\":[{\"facet\":\"service\",\"limit\":10,\"sort\":{\"aggregation\":\"sum\",\"facet\":\"@prof_core_cpu_cores\",\"order\":\"desc\"}}],\"search\":{\"query\":\"runtime:jvm\"}}}],\"type\":\"timeseries\"}}]}"
},
"headers": {
"JAVA-TEST-NAME": [
"Get_a_dashboard_returns_author_name_"
]
},
"method": "POST",
"path": "/api/v1/dashboard",
"keepAlive": false,
"secure": true
},
"httpResponse": {
"body": "{\"notify_list\":null,\"description\":null,\"restricted_roles\":[],\"author_name\":null,\"template_variables\":null,\"is_read_only\":false,\"id\":\"xb2-jve-hxz\",\"title\":\"Test-Get_a_dashboard_returns_author_name_-1640898263 with Profile Metrics Query\",\"url\":\"/dashboard/xb2-jve-hxz/test-getadashboardreturnsauthorname-1640898263-with-profile-metrics-query\",\"created_at\":\"2021-12-30T21:04:23.947661+00:00\",\"modified_at\":\"2021-12-30T21:04:23.947661+00:00\",\"author_handle\":\"frog@datadoghq.com\",\"widgets\":[{\"definition\":{\"requests\":[{\"profile_metrics_query\":{\"search\":{\"query\":\"runtime:jvm\"},\"group_by\":[{\"facet\":\"service\",\"sort\":{\"facet\":\"@prof_core_cpu_cores\",\"aggregation\":\"sum\",\"order\":\"desc\"},\"limit\":10}],\"compute\":{\"facet\":\"@prof_core_cpu_cores\",\"aggregation\":\"sum\"}}}],\"type\":\"timeseries\"},\"id\":2446599900087366}],\"layout_type\":\"ordered\"}",
"headers": {
"Date": [
"Thu, 30 Dec 2021 21:04:23 GMT"
],
"Content-Type": [
"application/json"
],
"Content-Length": [
"826"
],
"Connection": [
"close"
],
"Pragma": [
"no-cache"
],
"Cache-Control": [
"no-cache"
],
"Vary": [
"Accept-Encoding"
],
"X-Content-Type-Options": [
"nosniff"
],
"Strict-Transport-Security": [
"max-age=15724800;"
],
"Content-Security-Policy": [
"frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report"
],
"X-Frame-Options": [
"SAMEORIGIN"
]
},
"statusCode": 200,
"reasonPhrase": "OK"
},
"times": {
"remainingTimes": 1
},
"timeToLive": {
"unlimited": true
},
"id": "34f63680-76b1-934d-ff53-c725303fcd21"
},
{
"httpRequest": {
"headers": {
"JAVA-TEST-NAME": [
"Get_a_dashboard_returns_author_name_"
]
},
"method": "GET",
"path": "/api/v1/dashboard/xb2-jve-hxz",
"keepAlive": false,
"secure": true
},
"httpResponse": {
"body": "{\"notify_list\":null,\"description\":null,\"restricted_roles\":[],\"author_name\":\"Frog Account\",\"template_variables\":null,\"is_read_only\":false,\"id\":\"xb2-jve-hxz\",\"title\":\"Test-Get_a_dashboard_returns_author_name_-1640898263 with Profile Metrics Query\",\"url\":\"/dashboard/xb2-jve-hxz/test-getadashboardreturnsauthorname-1640898263-with-profile-metrics-query\",\"created_at\":\"2021-12-30T21:04:23.947661+00:00\",\"modified_at\":\"2021-12-30T21:04:23.947661+00:00\",\"author_handle\":\"frog@datadoghq.com\",\"widgets\":[{\"definition\":{\"requests\":[{\"profile_metrics_query\":{\"search\":{\"query\":\"runtime:jvm\"},\"group_by\":[{\"facet\":\"service\",\"sort\":{\"facet\":\"@prof_core_cpu_cores\",\"aggregation\":\"sum\",\"order\":\"desc\"},\"limit\":10}],\"compute\":{\"facet\":\"@prof_core_cpu_cores\",\"aggregation\":\"sum\"}}}],\"type\":\"timeseries\"},\"id\":2446599900087366}],\"layout_type\":\"ordered\"}",
"headers": {
"Date": [
"Thu, 30 Dec 2021 21:04:24 GMT"
],
"Content-Type": [
"application/json"
],
"Content-Length": [
"826"
],
"Connection": [
"close"
],
"Pragma": [
"no-cache"
],
"Cache-Control": [
"no-cache"
],
"Vary": [
"Accept-Encoding"
],
"X-Content-Type-Options": [
"nosniff"
],
"Strict-Transport-Security": [
"max-age=15724800;"
],
"Content-Security-Policy": [
"frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report"
],
"X-Frame-Options": [
"SAMEORIGIN"
]
},
"statusCode": 200,
"reasonPhrase": "OK"
},
"times": {
"remainingTimes": 1
},
"timeToLive": {
"unlimited": true
},
"id": "c46321bf-f724-7c70-bece-669f9f80f838"
},
{
"httpRequest": {
"headers": {
"JAVA-TEST-NAME": [
"Get_a_dashboard_returns_author_name_"
]
},
"method": "DELETE",
"path": "/api/v1/dashboard/xb2-jve-hxz",
"keepAlive": false,
"secure": true
},
"httpResponse": {
"body": "{\"deleted_dashboard_id\":\"xb2-jve-hxz\"}",
"headers": {
"Date": [
"Thu, 30 Dec 2021 21:04:24 GMT"
],
"Content-Type": [
"application/json"
],
"Content-Length": [
"38"
],
"Connection": [
"close"
],
"Pragma": [
"no-cache"
],
"Cache-Control": [
"no-cache"
],
"Vary": [
"Accept-Encoding"
],
"X-Content-Type-Options": [
"nosniff"
],
"Strict-Transport-Security": [
"max-age=15724800;"
],
"Content-Security-Policy": [
"frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report"
],
"X-Frame-Options": [
"SAMEORIGIN"
]
},
"statusCode": 200,
"reasonPhrase": "OK"
},
"times": {
"remainingTimes": 1
},
"timeToLive": {
"unlimited": true
},
"id": "c4897d24-77d3-abd5-89dd-90cf869ee5eb"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,15 @@ Feature: Dashboards
When the request is sent
Then the response status is 200 OK

@replay-only @team:DataDog/dashboards
Scenario: Get a dashboard returns 'author_name'
Given there is a valid "dashboard" in the system
And new "GetDashboard" request
And request contains "dashboard_id" parameter from "dashboard.id"
When the request is sent
Then the response status is 200 OK
And the response "author_name" is equal to "Frog Account"

@team:DataDog/dashboards
Scenario: Get all dashboards returns "OK" response
Given new "ListDashboards" request
Expand Down