Skip to content

Instantly share code, notes, and snippets.

@suresh-sendinblue
Created February 20, 2023 05:21
Show Gist options
  • Save suresh-sendinblue/2e31319cd4e4be321ac064df76d5fb91 to your computer and use it in GitHub Desktop.
Save suresh-sendinblue/2e31319cd4e4be321ac064df76d5fb91 to your computer and use it in GitHub Desktop.

Revisions

  1. suresh-sendinblue created this gist Feb 20, 2023.
    12 changes: 12 additions & 0 deletions argocd-api.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    #!/bin/bash

    ### Get ArgoCD token
    curl -s --location -H "CF-Access-Client-Id: <xxxxxxxx>" -H "CF-Access-Client-Secret: <xxxxxxx>" -d $'{"username":"<xxxxx>","password":"<xxxxx>"}' https://argocd.example.com/api/v1/session


    ### Restart k8s resource
    curl --location --request POST 'https://argocd.example.com/api/v1/applications/<application-name>/resource/actions?namespace=<app namespace>&resourceName=<resourse to restart>&version=v1&kind=<kind of the resource>&group=apps' \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/x-www-form-urlencoded' \
    --header 'Cookie: CF_Authorization=<cloudflare-generated-auth>' \
    --data-urlencode '"restart"='