From d1d6e91de2814313245e4728c629928d0033da1b Mon Sep 17 00:00:00 2001 From: toddobryan-clever <41170718+toddobryan-clever@users.noreply.github.com> Date: Mon, 8 Apr 2019 11:46:16 -0700 Subject: [PATCH] Looks like MaxAttempts was defined twice (#168) * Looks like MaxAttempts was defined twice * updated swagger.yml version and re-ran make generate --- docs/overview.md | 2 +- gen-go/server/db/dynamodb/dynamodb.go | 6 ++++++ gen-go/server/db/dynamodb/workflowdefinition.go | 9 ++++++++- gen-js/package.json | 2 +- swagger.yml | 4 +--- 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/docs/overview.md b/docs/overview.md index e17cbbf7..0aaa4568 100644 --- a/docs/overview.md +++ b/docs/overview.md @@ -7,7 +7,7 @@ Orchestrator for AWS Step Functions ### Version information -*Version* : 0.9.4 +*Version* : 0.9.5 ### URI scheme diff --git a/gen-go/server/db/dynamodb/dynamodb.go b/gen-go/server/db/dynamodb/dynamodb.go index 721fd9e0..0b981c1d 100644 --- a/gen-go/server/db/dynamodb/dynamodb.go +++ b/gen-go/server/db/dynamodb/dynamodb.go @@ -3,10 +3,12 @@ package dynamodb import ( "context" "errors" + "time" "github.com/Clever/workflow-manager/gen-go/models" "github.com/Clever/workflow-manager/gen-go/server/db" "github.com/aws/aws-sdk-go/service/dynamodb/dynamodbiface" + "github.com/go-openapi/strfmt" ) // Config is used to create a new DB struct. @@ -99,3 +101,7 @@ func (d DB) GetWorkflowDefinitionsByNameAndVersion(ctx context.Context, input db func (d DB) DeleteWorkflowDefinition(ctx context.Context, name string, version int64) error { return d.workflowDefinitionTable.deleteWorkflowDefinition(ctx, name, version) } + +func toDynamoTimeString(d strfmt.DateTime) string { + return time.Time(d).Format(time.RFC3339) // dynamodb attributevalue only supports RFC3339 resolution +} diff --git a/gen-go/server/db/dynamodb/workflowdefinition.go b/gen-go/server/db/dynamodb/workflowdefinition.go index 8ac46704..99014681 100644 --- a/gen-go/server/db/dynamodb/workflowdefinition.go +++ b/gen-go/server/db/dynamodb/workflowdefinition.go @@ -11,8 +11,11 @@ import ( "github.com/aws/aws-sdk-go/service/dynamodb" "github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute" "github.com/aws/aws-sdk-go/service/dynamodb/dynamodbiface" + "github.com/go-openapi/strfmt" ) +var _ = strfmt.DateTime{} + // WorkflowDefinitionTable represents the user-configurable properties of the WorkflowDefinition table. type WorkflowDefinitionTable struct { DynamoDBAPI dynamodbiface.DynamoDBAPI @@ -153,7 +156,11 @@ func (t WorkflowDefinitionTable) getWorkflowDefinitionsByNameAndVersion(ctx cont queryInput.ExpressionAttributeValues[":version"] = &dynamodb.AttributeValue{ N: aws.String(fmt.Sprintf("%d", *input.VersionStartingAt)), } - queryInput.KeyConditionExpression = aws.String("#NAME = :name AND #VERSION >= :version") + if input.Descending { + queryInput.KeyConditionExpression = aws.String("#NAME = :name AND #VERSION <= :version") + } else { + queryInput.KeyConditionExpression = aws.String("#NAME = :name AND #VERSION >= :version") + } } queryOutput, err := t.DynamoDBAPI.QueryWithContext(ctx, queryInput) diff --git a/gen-js/package.json b/gen-js/package.json index 094d99b0..30002e52 100644 --- a/gen-js/package.json +++ b/gen-js/package.json @@ -1,6 +1,6 @@ { "name": "workflow-manager", - "version": "0.9.4", + "version": "0.9.5", "description": "Orchestrator for AWS Step Functions", "main": "index.js", "dependencies": { diff --git a/swagger.yml b/swagger.yml index 984ff470..de72a903 100644 --- a/swagger.yml +++ b/swagger.yml @@ -4,7 +4,7 @@ info: description: Orchestrator for AWS Step Functions # when changing the version here, make sure to # re-run `make generate` to generate clients and server - version: 0.9.4 + version: 0.9.5 x-npm-package: workflow-manager schemes: - http @@ -794,8 +794,6 @@ definitions: properties: IntervalSeconds: type: integer - MaxAttempts: - type: integer BackoffRate: type: number ErrorEquals: