diff --git a/.apigentools-info b/.apigentools-info index 0a596fcae82..1dedbd42271 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -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" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 5fd94a6d80a..22ea89b2b53 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -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 diff --git a/api_docs/v1/Dashboard.md b/api_docs/v1/Dashboard.md index 4a4a6f0b845..e9eb705ba39 100644 --- a/api_docs/v1/Dashboard.md +++ b/api_docs/v1/Dashboard.md @@ -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] | diff --git a/examples/v1/dashboards/GetDashboard_4262333854.java b/examples/v1/dashboards/GetDashboard_4262333854.java new file mode 100644 index 00000000000..795f5238d5c --- /dev/null +++ b/examples/v1/dashboards/GetDashboard_4262333854.java @@ -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(); + } + } +} diff --git a/src/main/java/com/datadog/api/v1/client/model/Dashboard.java b/src/main/java/com/datadog/api/v1/client/model/Dashboard.java index 9677519192c..758de6bc042 100644 --- a/src/main/java/com/datadog/api/v1/client/model/Dashboard.java +++ b/src/main/java/com/datadog/api/v1/client/model/Dashboard.java @@ -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, @@ -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 authorName = JsonNullable.undefined(); + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; private OffsetDateTime createdAt; @@ -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.undefined(); + } + return authorName.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_AUTHOR_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getAuthorName_JsonNullable() { + return authorName; + } + + @JsonProperty(JSON_PROPERTY_AUTHOR_NAME) + private void setAuthorName_JsonNullable(JsonNullable authorName) { + this.authorName = authorName; + } + /** * Creation date of the dashboard. * @@ -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) @@ -554,6 +586,7 @@ public boolean equals(Object o) { public int hashCode() { return Objects.hash( authorHandle, + authorName, createdAt, description, id, @@ -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"); diff --git a/src/test/resources/cassettes/features/v1/Get_a_dashboard_returns_author_name_.freeze b/src/test/resources/cassettes/features/v1/Get_a_dashboard_returns_author_name_.freeze new file mode 100644 index 00000000000..18ba3979387 --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Get_a_dashboard_returns_author_name_.freeze @@ -0,0 +1 @@ +2021-12-30T21:04:23.650Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Get_a_dashboard_returns_author_name_.json b/src/test/resources/cassettes/features/v1/Get_a_dashboard_returns_author_name_.json new file mode 100644 index 00000000000..8c285bc9f8a --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Get_a_dashboard_returns_author_name_.json @@ -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" + } +] \ No newline at end of file diff --git a/src/test/resources/com/datadog/api/v1/client/api/dashboards.feature b/src/test/resources/com/datadog/api/v1/client/api/dashboards.feature index 4bcc08a8e57..251e8a8e6fd 100644 --- a/src/test/resources/com/datadog/api/v1/client/api/dashboards.feature +++ b/src/test/resources/com/datadog/api/v1/client/api/dashboards.feature @@ -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