From commits-return-39154-archive-asf-public=cust-asf.ponee.io@pulsar.apache.org Tue Oct 8 17:13:04 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id B9E5D180654 for ; Tue, 8 Oct 2019 19:13:03 +0200 (CEST) Received: (qmail 93896 invoked by uid 500); 8 Oct 2019 17:13:03 -0000 Mailing-List: contact commits-help@pulsar.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@pulsar.apache.org Delivered-To: mailing list commits@pulsar.apache.org Received: (qmail 93887 invoked by uid 99); 8 Oct 2019 17:13:03 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Oct 2019 17:13:03 +0000 From: GitBox To: commits@pulsar.apache.org Subject: [GitHub] [pulsar] devinbost edited a comment on issue #5312: Function REST API documentation is insufficient for Create POST action Message-ID: <157055478301.24846.12831450891870416113.gitbox@gitbox.apache.org> Date: Tue, 08 Oct 2019 17:13:03 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit devinbost edited a comment on issue #5312: Function REST API documentation is insufficient for Create POST action URL: https://github.com/apache/pulsar/issues/5312#issuecomment-539612612 Also, I found the code for the CLI in org.apache.pulsar.client.admin.internal.FunctionsImpl.java, which contains for the create: ``` @Override public void createFunctionWithUrl(FunctionConfig functionConfig, String pkgUrl) throws PulsarAdminException { try { final FormDataMultiPart mp = new FormDataMultiPart(); mp.bodyPart(new FormDataBodyPart("url", pkgUrl, MediaType.TEXT_PLAIN_TYPE)); mp.bodyPart(new FormDataBodyPart("functionConfig", new Gson().toJson(functionConfig), MediaType.APPLICATION_JSON_TYPE)); request(functions.path(functionConfig.getTenant()).path(functionConfig.getNamespace()).path(functionConfig.getName())) .post(Entity.entity(mp, MediaType.MULTIPART_FORM_DATA), ErrorData.class); } catch (Exception e) { throw getApiException(e); } } ``` and for the update: ``` @Override public void updateFunctionWithUrl(FunctionConfig functionConfig, String pkgUrl, UpdateOptions updateOptions) throws PulsarAdminException { try { final FormDataMultiPart mp = new FormDataMultiPart(); mp.bodyPart(new FormDataBodyPart("url", pkgUrl, MediaType.TEXT_PLAIN_TYPE)); mp.bodyPart(new FormDataBodyPart( "functionConfig", ObjectMapperFactory.getThreadLocal().writeValueAsString(functionConfig), MediaType.APPLICATION_JSON_TYPE)); if (updateOptions != null) { mp.bodyPart(new FormDataBodyPart( "updateOptions", ObjectMapperFactory.getThreadLocal().writeValueAsString(updateOptions), MediaType.APPLICATION_JSON_TYPE)); } request(functions.path(functionConfig.getTenant()).path(functionConfig.getNamespace()) .path(functionConfig.getName())).put(Entity.entity(mp, MediaType.MULTIPART_FORM_DATA), ErrorData.class); } catch (Exception e) { throw getApiException(e); } } ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services