1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
//! # cloudsctl
//!
//! `cloudsctl` (pronounced "cloud skittle") allows the user to modify their OpenStack
//! configuration (clouds.yaml, secure.yaml and clouds-public.yaml files) with a CLI.
//!
//! `cloudsctl` can also inject cloud variables from clouds.yaml, secure.yaml and
//! clouds-public.yaml into the environment and run a command. This allows you to keep all your
//! cloud configuration in one place and get rid of any Openstack RC files you might have lying
//! around.
//!
//! ## Quickstart
//!
//! ### Create a profile
//!
//! ```shell
//! $ cloudsctl profile create --auth-url https://my-cloud.domain.tld:5000/v3 my-profile
//! ```
//!
//! This will create an OpenStack profile called `my-profile` in your `clouds-public.yaml` file.
//!
//! ### Show a profile
//!
//! ```shell
//! $ cloudsctl profile show my-profile
//! ```
//!
//! This will show you the profile `my-profile`
//!
//! ### List profiles
//!
//! ```shell
//! $ cloudsctl profile list
//! ```
//!
//! This will list all profiles in `clouds-public.yaml`
//!
//! ### Delete a profile
//!
//! ```shell
//! $ cloudsctl profile delete my-profile
//! ```
//!
//! This will delete the profile called `my-profile` from `clouds-public.yaml`
//!
//! ### Set profile settings
//!
//! ```shell
//! $ cloudsctl profile set --auth-url https://new-api:5000/v3 my-profile
//! ```
//!
//! This will change the auth-url for the profile `my-profile` to `https://new-api:5000/v3` in
//! clouds-public.yaml.
//!
//! Run `cloudsctl profile set --help` to see all the settings that you can change for a profile.
//!
//! ### Create a cloud
//!
//! ```shell
//! $ cloudsctl cloud create --username my-user --password-prompt --profile my-profile my-cloud
//! ```
//!
//! This will:
//! - create a cloud named `my-cloud` in `clouds.yaml` that uses the `my-profile` profile from `clouds-public.yaml`
//! - put your password in `secure.yaml`
//!
//! ### Show a cloud
//!
//! ```shell
//! $ cloudsctl cloud show my-cloud
//! ```
//!
//! This will show you the cloud `my-cloud`.
//!
//! ### List clouds
//!
//! ```shell
//! $ cloudsctl cloud list
//! ```
//!
//! This will list all clouds in `clouds.yaml`
//!
//! ### Delete a cloud
//!
//! ```shell
//! $ cloudsctl cloud delete my-cloud
//! ```
//!
//! This will delete the cloud called `my-cloud` from `clouds.yaml`
//!
//! ### Set cloud settings
//!
//! ```shell
//! $ cloudsctl cloud set --auth-url https://new-api:5000/v3 my-cloud
//! ```
//!
//! This will change the auth-url for the cloud `my-cloud` to `https://new-api:5000/v3` in
//! clouds.yaml.
//!
//! Run `cloudsctl cloud set --help` to see all the settings that you can change for a cloud.
//!
//! ### Copy cloud
//!
//! ```shell
//! $ cloudsctl cloud copy --username new_user source_cloud target_cloud
//! ```
//!
//! This will copy cloud `source_cloud` to `target_cloud` and set the user to `new_user` in the
//! target_cloud.
//!
//! Run `cloudsctl cloud copy --help` to see all the settings that you can override in the target
//! cloud while copying from the source cloud.
//!
//! ### Inject cloud variables from configuration files into environment and run command.
//!
//! ```shell
//! $ cloudsctl cloud create --username my-user --password-prompt --project-name my-project --profile my-profile my-cloud
//! Password:
//! $ cloudsctl env my-cloud bash
//! $ env|grep OS_
//! OS_AUTH_URL=https://my-cloud.domain.tld:5000/v3
//! OS_VERIFY=false
//! OS_TENANT_NAME=my-project
//! OS_USERNAME=my-user
//! OS_PROJECT_NAME=my-project
//! OS_PASSWORD=foo
//! ```
//!
//! `bash` is the default command and could have been omitted in the command above.
//!
//! I like to keep an alias called `oscloud` like this:
//!
//! ```shell
//! $ alias oscloud='cloudsctl env'
//! $ oscloud my-cloud
//! $ openstack server list
//! etc...
//! ```
//!
//! ### Shell completion
//!
//! Thanks to [clap](https://docs.rs/clap/), cloudsctl supports shell completion for bash, zsh,
//! fish and elvish.
//!
//! ```shell
//! $ cloudsctl completion bash
//! ```
//!
//! A completion file will be generated in the current directory.
//!
use Error;