Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "B-20001" #13699

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions cmd/pptas-api-client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ func main() {
}
initRootFlags(root.PersistentFlags())

PPTASReportsCommand := &cobra.Command{
listMovesCommand := &cobra.Command{
Use: "list-moves",
Short: "An optimized fetch for all moves available to Prime",
Long: "Fetches moves that are available to Prime quickly, without all the data for nested objects.",
RunE: pptas.PPTASReports,
RunE: pptas.ListMoves,
SilenceUsage: true,
}
pptas.InitPPTASReportsFlags(PPTASReportsCommand.Flags())
root.AddCommand(PPTASReportsCommand)
pptas.InitListMovesFlags(listMovesCommand.Flags())
root.AddCommand(listMovesCommand)

if err := root.Execute(); err != nil {
panic(err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ import (
"github.com/transcom/mymove/pkg/gen/pptasmessages"
)

// InitPPTASReportsFlags declares which flags are enabled
func InitPPTASReportsFlags(flag *pflag.FlagSet) {
// InitListMovesFlags declares which flags are enabled
func InitListMovesFlags(flag *pflag.FlagSet) {
flag.String(utils.SinceFlag, "", "Timestamp for filtering moves. Returns moves updated since this time.")
flag.SortFlags = false
}

func checkPPTASReportsConfig(v *viper.Viper, logger *log.Logger) error {
func checkListMovesConfig(v *viper.Viper, logger *log.Logger) error {
err := utils.CheckRootConfig(v)
if err != nil {
logger.Fatal(err)
Expand All @@ -32,8 +32,8 @@ func checkPPTASReportsConfig(v *viper.Viper, logger *log.Logger) error {
return nil
}

// PPTASReports creates a gateway and sends the request to the endpoint
func PPTASReports(cmd *cobra.Command, args []string) error {
// ListMoves creates a gateway and sends the request to the endpoint
func ListMoves(cmd *cobra.Command, args []string) error {
v := viper.New()

//Create the logger
Expand All @@ -46,13 +46,13 @@ func PPTASReports(cmd *cobra.Command, args []string) error {
}

// Check the config before talking to the CAC
err := checkPPTASReportsConfig(v, logger)
err := checkListMovesConfig(v, logger)
if err != nil {
logger.Fatal(err)
}

// Get the since param, if any
var params moves.PptasReportsParams
var params moves.ListMovesParams
since := v.GetString(utils.SinceFlag)
if since != "" {
sinceDateTime, sinceErr := strfmt.ParseDateTime(since)
Expand Down Expand Up @@ -81,10 +81,10 @@ func PPTASReports(cmd *cobra.Command, args []string) error {
// commands, so start with list moves for now
wait := v.GetDuration(utils.WaitFlag)
params.SetTimeout(wait)
var payload pptasmessages.PPTASReports
var payload pptasmessages.ListMoves
// loop until we either time out or get a successful response
for {
resp, err := primeGateway.Moves.PptasReports(&params)
resp, err := primeGateway.Moves.ListMoves(&params)
if err != nil {
currentTime := time.Now()
if currentTime.Sub(startTime) > wait {
Expand Down
6 changes: 3 additions & 3 deletions pkg/gen/pptasapi/configure_mymove.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ func configureAPI(api *pptasoperations.MymoveAPI) http.Handler {

api.JSONProducer = runtime.JSONProducer()

if api.MovesPptasReportsHandler == nil {
api.MovesPptasReportsHandler = moves.PptasReportsHandlerFunc(func(params moves.PptasReportsParams) middleware.Responder {
return middleware.NotImplemented("operation moves.PptasReports has not yet been implemented")
if api.MovesListMovesHandler == nil {
api.MovesListMovesHandler = moves.ListMovesHandlerFunc(func(params moves.ListMovesParams) middleware.Responder {
return middleware.NotImplemented("operation moves.ListMoves has not yet been implemented")
})
}

Expand Down
Loading