def Run(self, args): project_ref = command_lib_util.ParseProject(args.id) if not console_io.PromptContinue('Your project will be deleted.'): return None result = projects_api.Delete(project_ref) log.DeletedResource(project_ref) return result
def testDeleteHttpError(self): test_project = util.GetTestActiveProject() test_project_ref = command_lib_util.ParseProject(test_project.projectId) self.mock_client.projects.Delete.Expect( self.messages.CloudresourcemanagerProjectsDeleteRequest( projectId=test_project.projectId), exception=self.HttpError()) with self.assertRaises(exceptions.HttpError): projects_api.Delete(test_project_ref)
def testDelete(self): test_project = util.GetTestActiveProject() test_project_ref = command_lib_util.ParseProject(test_project.projectId) self.mock_client.projects.Delete.Expect( self.messages.CloudresourcemanagerProjectsDeleteRequest( projectId=test_project.projectId), self.messages.Empty()) response = projects_api.Delete(test_project_ref) self.assertEqual(response.projectId, test_project.projectId)
def Run(self, args): project_ref = command_lib_util.ParseProject(args.id) if not console_io.PromptContinue('Your project will be deleted.'): return None result = projects_api.Delete(project_ref) log.DeletedResource(project_ref) # Print this here rather than in Epilog because Epilog doesn't have access # to the deleted resource. # We can't be more specific than "limited period" because the API says # "at an unspecified time". log.status.Print( '\nYou can undo this operation for a limited period by running:\n' ' $ gcloud projects undelete {0}'.format(args.id)) return result
def TearDown(self): projects_api.Delete(self.project_ref) log.DeletedResource(self.project_ref)