Compare commits

...

No commits in common. "master" and "5c7bad19c4451985e7e830cdb315be452d590245" have entirely different histories.

8 changed files with 15 additions and 9 deletions

View File

View File

View File

View File

View File

View File

View File

View File

@ -50,17 +50,21 @@ def put_request(url, headers,body):
return response return response
def CreateToken(DTAPIToken, DTENV,nwzone, dtEnvInfo, tokenname,scope): def CreateToken(DTAPIToken, DTENV,nwzone, dtEnvInfo, tokenname,scope):
env = DTENV env = DTENV
DTAPIToken = DTAPIToken DTAPIToken = DTAPIToken
DTAPIURL = env + "/api/v2/apiTokens" DTAPIURL = env + "/api/v2/apiTokens"
headers = { headers = {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'Authorization': 'Api-Token ' + DTAPIToken 'Authorization': 'Api-Token ' + DTAPIToken
} }
DynatraceInstaller = [ DynatraceInstaller = [
"InstallerDownload", "InstallerDownload",
"SupportAlert" "SupportAlert"
] ]
DevOps_Read = [ DevOps_Read = [
"DataExport", # Access problem and event feed, metrics, and topology. "DataExport", # Access problem and event feed, metrics, and topology.
"DTAQLAccess", # User sessions. "DTAQLAccess", # User sessions.
@ -73,6 +77,7 @@ def CreateToken(DTAPIToken, DTENV,nwzone, dtEnvInfo, tokenname,scope):
"releases.read", # Read releases. "releases.read", # Read releases.
"activeGates.read" "activeGates.read"
] ]
ReadAll = [ ReadAll = [
"DataExport", # Access problem and event feed, metrics, and topology. "DataExport", # Access problem and event feed, metrics, and topology.
"ReadConfig", # Read configuration. "ReadConfig", # Read configuration.
@ -113,6 +118,7 @@ def CreateToken(DTAPIToken, DTENV,nwzone, dtEnvInfo, tokenname,scope):
r = post_request(DTAPIURL,headers,data) r = post_request(DTAPIURL,headers,data)
print(r) print(r)
row = {'Environment':dtEnvInfo,'DT_API_URL':env +"/api", 'DT_[API|PAAS]_TOKEN':r.json()['token'],'DT_NETWORK_ZONE':nwzone} row = {'Environment':dtEnvInfo,'DT_API_URL':env +"/api", 'DT_[API|PAAS]_TOKEN':r.json()['token'],'DT_NETWORK_ZONE':nwzone}
return row return row
################# #################