Implement attachment checking in CLI (#141)

This commit is contained in:
Knut Ahlers 2023-10-21 17:12:08 +02:00 committed by GitHub
parent 34275baa2f
commit 9a530e1c66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 374 additions and 17 deletions

View file

@ -93,7 +93,7 @@ func createRunE(cmd *cobra.Command, _ []string) (err error) {
})
}
// Create the secret
// Get flags for creation
logrus.Info("creating the secret...")
instanceURL, err := cmd.Flags().GetString("instance")
if err != nil {
@ -105,6 +105,12 @@ func createRunE(cmd *cobra.Command, _ []string) (err error) {
return fmt.Errorf("getting expire flag: %w", err)
}
// Execute sanity checks
if err = client.SanityCheck(instanceURL, secret); err != nil {
return fmt.Errorf("sanity checking secret: %w", err)
}
// Create the secret
secretURL, expiresAt, err := client.Create(instanceURL, secret, expire)
if err != nil {
return fmt.Errorf("creating secret: %w", err)