From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:33031) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iJbYf-0002NH-KD for guix-patches@gnu.org; Sun, 13 Oct 2019 06:57:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iJbYd-0007S2-Cv for guix-patches@gnu.org; Sun, 13 Oct 2019 06:57:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:54677) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iJbYd-0007Rw-9X for guix-patches@gnu.org; Sun, 13 Oct 2019 06:57:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iJbYc-00084j-4x for guix-patches@gnu.org; Sun, 13 Oct 2019 06:57:03 -0400 Subject: [bug#37083] [PATCH] machine: Implement 'digital-ocean-environment-type'. Resent-Message-ID: From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <87ftlxf6q3.fsf@sdf.lonestar.org> <875zmirizk.fsf@gnu.org> <87y2z45knp.fsf@gnu.org> <87blvysuaz.fsf@sdf.lonestar.org> <87tv9nc1fz.fsf@sdf.lonestar.org> <87y2yy7f64.fsf@gnu.org> <87y2yh5px7.fsf@sdf.lonestar.org> <87sgonl8t4.fsf@gnu.org> <87ftkgno80.fsf@sdf.lonestar.org> <87blv4no6e.fsf_-_@sdf.lonestar.org> <877e5sm4kl.fsf@gnu.org> Date: Sun, 13 Oct 2019 12:56:21 +0200 In-Reply-To: <877e5sm4kl.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Sun, 29 Sep 2019 00:36:10 +0200") Message-ID: <87lftoap7u.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: "Jakob L. Kreuze" Cc: 37083@debbugs.gnu.org Hi Jakob, A friendly reminder. :-) I can commit it on your behalf if you lack the bandwidth right now. Thanks, Ludo=E2=80=99. Ludovic Court=C3=A8s skribis: > Hi Jakob! > > zerodaysfordays@sdf.lonestar.org (Jakob L. Kreuze) skribis: > >> gnu/machine/digital-ocean.scm: New file. >> gnu/local.mk (GNU_SYSTEM_MODULES): Add it. >> doc/guix.texi (Invoking 'guix deploy'): Add documentation for > ^ > Nitpick: please add a =E2=80=9C*=E2=80=9D before each bullet. :-) > > Apart from that, LGTM, woohoo! > >> +(define (fetch-endpoint endpoint) >> + "Return the contents of the Digital Ocean API endpoint ENDPOINT as an >> +alist. This procedure is quite a bit more specialized than 'json-fetch'= , as it >> +takes care to set headers such as 'Accept' and 'Authorization' appropri= ately." >> + (define headers >> + `((user-agent . "Guix Deploy") >> + (Accept . "application/json") >> + (Authorization . ,(format #f "Bearer ~a" (%digital-ocean-token)))= )) >> + (json-fetch (string-append %api-base endpoint) #:headers headers)) > > Note for later: we could use =E2=80=98define-json-mapping=E2=80=99 to wor= k on Scheme > records rather than on alists. > >> + (message (G_ "No Digital Ocean access token was provided. = This \ >> +may be fixed by setting the environment variable GUIX_DIGITAL_OCAEN_TOK= EN to \ > ^^ > Typo. > > Thank you! > > Ludo=E2=80=99.