Ejemplo n.º 1
0
 def create_project(self,
                    name=None,
                    registry_id=None,
                    metadata=None,
                    expect_status_code=201,
                    expect_response_body=None,
                    **kwargs):
     if name is None:
         name = base._random_name("project")
     if metadata is None:
         metadata = {}
     if registry_id is None:
         registry_id = registry_id
     project = v2_swagger_client.ProjectReq(project_name=name,
                                            registry_id=registry_id,
                                            metadata=metadata)
     try:
         _, status_code, header = self._get_client(
             **kwargs).create_project_with_http_info(project)
     except ApiException as e:
         base._assert_status_code(expect_status_code, e.status)
         if expect_response_body is not None:
             base._assert_status_body(expect_response_body, e.body)
         return
     base._assert_status_code(expect_status_code, status_code)
     base._assert_status_code(201, status_code)
     return base._get_id_from_header(header), name
Ejemplo n.º 2
0
 def update_project(self, project_id, expect_status_code=200, metadata=None, cve_allowlist=None, **kwargs):
     project = v2_swagger_client.ProjectReq(metadata=metadata, cve_allowlist=cve_allowlist)
     try:
         _, sc, _ = self._get_client(**kwargs).update_project_with_http_info(project_id, project)
     except ApiException as e:
         base._assert_status_code(expect_status_code, e.status)
     else:
         base._assert_status_code(expect_status_code, sc)