Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def create_handler(cred_file, board_type):
cred = load_json(cred_file)
dd_init(**cred)
return TimeboardHandler(dd_api.Timeboard) if board_type == 't' else ScreenboardHandler(dd_api.Screenboard)
from datadog import initialize, api
options = {
'api_key': '',
'app_key': ''
}
initialize(**options)
# Share it
api.Screenboard.share(812)
# Revoke the sharing
api.Screenboard.revoke(812)
from datadog import initialize, api
options = {
'api_key': '9775a026f1ca7d1c6c5af9d94d9595a4',
'app_key': '87ce4a24b5553d2e482ea8a8500e71b8ad4554ff'
}
initialize(**options)
api.Screenboard.get(811)
@classmethod
def dash_fetch(cls, dash_ref):
# Method to fetch Screenboards data.
cls.dash_list = dash_ref
for i in range(len(dash_ref)):
cls.dash_list[i] = api.Screenboard.get(dash_ref[i])
return cls.dash_list
def delete_dash(cls, dash):
print("\nIf you have any warning above about outdated widget types, you should not delete the original dashboard. Follow the described procedure to properly convert the dashboard. \n")
delete = input("Do you want to delete the dash (Y/n): ")
if delete == "Y" and cls.board_type == "screenboard":
print("deleting screenboard: " + cls.board['board_title'])
api.Screenboard.delete(dash)
elif delete == "Y" and cls.board_type == "timeboard":
print("deleting timeboard " + cls.board['dash']['title'])
api.Timeboard.delete(dash)
elif delete == "n":
print("No further action needed")
else:
print("Please select Y or n.")
cls.delete_dash(dash)
from datadog import initialize, api
options = {
'api_key': '',
'app_key': ''
}
initialize(**options)
# Share it
api.Screenboard.share(812)
# Revoke the sharing
api.Screenboard.revoke(812)
from datadog import initialize, api
options = {
'api_key': '9775a026f1ca7d1c6c5af9d94d9595a4',
'app_key': '87ce4a24b5553d2e482ea8a8500e71b8ad4554ff'
}
initialize(**options)
# Share it
api.Screenboard.share(812)
# Revoke the sharing
api.Screenboard.revoke(812)
board = ''
board_type = ''
if not dash_id:
print_error("Specify a dashboard id using --d if you are using action: get")
try:
res = api.Timeboard.get(dash_id)
board = res['dash']
board_type = "timeboard"
except:
pass
if 'errors' in board or not board:
try:
board = api.Screenboard.get(dash_id)
board_type = "screenboard"
except:
pass
print "Dashboard {} is a {}...".format(dash_id, board_type)
if board and board_type:
file_name = file_name if file_name else board_type + '-' + dash_id + '.json'
dash_to_json(board, board_type, file_name)
else:
print_error("Could not download dashboard")
else:
if not file_name:
print_error("Must specify a file name --f when creating a dashboard")
try:
with open(file_name) as data_file:
from datadog import initialize, api
options = {
'api_key': '9775a026f1ca7d1c6c5af9d94d9595a4',
'app_key': '87ce4a24b5553d2e482ea8a8500e71b8ad4554ff'
}
initialize(**options)
api.Screenboard.get_all()
from datadog import initialize, api
options = {
'api_key': '',
'app_key': ''
}
initialize(**options)
api.Screenboard.delete(811)