Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add dashboard resource #93

Merged
merged 3 commits into from
Oct 28, 2020
Merged

Add dashboard resource #93

merged 3 commits into from
Oct 28, 2020

Conversation

zippolyte
Copy link
Contributor

SSIA

@zippolyte zippolyte added the changelog/Added Added features results into a minor version bump label Oct 20, 2020
@zippolyte zippolyte requested a review from a team as a code owner October 20, 2020 15:29
@github-actions github-actions bot added documentation Documentation related changes resource/dashboard labels Oct 20, 2020
Copy link
Contributor

@nmuesch nmuesch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good. Left some inline comments

@@ -0,0 +1,39 @@
# Datadog::Dashboards::Dashboard

Congratulations on starting development! Next steps:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -0,0 +1,2 @@
cloudformation-cli-python-lib==2.1.1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets update these to just require the common package at 0.0.1

LOG.info("Starting %s Create Handler", TYPE_NAME)
model = request.desiredResourceState

json_payload = json.loads(model.DashboardDefinition)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should wrap this in a try/catch and return a failed ProgressEvent if its invalid json

with v1_client(
model.DatadogCredentials.ApiKey,
model.DatadogCredentials.ApplicationKey,
model.DatadogCredentials.ApiURL or "https://api.datadoghq.com",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
model.DatadogCredentials.ApiURL or "https://api.datadoghq.com",
model.DatadogCredentials.ApiURL,

Can we try without, the common package should now handle this

TELEMETRY_TYPE_NAME,
__version__,
) as api_client:
dashboard = validate_and_convert_types(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mind adding a comment about this one? With like whats expected in this signature and thats its doing the serialization? Also, can this raise an exception if the dashboard is invalid? If so we should do the same progressEvent exception

try:
dash = api_instance.get_dashboard(dashboard_id)
json_dict = ApiClient.sanitize_for_serialization(dash)
model.DashboardDefinition = json.dumps(json_dict)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth catching this too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, dumping should not raise

@@ -0,0 +1,79 @@
{
"typeName": "Datadog::Dashboards::Dashboard",
"description": "Datadog Dashboard",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also trying to standardize adding the version number of the resource in this field (see PR #97) If that gets approved, can we add the version here

@nmuesch nmuesch merged commit 5a37617 into master Oct 28, 2020
@nmuesch nmuesch deleted the hippo/dash branch October 28, 2020 16:05
@zippolyte zippolyte restored the hippo/dash branch November 17, 2020 09:28
@zippolyte zippolyte deleted the hippo/dash branch November 17, 2020 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog/Added Added features results into a minor version bump documentation Documentation related changes resource/dashboard
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants