Beispiel #1
0
    def get_deployments(self, index=0):
        sleep(1)
        result = self.get("/v1/job/" + self.job.ID + "/deployments",
                          params={"index": index})

        # This endpoints returns []Deployments which cannot be parsed by thrift
        ds = {"Deployments": json.loads(result.text)}
        return fromJson(json.dumps(ds), DeploymentListResponse())
Beispiel #2
0
 def diff(self):
     job = self.job
     click.echo(click.style("Running diff...", fg="green"))
     result = self.post(
         "/v1/job/" + job.ID + "/plan",
         data=jobToJSON(JobPlanRequest(Job=job, Diff=True)),
     )
     validate_json_output(result.text, JobPlanResponse())
     return fromJson(result.text, JobPlanResponse())
Beispiel #3
0
 def run(self):
     payload = jobToJSON(JobRegisterRequest(Job=self.job))
     result = self.post("/v1/job/" + self.job.ID, data=payload)
     validate_json_output(result.text, JobRegisterResponse())
     d = fromJson(result.text, JobRegisterResponse())
     return d
Beispiel #4
0
 def get_allocations(self):
     result = self.get("/v1/job/" + self.job.ID + "/allocations")
     _my = json.dumps({"Allocations": json.loads(result.text)})
     return fromJson(_my, JobAllocationsResponse())
Beispiel #5
0
 def get_service(self, service_id):
     result = self.get("/v1/catalog/service/" + service_id)
     _my = json.dumps({"ServiceNodes": json.loads(result.text)})
     return fromJson(_my, IndexedServiceNodes())