-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
953b2d3
commit 00d9c83
Showing
9 changed files
with
210 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import json | ||
|
||
import requests | ||
import sys | ||
|
||
def perform_put_request(url, data, headers=None): | ||
""" | ||
This function perform the PUT request to Azure in order to edit the vWAN Hub Routing-Intent | ||
""" | ||
result = {"status": "success", "message": ""} | ||
try: | ||
response = requests.put(url, json=data, headers=headers) | ||
result["message"] = response.text | ||
except Exception as e: | ||
result["status"] = "error" | ||
result["message"] = f"An error occurred: {str(e)}" | ||
return result | ||
|
||
if __name__ == "__main__": | ||
""" | ||
This script receives url, body, and authorization token as arguments and set vWAN Hub Routing-Intent | ||
""" | ||
api_url = sys.argv[1] | ||
api_data = eval(sys.argv[2]) | ||
auth_token = sys.argv[3] | ||
api_headers = {"Authorization": f'Bearer {auth_token}'} | ||
result = perform_put_request(api_url, api_data, api_headers) | ||
print(json.dumps(result)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.