-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
80 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,88 @@ | ||
# cf | ||
CLI for interacting with Cloudflare's V4 API. `cf` is mostly just a CLI | ||
wrapping of the [cloudflare-go](github.com/cloudflare/cloudflare-go) package. | ||
|
||
`cf` contains commands to interact with almost all cloudflare product areas and | ||
can configure almost all products in a consistent and well documented way. | ||
|
||
| The cloudflare command line interface | ||
# Installation | ||
If you just want to get started using `cf` then run the following command. | ||
``` | ||
go get -u github.com/ejcx/cf | ||
``` | ||
# Credentials | ||
Your cloudflare api credentials can be stored in `~/.cf/credentials` or as environment variables. | ||
### ~/.cf/credentials | ||
The format of the file should be like so: | ||
``` | ||
{ | ||
"Email": "[email protected]", | ||
"UserServiceKey": "v1.0-...aaa", | ||
"Key": "20...973" | ||
} | ||
``` | ||
### Environment Variables | ||
The three environment variables that should be set are `CF_API_KEY`, `CF_API_EMAIL`, and `CF_USER_SERVICE_KEY`. If any of the environment variables are set then the credentials file is ignored | ||
### Keychain | ||
Coming soon... | ||
# Usage | ||
**The cf is a full feature cli. All product areas are divided in to commands** | ||
``` | ||
e :) ./cf | ||
A CLI for interacting with Cloudflare's V4 API | ||
Usage: | ||
cf [command] | ||
Available Commands: | ||
cache Commands for interacting with caching and railgun APIs | ||
dns Create, read, update, and delete your dns records. | ||
firewall Commands to interact with products that block access to your site | ||
help Help about any command | ||
loadbalancer Manage, create, and describe your loadbalancers, pools, and monitor | ||
organization Interact with the organizations you own and have access to | ||
pagerule Change how cloudflare works on a URL or subdomain basis. | ||
ratelimit Configure, create, and view your zone's ratelimits. | ||
ssl Control and insight in to your zone's SSL stack | ||
user Interacting with your Cloudflare account | ||
zone Interact with cloudflare zones | ||
Flags: | ||
-h, --help help for cf | ||
Use "cf [command] --help" for more information about a command. | ||
``` | ||
|
||
**Each command has a list of subcommands that will allow you to interact with that product area. Here I am viewing the optional flags to the `edit-user` command.** | ||
``` | ||
e :) cf user edit-user --help | ||
Edit user account details | ||
If you don't have the Go toolchain you can download cf from the releases page. | ||
- [cf binary mac]() | ||
- [cf binary linux]() | ||
Usage: | ||
cf user edit-user [flags] | ||
|
||
Flags: | ||
--country string The country in which the user lives, example US. max length 30 | ||
--first-name string User's first name, max length 60 | ||
-h, --help help for edit-user | ||
--last-name string User's last name, max length 60 | ||
--telephone string User's telephone number, max length 20 | ||
--zipcode string The zip code or postal code in which the user lives, max length 20 | ||
``` | ||
|
||
|
||
**We can easily update the first name associated with the account by specifying a new first name.** | ||
``` | ||
e :) cf user edit-user --first-name Pete --last-name ZaHut | ||
{ | ||
"id": "64...4d", | ||
"email": "evan@xxx", | ||
"first_name": "Pete", | ||
"last_name": "ZaHut", | ||
"username": "e", | ||
"telephone": "1-867-5309", | ||
"zipcode": "94108", | ||
"created_on": "2014-10-30T02:06:57.665472Z", | ||
"modified_on": "2018-07-20T16:56:00.74237Z", | ||
"betas": [ | ||
"dnssec_beta", | ||
"chat_beta", | ||
"stream_beta" | ||
] | ||
} | ||
``` |