diff --git a/.apigentools-info b/.apigentools-info index 5c4d7bd58d2..10432bc3ff5 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.4", - "regenerated": "2023-04-14 15:23:00.877069", - "spec_repo_commit": "61947562" + "regenerated": "2023-04-17 14:56:10.524464", + "spec_repo_commit": "c9aa3e76" }, "v2": { "apigentools_version": "1.6.4", - "regenerated": "2023-04-14 15:23:00.889659", - "spec_repo_commit": "61947562" + "regenerated": "2023-04-17 14:56:10.537027", + "spec_repo_commit": "c9aa3e76" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index b7d44d65a7f..f54eca1bf49 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -1092,10 +1092,46 @@ components: description: ID of the deleted dashboard. type: string type: object + DashboardGlobalTime: + description: Object containing the live span selection for the dashboard. + properties: + live_span: + $ref: '#/components/schemas/DashboardGlobalTimeLiveSpan' + type: object + DashboardGlobalTimeLiveSpan: + description: Dashboard global time live_span selection + enum: + - 15m + - 1h + - 4h + - 1d + - 2d + - 1w + - 1mo + - 3mo + example: 1h + type: string + x-enum-varnames: + - PAST_FIFTEEN_MINUTES + - PAST_ONE_HOUR + - PAST_FOUR_HOURS + - PAST_ONE_DAY + - PAST_TWO_DAYS + - PAST_ONE_WEEK + - PAST_ONE_MONTH + - PAST_THREE_MONTHS DashboardID: description: Dashboard resource ID. example: 123-abc-456 type: string + DashboardInviteType: + description: Type for shared dashboard invitation request body. + enum: + - public_dashboard_invitation + example: public_dashboard_invitation + type: string + x-enum-varnames: + - PUBLIC_DASHBOARD_INVITATION DashboardLayoutType: description: Layout type of the dashboard. enum: @@ -1200,6 +1236,17 @@ components: required: - data type: object + DashboardShareType: + description: Type of sharing access (either open to anyone who has the public + URL or invite-only). + enum: + - open + - invite + nullable: true + type: string + x-enum-varnames: + - OPEN + - INVITE DashboardSummary: description: Dashboard summary response. properties: @@ -1326,6 +1373,23 @@ components: minItems: 1 type: array type: object + DashboardType: + description: The type of the associated private dashboard. + enum: + - custom_timeboard + - custom_screenboard + example: custom_timeboard + type: string + x-enum-varnames: + - CUSTOM_TIMEBOARD + - CUSTOM_SCREENBOARD + DeleteSharedDashboardResponse: + description: Response containing token of deleted shared dashboard. + properties: + deleted_public_dashboard_token: + description: Token associated with the shared dashboard that was revoked. + type: string + type: object DeletedMonitor: description: Response from the delete monitor call. properties: @@ -10727,6 +10791,28 @@ components: description: The type of the object, must be `slo`. type: string type: object + SelectableTemplateVariableItems: + description: Object containing the template variable's name, associated tag/attribute, + default value and selectable values. + properties: + default_value: + description: The default value of the template variable. + type: string + name: + description: Name of the template variable. + type: string + prefix: + description: The tag/attribute key associated with the template variable. + type: string + visible_tags: + description: List of visible tag values on the shared dashboard. + items: + description: Other values for this tag that can be selected on the shared + dashboard. + type: string + nullable: true + type: array + type: object Series: description: 'A metric to submit to Datadog. @@ -11222,6 +11308,259 @@ components: type: string x-enum-varnames: - TRACE_SERVICE + SharedDashboard: + description: The metadata object associated with how a dashboard has been/will + be shared. + properties: + author: + $ref: '#/components/schemas/SharedDashboardAuthor' + created_at: + description: Date the dashboard was shared. + format: date-time + readOnly: true + type: string + dashboard_id: + description: ID of the dashboard to share. + example: 123-abc-456 + type: string + dashboard_type: + $ref: '#/components/schemas/DashboardType' + global_time: + $ref: '#/components/schemas/DashboardGlobalTime' + global_time_selectable_enabled: + description: Whether to allow viewers to select a different global time + setting for the shared dashboard. + nullable: true + type: boolean + public_url: + description: URL of the shared dashboard. + readOnly: true + type: string + selectable_template_vars: + description: List of objects representing template variables on the shared + dashboard which can have selectable values. + example: + - default_value: '*' + name: exampleVar + prefix: test + visible_tags: + - selectableValue1 + - selectableValue2 + items: + $ref: '#/components/schemas/SelectableTemplateVariableItems' + nullable: true + type: array + share_list: + description: List of email addresses that can receive an invitation to access + to the shared dashboard. + example: + - test@datadoghq.com + - test2@email.com + items: + description: Email address that can receive an invitation to access the + shared dashboard. + format: email + type: string + nullable: true + type: array + share_type: + $ref: '#/components/schemas/DashboardShareType' + token: + description: A unique token assigned to the shared dashboard. + readOnly: true + type: string + required: + - dashboard_id + - dashboard_type + type: object + SharedDashboardAuthor: + description: User who shared the dashboard. + properties: + handle: + description: Identifier of the user who shared the dashboard. + example: test@datadoghq.com + readOnly: true + type: string + name: + description: Name of the user who shared the dashboard. + readOnly: true + type: string + readOnly: true + type: object + SharedDashboardInvites: + description: Invitations data and metadata that exists for a shared dashboard + returned by the API. + example: + data: + - attributes: + email: test@datadoghq.com + type: public_dashboard_invitation + properties: + data: + $ref: '#/components/schemas/SharedDashboardInvitesData' + meta: + $ref: '#/components/schemas/SharedDashboardInvitesMeta' + required: + - data + type: object + SharedDashboardInvitesData: + description: An object or list of objects containing the information for an + invitation to a shared dashboard. + example: + - attributes: + email: test@datadoghq.com + type: public_dashboard_invitation + oneOf: + - $ref: '#/components/schemas/SharedDashboardInvitesDataObject' + - $ref: '#/components/schemas/SharedDashboardInvitesDataList' + SharedDashboardInvitesDataList: + description: A list of objects containing the information for an invitation(s) + to a shared dashboard. + example: + - attributes: + email: test@datadoghq.com + type: public_dashboard_invitation + items: + $ref: '#/components/schemas/SharedDashboardInvitesDataObject' + type: array + SharedDashboardInvitesDataObject: + description: Object containing the information for an invitation to a shared + dashboard. + example: + attributes: + created_at: '2020-12-07T20:16:27.846985+00:00' + email: test@datadoghq.com + has_session: false + invitation_expiry: '2020-12-07T21:16:27.840542+00:00' + session_expiry: null + share_token: XXXXXX-123456abcedfg7890hijklmnopqrstuv + type: public_dashboard_invitation + properties: + attributes: + $ref: '#/components/schemas/SharedDashboardInvitesDataObjectAttributes' + type: + $ref: '#/components/schemas/DashboardInviteType' + required: + - type + - attributes + type: object + SharedDashboardInvitesDataObjectAttributes: + description: Attributes of the shared dashboard invitation + example: + created_at: '2020-12-07T20:16:27.846985+00:00' + email: test@datadoghq.com + has_session: false + invitation_expiry: '2020-12-07T21:16:27.840542+00:00' + session_expiry: null + share_token: XXXXXX-123456abcedfg7890hijklmnopqrstuv + properties: + created_at: + description: When the invitation was sent. + format: date-time + readOnly: true + type: string + email: + description: An email address that an invitation has been (or if used in + invitation request, will be) sent to. + nullable: false + type: string + has_session: + description: Indicates whether an active session exists for the invitation + (produced when a user clicks the link in the email). + readOnly: true + type: boolean + invitation_expiry: + description: When the invitation expires. + format: date-time + readOnly: true + type: string + session_expiry: + description: When the invited user's session expires. null if the invitation + has no associated session. + format: date-time + nullable: true + readOnly: true + type: string + share_token: + description: The unique token of the shared dashboard that was (or is to + be) shared. + readOnly: true + type: string + type: object + SharedDashboardInvitesMeta: + description: Pagination metadata returned by the API. + properties: + page: + $ref: '#/components/schemas/SharedDashboardInvitesMetaPage' + readOnly: true + type: object + SharedDashboardInvitesMetaPage: + description: Object containing the total count of invitations across all pages + properties: + total_count: + description: The total number of invitations on this shared board, across + all pages. + format: int64 + type: integer + type: object + SharedDashboardUpdateRequest: + description: Update a shared dashboard's settings. + example: + global_time: + live_span: 1h + share_list: + - test@datadoghq.com + - test2@datadoghq.com + share_type: invite + properties: + global_time: + $ref: '#/components/schemas/SharedDashboardUpdateRequestGlobalTime' + global_time_selectable_enabled: + description: Whether to allow viewers to select a different global time + setting for the shared dashboard. + nullable: true + type: boolean + selectable_template_vars: + description: List of objects representing template variables on the shared + dashboard which can have selectable values. + example: + - default_value: '*' + name: exampleVar + prefix: test + visible_tags: + - selectableValue1 + - selectableValue2 + items: + $ref: '#/components/schemas/SelectableTemplateVariableItems' + nullable: true + type: array + share_list: + description: List of email addresses that can be given access to the shared + dashboard. + example: + - test@datadoghq.com + - test2@email.com + items: + description: Email address that can receive an invitation to access the + shared dashboard. + format: email + type: string + nullable: true + type: array + share_type: + $ref: '#/components/schemas/DashboardShareType' + required: + - global_time + type: object + SharedDashboardUpdateRequestGlobalTime: + description: Timeframe setting for the shared dashboard. + example: + live_span: 1h + nullable: true + properties: + live_span: + $ref: '#/components/schemas/DashboardGlobalTimeLiveSpan' + type: object SignalArchiveReason: description: Reason why a signal has been archived. enum: @@ -20214,6 +20553,379 @@ paths: tags: - Dashboard Lists x-codegen-request-body-name: body + /api/v1/dashboard/public: + post: + description: Share a specified private dashboard, generating a URL at which + it can be publicly viewed. + operationId: CreatePublicDashboard + requestBody: + content: + application/json: + examples: + json-request-body: + value: + dashboard_id: 123-abc-456 + dashboard_type: custom_timeboard + share_type: open + schema: + $ref: '#/components/schemas/SharedDashboard' + description: Create a shared dashboard request body. + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/SharedDashboard' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Dashboard Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - dashboards_public_share + summary: Create a shared dashboard + tags: + - Dashboards + x-codegen-request-body-name: body + /api/v1/dashboard/public/{token}: + delete: + description: Revoke the public URL for a dashboard (rendering it private) associated + with the specified token. + operationId: DeletePublicDashboard + parameters: + - description: The token of the shared dashboard. + in: path + name: token + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteSharedDashboardResponse' + description: OK + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Shared Dashboard Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - dashboards_public_share + summary: Revoke a shared dashboard URL + tags: + - Dashboards + get: + description: Fetch an existing shared dashboard's sharing metadata associated + with the specified token. + operationId: GetPublicDashboard + parameters: + - description: The token of the shared dashboard. Generated when a dashboard + is shared. + in: path + name: token + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/SharedDashboard' + description: OK + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Shared Dashboard Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - dashboards_read + summary: Get a shared dashboard + tags: + - Dashboards + put: + description: Update a shared dashboard associated with the specified token. + operationId: UpdatePublicDashboard + parameters: + - description: The token of the shared dashboard. + in: path + name: token + required: true + schema: + type: string + requestBody: + content: + application/json: + examples: + json-request-body: + value: + global_time: + live_span: 1h + selectable_template_vars: + - default_value: '*' + name: exampleVar + prefix: test + visible_tags: + - selectableValue1 + - selectableValue2 + share_list: + - test@datadoghq.com + - test2@datadoghq.com + share_type: invite + schema: + $ref: '#/components/schemas/SharedDashboardUpdateRequest' + description: Update Dashboard request body. + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/SharedDashboard' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Authentication Error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Item Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - dashboards_public_share + summary: Update a shared dashboard + tags: + - Dashboards + x-codegen-request-body-name: body + /api/v1/dashboard/public/{token}/invitation: + delete: + description: Revoke previously sent invitation emails and active sessions used + to access a given shared dashboard for specific email addresses. + operationId: DeletePublicDashboardInvitation + parameters: + - description: The token of the shared dashboard. + in: path + name: token + required: true + schema: + type: string + requestBody: + content: + application/json: + examples: + json-request-body: + value: + data: + attributes: + email: test@datadoghq.com + type: public_dashboard_invitation + schema: + $ref: '#/components/schemas/SharedDashboardInvites' + description: Shared Dashboard Invitation deletion request body. + required: true + responses: + '204': + description: OK + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - dashboards_public_share + summary: Revoke shared dashboard invitations + tags: + - Dashboards + x-codegen-request-body-name: body + get: + description: Describe the invitations that exist for the given shared dashboard + (paginated). + operationId: GetPublicDashboardInvitations + parameters: + - description: Token of the shared dashboard for which to fetch invitations. + in: path + name: token + required: true + schema: + type: string + - description: The number of records to return in a single request. + in: query + name: page_size + required: false + schema: + format: int64 + type: integer + - description: The page to access (base 0). + in: query + name: page_number + required: false + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/SharedDashboardInvites' + description: OK + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - dashboards_public_share + summary: Get all invitations for a shared dashboard + tags: + - Dashboards + post: + description: Send emails to specified email addresses containing links to access + a given authenticated shared dashboard. Email addresses must already belong + to the authenticated shared dashboard's share_list. + operationId: SendPublicDashboardInvitation + parameters: + - description: The token of the shared dashboard. + in: path + name: token + required: true + schema: + type: string + requestBody: + content: + application/json: + examples: + json-request-body: + value: + data: + - attributes: + email: test@datadoghq.com + type: public_dashboard_invitation + schema: + $ref: '#/components/schemas/SharedDashboardInvites' + description: Shared Dashboard Invitation request body. + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/SharedDashboardInvites' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - dashboards_public_share + summary: Send shared dashboard invitation email + tags: + - Dashboards + x-codegen-request-body-name: body /api/v1/dashboard/{dashboard_id}: delete: description: Delete a dashboard using the specified ID. diff --git a/.generator/src/generator/formatter.py b/.generator/src/generator/formatter.py index cb1c07009a1..4e8ee4f1774 100644 --- a/.generator/src/generator/formatter.py +++ b/.generator/src/generator/formatter.py @@ -461,7 +461,10 @@ def format_data_with_schema_list( except (KeyError, ValueError): continue - if default_name: + if name: + one_of_imports.add(f"{default_name}") + value = f"new {default_name}({value})" + elif default_name: one_of_imports.add(f"{default_name}Item") value = f"new {default_name}Item({value})" @@ -513,7 +516,7 @@ def format_data_with_schema_dict( v, schema["properties"][k], replace_values=replace_values, - default_name=name + camel_case(k) if name else None, + default_name=name + upperfirst(k) if name else None, ) if value: parameters += f"\n.{escape_reserved_keyword(untitle_case(camel_case(k)))}({value})" diff --git a/examples/v1/dashboards/CreatePublicDashboard.java b/examples/v1/dashboards/CreatePublicDashboard.java new file mode 100644 index 00000000000..5e51ce91a08 --- /dev/null +++ b/examples/v1/dashboards/CreatePublicDashboard.java @@ -0,0 +1,39 @@ +// Create a shared dashboard returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v1.api.DashboardsApi; +import com.datadog.api.client.v1.model.DashboardGlobalTime; +import com.datadog.api.client.v1.model.DashboardGlobalTimeLiveSpan; +import com.datadog.api.client.v1.model.DashboardShareType; +import com.datadog.api.client.v1.model.DashboardType; +import com.datadog.api.client.v1.model.SharedDashboard; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + DashboardsApi apiInstance = new DashboardsApi(defaultClient); + + // there is a valid "dashboard" in the system + String DASHBOARD_ID = System.getenv("DASHBOARD_ID"); + + SharedDashboard body = + new SharedDashboard() + .dashboardId(DASHBOARD_ID) + .dashboardType(DashboardType.CUSTOM_TIMEBOARD) + .shareType(DashboardShareType.OPEN) + .globalTime( + new DashboardGlobalTime().liveSpan(DashboardGlobalTimeLiveSpan.PAST_ONE_HOUR)); + + try { + SharedDashboard result = apiInstance.createPublicDashboard(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DashboardsApi#createPublicDashboard"); + 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/examples/v1/dashboards/DeletePublicDashboard.java b/examples/v1/dashboards/DeletePublicDashboard.java new file mode 100644 index 00000000000..059e623bf51 --- /dev/null +++ b/examples/v1/dashboards/DeletePublicDashboard.java @@ -0,0 +1,24 @@ +// Revoke a shared dashboard URL returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v1.api.DashboardsApi; +import com.datadog.api.client.v1.model.DeleteSharedDashboardResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + DashboardsApi apiInstance = new DashboardsApi(defaultClient); + + try { + DeleteSharedDashboardResponse result = apiInstance.deletePublicDashboard("token"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DashboardsApi#deletePublicDashboard"); + 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/examples/v1/dashboards/DeletePublicDashboardInvitation.java b/examples/v1/dashboards/DeletePublicDashboardInvitation.java new file mode 100644 index 00000000000..b4454b054b2 --- /dev/null +++ b/examples/v1/dashboards/DeletePublicDashboardInvitation.java @@ -0,0 +1,39 @@ +// Revoke shared dashboard invitations returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v1.api.DashboardsApi; +import com.datadog.api.client.v1.model.DashboardInviteType; +import com.datadog.api.client.v1.model.SharedDashboardInvites; +import com.datadog.api.client.v1.model.SharedDashboardInvitesData; +import com.datadog.api.client.v1.model.SharedDashboardInvitesDataObject; +import com.datadog.api.client.v1.model.SharedDashboardInvitesDataObjectAttributes; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + DashboardsApi apiInstance = new DashboardsApi(defaultClient); + + SharedDashboardInvites body = + new SharedDashboardInvites() + .data( + new SharedDashboardInvitesData( + Collections.singletonList( + new SharedDashboardInvitesDataObject() + .attributes( + new SharedDashboardInvitesDataObjectAttributes() + .email("test@datadoghq.com")) + .type(DashboardInviteType.PUBLIC_DASHBOARD_INVITATION)))); + + try { + apiInstance.deletePublicDashboardInvitation("token", body); + } catch (ApiException e) { + System.err.println("Exception when calling DashboardsApi#deletePublicDashboardInvitation"); + 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/examples/v1/dashboards/GetPublicDashboard.java b/examples/v1/dashboards/GetPublicDashboard.java new file mode 100644 index 00000000000..9d18712b3dc --- /dev/null +++ b/examples/v1/dashboards/GetPublicDashboard.java @@ -0,0 +1,27 @@ +// Get a shared dashboard returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v1.api.DashboardsApi; +import com.datadog.api.client.v1.model.SharedDashboard; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + DashboardsApi apiInstance = new DashboardsApi(defaultClient); + + // there is a valid "shared_dashboard" in the system + String SHARED_DASHBOARD_TOKEN = System.getenv("SHARED_DASHBOARD_TOKEN"); + + try { + SharedDashboard result = apiInstance.getPublicDashboard(SHARED_DASHBOARD_TOKEN); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DashboardsApi#getPublicDashboard"); + 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/examples/v1/dashboards/GetPublicDashboardInvitations.java b/examples/v1/dashboards/GetPublicDashboardInvitations.java new file mode 100644 index 00000000000..e00c1e15ad9 --- /dev/null +++ b/examples/v1/dashboards/GetPublicDashboardInvitations.java @@ -0,0 +1,28 @@ +// Get all invitations for a shared dashboard returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v1.api.DashboardsApi; +import com.datadog.api.client.v1.model.SharedDashboardInvites; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + DashboardsApi apiInstance = new DashboardsApi(defaultClient); + + // there is a valid "shared_dashboard" in the system + String SHARED_DASHBOARD_TOKEN = System.getenv("SHARED_DASHBOARD_TOKEN"); + + try { + SharedDashboardInvites result = + apiInstance.getPublicDashboardInvitations(SHARED_DASHBOARD_TOKEN); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DashboardsApi#getPublicDashboardInvitations"); + 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/examples/v1/dashboards/SendPublicDashboardInvitation.java b/examples/v1/dashboards/SendPublicDashboardInvitation.java new file mode 100644 index 00000000000..2c8d0cd83da --- /dev/null +++ b/examples/v1/dashboards/SendPublicDashboardInvitation.java @@ -0,0 +1,42 @@ +// Send shared dashboard invitation email returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v1.api.DashboardsApi; +import com.datadog.api.client.v1.model.DashboardInviteType; +import com.datadog.api.client.v1.model.SharedDashboardInvites; +import com.datadog.api.client.v1.model.SharedDashboardInvitesData; +import com.datadog.api.client.v1.model.SharedDashboardInvitesDataObject; +import com.datadog.api.client.v1.model.SharedDashboardInvitesDataObjectAttributes; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + DashboardsApi apiInstance = new DashboardsApi(defaultClient); + + // there is a valid "shared_dashboard" in the system + String SHARED_DASHBOARD_TOKEN = System.getenv("SHARED_DASHBOARD_TOKEN"); + + SharedDashboardInvites body = + new SharedDashboardInvites() + .data( + new SharedDashboardInvitesData( + new SharedDashboardInvitesDataObject() + .attributes( + new SharedDashboardInvitesDataObjectAttributes() + .email("exampledashboard@datadoghq.com")) + .type(DashboardInviteType.PUBLIC_DASHBOARD_INVITATION))); + + try { + SharedDashboardInvites result = + apiInstance.sendPublicDashboardInvitation(SHARED_DASHBOARD_TOKEN, body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DashboardsApi#sendPublicDashboardInvitation"); + 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/examples/v1/dashboards/UpdatePublicDashboard.java b/examples/v1/dashboards/UpdatePublicDashboard.java new file mode 100644 index 00000000000..71977ed6f7a --- /dev/null +++ b/examples/v1/dashboards/UpdatePublicDashboard.java @@ -0,0 +1,38 @@ +// Update a shared dashboard returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v1.api.DashboardsApi; +import com.datadog.api.client.v1.model.DashboardGlobalTimeLiveSpan; +import com.datadog.api.client.v1.model.DashboardShareType; +import com.datadog.api.client.v1.model.SharedDashboard; +import com.datadog.api.client.v1.model.SharedDashboardUpdateRequest; +import com.datadog.api.client.v1.model.SharedDashboardUpdateRequestGlobalTime; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + DashboardsApi apiInstance = new DashboardsApi(defaultClient); + + // there is a valid "shared_dashboard" in the system + String SHARED_DASHBOARD_TOKEN = System.getenv("SHARED_DASHBOARD_TOKEN"); + + SharedDashboardUpdateRequest body = + new SharedDashboardUpdateRequest() + .globalTime( + new SharedDashboardUpdateRequestGlobalTime() + .liveSpan(DashboardGlobalTimeLiveSpan.PAST_FIFTEEN_MINUTES)) + .shareType(DashboardShareType.OPEN); + + try { + SharedDashboard result = apiInstance.updatePublicDashboard(SHARED_DASHBOARD_TOKEN, body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DashboardsApi#updatePublicDashboard"); + 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/client/v1/api/DashboardsApi.java b/src/main/java/com/datadog/api/client/v1/api/DashboardsApi.java index 5d9ee96867c..ab88d940d07 100644 --- a/src/main/java/com/datadog/api/client/v1/api/DashboardsApi.java +++ b/src/main/java/com/datadog/api/client/v1/api/DashboardsApi.java @@ -9,6 +9,10 @@ import com.datadog.api.client.v1.model.DashboardDeleteResponse; import com.datadog.api.client.v1.model.DashboardRestoreRequest; import com.datadog.api.client.v1.model.DashboardSummary; +import com.datadog.api.client.v1.model.DeleteSharedDashboardResponse; +import com.datadog.api.client.v1.model.SharedDashboard; +import com.datadog.api.client.v1.model.SharedDashboardInvites; +import com.datadog.api.client.v1.model.SharedDashboardUpdateRequest; import jakarta.ws.rs.client.Invocation; import jakarta.ws.rs.core.GenericType; import java.util.ArrayList; @@ -182,6 +186,138 @@ public CompletableFuture> createDashboardWithHttpInfoAsyn new GenericType() {}); } + /** + * Create a shared dashboard. + * + *

