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
def CreateToken(DTAPIToken, DTENV,nwzone, dtEnvInfo, tokenname,scope):
env = DTENV
DTAPIToken = DTAPIToken
DTAPIURL = env + "/api/v2/apiTokens"
headers = {
'Content-Type': 'application/json',
'Authorization': 'Api-Token ' + DTAPIToken
}
DynatraceInstaller = [
"InstallerDownload",
"SupportAlert"
]
]
DevOps_Read = [
"DataExport", # Access problem and event feed, metrics, and topology.
"DTAQLAccess", # User sessions.
@ -72,7 +76,8 @@ def CreateToken(DTAPIToken, DTENV,nwzone, dtEnvInfo, tokenname,scope):
"slo.read", # Read SLO.
"releases.read", # Read releases.
"activeGates.read"
]
]
ReadAll = [
"DataExport", # Access problem and event feed, metrics, and topology.
"ReadConfig", # Read configuration.
@ -93,7 +98,7 @@ def CreateToken(DTAPIToken, DTENV,nwzone, dtEnvInfo, tokenname,scope):
"slo.read", # Read SLO.
"releases.read", # Read releases.
"apiTokens.read" # Read API tokens.
]
]
temp=[]
if "DynatraceInstaller" in scope:
@ -113,6 +118,7 @@ def CreateToken(DTAPIToken, DTENV,nwzone, dtEnvInfo, tokenname,scope):
r = post_request(DTAPIURL,headers,data)
print(r)
row = {'Environment':dtEnvInfo,'DT_API_URL':env +"/api", 'DT_[API|PAAS]_TOKEN':r.json()['token'],'DT_NETWORK_ZONE':nwzone}
return row
#################