def createRepos(self, repo, org): req = http_request.http_request() url = "https://" + self.config[ "aws.dockerReg"] + '/api/v0/repositories/' + org payload = repo return req.authPost(self.logger, url, payload, self.config['docker.ucp.user'], self.dockerPassword)
def addAccts(self, accounts): ''' Use the API to create accts ccheck for InfraUser: if not there then create it. ''' req = http_request.http_request() url = "https://" + self.config["aws.dockerReg"] + '/enzi/v0/accounts' payload = accounts return req.authPost(self.logger, url, payload, self.config['docker.ucp.user'], self.dockerPassword)
def enableHRM(self): req = http_request.http_request() loginURL = "https://" + self.config["aws.dockerUCP"] + '/auth/login' headers = {'Content-Type': 'application/json'} payload = { 'password': self.dockerPassword, 'username': self.config['docker.ucp.user'] } response = req.post(self.logger, loginURL, payload, headers) if response != None: authToken = response['auth_token'] url = "https://" + self.config["aws.dockerUCP"] + '/api/hrm' headers = { 'Authorization': 'Bearer ' + authToken, 'Content-Type': 'application/json' } payload = {"HTTPPort": 80, "HTTPSPort": 8443} return req.post(self.logger, url, payload, headers)
def __init__(self): self.requester = http_request()
def addAcctToOrg(self, user, org, payload): req = http_request.http_request() url = "https://" + self.config[ "aws.dockerReg"] + '/enzi/v0/accounts/' + org + '/members/' + user return req.authPut(self.logger, url, payload, self.config['docker.ucp.user'], self.dockerPassword)