Reply
Highlighted
Accepted Solution

Automation of Route 53 Sync Groups via WAPI

[ Edited ]
JRuzicka
Techie
Posts: 10
3499     0

I'm currently using http requests with Python to script the addition of a new Route 53 Sync Group.  So far I'm able to create the new group using the RESTful API 2.5.0 documentation as my guideline.  I've run into a problem though when creating the task where I can't seem to assign the AWS User credentials I previously created under Credentials / Use IAM credential select option .  In the API documentation there does not seem to be any field for this.  

Re: Automation of Route 53 Sync Groups via WAPI

Moderator BRampling
Moderator
Posts: 69
3500     0

You need a Task Group and a Task. The Task is a struct within the task group. When you create the awsrte53taskgroup object, you need to include the task_list struct as one of the fields. Within that struct you can include the AWS user and the schedule for the task. It's documented here:

 

<url>/wapidoc/additional/structs.html#struct-awsrte53task

 

Let me know if you need an example.

Re: Automation of Route 53 Sync Groups via WAPI

JRuzicka
Techie
Posts: 10
3500     0

Thank you.  I didn't see that.  I was using the build process in the WebUI as my guideline, which lists the sync task as a separate definition from the formation of the sync group and does not include the credentials.  I'll review the information you provided.

Re: Automation of Route 53 Sync Groups via WAPI

JRuzicka
Techie
Posts: 10
3500     0

I'm a fairly new to scripting so I would appreciate an example, in Python if at all possible.  

 

Thank you,

John

Re: Automation of Route 53 Sync Groups via WAPI

Moderator BRampling
Moderator
Posts: 69
3500     0
#!/usr/bin/python

import sys,requests,json
from requests.auth import HTTPBasicAuth
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)

url = "https://10.60.27.4/wapi/v2.5/"
awsuser = "brampling"

payload = {"name": awsuser}

resp = requests.get(url + "awsuser", auth=HTTPBasicAuth('admin', 'infoblox'),verify=False,data=payload)

j = resp.json()
k = j[0]
awsuserref = k['_ref']

payload2 = json.dumps({"name":"blairtaskgroup", "grid_member":"infoblox.localdomain","task_list":[{"aws_user":awsuserref,"filter":"*","name":"blairtask","schedule_interval":5,"schedule_units":"MINS"}]})

resp = requests.post(url + "awsrte53taskgroup", auth=HTTPBasicAuth('admin', 'infoblox'),verify=False,data=payload2)

print resp.text
Showing results for 
Search instead for 
Do you mean 

Recommended for You