Coder Social home page Coder Social logo

cloudflare-cli's Introduction

cloudflare-cli

Communicating with Cloudflare API through command line interface

Table of Contents

  1. Introduction
  2. Features
  3. Usages
    1. Downloads
    2. Command usages
  4. Development
    1. Setup environment
    2. Add new sub command
    3. Incoming features
    4. Build with cross-compile options

Introduction

Usages

Download latest binary from github at

Downloads

For Windows x64

Download latest build for Windows amd64 at this addess cloudflare-windows-amd64-{release version}.zip Extract zip file, rename to cloudflare.exe and copy it to \Windows\system32\cloudflare set PATH to C:\Windows\system32\cloudflare

For Linux amd64

release_version="v0.0.x"
curl -OL "https://github.com/epiHATR/cloudflare-cli/releases/download/$release_version/cloudflare-linux-amd64-$release_version"
sudo mv cloudflare-linux-amd64-$release_version /usr/local/bin/cloudflare
sudo chmod +x /usr/local/bin/cloudflare

For MacOS arm64

release_version="v0.0.x"
curl -OL "https://github.com/epiHATR/cloudflare-cli/releases/download/$release_version/cloudflare-linux-arm64-$release_version"
sudo mv cloudflare-linux-arm64-$release_version /usr/local/bin/cloudflare
sudo chmod +x /usr/local/bin/cloudflare

Command Usages

command descriptions
cloudflare show cli introductions & starter command
cloudflare version display cli version and Cloudflare API version
cloudflare login login into Cloudflare API
cloudflare zone list list Cloudflare zone in account
cloudflare zone show show Cloudflare zone common information
cloudflare zone create create new Cloudflare zone
cloudflare zone setting pause pause a cloudflare zone
cloudflare zone setting unpause unpause a cloudflare zone
cloudflare zone settings set-type set Cloudflare zone type (parital, full, delegated)
cloudflare zone plan list list all Cloudflare plan for zone
cloudflare zone plan show show a Cloudflare plan details
cloudflare zone plan upgrade upgrade Cloudflare zone to a specified plan
cloudflare zone delete delete a Cloudflare zone
cloudflare zone dns list list DNS records on a Cloudflare zone
cloudflare zone dns show show a DNS records details of a Cloudflare zone
cloudflare zone dns add add a DNS records on a Cloudflare zone
cloudflare zone dns update change/update DNS records value on Cloudflare zone
cloudflare zone dns delete delete a DNS records on a Cloudflare zone

cloudflare

show cli introductions & starter command

cloudflare [ --help | -h ]
           [ --debug ]

cloudflare login

Login into Cloudflare API using API Token (--token | -t) or Email/ApiKey (--email|-e and --key|-k)

cloudflare login [ --token | -t ]
                 [ --email | -e ]
                 [ --key | -k ]

#global flags                                   
                 [ --help | -h ]
                 [ --debug ]

cloudflare version

Show current CLI version and Cloudflare API version

cloudflare version [ --short | -s ]

#global flags                                   
                   [ --help | -h ]
                   [ --debug ]

cloudflare zone list

List all Cloudflare zone under account

cloudflare zone list [ --account-id ]
                     [ --name | -n ]

#global flags       
                    [ --query | -q ]                           
                    [ --output |-o ]
                    [ --help | -h ]
                    [ --debug ]

cloudflare zone show

List all Cloudflare zone under account

cloudflare zone show [ --id | -i]
                     [ --name | -n ]

#global flags       
                    [ --query | -q ]                           
                    [ --output |-o ]
                    [ --help | -h ]
                    [ --debug ]

cloudflare zone dns list

List all DNS records in a Cloudflare zone

cloudflare zone dns list [ --zone-id | -i]
                         [ --type | -t ]

#global flags       
                        [ --query | -q ]                           
                        [ --output |-o ]
                        [ --help | -h ]
                        [ --debug ]

cloudflare zone dns show

Show details of a Cloudflare DNS record

cloudflare zone dns show [ --id | -i ]
                         [ --zone-id | -i]

#global flags       
                         [ --query | -q ]                           
                         [ --output |-o ]
                         [ --help | -h ]
                         [ --debug ]

cloudflare zone dns add

Add a Cloudflare DNS record and return its result

See data payload format at Cloudflare API documentation - create DNS record

cloudflare zone dns add [ --zone-id | -i]
                        [ --data|-d ]
#global flags       
                        [ --query | -q ]                           
                        [ --output |-o ]
                        [ --help | -h ]
                        [ --debug ]

cloudflare zone setting pause

Pause a Cloudfalre zone

cloudflare zone setting pause [ --zone-id | -i]

#global flags       
                              [ --query | -q ]                           
                              [ --output |-o ]
                              [ --help | -h ]
                              [ --debug ]

cloudflare zone setting unpause

UnPause a Cloudfalre zone

cloudflare zone setting unpause [ --zone-id | -i]

#global flags       
                                [ --query | -q ]                           
                                [ --output |-o ]
                                [ --help | -h ]
                                [ --debug ]

cloudflare zone setting set-type

Change Cloudflare zone type (full, partial)

cloudflare zone setting set-type [ --zone-id]
                                 [ --type| -t ]

#global flags       
                                 [ --query | -q ]                           
                                 [ --output |-o ]
                                 [ --help | -h ]
                                 [ --debug ]

cloudflare zone plan list

List all Cloudflare zone's plan

cloudflare zone zone plan list [ --zone-id]
                               [ --all-available|-a ]
                               [ --rate-plan-only ]
#global flags       
                                [ --query | -q ]                           
                                [ --output |-o ]
                                [ --help | -h ]
                                [ --debug ]

cloudflare zone plan show

Show details of a zone's plan

cloudflare zone zone plan show [ --zone-id ]
                               [ --id | -i]
#global flags       
                                [ --query | -q ]                           
                                [ --output |-o ]
                                [ --help | -h ]
                                [ --debug ]

cloudflare zone plan upgrade

Upgrade a Clouddflare zone plan

cloudflare zone zone plan upgrade [ --zone-id ]
                                  [ --plan-id | -i]
                                  [ --plan-name | -n]
#global flags       
                                [ --query | -q ]                           
                                [ --output |-o ]
                                [ --help | -h ]
                                [ --debug ]

Development

Setup development environment

Add sub commands

Incoming features

  • add --output|-o flag to allow output as json, yaml
  • enable --query|-q flag to allow JMESpath based queries
  • enable login with email & key

Build

Following command running on MACOS M1 which will create a release version of cloudflare-cli, targeting for: Windows exe

version="v0.0.x"
GOOS=windows GOARCH=amd64 go build -o "release/windows-amd64-$version/cloudflare.exe" cloudflare

For Linux 64 binary

GOOS=linux GOARCH=amd64 go build -o "release/linux-amd64-$version/cloudflare" cloudflare
cd release/linux-amd64-$version
tar -czvf linux-amd64-$version.tar.gz cloudflare

For MacOS binary

GOOS=darwin GOARCH=arm64 go build -o "release/darwin-arm64-$version/cloudflare" cloudflare
cd release/darwin-arm64-$version
tar -czvf darwin-arm64-$version.tar.gz cloudflare

cloudflare-cli's People

Contributors

epihatr avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.