(deps commandDeps)
| 60 | } |
| 61 | |
| 62 | func newProviderModelsRefreshCommand(deps commandDeps) *cobra.Command { |
| 63 | var sourceID string |
| 64 | var force bool |
| 65 | var requestID string |
| 66 | cmd := &cobra.Command{ |
| 67 | Use: "refresh [provider]", |
| 68 | Short: "Refresh provider model catalog sources", |
| 69 | Args: optionalProviderArg(), |
| 70 | RunE: func(cmd *cobra.Command, args []string) error { |
| 71 | client, err := clientFromDeps(deps) |
| 72 | if err != nil { |
| 73 | return err |
| 74 | } |
| 75 | record, err := client.RefreshProviderModels( |
| 76 | cmd.Context(), |
| 77 | providerArgValue(args), |
| 78 | ProviderModelRefreshRequest{ |
| 79 | SourceID: sourceID, |
| 80 | Force: force, |
| 81 | RequestID: requestID, |
| 82 | }, |
| 83 | ) |
| 84 | if err != nil { |
| 85 | return err |
| 86 | } |
| 87 | return writeCommandOutput(cmd, providerModelRefreshBundle(record)) |
| 88 | }, |
| 89 | } |
| 90 | cmd.Flags().StringVar(&sourceID, "source", "", "Refresh only one catalog source id") |
| 91 | cmd.Flags().BoolVar(&force, "force", false, "Force refresh even when cached status is fresh") |
| 92 | cmd.Flags().StringVar(&requestID, "request-id", "", "Refresh request id for daemon logs") |
| 93 | return cmd |
| 94 | } |
| 95 | |
| 96 | func newProviderModelsStatusCommand(deps commandDeps) *cobra.Command { |
| 97 | cmd := &cobra.Command{ |
no test coverage detected