Compare commits
No commits in common. "modified_script" and "master" have entirely different histories.
modified_s
...
master
|
|
@ -50,21 +50,17 @@ 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.
|
||||||
|
|
@ -76,8 +72,7 @@ def CreateToken(DTAPIToken, DTENV,nwzone, dtEnvInfo, tokenname,scope):
|
||||||
"slo.read", # Read SLO.
|
"slo.read", # Read SLO.
|
||||||
"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.
|
||||||
|
|
@ -98,7 +93,7 @@ def CreateToken(DTAPIToken, DTENV,nwzone, dtEnvInfo, tokenname,scope):
|
||||||
"slo.read", # Read SLO.
|
"slo.read", # Read SLO.
|
||||||
"releases.read", # Read releases.
|
"releases.read", # Read releases.
|
||||||
"apiTokens.read" # Read API tokens.
|
"apiTokens.read" # Read API tokens.
|
||||||
]
|
]
|
||||||
|
|
||||||
temp=[]
|
temp=[]
|
||||||
if "DynatraceInstaller" in scope:
|
if "DynatraceInstaller" in scope:
|
||||||
|
|
@ -118,7 +113,6 @@ 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
|
||||||
|
|
||||||
#################
|
#################
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue