| 222 | } |
| 223 | |
| 224 | func PromptMissing(opts *CreateOptions) error { |
| 225 | if opts.Name.Value == "" { |
| 226 | if err := opts.Ask(&survey.Input{ |
| 227 | Message: "Name", |
| 228 | Help: "A short, memorable, unique name for this account.", |
| 229 | }, &opts.Name.Value, survey.WithValidator(survey.ComposeValidators( |
| 230 | survey.MaxLength(200), |
| 231 | survey.MinLength(1), |
| 232 | survey.Required, |
| 233 | ))); err != nil { |
| 234 | return err |
| 235 | } |
| 236 | } |
| 237 | |
| 238 | if opts.Description.Value == "" { |
| 239 | if err := opts.Ask(&surveyext.OctoEditor{ |
| 240 | Editor: &survey.Editor{ |
| 241 | Message: "Description", |
| 242 | Help: "A summary explaining the use of the account to other users.", |
| 243 | FileName: "*.md", |
| 244 | }, |
| 245 | Optional: true, |
| 246 | }, &opts.Description.Value); err != nil { |
| 247 | return err |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | if opts.SubscriptionID.Value == "" { |
| 252 | if err := opts.Ask(&survey.Input{ |
| 253 | Message: "Subscription ID", |
| 254 | Help: "Your Azure Subscription ID. This is a GUID in the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.", |
| 255 | }, &opts.SubscriptionID.Value, survey.WithValidator(survey.ComposeValidators( |
| 256 | survey.Required, |
| 257 | validation.IsUuid, |
| 258 | ))); err != nil { |
| 259 | return err |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | if opts.TenantID.Value == "" { |
| 264 | if err := opts.Ask(&survey.Input{ |
| 265 | Message: "Tenant ID", |
| 266 | Help: "Your Azure Active Directory Tenant ID. This is a GUID in the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.", |
| 267 | }, &opts.TenantID.Value, survey.WithValidator(survey.ComposeValidators( |
| 268 | survey.Required, |
| 269 | validation.IsUuid, |
| 270 | ))); err != nil { |
| 271 | return err |
| 272 | } |
| 273 | } |
| 274 | |
| 275 | if opts.ApplicationID.Value == "" { |
| 276 | if err := opts.Ask(&survey.Input{ |
| 277 | Message: "Application ID", |
| 278 | Help: "Your Azure Active Directory Application ID. This is a GUID in the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.", |
| 279 | }, &opts.ApplicationID.Value, survey.WithValidator(survey.ComposeValidators( |
| 280 | survey.Required, |
| 281 | validation.IsUuid, |