See {@link #createPublicDashboardWithHttpInfo}. + * + * @param body Create a shared dashboard request body. (required) + * @return SharedDashboard + * @throws ApiException if fails to make API call + */ + public SharedDashboard createPublicDashboard(SharedDashboard body) throws ApiException { + return createPublicDashboardWithHttpInfo(body).getData(); + } + + /** + * Create a shared dashboard. + * + *

See {@link #createPublicDashboardWithHttpInfoAsync}. + * + * @param body Create a shared dashboard request body. (required) + * @return CompletableFuture<SharedDashboard> + */ + public CompletableFuture createPublicDashboardAsync(SharedDashboard body) { + return createPublicDashboardWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Share a specified private dashboard, generating a URL at which it can be publicly viewed. + * + * @param body Create a shared dashboard request body. (required) + * @return ApiResponse<SharedDashboard> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Dashboard Not Found -
429 Too many requests -
+ */ + public ApiResponse createPublicDashboardWithHttpInfo(SharedDashboard body) + throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createPublicDashboard"); + } + // create path and map variables + String localVarPath = "/api/v1/dashboard/public"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v1.DashboardsApi.createPublicDashboard", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create a shared dashboard. + * + *

See {@link #createPublicDashboardWithHttpInfo}. + * + * @param body Create a shared dashboard request body. (required) + * @return CompletableFuture<ApiResponse<SharedDashboard>> + */ + public CompletableFuture> createPublicDashboardWithHttpInfoAsync( + SharedDashboard body) { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling createPublicDashboard")); + return result; + } + // create path and map variables + String localVarPath = "/api/v1/dashboard/public"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v1.DashboardsApi.createPublicDashboard", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Delete a dashboard. * @@ -452,28 +588,28 @@ public CompletableFuture> deleteDashboardsWithHttpInfoAsync( } /** - * Get a dashboard. + * Revoke a shared dashboard URL. * - *

See {@link #getDashboardWithHttpInfo}. + *

See {@link #deletePublicDashboardWithHttpInfo}. * - * @param dashboardId The ID of the dashboard. (required) - * @return Dashboard + * @param token The token of the shared dashboard. (required) + * @return DeleteSharedDashboardResponse * @throws ApiException if fails to make API call */ - public Dashboard getDashboard(String dashboardId) throws ApiException { - return getDashboardWithHttpInfo(dashboardId).getData(); + public DeleteSharedDashboardResponse deletePublicDashboard(String token) throws ApiException { + return deletePublicDashboardWithHttpInfo(token).getData(); } /** - * Get a dashboard. + * Revoke a shared dashboard URL. * - *

See {@link #getDashboardWithHttpInfoAsync}. + *

See {@link #deletePublicDashboardWithHttpInfoAsync}. * - * @param dashboardId The ID of the dashboard. (required) - * @return CompletableFuture<Dashboard> + * @param token The token of the shared dashboard. (required) + * @return CompletableFuture<DeleteSharedDashboardResponse> */ - public CompletableFuture getDashboardAsync(String dashboardId) { - return getDashboardWithHttpInfoAsync(dashboardId) + public CompletableFuture deletePublicDashboardAsync(String token) { + return deletePublicDashboardWithHttpInfoAsync(token) .thenApply( response -> { return response.getData(); @@ -481,42 +617,691 @@ public CompletableFuture getDashboardAsync(String dashboardId) { } /** - * Get a dashboard using the specified ID. + * Revoke the public URL for a dashboard (rendering it private) associated with the specified + * token. * - * @param dashboardId The ID of the dashboard. (required) - * @return ApiResponse<Dashboard> + * @param token The token of the shared dashboard. (required) + * @return ApiResponse<DeleteSharedDashboardResponse> * @throws ApiException if fails to make API call * @http.response.details * * * * - * - * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
403 Authentication Error -
404 Item Not Found -
403 Forbidden -
404 Shared Dashboard Not Found -
429 Too many requests -
+ */ + public ApiResponse deletePublicDashboardWithHttpInfo(String token) + throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'token' is set + if (token == null) { + throw new ApiException( + 400, "Missing the required parameter 'token' when calling deletePublicDashboard"); + } + // create path and map variables + String localVarPath = + "/api/v1/dashboard/public/{token}" + .replaceAll("\\{" + "token" + "\\}", apiClient.escapeString(token.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v1.DashboardsApi.deletePublicDashboard", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Revoke a shared dashboard URL. + * + *

See {@link #deletePublicDashboardWithHttpInfo}. + * + * @param token The token of the shared dashboard. (required) + * @return CompletableFuture<ApiResponse<DeleteSharedDashboardResponse>> + */ + public CompletableFuture> + deletePublicDashboardWithHttpInfoAsync(String token) { + Object localVarPostBody = null; + + // verify the required parameter 'token' is set + if (token == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'token' when calling deletePublicDashboard")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v1/dashboard/public/{token}" + .replaceAll("\\{" + "token" + "\\}", apiClient.escapeString(token.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v1.DashboardsApi.deletePublicDashboard", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Revoke shared dashboard invitations. + * + *

See {@link #deletePublicDashboardInvitationWithHttpInfo}. + * + * @param token The token of the shared dashboard. (required) + * @param body Shared Dashboard Invitation deletion request body. (required) + * @throws ApiException if fails to make API call + */ + public void deletePublicDashboardInvitation(String token, SharedDashboardInvites body) + throws ApiException { + deletePublicDashboardInvitationWithHttpInfo(token, body); + } + + /** + * Revoke shared dashboard invitations. + * + *

See {@link #deletePublicDashboardInvitationWithHttpInfoAsync}. + * + * @param token The token of the shared dashboard. (required) + * @param body Shared Dashboard Invitation deletion request body. (required) + * @return CompletableFuture + */ + public CompletableFuture deletePublicDashboardInvitationAsync( + String token, SharedDashboardInvites body) { + return deletePublicDashboardInvitationWithHttpInfoAsync(token, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Revoke previously sent invitation emails and active sessions used to access a given shared + * dashboard for specific email addresses. + * + * @param token The token of the shared dashboard. (required) + * @param body Shared Dashboard Invitation deletion request body. (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
204 OK -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse deletePublicDashboardInvitationWithHttpInfo( + String token, SharedDashboardInvites body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'token' is set + if (token == null) { + throw new ApiException( + 400, + "Missing the required parameter 'token' when calling deletePublicDashboardInvitation"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, + "Missing the required parameter 'body' when calling deletePublicDashboardInvitation"); + } + // create path and map variables + String localVarPath = + "/api/v1/dashboard/public/{token}/invitation" + .replaceAll("\\{" + "token" + "\\}", apiClient.escapeString(token.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v1.DashboardsApi.deletePublicDashboardInvitation", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Revoke shared dashboard invitations. + * + *

See {@link #deletePublicDashboardInvitationWithHttpInfo}. + * + * @param token The token of the shared dashboard. (required) + * @param body Shared Dashboard Invitation deletion request body. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deletePublicDashboardInvitationWithHttpInfoAsync( + String token, SharedDashboardInvites body) { + Object localVarPostBody = body; + + // verify the required parameter 'token' is set + if (token == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'token' when calling" + + " deletePublicDashboardInvitation")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'body' when calling" + + " deletePublicDashboardInvitation")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v1/dashboard/public/{token}/invitation" + .replaceAll("\\{" + "token" + "\\}", apiClient.escapeString(token.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v1.DashboardsApi.deletePublicDashboardInvitation", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "DELETE", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Get a dashboard. + * + *

See {@link #getDashboardWithHttpInfo}. + * + * @param dashboardId The ID of the dashboard. (required) + * @return Dashboard + * @throws ApiException if fails to make API call + */ + public Dashboard getDashboard(String dashboardId) throws ApiException { + return getDashboardWithHttpInfo(dashboardId).getData(); + } + + /** + * Get a dashboard. + * + *

See {@link #getDashboardWithHttpInfoAsync}. + * + * @param dashboardId The ID of the dashboard. (required) + * @return CompletableFuture<Dashboard> + */ + public CompletableFuture getDashboardAsync(String dashboardId) { + return getDashboardWithHttpInfoAsync(dashboardId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get a dashboard using the specified ID. + * + * @param dashboardId The ID of the dashboard. (required) + * @return ApiResponse<Dashboard> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
403 Authentication Error -
404 Item Not Found -
429 Too many requests -
+ */ + public ApiResponse getDashboardWithHttpInfo(String dashboardId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'dashboardId' is set + if (dashboardId == null) { + throw new ApiException( + 400, "Missing the required parameter 'dashboardId' when calling getDashboard"); + } + // create path and map variables + String localVarPath = + "/api/v1/dashboard/{dashboard_id}" + .replaceAll( + "\\{" + "dashboard_id" + "\\}", apiClient.escapeString(dashboardId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v1.DashboardsApi.getDashboard", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get a dashboard. + * + *

See {@link #getDashboardWithHttpInfo}. + * + * @param dashboardId The ID of the dashboard. (required) + * @return CompletableFuture<ApiResponse<Dashboard>> + */ + public CompletableFuture> getDashboardWithHttpInfoAsync( + String dashboardId) { + Object localVarPostBody = null; + + // verify the required parameter 'dashboardId' is set + if (dashboardId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'dashboardId' when calling getDashboard")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v1/dashboard/{dashboard_id}" + .replaceAll( + "\\{" + "dashboard_id" + "\\}", apiClient.escapeString(dashboardId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v1.DashboardsApi.getDashboard", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get a shared dashboard. + * + *

See {@link #getPublicDashboardWithHttpInfo}. + * + * @param token The token of the shared dashboard. Generated when a dashboard is shared. + * (required) + * @return SharedDashboard + * @throws ApiException if fails to make API call + */ + public SharedDashboard getPublicDashboard(String token) throws ApiException { + return getPublicDashboardWithHttpInfo(token).getData(); + } + + /** + * Get a shared dashboard. + * + *

See {@link #getPublicDashboardWithHttpInfoAsync}. + * + * @param token The token of the shared dashboard. Generated when a dashboard is shared. + * (required) + * @return CompletableFuture<SharedDashboard> + */ + public CompletableFuture getPublicDashboardAsync(String token) { + return getPublicDashboardWithHttpInfoAsync(token) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Fetch an existing shared dashboard's sharing metadata associated with the specified token. + * + * @param token The token of the shared dashboard. Generated when a dashboard is shared. + * (required) + * @return ApiResponse<SharedDashboard> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Shared Dashboard Not Found -
429 Too many requests -
+ */ + public ApiResponse getPublicDashboardWithHttpInfo(String token) + throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'token' is set + if (token == null) { + throw new ApiException( + 400, "Missing the required parameter 'token' when calling getPublicDashboard"); + } + // create path and map variables + String localVarPath = + "/api/v1/dashboard/public/{token}" + .replaceAll("\\{" + "token" + "\\}", apiClient.escapeString(token.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v1.DashboardsApi.getPublicDashboard", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get a shared dashboard. + * + *

See {@link #getPublicDashboardWithHttpInfo}. + * + * @param token The token of the shared dashboard. Generated when a dashboard is shared. + * (required) + * @return CompletableFuture<ApiResponse<SharedDashboard>> + */ + public CompletableFuture> getPublicDashboardWithHttpInfoAsync( + String token) { + Object localVarPostBody = null; + + // verify the required parameter 'token' is set + if (token == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'token' when calling getPublicDashboard")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v1/dashboard/public/{token}" + .replaceAll("\\{" + "token" + "\\}", apiClient.escapeString(token.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v1.DashboardsApi.getPublicDashboard", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** Manage optional parameters to getPublicDashboardInvitations. */ + public static class GetPublicDashboardInvitationsOptionalParameters { + private Long pageSize; + private Long pageNumber; + + /** + * Set pageSize. + * + * @param pageSize The number of records to return in a single request. (optional) + * @return GetPublicDashboardInvitationsOptionalParameters + */ + public GetPublicDashboardInvitationsOptionalParameters pageSize(Long pageSize) { + this.pageSize = pageSize; + return this; + } + + /** + * Set pageNumber. + * + * @param pageNumber The page to access (base 0). (optional) + * @return GetPublicDashboardInvitationsOptionalParameters + */ + public GetPublicDashboardInvitationsOptionalParameters pageNumber(Long pageNumber) { + this.pageNumber = pageNumber; + return this; + } + } + + /** + * Get all invitations for a shared dashboard. + * + *

See {@link #getPublicDashboardInvitationsWithHttpInfo}. + * + * @param token Token of the shared dashboard for which to fetch invitations. (required) + * @return SharedDashboardInvites + * @throws ApiException if fails to make API call + */ + public SharedDashboardInvites getPublicDashboardInvitations(String token) throws ApiException { + return getPublicDashboardInvitationsWithHttpInfo( + token, new GetPublicDashboardInvitationsOptionalParameters()) + .getData(); + } + + /** + * Get all invitations for a shared dashboard. + * + *

See {@link #getPublicDashboardInvitationsWithHttpInfoAsync}. + * + * @param token Token of the shared dashboard for which to fetch invitations. (required) + * @return CompletableFuture<SharedDashboardInvites> + */ + public CompletableFuture getPublicDashboardInvitationsAsync( + String token) { + return getPublicDashboardInvitationsWithHttpInfoAsync( + token, new GetPublicDashboardInvitationsOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get all invitations for a shared dashboard. + * + *

See {@link #getPublicDashboardInvitationsWithHttpInfo}. + * + * @param token Token of the shared dashboard for which to fetch invitations. (required) + * @param parameters Optional parameters for the request. + * @return SharedDashboardInvites + * @throws ApiException if fails to make API call + */ + public SharedDashboardInvites getPublicDashboardInvitations( + String token, GetPublicDashboardInvitationsOptionalParameters parameters) + throws ApiException { + return getPublicDashboardInvitationsWithHttpInfo(token, parameters).getData(); + } + + /** + * Get all invitations for a shared dashboard. + * + *

See {@link #getPublicDashboardInvitationsWithHttpInfoAsync}. + * + * @param token Token of the shared dashboard for which to fetch invitations. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<SharedDashboardInvites> + */ + public CompletableFuture getPublicDashboardInvitationsAsync( + String token, GetPublicDashboardInvitationsOptionalParameters parameters) { + return getPublicDashboardInvitationsWithHttpInfoAsync(token, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Describe the invitations that exist for the given shared dashboard (paginated). + * + * @param token Token of the shared dashboard for which to fetch invitations. (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<SharedDashboardInvites> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * * *
Response details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
429 Too many requests -
*/ - public ApiResponse getDashboardWithHttpInfo(String dashboardId) throws ApiException { + public ApiResponse getPublicDashboardInvitationsWithHttpInfo( + String token, GetPublicDashboardInvitationsOptionalParameters parameters) + throws ApiException { Object localVarPostBody = null; - // verify the required parameter 'dashboardId' is set - if (dashboardId == null) { + // verify the required parameter 'token' is set + if (token == null) { throw new ApiException( - 400, "Missing the required parameter 'dashboardId' when calling getDashboard"); + 400, "Missing the required parameter 'token' when calling getPublicDashboardInvitations"); } + Long pageSize = parameters.pageSize; + Long pageNumber = parameters.pageNumber; // create path and map variables String localVarPath = - "/api/v1/dashboard/{dashboard_id}" - .replaceAll( - "\\{" + "dashboard_id" + "\\}", apiClient.escapeString(dashboardId.toString())); + "/api/v1/dashboard/public/{token}/invitation" + .replaceAll("\\{" + "token" + "\\}", apiClient.escapeString(token.toString())); + List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page_size", pageSize)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page_number", pageNumber)); + Invocation.Builder builder = apiClient.createBuilder( - "v1.DashboardsApi.getDashboard", + "v1.DashboardsApi.getPublicDashboardInvitations", localVarPath, - new ArrayList(), + localVarQueryParams, localVarHeaderParams, new HashMap(), new String[] {"application/json"}, @@ -529,50 +1314,58 @@ public ApiResponse getDashboardWithHttpInfo(String dashboardId) throw localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** - * Get a dashboard. + * Get all invitations for a shared dashboard. * - *

See {@link #getDashboardWithHttpInfo}. + *

See {@link #getPublicDashboardInvitationsWithHttpInfo}. * - * @param dashboardId The ID of the dashboard. (required) - * @return CompletableFuture<ApiResponse<Dashboard>> + * @param token Token of the shared dashboard for which to fetch invitations. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<SharedDashboardInvites>> */ - public CompletableFuture> getDashboardWithHttpInfoAsync( - String dashboardId) { + public CompletableFuture> + getPublicDashboardInvitationsWithHttpInfoAsync( + String token, GetPublicDashboardInvitationsOptionalParameters parameters) { Object localVarPostBody = null; - // verify the required parameter 'dashboardId' is set - if (dashboardId == null) { - CompletableFuture> result = new CompletableFuture<>(); + // verify the required parameter 'token' is set + if (token == null) { + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException( - 400, "Missing the required parameter 'dashboardId' when calling getDashboard")); + 400, + "Missing the required parameter 'token' when calling getPublicDashboardInvitations")); return result; } + Long pageSize = parameters.pageSize; + Long pageNumber = parameters.pageNumber; // create path and map variables String localVarPath = - "/api/v1/dashboard/{dashboard_id}" - .replaceAll( - "\\{" + "dashboard_id" + "\\}", apiClient.escapeString(dashboardId.toString())); + "/api/v1/dashboard/public/{token}/invitation" + .replaceAll("\\{" + "token" + "\\}", apiClient.escapeString(token.toString())); + List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page_size", pageSize)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page_number", pageNumber)); + Invocation.Builder builder; try { builder = apiClient.createBuilder( - "v1.DashboardsApi.getDashboard", + "v1.DashboardsApi.getPublicDashboardInvitations", localVarPath, - new ArrayList(), + localVarQueryParams, localVarHeaderParams, new HashMap(), new String[] {"application/json"}, new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); } catch (ApiException ex) { - CompletableFuture> result = new CompletableFuture<>(); + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally(ex); return result; } @@ -584,7 +1377,7 @@ public CompletableFuture> getDashboardWithHttpInfoAsync( localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** Manage optional parameters to listDashboards. */ @@ -909,6 +1702,167 @@ public CompletableFuture> restoreDashboardsWithHttpInfoAsync( null); } + /** + * Send shared dashboard invitation email. + * + *

See {@link #sendPublicDashboardInvitationWithHttpInfo}. + * + * @param token The token of the shared dashboard. (required) + * @param body Shared Dashboard Invitation request body. (required) + * @return SharedDashboardInvites + * @throws ApiException if fails to make API call + */ + public SharedDashboardInvites sendPublicDashboardInvitation( + String token, SharedDashboardInvites body) throws ApiException { + return sendPublicDashboardInvitationWithHttpInfo(token, body).getData(); + } + + /** + * Send shared dashboard invitation email. + * + *

See {@link #sendPublicDashboardInvitationWithHttpInfoAsync}. + * + * @param token The token of the shared dashboard. (required) + * @param body Shared Dashboard Invitation request body. (required) + * @return CompletableFuture<SharedDashboardInvites> + */ + public CompletableFuture sendPublicDashboardInvitationAsync( + String token, SharedDashboardInvites body) { + return sendPublicDashboardInvitationWithHttpInfoAsync(token, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Send emails to specified email addresses containing links to access a given authenticated + * shared dashboard. Email addresses must already belong to the authenticated shared dashboard's + * share_list. + * + * @param token The token of the shared dashboard. (required) + * @param body Shared Dashboard Invitation request body. (required) + * @return ApiResponse<SharedDashboardInvites> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
201 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse sendPublicDashboardInvitationWithHttpInfo( + String token, SharedDashboardInvites body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'token' is set + if (token == null) { + throw new ApiException( + 400, "Missing the required parameter 'token' when calling sendPublicDashboardInvitation"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling sendPublicDashboardInvitation"); + } + // create path and map variables + String localVarPath = + "/api/v1/dashboard/public/{token}/invitation" + .replaceAll("\\{" + "token" + "\\}", apiClient.escapeString(token.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v1.DashboardsApi.sendPublicDashboardInvitation", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Send shared dashboard invitation email. + * + *

See {@link #sendPublicDashboardInvitationWithHttpInfo}. + * + * @param token The token of the shared dashboard. (required) + * @param body Shared Dashboard Invitation request body. (required) + * @return CompletableFuture<ApiResponse<SharedDashboardInvites>> + */ + public CompletableFuture> + sendPublicDashboardInvitationWithHttpInfoAsync(String token, SharedDashboardInvites body) { + Object localVarPostBody = body; + + // verify the required parameter 'token' is set + if (token == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'token' when calling sendPublicDashboardInvitation")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'body' when calling sendPublicDashboardInvitation")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v1/dashboard/public/{token}/invitation" + .replaceAll("\\{" + "token" + "\\}", apiClient.escapeString(token.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v1.DashboardsApi.sendPublicDashboardInvitation", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Update a dashboard. * @@ -1065,4 +2019,161 @@ public CompletableFuture> updateDashboardWithHttpInfoAsyn false, new GenericType() {}); } + + /** + * Update a shared dashboard. + * + *

See {@link #updatePublicDashboardWithHttpInfo}. + * + * @param token The token of the shared dashboard. (required) + * @param body Update Dashboard request body. (required) + * @return SharedDashboard + * @throws ApiException if fails to make API call + */ + public SharedDashboard updatePublicDashboard(String token, SharedDashboardUpdateRequest body) + throws ApiException { + return updatePublicDashboardWithHttpInfo(token, body).getData(); + } + + /** + * Update a shared dashboard. + * + *

See {@link #updatePublicDashboardWithHttpInfoAsync}. + * + * @param token The token of the shared dashboard. (required) + * @param body Update Dashboard request body. (required) + * @return CompletableFuture<SharedDashboard> + */ + public CompletableFuture updatePublicDashboardAsync( + String token, SharedDashboardUpdateRequest body) { + return updatePublicDashboardWithHttpInfoAsync(token, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Update a shared dashboard associated with the specified token. + * + * @param token The token of the shared dashboard. (required) + * @param body Update Dashboard request body. (required) + * @return ApiResponse<SharedDashboard> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Authentication Error -
404 Item Not Found -
429 Too many requests -
+ */ + public ApiResponse updatePublicDashboardWithHttpInfo( + String token, SharedDashboardUpdateRequest body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'token' is set + if (token == null) { + throw new ApiException( + 400, "Missing the required parameter 'token' when calling updatePublicDashboard"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling updatePublicDashboard"); + } + // create path and map variables + String localVarPath = + "/api/v1/dashboard/public/{token}" + .replaceAll("\\{" + "token" + "\\}", apiClient.escapeString(token.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v1.DashboardsApi.updatePublicDashboard", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "PUT", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update a shared dashboard. + * + *

See {@link #updatePublicDashboardWithHttpInfo}. + * + * @param token The token of the shared dashboard. (required) + * @param body Update Dashboard request body. (required) + * @return CompletableFuture<ApiResponse<SharedDashboard>> + */ + public CompletableFuture> updatePublicDashboardWithHttpInfoAsync( + String token, SharedDashboardUpdateRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'token' is set + if (token == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'token' when calling updatePublicDashboard")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling updatePublicDashboard")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v1/dashboard/public/{token}" + .replaceAll("\\{" + "token" + "\\}", apiClient.escapeString(token.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v1.DashboardsApi.updatePublicDashboard", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "PUT", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } } diff --git a/src/main/java/com/datadog/api/client/v1/model/DashboardGlobalTime.java b/src/main/java/com/datadog/api/client/v1/model/DashboardGlobalTime.java new file mode 100644 index 00000000000..88461f9a929 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/DashboardGlobalTime.java @@ -0,0 +1,85 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v1.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; + +/** Object containing the live span selection for the dashboard. */ +@JsonPropertyOrder({DashboardGlobalTime.JSON_PROPERTY_LIVE_SPAN}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DashboardGlobalTime { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_LIVE_SPAN = "live_span"; + private DashboardGlobalTimeLiveSpan liveSpan; + + public DashboardGlobalTime liveSpan(DashboardGlobalTimeLiveSpan liveSpan) { + this.liveSpan = liveSpan; + this.unparsed |= !liveSpan.isValid(); + return this; + } + + /** + * Dashboard global time live_span selection + * + * @return liveSpan + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LIVE_SPAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public DashboardGlobalTimeLiveSpan getLiveSpan() { + return liveSpan; + } + + public void setLiveSpan(DashboardGlobalTimeLiveSpan liveSpan) { + if (!liveSpan.isValid()) { + this.unparsed = true; + } + this.liveSpan = liveSpan; + } + + /** Return true if this DashboardGlobalTime object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DashboardGlobalTime dashboardGlobalTime = (DashboardGlobalTime) o; + return Objects.equals(this.liveSpan, dashboardGlobalTime.liveSpan); + } + + @Override + public int hashCode() { + return Objects.hash(liveSpan); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DashboardGlobalTime {\n"); + sb.append(" liveSpan: ").append(toIndentedString(liveSpan)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/DashboardGlobalTimeLiveSpan.java b/src/main/java/com/datadog/api/client/v1/model/DashboardGlobalTimeLiveSpan.java new file mode 100644 index 00000000000..4aa435ac6b9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/DashboardGlobalTimeLiveSpan.java @@ -0,0 +1,109 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v1.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import java.util.Set; + +/** Dashboard global time live_span selection */ +@JsonSerialize(using = DashboardGlobalTimeLiveSpan.DashboardGlobalTimeLiveSpanSerializer.class) +public class DashboardGlobalTimeLiveSpan { + + public static final DashboardGlobalTimeLiveSpan PAST_FIFTEEN_MINUTES = + new DashboardGlobalTimeLiveSpan("15m"); + public static final DashboardGlobalTimeLiveSpan PAST_ONE_HOUR = + new DashboardGlobalTimeLiveSpan("1h"); + public static final DashboardGlobalTimeLiveSpan PAST_FOUR_HOURS = + new DashboardGlobalTimeLiveSpan("4h"); + public static final DashboardGlobalTimeLiveSpan PAST_ONE_DAY = + new DashboardGlobalTimeLiveSpan("1d"); + public static final DashboardGlobalTimeLiveSpan PAST_TWO_DAYS = + new DashboardGlobalTimeLiveSpan("2d"); + public static final DashboardGlobalTimeLiveSpan PAST_ONE_WEEK = + new DashboardGlobalTimeLiveSpan("1w"); + public static final DashboardGlobalTimeLiveSpan PAST_ONE_MONTH = + new DashboardGlobalTimeLiveSpan("1mo"); + public static final DashboardGlobalTimeLiveSpan PAST_THREE_MONTHS = + new DashboardGlobalTimeLiveSpan("3mo"); + + private static final Set allowedValues = + new HashSet(Arrays.asList("15m", "1h", "4h", "1d", "2d", "1w", "1mo", "3mo")); + + private String value; + + public boolean isValid() { + return allowedValues.contains(this.value); + } + + DashboardGlobalTimeLiveSpan(String value) { + this.value = value; + } + + public static class DashboardGlobalTimeLiveSpanSerializer + extends StdSerializer { + public DashboardGlobalTimeLiveSpanSerializer(Class t) { + super(t); + } + + public DashboardGlobalTimeLiveSpanSerializer() { + this(null); + } + + @Override + public void serialize( + DashboardGlobalTimeLiveSpan value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonValue + public String getValue() { + return this.value; + } + + public void setValue(String value) { + this.value = value; + } + + /** Return true if this DashboardGlobalTimeLiveSpan object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return this.value.equals(((DashboardGlobalTimeLiveSpan) o).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static DashboardGlobalTimeLiveSpan fromValue(String value) { + return new DashboardGlobalTimeLiveSpan(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/DashboardInviteType.java b/src/main/java/com/datadog/api/client/v1/model/DashboardInviteType.java new file mode 100644 index 00000000000..e65b0a8c2fd --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/DashboardInviteType.java @@ -0,0 +1,94 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v1.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import java.util.Set; + +/** Type for shared dashboard invitation request body. */ +@JsonSerialize(using = DashboardInviteType.DashboardInviteTypeSerializer.class) +public class DashboardInviteType { + + public static final DashboardInviteType PUBLIC_DASHBOARD_INVITATION = + new DashboardInviteType("public_dashboard_invitation"); + + private static final Set allowedValues = + new HashSet(Arrays.asList("public_dashboard_invitation")); + + private String value; + + public boolean isValid() { + return allowedValues.contains(this.value); + } + + DashboardInviteType(String value) { + this.value = value; + } + + public static class DashboardInviteTypeSerializer extends StdSerializer { + public DashboardInviteTypeSerializer(Class t) { + super(t); + } + + public DashboardInviteTypeSerializer() { + this(null); + } + + @Override + public void serialize( + DashboardInviteType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonValue + public String getValue() { + return this.value; + } + + public void setValue(String value) { + this.value = value; + } + + /** Return true if this DashboardInviteType object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return this.value.equals(((DashboardInviteType) o).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static DashboardInviteType fromValue(String value) { + return new DashboardInviteType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/DashboardShareType.java b/src/main/java/com/datadog/api/client/v1/model/DashboardShareType.java new file mode 100644 index 00000000000..73fa078f4b5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/DashboardShareType.java @@ -0,0 +1,93 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v1.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import java.util.Set; + +/** Type of sharing access (either open to anyone who has the public URL or invite-only). */ +@JsonSerialize(using = DashboardShareType.DashboardShareTypeSerializer.class) +public class DashboardShareType { + + public static final DashboardShareType OPEN = new DashboardShareType("open"); + public static final DashboardShareType INVITE = new DashboardShareType("invite"); + + private static final Set allowedValues = + new HashSet(Arrays.asList("open", "invite")); + + private String value; + + public boolean isValid() { + return allowedValues.contains(this.value); + } + + DashboardShareType(String value) { + this.value = value; + } + + public static class DashboardShareTypeSerializer extends StdSerializer { + public DashboardShareTypeSerializer(Class t) { + super(t); + } + + public DashboardShareTypeSerializer() { + this(null); + } + + @Override + public void serialize(DashboardShareType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonValue + public String getValue() { + return this.value; + } + + public void setValue(String value) { + this.value = value; + } + + /** Return true if this DashboardShareType object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return this.value.equals(((DashboardShareType) o).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static DashboardShareType fromValue(String value) { + return new DashboardShareType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/DashboardType.java b/src/main/java/com/datadog/api/client/v1/model/DashboardType.java new file mode 100644 index 00000000000..a478f0c77e9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/DashboardType.java @@ -0,0 +1,93 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v1.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import java.util.Set; + +/** The type of the associated private dashboard. */ +@JsonSerialize(using = DashboardType.DashboardTypeSerializer.class) +public class DashboardType { + + public static final DashboardType CUSTOM_TIMEBOARD = new DashboardType("custom_timeboard"); + public static final DashboardType CUSTOM_SCREENBOARD = new DashboardType("custom_screenboard"); + + private static final Set allowedValues = + new HashSet(Arrays.asList("custom_timeboard", "custom_screenboard")); + + private String value; + + public boolean isValid() { + return allowedValues.contains(this.value); + } + + DashboardType(String value) { + this.value = value; + } + + public static class DashboardTypeSerializer extends StdSerializer { + public DashboardTypeSerializer(Class t) { + super(t); + } + + public DashboardTypeSerializer() { + this(null); + } + + @Override + public void serialize(DashboardType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonValue + public String getValue() { + return this.value; + } + + public void setValue(String value) { + this.value = value; + } + + /** Return true if this DashboardType object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return this.value.equals(((DashboardType) o).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static DashboardType fromValue(String value) { + return new DashboardType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/DeleteSharedDashboardResponse.java b/src/main/java/com/datadog/api/client/v1/model/DeleteSharedDashboardResponse.java new file mode 100644 index 00000000000..bf03bfbfa5e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/DeleteSharedDashboardResponse.java @@ -0,0 +1,87 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v1.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; + +/** Response containing token of deleted shared dashboard. */ +@JsonPropertyOrder({DeleteSharedDashboardResponse.JSON_PROPERTY_DELETED_PUBLIC_DASHBOARD_TOKEN}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DeleteSharedDashboardResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DELETED_PUBLIC_DASHBOARD_TOKEN = + "deleted_public_dashboard_token"; + private String deletedPublicDashboardToken; + + public DeleteSharedDashboardResponse deletedPublicDashboardToken( + String deletedPublicDashboardToken) { + this.deletedPublicDashboardToken = deletedPublicDashboardToken; + return this; + } + + /** + * Token associated with the shared dashboard that was revoked. + * + * @return deletedPublicDashboardToken + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DELETED_PUBLIC_DASHBOARD_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDeletedPublicDashboardToken() { + return deletedPublicDashboardToken; + } + + public void setDeletedPublicDashboardToken(String deletedPublicDashboardToken) { + this.deletedPublicDashboardToken = deletedPublicDashboardToken; + } + + /** Return true if this DeleteSharedDashboardResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeleteSharedDashboardResponse deleteSharedDashboardResponse = (DeleteSharedDashboardResponse) o; + return Objects.equals( + this.deletedPublicDashboardToken, + deleteSharedDashboardResponse.deletedPublicDashboardToken); + } + + @Override + public int hashCode() { + return Objects.hash(deletedPublicDashboardToken); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteSharedDashboardResponse {\n"); + sb.append(" deletedPublicDashboardToken: ") + .append(toIndentedString(deletedPublicDashboardToken)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/SelectableTemplateVariableItems.java b/src/main/java/com/datadog/api/client/v1/model/SelectableTemplateVariableItems.java new file mode 100644 index 00000000000..247de2da6a2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/SelectableTemplateVariableItems.java @@ -0,0 +1,193 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v1.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** + * Object containing the template variable's name, associated tag/attribute, default value and + * selectable values. + */ +@JsonPropertyOrder({ + SelectableTemplateVariableItems.JSON_PROPERTY_DEFAULT_VALUE, + SelectableTemplateVariableItems.JSON_PROPERTY_NAME, + SelectableTemplateVariableItems.JSON_PROPERTY_PREFIX, + SelectableTemplateVariableItems.JSON_PROPERTY_VISIBLE_TAGS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SelectableTemplateVariableItems { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DEFAULT_VALUE = "default_value"; + private String defaultValue; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_PREFIX = "prefix"; + private String prefix; + + public static final String JSON_PROPERTY_VISIBLE_TAGS = "visible_tags"; + private JsonNullable> visibleTags = JsonNullable.>undefined(); + + public SelectableTemplateVariableItems defaultValue(String defaultValue) { + this.defaultValue = defaultValue; + return this; + } + + /** + * The default value of the template variable. + * + * @return defaultValue + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DEFAULT_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(String defaultValue) { + this.defaultValue = defaultValue; + } + + public SelectableTemplateVariableItems name(String name) { + this.name = name; + return this; + } + + /** + * Name of the template variable. + * + * @return name + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public SelectableTemplateVariableItems prefix(String prefix) { + this.prefix = prefix; + return this; + } + + /** + * The tag/attribute key associated with the template variable. + * + * @return prefix + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PREFIX) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPrefix() { + return prefix; + } + + public void setPrefix(String prefix) { + this.prefix = prefix; + } + + public SelectableTemplateVariableItems visibleTags(List visibleTags) { + this.visibleTags = JsonNullable.>of(visibleTags); + return this; + } + + public SelectableTemplateVariableItems addVisibleTagsItem(String visibleTagsItem) { + if (this.visibleTags == null || !this.visibleTags.isPresent()) { + this.visibleTags = JsonNullable.>of(new ArrayList<>()); + } + try { + this.visibleTags.get().add(visibleTagsItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * List of visible tag values on the shared dashboard. + * + * @return visibleTags + */ + @jakarta.annotation.Nullable + @JsonIgnore + public List getVisibleTags() { + return visibleTags.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_VISIBLE_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable> getVisibleTags_JsonNullable() { + return visibleTags; + } + + @JsonProperty(JSON_PROPERTY_VISIBLE_TAGS) + public void setVisibleTags_JsonNullable(JsonNullable> visibleTags) { + this.visibleTags = visibleTags; + } + + public void setVisibleTags(List visibleTags) { + this.visibleTags = JsonNullable.>of(visibleTags); + } + + /** Return true if this SelectableTemplateVariableItems object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SelectableTemplateVariableItems selectableTemplateVariableItems = + (SelectableTemplateVariableItems) o; + return Objects.equals(this.defaultValue, selectableTemplateVariableItems.defaultValue) + && Objects.equals(this.name, selectableTemplateVariableItems.name) + && Objects.equals(this.prefix, selectableTemplateVariableItems.prefix) + && Objects.equals(this.visibleTags, selectableTemplateVariableItems.visibleTags); + } + + @Override + public int hashCode() { + return Objects.hash(defaultValue, name, prefix, visibleTags); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SelectableTemplateVariableItems {\n"); + sb.append(" defaultValue: ").append(toIndentedString(defaultValue)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" prefix: ").append(toIndentedString(prefix)).append("\n"); + sb.append(" visibleTags: ").append(toIndentedString(visibleTags)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/SharedDashboard.java b/src/main/java/com/datadog/api/client/v1/model/SharedDashboard.java new file mode 100644 index 00000000000..ec518534501 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/SharedDashboard.java @@ -0,0 +1,436 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v1.model; + +import com.datadog.api.client.JsonTimeSerializer; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** The metadata object associated with how a dashboard has been/will be shared. */ +@JsonPropertyOrder({ + SharedDashboard.JSON_PROPERTY_AUTHOR, + SharedDashboard.JSON_PROPERTY_CREATED_AT, + SharedDashboard.JSON_PROPERTY_DASHBOARD_ID, + SharedDashboard.JSON_PROPERTY_DASHBOARD_TYPE, + SharedDashboard.JSON_PROPERTY_GLOBAL_TIME, + SharedDashboard.JSON_PROPERTY_GLOBAL_TIME_SELECTABLE_ENABLED, + SharedDashboard.JSON_PROPERTY_PUBLIC_URL, + SharedDashboard.JSON_PROPERTY_SELECTABLE_TEMPLATE_VARS, + SharedDashboard.JSON_PROPERTY_SHARE_LIST, + SharedDashboard.JSON_PROPERTY_SHARE_TYPE, + SharedDashboard.JSON_PROPERTY_TOKEN +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SharedDashboard { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_AUTHOR = "author"; + private SharedDashboardAuthor author; + + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + + @JsonSerialize(using = JsonTimeSerializer.class) + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_DASHBOARD_ID = "dashboard_id"; + private String dashboardId; + + public static final String JSON_PROPERTY_DASHBOARD_TYPE = "dashboard_type"; + private DashboardType dashboardType; + + public static final String JSON_PROPERTY_GLOBAL_TIME = "global_time"; + private DashboardGlobalTime globalTime; + + public static final String JSON_PROPERTY_GLOBAL_TIME_SELECTABLE_ENABLED = + "global_time_selectable_enabled"; + private JsonNullable globalTimeSelectableEnabled = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_PUBLIC_URL = "public_url"; + private String publicUrl; + + public static final String JSON_PROPERTY_SELECTABLE_TEMPLATE_VARS = "selectable_template_vars"; + private JsonNullable> selectableTemplateVars = + JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_SHARE_LIST = "share_list"; + private JsonNullable> shareList = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_SHARE_TYPE = "share_type"; + private JsonNullable shareType = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_TOKEN = "token"; + private String token; + + public SharedDashboard() {} + + @JsonCreator + public SharedDashboard( + @JsonProperty(required = true, value = JSON_PROPERTY_DASHBOARD_ID) String dashboardId, + @JsonProperty(required = true, value = JSON_PROPERTY_DASHBOARD_TYPE) + DashboardType dashboardType) { + this.dashboardId = dashboardId; + this.dashboardType = dashboardType; + this.unparsed |= !dashboardType.isValid(); + } + + /** + * User who shared the dashboard. + * + * @return author + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_AUTHOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public SharedDashboardAuthor getAuthor() { + return author; + } + + /** + * Date the dashboard was shared. + * + * @return createdAt + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public SharedDashboard dashboardId(String dashboardId) { + this.dashboardId = dashboardId; + return this; + } + + /** + * ID of the dashboard to share. + * + * @return dashboardId + */ + @JsonProperty(JSON_PROPERTY_DASHBOARD_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDashboardId() { + return dashboardId; + } + + public void setDashboardId(String dashboardId) { + this.dashboardId = dashboardId; + } + + public SharedDashboard dashboardType(DashboardType dashboardType) { + this.dashboardType = dashboardType; + this.unparsed |= !dashboardType.isValid(); + return this; + } + + /** + * The type of the associated private dashboard. + * + * @return dashboardType + */ + @JsonProperty(JSON_PROPERTY_DASHBOARD_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public DashboardType getDashboardType() { + return dashboardType; + } + + public void setDashboardType(DashboardType dashboardType) { + if (!dashboardType.isValid()) { + this.unparsed = true; + } + this.dashboardType = dashboardType; + } + + public SharedDashboard globalTime(DashboardGlobalTime globalTime) { + this.globalTime = globalTime; + this.unparsed |= globalTime.unparsed; + return this; + } + + /** + * Object containing the live span selection for the dashboard. + * + * @return globalTime + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_GLOBAL_TIME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public DashboardGlobalTime getGlobalTime() { + return globalTime; + } + + public void setGlobalTime(DashboardGlobalTime globalTime) { + this.globalTime = globalTime; + } + + public SharedDashboard globalTimeSelectableEnabled(Boolean globalTimeSelectableEnabled) { + this.globalTimeSelectableEnabled = JsonNullable.of(globalTimeSelectableEnabled); + return this; + } + + /** + * Whether to allow viewers to select a different global time setting for the shared dashboard. + * + * @return globalTimeSelectableEnabled + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Boolean getGlobalTimeSelectableEnabled() { + return globalTimeSelectableEnabled.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_GLOBAL_TIME_SELECTABLE_ENABLED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getGlobalTimeSelectableEnabled_JsonNullable() { + return globalTimeSelectableEnabled; + } + + @JsonProperty(JSON_PROPERTY_GLOBAL_TIME_SELECTABLE_ENABLED) + public void setGlobalTimeSelectableEnabled_JsonNullable( + JsonNullable globalTimeSelectableEnabled) { + this.globalTimeSelectableEnabled = globalTimeSelectableEnabled; + } + + public void setGlobalTimeSelectableEnabled(Boolean globalTimeSelectableEnabled) { + this.globalTimeSelectableEnabled = JsonNullable.of(globalTimeSelectableEnabled); + } + + /** + * URL of the shared dashboard. + * + * @return publicUrl + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PUBLIC_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPublicUrl() { + return publicUrl; + } + + public SharedDashboard selectableTemplateVars( + List selectableTemplateVars) { + this.selectableTemplateVars = + JsonNullable.>of(selectableTemplateVars); + return this; + } + + public SharedDashboard addSelectableTemplateVarsItem( + SelectableTemplateVariableItems selectableTemplateVarsItem) { + if (this.selectableTemplateVars == null || !this.selectableTemplateVars.isPresent()) { + this.selectableTemplateVars = + JsonNullable.>of(new ArrayList<>()); + } + try { + this.selectableTemplateVars.get().add(selectableTemplateVarsItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * List of objects representing template variables on the shared dashboard which can have + * selectable values. + * + * @return selectableTemplateVars + */ + @jakarta.annotation.Nullable + @JsonIgnore + public List getSelectableTemplateVars() { + return selectableTemplateVars.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_SELECTABLE_TEMPLATE_VARS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable> + getSelectableTemplateVars_JsonNullable() { + return selectableTemplateVars; + } + + @JsonProperty(JSON_PROPERTY_SELECTABLE_TEMPLATE_VARS) + public void setSelectableTemplateVars_JsonNullable( + JsonNullable> selectableTemplateVars) { + this.selectableTemplateVars = selectableTemplateVars; + } + + public void setSelectableTemplateVars( + List selectableTemplateVars) { + this.selectableTemplateVars = + JsonNullable.>of(selectableTemplateVars); + } + + public SharedDashboard shareList(List shareList) { + this.shareList = JsonNullable.>of(shareList); + return this; + } + + public SharedDashboard addShareListItem(String shareListItem) { + if (this.shareList == null || !this.shareList.isPresent()) { + this.shareList = JsonNullable.>of(new ArrayList<>()); + } + try { + this.shareList.get().add(shareListItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * List of email addresses that can receive an invitation to access to the shared dashboard. + * + * @return shareList + */ + @jakarta.annotation.Nullable + @JsonIgnore + public List getShareList() { + return shareList.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_SHARE_LIST) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable> getShareList_JsonNullable() { + return shareList; + } + + @JsonProperty(JSON_PROPERTY_SHARE_LIST) + public void setShareList_JsonNullable(JsonNullable> shareList) { + this.shareList = shareList; + } + + public void setShareList(List shareList) { + this.shareList = JsonNullable.>of(shareList); + } + + public SharedDashboard shareType(DashboardShareType shareType) { + this.shareType = JsonNullable.of(shareType); + return this; + } + + /** + * Type of sharing access (either open to anyone who has the public URL or invite-only). + * + * @return shareType + */ + @jakarta.annotation.Nullable + @JsonIgnore + public DashboardShareType getShareType() { + return shareType.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_SHARE_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getShareType_JsonNullable() { + return shareType; + } + + @JsonProperty(JSON_PROPERTY_SHARE_TYPE) + public void setShareType_JsonNullable(JsonNullable shareType) { + this.shareType = shareType; + } + + public void setShareType(DashboardShareType shareType) { + if (!shareType.isValid()) { + this.unparsed = true; + } + this.shareType = JsonNullable.of(shareType); + } + + /** + * A unique token assigned to the shared dashboard. + * + * @return token + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getToken() { + return token; + } + + /** Return true if this SharedDashboard object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SharedDashboard sharedDashboard = (SharedDashboard) o; + return Objects.equals(this.author, sharedDashboard.author) + && Objects.equals(this.createdAt, sharedDashboard.createdAt) + && Objects.equals(this.dashboardId, sharedDashboard.dashboardId) + && Objects.equals(this.dashboardType, sharedDashboard.dashboardType) + && Objects.equals(this.globalTime, sharedDashboard.globalTime) + && Objects.equals( + this.globalTimeSelectableEnabled, sharedDashboard.globalTimeSelectableEnabled) + && Objects.equals(this.publicUrl, sharedDashboard.publicUrl) + && Objects.equals(this.selectableTemplateVars, sharedDashboard.selectableTemplateVars) + && Objects.equals(this.shareList, sharedDashboard.shareList) + && Objects.equals(this.shareType, sharedDashboard.shareType) + && Objects.equals(this.token, sharedDashboard.token); + } + + @Override + public int hashCode() { + return Objects.hash( + author, + createdAt, + dashboardId, + dashboardType, + globalTime, + globalTimeSelectableEnabled, + publicUrl, + selectableTemplateVars, + shareList, + shareType, + token); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SharedDashboard {\n"); + sb.append(" author: ").append(toIndentedString(author)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" dashboardId: ").append(toIndentedString(dashboardId)).append("\n"); + sb.append(" dashboardType: ").append(toIndentedString(dashboardType)).append("\n"); + sb.append(" globalTime: ").append(toIndentedString(globalTime)).append("\n"); + sb.append(" globalTimeSelectableEnabled: ") + .append(toIndentedString(globalTimeSelectableEnabled)) + .append("\n"); + sb.append(" publicUrl: ").append(toIndentedString(publicUrl)).append("\n"); + sb.append(" selectableTemplateVars: ") + .append(toIndentedString(selectableTemplateVars)) + .append("\n"); + sb.append(" shareList: ").append(toIndentedString(shareList)).append("\n"); + sb.append(" shareType: ").append(toIndentedString(shareType)).append("\n"); + sb.append(" token: ").append(toIndentedString(token)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/SharedDashboardAuthor.java b/src/main/java/com/datadog/api/client/v1/model/SharedDashboardAuthor.java new file mode 100644 index 00000000000..deaf474609a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/SharedDashboardAuthor.java @@ -0,0 +1,92 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v1.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; + +/** User who shared the dashboard. */ +@JsonPropertyOrder({ + SharedDashboardAuthor.JSON_PROPERTY_HANDLE, + SharedDashboardAuthor.JSON_PROPERTY_NAME +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SharedDashboardAuthor { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_HANDLE = "handle"; + private String handle; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + /** + * Identifier of the user who shared the dashboard. + * + * @return handle + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_HANDLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getHandle() { + return handle; + } + + /** + * Name of the user who shared the dashboard. + * + * @return name + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + /** Return true if this SharedDashboardAuthor object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SharedDashboardAuthor sharedDashboardAuthor = (SharedDashboardAuthor) o; + return Objects.equals(this.handle, sharedDashboardAuthor.handle) + && Objects.equals(this.name, sharedDashboardAuthor.name); + } + + @Override + public int hashCode() { + return Objects.hash(handle, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SharedDashboardAuthor {\n"); + sb.append(" handle: ").append(toIndentedString(handle)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/SharedDashboardInvites.java b/src/main/java/com/datadog/api/client/v1/model/SharedDashboardInvites.java new file mode 100644 index 00000000000..ef05e8b7066 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/SharedDashboardInvites.java @@ -0,0 +1,112 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v1.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; + +/** Invitations data and metadata that exists for a shared dashboard returned by the API. */ +@JsonPropertyOrder({ + SharedDashboardInvites.JSON_PROPERTY_DATA, + SharedDashboardInvites.JSON_PROPERTY_META +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SharedDashboardInvites { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private SharedDashboardInvitesData data; + + public static final String JSON_PROPERTY_META = "meta"; + private SharedDashboardInvitesMeta meta; + + public SharedDashboardInvites() {} + + @JsonCreator + public SharedDashboardInvites( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) SharedDashboardInvitesData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public SharedDashboardInvites data(SharedDashboardInvitesData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * An object or list of objects containing the information for an invitation to a shared + * dashboard. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SharedDashboardInvitesData getData() { + return data; + } + + public void setData(SharedDashboardInvitesData data) { + this.data = data; + } + + /** + * Pagination metadata returned by the API. + * + * @return meta + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_META) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public SharedDashboardInvitesMeta getMeta() { + return meta; + } + + /** Return true if this SharedDashboardInvites object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SharedDashboardInvites sharedDashboardInvites = (SharedDashboardInvites) o; + return Objects.equals(this.data, sharedDashboardInvites.data) + && Objects.equals(this.meta, sharedDashboardInvites.meta); + } + + @Override + public int hashCode() { + return Objects.hash(data, meta); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SharedDashboardInvites {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/SharedDashboardInvitesData.java b/src/main/java/com/datadog/api/client/v1/model/SharedDashboardInvitesData.java new file mode 100644 index 00000000000..f5a2ffc8ac8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/SharedDashboardInvitesData.java @@ -0,0 +1,289 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v1.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = SharedDashboardInvitesData.SharedDashboardInvitesDataDeserializer.class) +@JsonSerialize(using = SharedDashboardInvitesData.SharedDashboardInvitesDataSerializer.class) +public class SharedDashboardInvitesData extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(SharedDashboardInvitesData.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class SharedDashboardInvitesDataSerializer + extends StdSerializer { + public SharedDashboardInvitesDataSerializer(Class t) { + super(t); + } + + public SharedDashboardInvitesDataSerializer() { + this(null); + } + + @Override + public void serialize( + SharedDashboardInvitesData value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class SharedDashboardInvitesDataDeserializer + extends StdDeserializer { + public SharedDashboardInvitesDataDeserializer() { + this(SharedDashboardInvitesData.class); + } + + public SharedDashboardInvitesDataDeserializer(Class vc) { + super(vc); + } + + @Override + public SharedDashboardInvitesData deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize SharedDashboardInvitesDataObject + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (SharedDashboardInvitesDataObject.class.equals(Integer.class) + || SharedDashboardInvitesDataObject.class.equals(Long.class) + || SharedDashboardInvitesDataObject.class.equals(Float.class) + || SharedDashboardInvitesDataObject.class.equals(Double.class) + || SharedDashboardInvitesDataObject.class.equals(Boolean.class) + || SharedDashboardInvitesDataObject.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((SharedDashboardInvitesDataObject.class.equals(Integer.class) + || SharedDashboardInvitesDataObject.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((SharedDashboardInvitesDataObject.class.equals(Float.class) + || SharedDashboardInvitesDataObject.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (SharedDashboardInvitesDataObject.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (SharedDashboardInvitesDataObject.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(SharedDashboardInvitesDataObject.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((SharedDashboardInvitesDataObject) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'SharedDashboardInvitesDataObject'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, "Input data does not match schema 'SharedDashboardInvitesDataObject'", e); + } + + // deserialize List + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (List.class.equals(Integer.class) + || List.class.equals(Long.class) + || List.class.equals(Float.class) + || List.class.equals(Double.class) + || List.class.equals(Boolean.class) + || List.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((List.class.equals(Integer.class) || List.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((List.class.equals(Float.class) || List.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (List.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (List.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(List.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + deserialized = tmp; + match++; + + log.log(Level.FINER, "Input data matches schema 'List'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'List'", e); + } + + SharedDashboardInvitesData ret = new SharedDashboardInvitesData(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public SharedDashboardInvitesData getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "SharedDashboardInvitesData cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public SharedDashboardInvitesData() { + super("oneOf", Boolean.FALSE); + } + + public SharedDashboardInvitesData(SharedDashboardInvitesDataObject o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public SharedDashboardInvitesData(List o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put( + "SharedDashboardInvitesDataObject", new GenericType() {}); + schemas.put( + "List", + new GenericType>() {}); + JSON.registerDescendants( + SharedDashboardInvitesData.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return SharedDashboardInvitesData.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: SharedDashboardInvitesDataObject, + * List<SharedDashboardInvitesDataObject> + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf( + SharedDashboardInvitesDataObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(List.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException( + "Invalid instance type. Must be SharedDashboardInvitesDataObject," + + " List"); + } + + /** + * Get the actual instance, which can be the following: SharedDashboardInvitesDataObject, + * List<SharedDashboardInvitesDataObject> + * + * @return The actual instance (SharedDashboardInvitesDataObject, + * List<SharedDashboardInvitesDataObject>) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `SharedDashboardInvitesDataObject`. If the actual instance is not + * `SharedDashboardInvitesDataObject`, the ClassCastException will be thrown. + * + * @return The actual instance of `SharedDashboardInvitesDataObject` + * @throws ClassCastException if the instance is not `SharedDashboardInvitesDataObject` + */ + public SharedDashboardInvitesDataObject getSharedDashboardInvitesDataObject() + throws ClassCastException { + return (SharedDashboardInvitesDataObject) super.getActualInstance(); + } + + /** + * Get the actual instance of `List<SharedDashboardInvitesDataObject>`. If the actual + * instance is not `List<SharedDashboardInvitesDataObject>`, the ClassCastException will be + * thrown. + * + * @return The actual instance of `List<SharedDashboardInvitesDataObject>` + * @throws ClassCastException if the instance is not + * `List<SharedDashboardInvitesDataObject>` + */ + public List getList() throws ClassCastException { + return (List) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/SharedDashboardInvitesDataObject.java b/src/main/java/com/datadog/api/client/v1/model/SharedDashboardInvitesDataObject.java new file mode 100644 index 00000000000..d20dbd4a0ca --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/SharedDashboardInvitesDataObject.java @@ -0,0 +1,129 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v1.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; + +/** Object containing the information for an invitation to a shared dashboard. */ +@JsonPropertyOrder({ + SharedDashboardInvitesDataObject.JSON_PROPERTY_ATTRIBUTES, + SharedDashboardInvitesDataObject.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SharedDashboardInvitesDataObject { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private SharedDashboardInvitesDataObjectAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private DashboardInviteType type; + + public SharedDashboardInvitesDataObject() {} + + @JsonCreator + public SharedDashboardInvitesDataObject( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + SharedDashboardInvitesDataObjectAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) DashboardInviteType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public SharedDashboardInvitesDataObject attributes( + SharedDashboardInvitesDataObjectAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of the shared dashboard invitation + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SharedDashboardInvitesDataObjectAttributes getAttributes() { + return attributes; + } + + public void setAttributes(SharedDashboardInvitesDataObjectAttributes attributes) { + this.attributes = attributes; + } + + public SharedDashboardInvitesDataObject type(DashboardInviteType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type for shared dashboard invitation request body. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public DashboardInviteType getType() { + return type; + } + + public void setType(DashboardInviteType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** Return true if this SharedDashboardInvitesDataObject object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SharedDashboardInvitesDataObject sharedDashboardInvitesDataObject = + (SharedDashboardInvitesDataObject) o; + return Objects.equals(this.attributes, sharedDashboardInvitesDataObject.attributes) + && Objects.equals(this.type, sharedDashboardInvitesDataObject.type); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SharedDashboardInvitesDataObject {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/SharedDashboardInvitesDataObjectAttributes.java b/src/main/java/com/datadog/api/client/v1/model/SharedDashboardInvitesDataObjectAttributes.java new file mode 100644 index 00000000000..0f1925500f4 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/SharedDashboardInvitesDataObjectAttributes.java @@ -0,0 +1,202 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v1.model; + +import com.datadog.api.client.JsonTimeSerializer; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import java.time.OffsetDateTime; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Attributes of the shared dashboard invitation */ +@JsonPropertyOrder({ + SharedDashboardInvitesDataObjectAttributes.JSON_PROPERTY_CREATED_AT, + SharedDashboardInvitesDataObjectAttributes.JSON_PROPERTY_EMAIL, + SharedDashboardInvitesDataObjectAttributes.JSON_PROPERTY_HAS_SESSION, + SharedDashboardInvitesDataObjectAttributes.JSON_PROPERTY_INVITATION_EXPIRY, + SharedDashboardInvitesDataObjectAttributes.JSON_PROPERTY_SESSION_EXPIRY, + SharedDashboardInvitesDataObjectAttributes.JSON_PROPERTY_SHARE_TOKEN +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SharedDashboardInvitesDataObjectAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + + @JsonSerialize(using = JsonTimeSerializer.class) + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_EMAIL = "email"; + private String email; + + public static final String JSON_PROPERTY_HAS_SESSION = "has_session"; + private Boolean hasSession; + + public static final String JSON_PROPERTY_INVITATION_EXPIRY = "invitation_expiry"; + + @JsonSerialize(using = JsonTimeSerializer.class) + private OffsetDateTime invitationExpiry; + + public static final String JSON_PROPERTY_SESSION_EXPIRY = "session_expiry"; + + @JsonSerialize(using = JsonTimeSerializer.class) + private JsonNullable sessionExpiry = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_SHARE_TOKEN = "share_token"; + private String shareToken; + + /** + * When the invitation was sent. + * + * @return createdAt + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public SharedDashboardInvitesDataObjectAttributes email(String email) { + this.email = email; + return this; + } + + /** + * An email address that an invitation has been (or if used in invitation request, will be) sent + * to. + * + * @return email + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EMAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + /** + * Indicates whether an active session exists for the invitation (produced when a user clicks the + * link in the email). + * + * @return hasSession + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_HAS_SESSION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getHasSession() { + return hasSession; + } + + /** + * When the invitation expires. + * + * @return invitationExpiry + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_INVITATION_EXPIRY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getInvitationExpiry() { + return invitationExpiry; + } + + /** + * When the invited user's session expires. null if the invitation has no associated session. + * + * @return sessionExpiry + */ + @jakarta.annotation.Nullable + @JsonIgnore + public OffsetDateTime getSessionExpiry() { + + if (sessionExpiry == null) { + sessionExpiry = JsonNullable.undefined(); + } + return sessionExpiry.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_SESSION_EXPIRY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getSessionExpiry_JsonNullable() { + return sessionExpiry; + } + + @JsonProperty(JSON_PROPERTY_SESSION_EXPIRY) + private void setSessionExpiry_JsonNullable(JsonNullable sessionExpiry) { + this.sessionExpiry = sessionExpiry; + } + + /** + * The unique token of the shared dashboard that was (or is to be) shared. + * + * @return shareToken + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SHARE_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getShareToken() { + return shareToken; + } + + /** Return true if this SharedDashboardInvitesDataObjectAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SharedDashboardInvitesDataObjectAttributes sharedDashboardInvitesDataObjectAttributes = + (SharedDashboardInvitesDataObjectAttributes) o; + return Objects.equals(this.createdAt, sharedDashboardInvitesDataObjectAttributes.createdAt) + && Objects.equals(this.email, sharedDashboardInvitesDataObjectAttributes.email) + && Objects.equals(this.hasSession, sharedDashboardInvitesDataObjectAttributes.hasSession) + && Objects.equals( + this.invitationExpiry, sharedDashboardInvitesDataObjectAttributes.invitationExpiry) + && Objects.equals( + this.sessionExpiry, sharedDashboardInvitesDataObjectAttributes.sessionExpiry) + && Objects.equals(this.shareToken, sharedDashboardInvitesDataObjectAttributes.shareToken); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, email, hasSession, invitationExpiry, sessionExpiry, shareToken); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SharedDashboardInvitesDataObjectAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" hasSession: ").append(toIndentedString(hasSession)).append("\n"); + sb.append(" invitationExpiry: ").append(toIndentedString(invitationExpiry)).append("\n"); + sb.append(" sessionExpiry: ").append(toIndentedString(sessionExpiry)).append("\n"); + sb.append(" shareToken: ").append(toIndentedString(shareToken)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/SharedDashboardInvitesMeta.java b/src/main/java/com/datadog/api/client/v1/model/SharedDashboardInvitesMeta.java new file mode 100644 index 00000000000..1cbae3e2906 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/SharedDashboardInvitesMeta.java @@ -0,0 +1,82 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v1.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; + +/** Pagination metadata returned by the API. */ +@JsonPropertyOrder({SharedDashboardInvitesMeta.JSON_PROPERTY_PAGE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SharedDashboardInvitesMeta { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_PAGE = "page"; + private SharedDashboardInvitesMetaPage page; + + public SharedDashboardInvitesMeta page(SharedDashboardInvitesMetaPage page) { + this.page = page; + this.unparsed |= page.unparsed; + return this; + } + + /** + * Object containing the total count of invitations across all pages + * + * @return page + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public SharedDashboardInvitesMetaPage getPage() { + return page; + } + + public void setPage(SharedDashboardInvitesMetaPage page) { + this.page = page; + } + + /** Return true if this SharedDashboardInvitesMeta object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SharedDashboardInvitesMeta sharedDashboardInvitesMeta = (SharedDashboardInvitesMeta) o; + return Objects.equals(this.page, sharedDashboardInvitesMeta.page); + } + + @Override + public int hashCode() { + return Objects.hash(page); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SharedDashboardInvitesMeta {\n"); + sb.append(" page: ").append(toIndentedString(page)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/SharedDashboardInvitesMetaPage.java b/src/main/java/com/datadog/api/client/v1/model/SharedDashboardInvitesMetaPage.java new file mode 100644 index 00000000000..4ea7e73c150 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/SharedDashboardInvitesMetaPage.java @@ -0,0 +1,82 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v1.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; + +/** Object containing the total count of invitations across all pages */ +@JsonPropertyOrder({SharedDashboardInvitesMetaPage.JSON_PROPERTY_TOTAL_COUNT}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SharedDashboardInvitesMetaPage { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_TOTAL_COUNT = "total_count"; + private Long totalCount; + + public SharedDashboardInvitesMetaPage totalCount(Long totalCount) { + this.totalCount = totalCount; + return this; + } + + /** + * The total number of invitations on this shared board, across all pages. + * + * @return totalCount + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TOTAL_COUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getTotalCount() { + return totalCount; + } + + public void setTotalCount(Long totalCount) { + this.totalCount = totalCount; + } + + /** Return true if this SharedDashboardInvitesMetaPage object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SharedDashboardInvitesMetaPage sharedDashboardInvitesMetaPage = + (SharedDashboardInvitesMetaPage) o; + return Objects.equals(this.totalCount, sharedDashboardInvitesMetaPage.totalCount); + } + + @Override + public int hashCode() { + return Objects.hash(totalCount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SharedDashboardInvitesMetaPage {\n"); + sb.append(" totalCount: ").append(toIndentedString(totalCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/SharedDashboardUpdateRequest.java b/src/main/java/com/datadog/api/client/v1/model/SharedDashboardUpdateRequest.java new file mode 100644 index 00000000000..23c08e9254f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/SharedDashboardUpdateRequest.java @@ -0,0 +1,299 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v1.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Update a shared dashboard's settings. */ +@JsonPropertyOrder({ + SharedDashboardUpdateRequest.JSON_PROPERTY_GLOBAL_TIME, + SharedDashboardUpdateRequest.JSON_PROPERTY_GLOBAL_TIME_SELECTABLE_ENABLED, + SharedDashboardUpdateRequest.JSON_PROPERTY_SELECTABLE_TEMPLATE_VARS, + SharedDashboardUpdateRequest.JSON_PROPERTY_SHARE_LIST, + SharedDashboardUpdateRequest.JSON_PROPERTY_SHARE_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SharedDashboardUpdateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_GLOBAL_TIME = "global_time"; + private SharedDashboardUpdateRequestGlobalTime globalTime; + + public static final String JSON_PROPERTY_GLOBAL_TIME_SELECTABLE_ENABLED = + "global_time_selectable_enabled"; + private JsonNullable globalTimeSelectableEnabled = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_SELECTABLE_TEMPLATE_VARS = "selectable_template_vars"; + private JsonNullable> selectableTemplateVars = + JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_SHARE_LIST = "share_list"; + private JsonNullable> shareList = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_SHARE_TYPE = "share_type"; + private JsonNullable shareType = JsonNullable.undefined(); + + public SharedDashboardUpdateRequest() {} + + @JsonCreator + public SharedDashboardUpdateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_GLOBAL_TIME) + SharedDashboardUpdateRequestGlobalTime globalTime) { + this.globalTime = globalTime; + if (globalTime != null) { + this.unparsed |= globalTime.unparsed; + } + } + + public SharedDashboardUpdateRequest globalTime( + SharedDashboardUpdateRequestGlobalTime globalTime) { + this.globalTime = globalTime; + if (globalTime != null) { + this.unparsed |= globalTime.unparsed; + } + return this; + } + + /** + * Timeframe setting for the shared dashboard. + * + * @return globalTime + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_GLOBAL_TIME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SharedDashboardUpdateRequestGlobalTime getGlobalTime() { + return globalTime; + } + + public void setGlobalTime(SharedDashboardUpdateRequestGlobalTime globalTime) { + this.globalTime = globalTime; + } + + public SharedDashboardUpdateRequest globalTimeSelectableEnabled( + Boolean globalTimeSelectableEnabled) { + this.globalTimeSelectableEnabled = JsonNullable.of(globalTimeSelectableEnabled); + return this; + } + + /** + * Whether to allow viewers to select a different global time setting for the shared dashboard. + * + * @return globalTimeSelectableEnabled + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Boolean getGlobalTimeSelectableEnabled() { + return globalTimeSelectableEnabled.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_GLOBAL_TIME_SELECTABLE_ENABLED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getGlobalTimeSelectableEnabled_JsonNullable() { + return globalTimeSelectableEnabled; + } + + @JsonProperty(JSON_PROPERTY_GLOBAL_TIME_SELECTABLE_ENABLED) + public void setGlobalTimeSelectableEnabled_JsonNullable( + JsonNullable globalTimeSelectableEnabled) { + this.globalTimeSelectableEnabled = globalTimeSelectableEnabled; + } + + public void setGlobalTimeSelectableEnabled(Boolean globalTimeSelectableEnabled) { + this.globalTimeSelectableEnabled = JsonNullable.of(globalTimeSelectableEnabled); + } + + public SharedDashboardUpdateRequest selectableTemplateVars( + List selectableTemplateVars) { + this.selectableTemplateVars = + JsonNullable.>of(selectableTemplateVars); + return this; + } + + public SharedDashboardUpdateRequest addSelectableTemplateVarsItem( + SelectableTemplateVariableItems selectableTemplateVarsItem) { + if (this.selectableTemplateVars == null || !this.selectableTemplateVars.isPresent()) { + this.selectableTemplateVars = + JsonNullable.>of(new ArrayList<>()); + } + try { + this.selectableTemplateVars.get().add(selectableTemplateVarsItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * List of objects representing template variables on the shared dashboard which can have + * selectable values. + * + * @return selectableTemplateVars + */ + @jakarta.annotation.Nullable + @JsonIgnore + public List getSelectableTemplateVars() { + return selectableTemplateVars.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_SELECTABLE_TEMPLATE_VARS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable> + getSelectableTemplateVars_JsonNullable() { + return selectableTemplateVars; + } + + @JsonProperty(JSON_PROPERTY_SELECTABLE_TEMPLATE_VARS) + public void setSelectableTemplateVars_JsonNullable( + JsonNullable> selectableTemplateVars) { + this.selectableTemplateVars = selectableTemplateVars; + } + + public void setSelectableTemplateVars( + List selectableTemplateVars) { + this.selectableTemplateVars = + JsonNullable.>of(selectableTemplateVars); + } + + public SharedDashboardUpdateRequest shareList(List shareList) { + this.shareList = JsonNullable.>of(shareList); + return this; + } + + public SharedDashboardUpdateRequest addShareListItem(String shareListItem) { + if (this.shareList == null || !this.shareList.isPresent()) { + this.shareList = JsonNullable.>of(new ArrayList<>()); + } + try { + this.shareList.get().add(shareListItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * List of email addresses that can be given access to the shared dashboard. + * + * @return shareList + */ + @jakarta.annotation.Nullable + @JsonIgnore + public List getShareList() { + return shareList.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_SHARE_LIST) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable> getShareList_JsonNullable() { + return shareList; + } + + @JsonProperty(JSON_PROPERTY_SHARE_LIST) + public void setShareList_JsonNullable(JsonNullable> shareList) { + this.shareList = shareList; + } + + public void setShareList(List shareList) { + this.shareList = JsonNullable.>of(shareList); + } + + public SharedDashboardUpdateRequest shareType(DashboardShareType shareType) { + this.shareType = JsonNullable.of(shareType); + return this; + } + + /** + * Type of sharing access (either open to anyone who has the public URL or invite-only). + * + * @return shareType + */ + @jakarta.annotation.Nullable + @JsonIgnore + public DashboardShareType getShareType() { + return shareType.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_SHARE_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getShareType_JsonNullable() { + return shareType; + } + + @JsonProperty(JSON_PROPERTY_SHARE_TYPE) + public void setShareType_JsonNullable(JsonNullable shareType) { + this.shareType = shareType; + } + + public void setShareType(DashboardShareType shareType) { + if (!shareType.isValid()) { + this.unparsed = true; + } + this.shareType = JsonNullable.of(shareType); + } + + /** Return true if this SharedDashboardUpdateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SharedDashboardUpdateRequest sharedDashboardUpdateRequest = (SharedDashboardUpdateRequest) o; + return Objects.equals(this.globalTime, sharedDashboardUpdateRequest.globalTime) + && Objects.equals( + this.globalTimeSelectableEnabled, + sharedDashboardUpdateRequest.globalTimeSelectableEnabled) + && Objects.equals( + this.selectableTemplateVars, sharedDashboardUpdateRequest.selectableTemplateVars) + && Objects.equals(this.shareList, sharedDashboardUpdateRequest.shareList) + && Objects.equals(this.shareType, sharedDashboardUpdateRequest.shareType); + } + + @Override + public int hashCode() { + return Objects.hash( + globalTime, globalTimeSelectableEnabled, selectableTemplateVars, shareList, shareType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SharedDashboardUpdateRequest {\n"); + sb.append(" globalTime: ").append(toIndentedString(globalTime)).append("\n"); + sb.append(" globalTimeSelectableEnabled: ") + .append(toIndentedString(globalTimeSelectableEnabled)) + .append("\n"); + sb.append(" selectableTemplateVars: ") + .append(toIndentedString(selectableTemplateVars)) + .append("\n"); + sb.append(" shareList: ").append(toIndentedString(shareList)).append("\n"); + sb.append(" shareType: ").append(toIndentedString(shareType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/SharedDashboardUpdateRequestGlobalTime.java b/src/main/java/com/datadog/api/client/v1/model/SharedDashboardUpdateRequestGlobalTime.java new file mode 100644 index 00000000000..1e25abdbb3a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/SharedDashboardUpdateRequestGlobalTime.java @@ -0,0 +1,86 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v1.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; + +/** Timeframe setting for the shared dashboard. */ +@JsonPropertyOrder({SharedDashboardUpdateRequestGlobalTime.JSON_PROPERTY_LIVE_SPAN}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SharedDashboardUpdateRequestGlobalTime { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_LIVE_SPAN = "live_span"; + private DashboardGlobalTimeLiveSpan liveSpan; + + public SharedDashboardUpdateRequestGlobalTime liveSpan(DashboardGlobalTimeLiveSpan liveSpan) { + this.liveSpan = liveSpan; + this.unparsed |= !liveSpan.isValid(); + return this; + } + + /** + * Dashboard global time live_span selection + * + * @return liveSpan + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LIVE_SPAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public DashboardGlobalTimeLiveSpan getLiveSpan() { + return liveSpan; + } + + public void setLiveSpan(DashboardGlobalTimeLiveSpan liveSpan) { + if (!liveSpan.isValid()) { + this.unparsed = true; + } + this.liveSpan = liveSpan; + } + + /** Return true if this SharedDashboardUpdateRequestGlobalTime object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SharedDashboardUpdateRequestGlobalTime sharedDashboardUpdateRequestGlobalTime = + (SharedDashboardUpdateRequestGlobalTime) o; + return Objects.equals(this.liveSpan, sharedDashboardUpdateRequestGlobalTime.liveSpan); + } + + @Override + public int hashCode() { + return Objects.hash(liveSpan); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SharedDashboardUpdateRequestGlobalTime {\n"); + sb.append(" liveSpan: ").append(toIndentedString(liveSpan)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/test/java/com/datadog/api/ClientSteps.java b/src/test/java/com/datadog/api/ClientSteps.java index 9cfe87eb015..356ae9b248a 100644 --- a/src/test/java/com/datadog/api/ClientSteps.java +++ b/src/test/java/com/datadog/api/ClientSteps.java @@ -2,6 +2,7 @@ import static org.junit.Assert.*; +import com.datadog.api.client.AbstractOpenApiSchema; import com.google.gson.Gson; import datadog.trace.api.interceptor.MutableSpan; import io.cucumber.java.After; @@ -276,8 +277,15 @@ public void theResponseHasLength(String responsePath, Long size) java.lang.ClassNotFoundException, java.lang.NoSuchFieldException { Object responseData = world.responseClass.getMethod("getData").invoke(world.response); - List value = (List) World.lookup(responseData, responsePath); - assertEquals(size, Long.valueOf(value.size())); + List responseList; + try { + responseList = (List) World.lookup(responseData, responsePath); + } catch (java.lang.ClassCastException e) { + AbstractOpenApiSchema responseObject = + (AbstractOpenApiSchema) World.lookup(responseData, responsePath); + responseList = (List) responseObject.getActualInstance(); + } + assertEquals(size, Long.valueOf(responseList.size())); } @Then("the response has {int} items") diff --git a/src/test/resources/cassettes/features/v1/Create_a_shared_dashboard_returns_Dashboard_Not_Found_response.freeze b/src/test/resources/cassettes/features/v1/Create_a_shared_dashboard_returns_Dashboard_Not_Found_response.freeze new file mode 100644 index 00000000000..89dac55f335 --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Create_a_shared_dashboard_returns_Dashboard_Not_Found_response.freeze @@ -0,0 +1 @@ +2023-03-31T21:01:49.932Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Create_a_shared_dashboard_returns_Dashboard_Not_Found_response.json b/src/test/resources/cassettes/features/v1/Create_a_shared_dashboard_returns_Dashboard_Not_Found_response.json new file mode 100644 index 00000000000..4f732737384 --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Create_a_shared_dashboard_returns_Dashboard_Not_Found_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"dashboard_id\":\"abc-123-def\",\"dashboard_type\":\"custom_timeboard\",\"global_time\":{\"live_span\":\"1h\"},\"share_type\":\"open\"}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v1/dashboard/public", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[\"custom_timeboard abc-123-def not found\"]}", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "e2da164f-1ac8-c685-5e0c-45f057d1fc0e" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Create_a_shared_dashboard_returns_OK_response.freeze b/src/test/resources/cassettes/features/v1/Create_a_shared_dashboard_returns_OK_response.freeze new file mode 100644 index 00000000000..9de127c1f3f --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Create_a_shared_dashboard_returns_OK_response.freeze @@ -0,0 +1 @@ +2023-03-31T21:01:50.111Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Create_a_shared_dashboard_returns_OK_response.json b/src/test/resources/cassettes/features/v1/Create_a_shared_dashboard_returns_OK_response.json new file mode 100644 index 00000000000..c6329ee9114 --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Create_a_shared_dashboard_returns_OK_response.json @@ -0,0 +1,114 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"layout_type\":\"ordered\",\"title\":\"Test-Create_a_shared_dashboard_returns_OK_response-1680296510 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": {}, + "method": "POST", + "path": "/api/v1/dashboard", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"id\":\"ku9-p3f-2qu\",\"title\":\"Test-Create_a_shared_dashboard_returns_OK_response-1680296510 with Profile Metrics Query\",\"description\":null,\"author_handle\":\"frog@datadoghq.com\",\"author_name\":null,\"layout_type\":\"ordered\",\"url\":\"/dashboard/ku9-p3f-2qu/test-createashareddashboardreturnsokresponse-1680296510-with-profile-metrics-que\",\"is_read_only\":false,\"template_variables\":null,\"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\"},\"id\":1709388709940781}],\"notify_list\":null,\"created_at\":\"2023-03-31T21:01:50.263804+00:00\",\"modified_at\":\"2023-03-31T21:01:50.263804+00:00\",\"restricted_roles\":[]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "3efcf307-e2aa-e772-fe0e-dcf2899ea82d" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"dashboard_id\":\"ku9-p3f-2qu\",\"dashboard_type\":\"custom_timeboard\",\"global_time\":{\"live_span\":\"1h\"},\"share_type\":\"open\"}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v1/dashboard/public", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"author\":{\"handle\":\"frog@datadoghq.com\",\"name\":null},\"dashboard_id\":\"ku9-p3f-2qu\",\"dashboard_type\":\"custom_timeboard\",\"global_time_selectable_enabled\":false,\"global_time\":{\"live_span\":\"1h\"},\"selectable_template_vars\":null,\"token\":\"fasjyydbcgwwc2uc-078f138782b770a6d7512a925664fca3\",\"public_url\":\"https://p.datadoghq.com/sb/fasjyydbcgwwc2uc-078f138782b770a6d7512a925664fca3\",\"created\":\"2023-03-31T21:01:50.643308+00:00\",\"share_type\":\"open\",\"share_list\":null}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "da6b6d1f-25d6-e521-7e98-edc441c52c33" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v1/dashboard/public/fasjyydbcgwwc2uc-078f138782b770a6d7512a925664fca3", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"deleted_public_dashboard_token\":\"fasjyydbcgwwc2uc-078f138782b770a6d7512a925664fca3\"}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "1174a57b-b5f6-b71a-8521-1a7e4607eda1" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v1/dashboard/ku9-p3f-2qu", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"deleted_dashboard_id\":\"ku9-p3f-2qu\"}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "fb3260d9-bc79-b397-dcf8-fa9d415226ed" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Get_a_shared_dashboard_returns_OK_response.freeze b/src/test/resources/cassettes/features/v1/Get_a_shared_dashboard_returns_OK_response.freeze new file mode 100644 index 00000000000..b877b6dbf69 --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Get_a_shared_dashboard_returns_OK_response.freeze @@ -0,0 +1 @@ +2023-04-07T16:13:43.155Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Get_a_shared_dashboard_returns_OK_response.json b/src/test/resources/cassettes/features/v1/Get_a_shared_dashboard_returns_OK_response.json new file mode 100644 index 00000000000..0cd805fb706 --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Get_a_shared_dashboard_returns_OK_response.json @@ -0,0 +1,140 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"layout_type\":\"ordered\",\"title\":\"Test-Get_a_shared_dashboard_returns_OK_response-1680884023 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": {}, + "method": "POST", + "path": "/api/v1/dashboard", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"id\":\"zrc-p5j-6r5\",\"title\":\"Test-Get_a_shared_dashboard_returns_OK_response-1680884023 with Profile Metrics Query\",\"description\":null,\"author_handle\":\"frog@datadoghq.com\",\"author_name\":null,\"layout_type\":\"ordered\",\"url\":\"/dashboard/zrc-p5j-6r5/test-getashareddashboardreturnsokresponse-1680884023-with-profile-metrics-query\",\"is_read_only\":false,\"template_variables\":null,\"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\"},\"id\":1984776941235348}],\"notify_list\":null,\"created_at\":\"2023-04-07T16:13:43.596459+00:00\",\"modified_at\":\"2023-04-07T16:13:43.596459+00:00\",\"restricted_roles\":[]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "10e953df-b8ea-13e1-c159-04e227d93679" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"dashboard_id\":\"zrc-p5j-6r5\",\"dashboard_type\":\"custom_timeboard\",\"global_time\":{\"live_span\":\"1h\"},\"share_list\":[\"testgetashareddashboardreturnsokresponse1680884023@datadoghq.com\"],\"share_type\":\"invite\"}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v1/dashboard/public", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"author\":{\"handle\":\"frog@datadoghq.com\",\"name\":null},\"dashboard_id\":\"zrc-p5j-6r5\",\"dashboard_type\":\"custom_timeboard\",\"global_time_selectable_enabled\":false,\"global_time\":{\"live_span\":\"1h\"},\"selectable_template_vars\":null,\"token\":\"fasjyydbcgwwc2uc-c4a0580ce838fc0e47144fc8808f5467\",\"public_url\":\"https://p.datadoghq.com/sb/fasjyydbcgwwc2uc-c4a0580ce838fc0e47144fc8808f5467\",\"created\":\"2023-04-07T16:13:44.162867+00:00\",\"share_type\":\"invite\",\"share_list\":[\"testgetashareddashboardreturnsokresponse1680884023@datadoghq.com\"]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "ae8b0730-533f-64e0-ae5c-5d0ecdc0dd7b" + }, + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v1/dashboard/public/fasjyydbcgwwc2uc-c4a0580ce838fc0e47144fc8808f5467", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"author\":{\"handle\":\"frog@datadoghq.com\",\"name\":null},\"dashboard_id\":\"zrc-p5j-6r5\",\"dashboard_type\":\"custom_timeboard\",\"global_time_selectable_enabled\":false,\"global_time\":{\"live_span\":\"1h\"},\"selectable_template_vars\":null,\"token\":\"fasjyydbcgwwc2uc-c4a0580ce838fc0e47144fc8808f5467\",\"public_url\":\"https://p.datadoghq.com/sb/fasjyydbcgwwc2uc-c4a0580ce838fc0e47144fc8808f5467\",\"created\":\"2023-04-07T16:13:44.162867+00:00\",\"share_type\":\"invite\",\"share_list\":[\"testgetashareddashboardreturnsokresponse1680884023@datadoghq.com\"]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "f396e162-2cf1-0e15-a0fa-fe56f5ece780" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v1/dashboard/public/fasjyydbcgwwc2uc-c4a0580ce838fc0e47144fc8808f5467", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"deleted_public_dashboard_token\":\"fasjyydbcgwwc2uc-c4a0580ce838fc0e47144fc8808f5467\"}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "a41f180b-ecfa-8ca7-d03a-7cef0bff5f0d" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v1/dashboard/zrc-p5j-6r5", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"deleted_dashboard_id\":\"zrc-p5j-6r5\"}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "d8803a0a-e5d5-90d0-0a9c-970237d58936" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Get_all_invitations_for_a_shared_dashboard_returns_OK_response.freeze b/src/test/resources/cassettes/features/v1/Get_all_invitations_for_a_shared_dashboard_returns_OK_response.freeze new file mode 100644 index 00000000000..4fab458599f --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Get_all_invitations_for_a_shared_dashboard_returns_OK_response.freeze @@ -0,0 +1 @@ +2023-04-07T16:13:45.509Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Get_all_invitations_for_a_shared_dashboard_returns_OK_response.json b/src/test/resources/cassettes/features/v1/Get_all_invitations_for_a_shared_dashboard_returns_OK_response.json new file mode 100644 index 00000000000..622e21f6917 --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Get_all_invitations_for_a_shared_dashboard_returns_OK_response.json @@ -0,0 +1,140 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"layout_type\":\"ordered\",\"title\":\"Test-Get_all_invitations_for_a_shared_dashboard_returns_OK_response-1680884025 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": {}, + "method": "POST", + "path": "/api/v1/dashboard", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"id\":\"ggv-zp5-2r8\",\"title\":\"Test-Get_all_invitations_for_a_shared_dashboard_returns_OK_response-1680884025 with Profile Metrics Query\",\"description\":null,\"author_handle\":\"frog@datadoghq.com\",\"author_name\":null,\"layout_type\":\"ordered\",\"url\":\"/dashboard/ggv-zp5-2r8/test-getallinvitationsforashareddashboardreturnsokresponse-1680884025-with-profi\",\"is_read_only\":false,\"template_variables\":null,\"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\"},\"id\":6124782451549434}],\"notify_list\":null,\"created_at\":\"2023-04-07T16:13:45.869264+00:00\",\"modified_at\":\"2023-04-07T16:13:45.869264+00:00\",\"restricted_roles\":[]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "5c31db7b-1fd8-24f2-2234-65e781e5fd4c" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"dashboard_id\":\"ggv-zp5-2r8\",\"dashboard_type\":\"custom_timeboard\",\"global_time\":{\"live_span\":\"1h\"},\"share_list\":[\"testgetallinvitationsforashareddashboardreturnsokresponse1680884025@datadoghq.com\"],\"share_type\":\"invite\"}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v1/dashboard/public", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"author\":{\"handle\":\"frog@datadoghq.com\",\"name\":null},\"dashboard_id\":\"ggv-zp5-2r8\",\"dashboard_type\":\"custom_timeboard\",\"global_time_selectable_enabled\":false,\"global_time\":{\"live_span\":\"1h\"},\"selectable_template_vars\":null,\"token\":\"fasjyydbcgwwc2uc-c1e0c122d13080aabd50aa3bbadfe6be\",\"public_url\":\"https://p.datadoghq.com/sb/fasjyydbcgwwc2uc-c1e0c122d13080aabd50aa3bbadfe6be\",\"created\":\"2023-04-07T16:13:46.433503+00:00\",\"share_type\":\"invite\",\"share_list\":[\"testgetallinvitationsforashareddashboardreturnsokresponse1680884025@datadoghq.com\"]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "92466265-bce7-b055-d969-781870465cc7" + }, + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v1/dashboard/public/fasjyydbcgwwc2uc-c1e0c122d13080aabd50aa3bbadfe6be/invitation", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":[],\"meta\":{\"page\":{\"total_count\":0}}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "cee9ba3e-4737-70e5-6ab5-ea13b43ce17d" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v1/dashboard/public/fasjyydbcgwwc2uc-c1e0c122d13080aabd50aa3bbadfe6be", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"deleted_public_dashboard_token\":\"fasjyydbcgwwc2uc-c1e0c122d13080aabd50aa3bbadfe6be\"}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "16751465-3995-d858-6dc2-301473690c95" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v1/dashboard/ggv-zp5-2r8", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"deleted_dashboard_id\":\"ggv-zp5-2r8\"}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "845a66b6-3fe1-ebc7-031c-904dd7ae2888" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Send_shared_dashboard_invitation_email_returns_OK_response.freeze b/src/test/resources/cassettes/features/v1/Send_shared_dashboard_invitation_email_returns_OK_response.freeze new file mode 100644 index 00000000000..a4feec1f533 --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Send_shared_dashboard_invitation_email_returns_OK_response.freeze @@ -0,0 +1 @@ +2023-04-07T16:10:11.930Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Send_shared_dashboard_invitation_email_returns_OK_response.json b/src/test/resources/cassettes/features/v1/Send_shared_dashboard_invitation_email_returns_OK_response.json new file mode 100644 index 00000000000..582201ce961 --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Send_shared_dashboard_invitation_email_returns_OK_response.json @@ -0,0 +1,173 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"layout_type\":\"ordered\",\"title\":\"Test-Send_shared_dashboard_invitation_email_returns_OK_response-1680883811 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": {}, + "method": "POST", + "path": "/api/v1/dashboard", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"id\":\"raa-btt-uqs\",\"title\":\"Test-Send_shared_dashboard_invitation_email_returns_OK_response-1680883811 with Profile Metrics Query\",\"description\":null,\"author_handle\":\"frog@datadoghq.com\",\"author_name\":null,\"layout_type\":\"ordered\",\"url\":\"/dashboard/raa-btt-uqs/test-sendshareddashboardinvitationemailreturnsokresponse-1680883811-with-profile\",\"is_read_only\":false,\"template_variables\":null,\"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\"},\"id\":2455557193881497}],\"notify_list\":null,\"created_at\":\"2023-04-07T16:10:12.130578+00:00\",\"modified_at\":\"2023-04-07T16:10:12.130578+00:00\",\"restricted_roles\":[]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "c6dce98d-a860-9415-741e-de45324ad4fd" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"dashboard_id\":\"raa-btt-uqs\",\"dashboard_type\":\"custom_timeboard\",\"global_time\":{\"live_span\":\"1h\"},\"share_list\":[\"testsendshareddashboardinvitationemailreturnsokresponse1680883811@datadoghq.com\"],\"share_type\":\"invite\"}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v1/dashboard/public", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"author\":{\"handle\":\"frog@datadoghq.com\",\"name\":null},\"dashboard_id\":\"raa-btt-uqs\",\"dashboard_type\":\"custom_timeboard\",\"global_time_selectable_enabled\":false,\"global_time\":{\"live_span\":\"1h\"},\"selectable_template_vars\":null,\"token\":\"fasjyydbcgwwc2uc-0aaf9e22dcfc91f4bf3857f95fbdd16e\",\"public_url\":\"https://p.datadoghq.com/sb/fasjyydbcgwwc2uc-0aaf9e22dcfc91f4bf3857f95fbdd16e\",\"created\":\"2023-04-07T16:10:12.476162+00:00\",\"share_type\":\"invite\",\"share_list\":[\"testsendshareddashboardinvitationemailreturnsokresponse1680883811@datadoghq.com\"]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "3ba7c4f0-9619-07c8-1737-d94ea8e9b88d" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"email\":\"testsendshareddashboardinvitationemailreturnsokresponse1680883811@datadoghq.com\"},\"type\":\"public_dashboard_invitation\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v1/dashboard/public/fasjyydbcgwwc2uc-0aaf9e22dcfc91f4bf3857f95fbdd16e/invitation", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"public_dashboard_invitation\",\"attributes\":{\"email\":\"testsendshareddashboardinvitationemailreturnsokresponse1680883811@datadoghq.com\",\"share_token\":\"fasjyydbcgwwc2uc-0aaf9e22dcfc91f4bf3857f95fbdd16e\",\"created_at\":\"2023-04-07T16:10:12.708843+00:00\",\"invitation_expiry\":\"2023-04-07T17:10:12.707450+00:00\",\"has_session\":false,\"session_expiry\":null}}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "ef3bc890-85ae-6bbd-3795-a54004cd6363" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"email\":\"testsendshareddashboardinvitationemailreturnsokresponse1680883811@datadoghq.com\"},\"type\":\"public_dashboard_invitation\"}}" + }, + "headers": {}, + "method": "DELETE", + "path": "/api/v1/dashboard/public/fasjyydbcgwwc2uc-0aaf9e22dcfc91f4bf3857f95fbdd16e/invitation", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "624c820e-6d9b-55ed-e10c-34ee5ac55c63" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v1/dashboard/public/fasjyydbcgwwc2uc-0aaf9e22dcfc91f4bf3857f95fbdd16e", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"deleted_public_dashboard_token\":\"fasjyydbcgwwc2uc-0aaf9e22dcfc91f4bf3857f95fbdd16e\"}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "03d6041e-c8f4-6eca-bba9-7317258d37fd" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v1/dashboard/raa-btt-uqs", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"deleted_dashboard_id\":\"raa-btt-uqs\"}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "76ab0a51-16b5-6cba-c551-156303080b3c" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Update_a_shared_dashboard_returns_OK_response.freeze b/src/test/resources/cassettes/features/v1/Update_a_shared_dashboard_returns_OK_response.freeze new file mode 100644 index 00000000000..eea423a1370 --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Update_a_shared_dashboard_returns_OK_response.freeze @@ -0,0 +1 @@ +2023-04-12T20:55:44.574Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Update_a_shared_dashboard_returns_OK_response.json b/src/test/resources/cassettes/features/v1/Update_a_shared_dashboard_returns_OK_response.json new file mode 100644 index 00000000000..ded5ebf6fa3 --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Update_a_shared_dashboard_returns_OK_response.json @@ -0,0 +1,144 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"layout_type\":\"ordered\",\"title\":\"Test-Update_a_shared_dashboard_returns_OK_response-1681332944 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": {}, + "method": "POST", + "path": "/api/v1/dashboard", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"id\":\"n4p-ymg-wjf\",\"title\":\"Test-Update_a_shared_dashboard_returns_OK_response-1681332944 with Profile Metrics Query\",\"description\":null,\"author_handle\":\"frog@datadoghq.com\",\"author_name\":null,\"layout_type\":\"ordered\",\"url\":\"/dashboard/n4p-ymg-wjf/test-updateashareddashboardreturnsokresponse-1681332944-with-profile-metrics-que\",\"is_read_only\":false,\"template_variables\":null,\"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\"},\"id\":8334852074489292}],\"notify_list\":null,\"created_at\":\"2023-04-12T20:55:45.157005+00:00\",\"modified_at\":\"2023-04-12T20:55:45.157005+00:00\",\"restricted_roles\":[]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "04e6632c-5f5e-932b-8269-4d2e5f2e3804" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"dashboard_id\":\"n4p-ymg-wjf\",\"dashboard_type\":\"custom_timeboard\",\"global_time\":{\"live_span\":\"1h\"},\"share_list\":[\"testupdateashareddashboardreturnsokresponse1681332944@datadoghq.com\"],\"share_type\":\"invite\"}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v1/dashboard/public", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"author\":{\"handle\":\"frog@datadoghq.com\",\"name\":null},\"dashboard_id\":\"n4p-ymg-wjf\",\"dashboard_type\":\"custom_timeboard\",\"global_time_selectable_enabled\":false,\"global_time\":{\"live_span\":\"1h\"},\"selectable_template_vars\":null,\"token\":\"fasjyydbcgwwc2uc-02029ebbe19451affffb0342605f03e7\",\"public_url\":\"https://p.datadoghq.com/sb/fasjyydbcgwwc2uc-02029ebbe19451affffb0342605f03e7\",\"created\":\"2023-04-12T20:55:45.513088+00:00\",\"share_type\":\"invite\",\"share_list\":[\"testupdateashareddashboardreturnsokresponse1681332944@datadoghq.com\"]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "b8ecddab-1508-d45f-f948-5905956d9435" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"global_time\":{\"live_span\":\"15m\"},\"share_list\":[],\"share_type\":\"open\"}" + }, + "headers": {}, + "method": "PUT", + "path": "/api/v1/dashboard/public/fasjyydbcgwwc2uc-02029ebbe19451affffb0342605f03e7", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"author\":{\"handle\":\"frog@datadoghq.com\",\"name\":null},\"dashboard_id\":\"n4p-ymg-wjf\",\"dashboard_type\":\"custom_timeboard\",\"global_time_selectable_enabled\":false,\"global_time\":{\"live_span\":\"15m\"},\"selectable_template_vars\":null,\"token\":\"fasjyydbcgwwc2uc-02029ebbe19451affffb0342605f03e7\",\"public_url\":\"https://p.datadoghq.com/sb/fasjyydbcgwwc2uc-02029ebbe19451affffb0342605f03e7\",\"created\":\"2023-04-12T20:55:45.513088+00:00\",\"share_type\":\"open\",\"share_list\":[]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "666e7c08-deb0-9c42-30a3-ac7291fe4755" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v1/dashboard/public/fasjyydbcgwwc2uc-02029ebbe19451affffb0342605f03e7", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"deleted_public_dashboard_token\":\"fasjyydbcgwwc2uc-02029ebbe19451affffb0342605f03e7\"}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "2a4053aa-c7c4-be18-706d-24680d08b548" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v1/dashboard/n4p-ymg-wjf", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"deleted_dashboard_id\":\"n4p-ymg-wjf\"}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "f8c88d89-e4ba-f805-e0e5-0a3a50938315" + } +] \ No newline at end of file diff --git a/src/test/resources/com/datadog/api/client/v1/api/dashboards.feature b/src/test/resources/com/datadog/api/client/v1/api/dashboards.feature index 1c0e23ee79e..49cc532dbe2 100644 --- a/src/test/resources/com/datadog/api/client/v1/api/dashboards.feature +++ b/src/test/resources/com/datadog/api/client/v1/api/dashboards.feature @@ -664,6 +664,30 @@ Feature: Dashboards And the response "widgets[0].definition.requests[0].queries[0].data_source" is equal to "ci_tests" And the response "widgets[0].definition.requests[0].queries[0].search.query" is equal to "test_level:test" + @generated @skip @team:DataDog/dashboards + Scenario: Create a shared dashboard returns "Bad Request" response + Given new "CreatePublicDashboard" request + And body with value {"dashboard_id": "123-abc-456", "dashboard_type": "custom_timeboard", "global_time": {"live_span": "1h"}, "global_time_selectable_enabled": null, "selectable_template_vars": [{"default_value": "*", "name": "exampleVar", "prefix": "test", "visible_tags": ["selectableValue1", "selectableValue2"]}], "share_list": ["test@datadoghq.com", "test2@email.com"], "share_type": "open"} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/dashboards + Scenario: Create a shared dashboard returns "Dashboard Not Found" response + Given new "CreatePublicDashboard" request + And body with value {"dashboard_id": "abc-123-def", "dashboard_type": "custom_timeboard", "share_type": "open", "global_time": {"live_span": "1h"}} + When the request is sent + Then the response status is 404 Dashboard Not Found + + @team:DataDog/dashboards + Scenario: Create a shared dashboard returns "OK" response + Given there is a valid "dashboard" in the system + And new "CreatePublicDashboard" request + And body with value {"dashboard_id": "{{dashboard.id}}", "dashboard_type": "custom_timeboard", "share_type": "open", "global_time": {"live_span": "1h"}} + When the request is sent + Then the response status is 200 OK + And the response "dashboard_id" has the same value as "dashboard.id" + And the response "dashboard_type" is equal to "custom_timeboard" + @generated @skip @team:DataDog/dashboards Scenario: Delete a dashboard returns "Dashboards Not Found" response Given new "DeleteDashboard" request @@ -727,6 +751,24 @@ Feature: Dashboards Then the response status is 200 OK And the response "author_name" is equal to "Frog Account" + @team:DataDog/dashboards + Scenario: Get a shared dashboard returns "OK" response + Given there is a valid "dashboard" in the system + And there is a valid "shared_dashboard" in the system + And new "GetPublicDashboard" request + And request contains "token" parameter from "shared_dashboard.token" + When the request is sent + Then the response status is 200 OK + And the response "dashboard_id" has the same value as "dashboard.id" + And the response "token" has the same value as "shared_dashboard.token" + + @generated @skip @team:DataDog/dashboards + Scenario: Get a shared dashboard returns "Shared Dashboard Not Found" response + Given new "GetPublicDashboard" request + And request contains "token" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Shared Dashboard Not Found + @replay-only @team:DataDog/dashboards Scenario: Get all dashboards returns "OK" response Given new "ListDashboards" request @@ -737,6 +779,23 @@ Feature: Dashboards And the response "dashboards[0].title" has the same value as "dashboard.title" And the response "dashboards[0].id" has the same value as "dashboard.id" + @generated @skip @team:DataDog/dashboards + Scenario: Get all invitations for a shared dashboard returns "Not Found" response + Given new "GetPublicDashboardInvitations" request + And request contains "token" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/dashboards + Scenario: Get all invitations for a shared dashboard returns "OK" response + Given there is a valid "dashboard" in the system + And there is a valid "shared_dashboard" in the system + And new "GetPublicDashboardInvitations" request + And request contains "token" parameter from "shared_dashboard.token" + When the request is sent + Then the response status is 200 OK + And the response "data" has length 0 + @replay-only @team:DataDog/dashboards Scenario: Get deleted dashboards returns "OK" response Given new "ListDashboards" request @@ -771,6 +830,64 @@ Feature: Dashboards When the request is sent Then the response status is 204 No Content + @generated @skip @team:DataDog/dashboards + Scenario: Revoke a shared dashboard URL returns "OK" response + Given new "DeletePublicDashboard" request + And request contains "token" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/dashboards + Scenario: Revoke a shared dashboard URL returns "Shared Dashboard Not Found" response + Given new "DeletePublicDashboard" request + And request contains "token" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Shared Dashboard Not Found + + @generated @skip @team:DataDog/dashboards + Scenario: Revoke shared dashboard invitations returns "Not Found" response + Given new "DeletePublicDashboardInvitation" request + And request contains "token" parameter from "REPLACE.ME" + And body with value {"data": [{"attributes": {"email": "test@datadoghq.com"}, "type": "public_dashboard_invitation"}]} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/dashboards + Scenario: Revoke shared dashboard invitations returns "OK" response + Given new "DeletePublicDashboardInvitation" request + And request contains "token" parameter from "REPLACE.ME" + And body with value {"data": [{"attributes": {"email": "test@datadoghq.com"}, "type": "public_dashboard_invitation"}]} + When the request is sent + Then the response status is 204 OK + + @generated @skip @team:DataDog/dashboards + Scenario: Send shared dashboard invitation email returns "Bad Request" response + Given new "SendPublicDashboardInvitation" request + And request contains "token" parameter from "REPLACE.ME" + And body with value {"data": [{"attributes": {"email": "test@datadoghq.com"}, "type": "public_dashboard_invitation"}]} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/dashboards + Scenario: Send shared dashboard invitation email returns "Not Found" response + Given new "SendPublicDashboardInvitation" request + And request contains "token" parameter from "REPLACE.ME" + And body with value {"data": [{"attributes": {"email": "test@datadoghq.com"}, "type": "public_dashboard_invitation"}]} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/dashboards + Scenario: Send shared dashboard invitation email returns "OK" response + Given there is a valid "dashboard" in the system + And there is a valid "shared_dashboard" in the system + And new "SendPublicDashboardInvitation" request + And request contains "token" parameter from "shared_dashboard.token" + And body with value {"data": {"attributes": {"email": "{{unique_lower_alnum}}@datadoghq.com"}, "type": "public_dashboard_invitation"}} + When the request is sent + Then the response status is 201 OK + And the response "data.attributes.email" has the same value as "shared_dashboard.share_list[0]" + And the response "data.attributes.share_token" has the same value as "shared_dashboard.token" + @generated @skip @team:DataDog/dashboards Scenario: Update a dashboard returns "Bad Request" response Given new "UpdateDashboard" request @@ -806,3 +923,34 @@ Feature: Dashboards When the request is sent Then the response status is 200 OK And the response "tags" is equal to ["team:foo", "team:bar"] + + @generated @skip @team:DataDog/dashboards + Scenario: Update a shared dashboard returns "Bad Request" response + Given new "UpdatePublicDashboard" request + And request contains "token" parameter from "REPLACE.ME" + And body with value {"global_time": {"live_span": "1h"}, "share_list": ["test@datadoghq.com", "test2@datadoghq.com"], "share_type": "invite"} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/dashboards + Scenario: Update a shared dashboard returns "Item Not Found" response + Given new "UpdatePublicDashboard" request + And request contains "token" parameter from "REPLACE.ME" + And body with value {"global_time": {"live_span": "1h"}, "share_list": ["test@datadoghq.com", "test2@datadoghq.com"], "share_type": "invite"} + When the request is sent + Then the response status is 404 Item Not Found + + @team:DataDog/dashboards + Scenario: Update a shared dashboard returns "OK" response + Given there is a valid "dashboard" in the system + And there is a valid "shared_dashboard" in the system + And new "UpdatePublicDashboard" request + And request contains "token" parameter from "shared_dashboard.token" + And body with value {"global_time": {"live_span": "15m"}, "share_list": [], "share_type": "open"} + When the request is sent + Then the response status is 200 OK + And the response "dashboard_id" has the same value as "dashboard.id" + And the response "dashboard_type" is equal to "custom_timeboard" + And the response "global_time.live_span" is equal to "15m" + And the response "share_type" is equal to "open" + And the response "share_list" has length 0 diff --git a/src/test/resources/com/datadog/api/client/v1/api/given.json b/src/test/resources/com/datadog/api/client/v1/api/given.json index 87651022c2f..30de30f9091 100644 --- a/src/test/resources/com/datadog/api/client/v1/api/given.json +++ b/src/test/resources/com/datadog/api/client/v1/api/given.json @@ -35,6 +35,34 @@ "tag": "Dashboard Lists", "operationId": "CreateDashboardList" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"dashboard_id\": \"{{ dashboard.id }}\",\n \"dashboard_type\": \"custom_timeboard\",\n \"share_type\": \"invite\",\n \"share_list\": [\"{{unique_lower_alnum}}@datadoghq.com\"],\n \"global_time\": {\n \"live_span\": \"1h\"\n }\n}" + } + ], + "step": "there is a valid \"shared_dashboard\" in the system", + "key": "shared_dashboard", + "tag": "Dashboards", + "operationId": "CreatePublicDashboard" + }, + { + "parameters": [ + { + "name": "token", + "value": "\"{{ shared_dashboard.token }}\"" + }, + { + "name": "body", + "value": "{\n \"data\": {\n \"attributes\": {\n \"email\": \"{{unique_lower_alnum}}@datadoghq.com\"\n },\n \"type\": \"public_dashboard_invitation\"\n }\n}" + } + ], + "step": "there is a valid \"public_dashboard_invitation\" in the system", + "key": "public_dashboard_invitation", + "tag": "Dashboards", + "operationId": "SendPublicDashboardInvitation" + }, { "parameters": [ { diff --git a/src/test/resources/com/datadog/api/client/v1/api/undo.json b/src/test/resources/com/datadog/api/client/v1/api/undo.json index c78fa1feacd..b5f13498dcd 100644 --- a/src/test/resources/com/datadog/api/client/v1/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v1/api/undo.json @@ -165,6 +165,66 @@ "type": "idempotent" } }, + "CreatePublicDashboard": { + "tag": "Dashboards", + "undo": { + "operationId": "DeletePublicDashboard", + "parameters": [ + { + "name": "token", + "source": "token" + } + ], + "type": "unsafe" + } + }, + "DeletePublicDashboard": { + "tag": "Dashboards", + "undo": { + "type": "idempotent" + } + }, + "GetPublicDashboard": { + "tag": "Dashboards", + "undo": { + "type": "safe" + } + }, + "UpdatePublicDashboard": { + "tag": "Dashboards", + "undo": { + "type": "idempotent" + } + }, + "DeletePublicDashboardInvitation": { + "tag": "Dashboards", + "undo": { + "type": "idempotent" + } + }, + "GetPublicDashboardInvitations": { + "tag": "Dashboards", + "undo": { + "type": "safe" + } + }, + "SendPublicDashboardInvitation": { + "tag": "Dashboards", + "undo": { + "operationId": "DeletePublicDashboardInvitation", + "parameters": [ + { + "name": "token", + "source": "data.attributes.share_token" + }, + { + "name": "body", + "template": "{\n \"data\": {\n \"attributes\": {\n \"email\": \"{{data.attributes.email}}\"\n },\n \"type\": \"public_dashboard_invitation\"\n }\n}" + } + ], + "type": "unsafe" + } + }, "DeleteDashboard": { "tag": "Dashboards", "undo": {