This commit is contained in:
Sayan Naskar 2020-10-27 09:51:43 +05:30
Родитель ffc06e657c
Коммит 669b756e32
2 изменённых файлов: 2 добавлений и 26 удалений

Просмотреть файл

@ -12,7 +12,6 @@
@vmmServerId = /{{armStub}}/vmmServers/{{vmmServerName}} @vmmServerId = /{{armStub}}/vmmServers/{{vmmServerName}}
# @name vmmServerPut # @name vmmServerPut
PUT {{armRoot}}{{vmmServerId}}{{reqParams}} PUT {{armRoot}}{{vmmServerId}}{{reqParams}}
Authorization: Bearer {{bearerToken}}
Content-Type: application/json Content-Type: application/json
<@ ./payload/vmmServer.json <@ ./payload/vmmServer.json
@ -20,12 +19,10 @@ Content-Type: application/json
### ###
# @name vmmServerAsyncGet # @name vmmServerAsyncGet
GET {{vmmServerPut.response.headers.Azure-AsyncOperation}} GET {{vmmServerPut.response.headers.Azure-AsyncOperation}}
Authorization: Bearer {{bearerToken}}
### ###
# @name vmmServerGet # @name vmmServerGet
GET {{armRoot}}{{vmmServerId}}{{reqParams}} GET {{armRoot}}{{vmmServerId}}{{reqParams}}
Authorization: Bearer {{bearerToken}}
# ------------------------------------------------------------------------------------------------- # -------------------------------------------------------------------------------------------------
### Cloud ### Cloud
@ -33,7 +30,6 @@ Authorization: Bearer {{bearerToken}}
@cloudId = /{{armStub}}/clouds/{{cloudName}} @cloudId = /{{armStub}}/clouds/{{cloudName}}
# @name cloudPut # @name cloudPut
PUT {{armRoot}}{{cloudId}}{{reqParams}} PUT {{armRoot}}{{cloudId}}{{reqParams}}
Authorization: Bearer {{bearerToken}}
Content-Type: application/json Content-Type: application/json
<@ ./payload/cloud.json <@ ./payload/cloud.json
@ -41,12 +37,10 @@ Content-Type: application/json
### ###
# @name cloudAsyncGet # @name cloudAsyncGet
GET {{cloudPut.response.headers.Azure-AsyncOperation}} GET {{cloudPut.response.headers.Azure-AsyncOperation}}
Authorization: Bearer {{bearerToken}}
### ###
# @name cloudGet # @name cloudGet
GET {{armRoot}}{{cloudId}}{{reqParams}} GET {{armRoot}}{{cloudId}}{{reqParams}}
Authorization: Bearer {{bearerToken}}
# ------------------------------------------------------------------------------------------------- # -------------------------------------------------------------------------------------------------
### VirtualNetwork 1 ### VirtualNetwork 1
@ -54,7 +48,6 @@ Authorization: Bearer {{bearerToken}}
@virtualNetwork1Id = /{{armStub}}/virtualNetworks/{{virtualNetwork1Name}} @virtualNetwork1Id = /{{armStub}}/virtualNetworks/{{virtualNetwork1Name}}
# @name virtualNetwork1Put # @name virtualNetwork1Put
PUT {{armRoot}}{{virtualNetwork1Id}}{{reqParams}} PUT {{armRoot}}{{virtualNetwork1Id}}{{reqParams}}
Authorization: Bearer {{bearerToken}}
Content-Type: application/json Content-Type: application/json
<@ ./payload/virtualNetwork-1.json <@ ./payload/virtualNetwork-1.json
@ -62,12 +55,10 @@ Content-Type: application/json
### ###
# @name virtualNetwork1AsyncGet # @name virtualNetwork1AsyncGet
GET {{virtualNetwork1Put.response.headers.Azure-AsyncOperation}} GET {{virtualNetwork1Put.response.headers.Azure-AsyncOperation}}
Authorization: Bearer {{bearerToken}}
### ###
# @name virtualNetwork1Get # @name virtualNetwork1Get
GET {{armRoot}}{{virtualNetwork1Id}}{{reqParams}} GET {{armRoot}}{{virtualNetwork1Id}}{{reqParams}}
Authorization: Bearer {{bearerToken}}
# ------------------------------------------------------------------------------------------------- # -------------------------------------------------------------------------------------------------
### VirtualNetwork 2 ### VirtualNetwork 2
@ -75,7 +66,6 @@ Authorization: Bearer {{bearerToken}}
@virtualNetwork2Id = /{{armStub}}/virtualNetworks/{{virtualNetwork2Name}} @virtualNetwork2Id = /{{armStub}}/virtualNetworks/{{virtualNetwork2Name}}
# @name virtualNetwork2Put # @name virtualNetwork2Put
PUT {{armRoot}}{{virtualNetwork2Id}}{{reqParams}} PUT {{armRoot}}{{virtualNetwork2Id}}{{reqParams}}
Authorization: Bearer {{bearerToken}}
Content-Type: application/json Content-Type: application/json
<@ ./payload/virtualNetwork-2.json <@ ./payload/virtualNetwork-2.json
@ -83,12 +73,10 @@ Content-Type: application/json
### ###
# @name virtualNetwork2AsyncGet # @name virtualNetwork2AsyncGet
GET {{virtualNetwork2Put.response.headers.Azure-AsyncOperation}} GET {{virtualNetwork2Put.response.headers.Azure-AsyncOperation}}
Authorization: Bearer {{bearerToken}}
### ###
# @name virtualNetwork2Get # @name virtualNetwork2Get
GET {{armRoot}}{{virtualNetwork2Id}}{{reqParams}} GET {{armRoot}}{{virtualNetwork2Id}}{{reqParams}}
Authorization: Bearer {{bearerToken}}
# ------------------------------------------------------------------------------------------------- # -------------------------------------------------------------------------------------------------
### VirtualMachineTemplate ### VirtualMachineTemplate
@ -96,7 +84,6 @@ Authorization: Bearer {{bearerToken}}
@virtualMachineTemplateId = /{{armStub}}/virtualMachineTemplates/{{virtualMachineTemplateName}} @virtualMachineTemplateId = /{{armStub}}/virtualMachineTemplates/{{virtualMachineTemplateName}}
# @name virtualMachineTemplatePut # @name virtualMachineTemplatePut
PUT {{armRoot}}{{virtualMachineTemplateId}}{{reqParams}} PUT {{armRoot}}{{virtualMachineTemplateId}}{{reqParams}}
Authorization: Bearer {{bearerToken}}
Content-Type: application/json Content-Type: application/json
<@ ./payload/virtualMachineTemplate.json <@ ./payload/virtualMachineTemplate.json
@ -104,12 +91,10 @@ Content-Type: application/json
### ###
# @name virtualMachineTemplateAsyncGet # @name virtualMachineTemplateAsyncGet
GET {{virtualMachineTemplatePut.response.headers.Azure-AsyncOperation}} GET {{virtualMachineTemplatePut.response.headers.Azure-AsyncOperation}}
Authorization: Bearer {{bearerToken}}
### ###
# @name virtualMachineTemplateGet # @name virtualMachineTemplateGet
GET {{armRoot}}{{virtualMachineTemplateId}}{{reqParams}} GET {{armRoot}}{{virtualMachineTemplateId}}{{reqParams}}
Authorization: Bearer {{bearerToken}}
# ------------------------------------------------------------------------------------------------- # -------------------------------------------------------------------------------------------------
### VirtualMachine ### VirtualMachine
@ -117,7 +102,6 @@ Authorization: Bearer {{bearerToken}}
@virtualMachineId = /{{armStub}}/virtualMachines/{{virtualMachineName}} @virtualMachineId = /{{armStub}}/virtualMachines/{{virtualMachineName}}
# @name virtualMachinePut # @name virtualMachinePut
PUT {{armRoot}}{{virtualMachineId}}{{reqParams}} PUT {{armRoot}}{{virtualMachineId}}{{reqParams}}
Authorization: Bearer {{bearerToken}}
Content-Type: application/json Content-Type: application/json
<@ ./payload/virtualMachine.json <@ ./payload/virtualMachine.json
@ -125,37 +109,29 @@ Content-Type: application/json
### ###
# @name virtualMachineAsyncGet # @name virtualMachineAsyncGet
GET {{virtualMachinePut.response.headers.Azure-AsyncOperation}} GET {{virtualMachinePut.response.headers.Azure-AsyncOperation}}
Authorization: Bearer {{bearerToken}}
### ###
# @name virtualMachineGet # @name virtualMachineGet
GET {{armRoot}}{{virtualMachineId}}{{reqParams}} GET {{armRoot}}{{virtualMachineId}}{{reqParams}}
Authorization: Bearer {{bearerToken}}
#--------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------
### Delete all resources ### Delete all resources
### ###
# @name virtualMachineDel # @name virtualMachineDel
DELETE {{armRoot}}{{virtualMachineId}}{{reqParams}} DELETE {{armRoot}}{{virtualMachineId}}{{reqParams}}
Authorization: Bearer {{bearerToken}}
### ###
# @name virtualMachineTemplateDel # @name virtualMachineTemplateDel
DELETE {{armRoot}}{{virtualMachineTemplateId}}{{reqParams}} DELETE {{armRoot}}{{virtualMachineTemplateId}}{{reqParams}}
Authorization: Bearer {{bearerToken}}
### ###
# @name virtualNetwork2Del # @name virtualNetwork2Del
DELETE {{armRoot}}{{virtualNetwork2Id}}{{reqParams}} DELETE {{armRoot}}{{virtualNetwork2Id}}{{reqParams}}
Authorization: Bearer {{bearerToken}}
### ###
# @name virtualNetwork1Del # @name virtualNetwork1Del
DELETE {{armRoot}}{{virtualNetwork1Id}}{{reqParams}} DELETE {{armRoot}}{{virtualNetwork1Id}}{{reqParams}}
Authorization: Bearer {{bearerToken}}
### ###
# @name cloudDel # @name cloudDel
DELETE {{armRoot}}{{cloudId}}{{reqParams}} DELETE {{armRoot}}{{cloudId}}{{reqParams}}
Authorization: Bearer {{bearerToken}}
### ###
# @name vmmServerDel # @name vmmServerDel
DELETE {{armRoot}}{{vmmServerId}}{{reqParams}} DELETE {{armRoot}}{{vmmServerId}}{{reqParams}}
Authorization: Bearer {{bearerToken}}

Просмотреть файл

@ -32,8 +32,8 @@ def setBearerToken(projectRoot: str):
finally: finally:
settingsJSON: typing.Dict[str, typing.Any] = json.load(open(settingsJSONPath, 'r')) settingsJSON: typing.Dict[str, typing.Any] = json.load(open(settingsJSONPath, 'r'))
keyPath = ['rest-client.environmentVariables', 'local', 'bearerToken'] keyPath = ['rest-client.defaultHeaders', 'Authorization']
setValueOfNestedKey(settingsJSON, keyPath, tokenJSON['accessToken']) setValueOfNestedKey(settingsJSON, keyPath, f"Bearer {tokenJSON['accessToken']}")
json.dump(settingsJSON, open(settingsJSONPath, 'w'), indent=2) json.dump(settingsJSON, open(settingsJSONPath, 'w'), indent=2)
setBearerToken(dirname(abspath(__file__))) setBearerToken(dirname(abspath(__file__)))