feat: updated pr based on review

This commit is contained in:
=
2024-11-25 20:28:43 +05:30
parent ed7fc0e5cd
commit be39e63832
4 changed files with 7 additions and 22 deletions

View File

@ -237,6 +237,7 @@ func createDynamicSecretLeaseByName(cmd *cobra.Command, args []string) {
fmt.Println("Dynamic Secret Leasing")
fmt.Printf("Name: %s\n", dynamicSecretRootCredential.Name)
fmt.Printf("Provider: %s\n", dynamicSecretRootCredential.Type)
fmt.Printf("Lease ID: %s\n", leaseDetails.Id)
fmt.Printf("Expire At: %s\n", leaseDetails.ExpireAt.Local().Format("02-Jan-2006 03:04:05 PM"))
visualize.PrintAllDyamicSecretLeaseCredentials(leaseCredentials)
}
@ -245,7 +246,7 @@ func createDynamicSecretLeaseByName(cmd *cobra.Command, args []string) {
}
var dynamicSecretLeaseRenewCmd = &cobra.Command{
Example: `lease create <dynamic secret name>"`,
Example: `lease renew <dynamic secret name>"`,
Short: "Used to renew dynamic secret lease by name",
Use: "renew [lease-id]",
DisableFlagsInUseLine: true,

View File

@ -28,8 +28,9 @@ func PrintAllDynamicRootCredentials(dynamicRootCredentials []infisicalModels.Dyn
func PrintAllDynamicSecretLeases(dynamicSecretLeases []infisicalModels.DynamicSecretLease) {
rows := [][]string{}
const timeformat = "02-Jan-2006 03:04:05 PM"
for _, el := range dynamicSecretLeases {
rows = append(rows, []string{el.Id, el.ExpireAt.Local().Format("02-Jan-2006 03:04:05 PM"), el.CreatedAt.Local().Format("02-Jan-2006 03:04:05 PM")})
rows = append(rows, []string{el.Id, el.ExpireAt.Local().Format(timeformat), el.CreatedAt.Local().Format(timeformat)})
}
headers := []string{"ID", "Expire At", "Created At"}

View File

@ -95,25 +95,6 @@ func getLongestValues(rows [][3]string) (longestSecretName, longestSecretType in
}
func GenericTable(headers []string, rows [][]string) {
// if we're not in a terminal or cygwin terminal, don't truncate the secret value
shouldTruncate := isatty.IsTerminal(os.Stdout.Fd())
// This will return an error if we're not in a terminal or
// if the terminal is a cygwin terminal like Git Bash.
width, _, err := term.GetSize(int(os.Stdout.Fd()))
if err != nil {
if shouldTruncate {
log.Error().Msgf("error getting terminal size: %s", err)
} else {
log.Debug().Err(err)
}
}
availableWidth := width - borderWidths
if availableWidth < 0 {
availableWidth = 0
}
t := table.NewWriter()
t.SetOutputMirror(os.Stdout)
t.SetStyle(table.StyleLight)

View File

@ -1,6 +1,6 @@
---
title: "infisical dynamic-secrets"
description: "Perform various operations with Infisical dynamic secrets"
description: "Perform dynamic secret operations directly with the CLI"
---
```
@ -9,6 +9,8 @@ infisical dynamic-secrets
## Description
Dynamic secrets are unique secrets generated on demand based on the provided configuration settings. For more details, refer to [dynamics secrets section](/documentation/platform/dynamic-secrets/overview).
This command enables you to perform list, lease, renew lease, and revoke lease operations on dynamic secrets within your Infisical project.
### Sub-commands