diff --git a/.circleci/config.yml b/.circleci/config.yml index 7439e85..242d502 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,14 +1,23 @@ version: 2 jobs: - unittest: + unit_test: docker: - image: circleci/golang:1.14 steps: - checkout - run: make test + functional_test: + docker: + - image: checkr/docker-docker-compose + steps: + - checkout + - setup_remote_docker: + version: 18.09.3 + - run: make docker_functional_test workflows: version: 2 test: jobs: - - unittest + - unit_test + - functional_test diff --git a/.dockerignore b/.dockerignore index edbb167..928c211 100644 --- a/.dockerignore +++ b/.dockerignore @@ -17,3 +17,5 @@ vendor/ go.mod go.sum Makefile +docker-compose.yaml +/.circleci diff --git a/Makefile b/Makefile index d1f8455..70c53b7 100644 --- a/Makefile +++ b/Makefile @@ -20,12 +20,23 @@ docker_build: docker_run: docker-compose up --remove-orphans --force-recreate +docker_functional_test: + docker-compose down -v + docker-compose build + docker-compose up --no-start + for f in ./mocks/openmock_templates/*.yaml; do docker cp $$f dsrhub_openmock:/data/templates/; done + for f in ./sql/schema.sql; do docker cp $$f dsrhub_db:/docker-entrypoint-initdb.d/; done + for f in ./templates/*.yaml; do docker cp $$f dsrhub_utask:/app/templates/; done + for f in ./functional_test/*.yaml; do docker cp $$f dsrhub_functional_test:/var/local/; done + docker-compose up -d + docker-compose exec -w /var/local functional_test venom run --log info '*' + gen_proto: docker run --rm \ -v $(PWD)/idl_dsrhub:/defs \ -v $(PWD)/idl_dsrhub:/go/src/github.com/dsrhub/dsrhub/idl_dsrhub \ -v $(PWD)/idl_dsrhub/dsrhub.swagger.json:/go/src/dsrhub.swagger.json \ - namely/protoc-all:1.29_2 -i . -d . -l go -o /go/src --with-gateway --with-swagger-json-names + namely/protoc-all:1.29_2 -i . -d . -l go -o /go/src --with-gateway _install_cmd_golangci_lint: ifndef CMD_GOLANGCILINT diff --git a/docker-compose.yaml b/docker-compose.yaml index 4f59ec1..d3ae9d1 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,7 +1,8 @@ -version: "3.8" +version: "2.4" services: utask: build: . + container_name: dsrhub_utask restart: on-failure command: ["/wait-for-it.sh", "db:5432", "--", "/app/utask"] environment: @@ -15,11 +16,13 @@ services: ports: - "8081:8081" volumes: - - "./templates:/app/templates:ro" + - "./templates:/app/templates" depends_on: - db + db: image: postgres:9.5.3 + container_name: dsrhub_db restart: on-failure environment: POSTGRES_USER: user @@ -27,8 +30,10 @@ services: POSTGRES_DB: utask volumes: - "./sql:/docker-entrypoint-initdb.d" + openmock: build: ./mocks + container_name: dsrhub_openmock restart: on-failure environment: OPENMOCK_TEMPLATES_DIR: '/data/templates' @@ -39,3 +44,9 @@ services: ports: - "9999:9999" - "50051:50051" + + functional_test: + image: zhouzhuojie/docker-venom + container_name: dsrhub_functional_test + entrypoint: '' + command: sh -c "tail -F /dev/null" diff --git a/functional_test/dsrhub_openmock.yaml b/functional_test/dsrhub_openmock.yaml new file mode 100644 index 0000000..cc74df2 --- /dev/null +++ b/functional_test/dsrhub_openmock.yaml @@ -0,0 +1,23 @@ +name: TestSuite of dsrhub's openmock +testcases: +- name: Make sure openmock is ready to serve POST /:service/dsrhub/exchange_identity + steps: + - type: http + method: POST + url: http://openmock:9999/test_email_service/dsrhub/exchange_identity + retry: 20 + delay: 5 + assertions: + - result.statuscode ShouldEqual 200 + - result.body ShouldContainSubstring email + +- name: Make sure openmock is ready to serve POST /:service_name/dsrhub/create_dsr_request + steps: + - type: http + method: POST + url: http://openmock:9999/test_email_service/dsrhub/create_dsr_request + retry: 20 + delay: 5 + assertions: + - result.statuscode ShouldEqual 200 + - result.body ShouldContainSubstring email diff --git a/functional_test/dsrhub_utask.yaml b/functional_test/dsrhub_utask.yaml new file mode 100644 index 0000000..fb3af5d --- /dev/null +++ b/functional_test/dsrhub_utask.yaml @@ -0,0 +1,46 @@ +name: TestSuite of dsrhub's utask +testcases: +- name: getUnsecuredStats + steps: + - type: http + method: GET + url: http://utask:8081/unsecured/stats + retry: 20 + delay: 5 + headers: + accept: application/json + assertions: + - result.statuscode ShouldEqual 200 + +- name: createTask + steps: + - type: http + method: POST + url: http://utask:8081/task + retry: 10 + delay: 5 + headers: + Content-Type: application/json + Authorization: Basic YWRtaW46MTIzNA== # admin:1234 + body: > + { + "template_name": "example-complex-dsrhub-workflow", + "input": {"email":"zzzz@example.com"} + } + assertions: + - result.statuscode ShouldEqual 201 + - result.bodyjson.state ShouldEqual TODO + +- name: getTaskState + steps: + - type: http + method: GET + url: http://utask:8081/task/{{.createTask.result.bodyjson.id}} + retry: 60 + delay: 2 + headers: + Content-Type: application/json + Authorization: Basic YWRtaW46MTIzNA== # admin:1234 + assertions: + - result.statuscode ShouldEqual 200 + - result.bodyjson.state ShouldEqual DONE diff --git a/idl_dsrhub/dsrhub.pb.go b/idl_dsrhub/dsrhub.pb.go index da5527b..77d5458 100644 --- a/idl_dsrhub/dsrhub.pb.go +++ b/idl_dsrhub/dsrhub.pb.go @@ -328,43 +328,44 @@ func init() { func init() { proto.RegisterFile("dsrhub.proto", fileDescriptor_872837866b3f167b) } var fileDescriptor_872837866b3f167b = []byte{ - // 575 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x94, 0x41, 0x6f, 0xd3, 0x30, - 0x14, 0xc7, 0xe5, 0x0c, 0x0a, 0x7b, 0x5a, 0x47, 0x67, 0x40, 0x84, 0x6a, 0x8c, 0x2a, 0x5d, 0x05, - 0xaa, 0xb6, 0x06, 0x95, 0x0b, 0xea, 0xad, 0x6c, 0x03, 0xca, 0x09, 0xb5, 0xc0, 0x81, 0x4b, 0xe4, - 0x24, 0x26, 0xcd, 0xf0, 0xe2, 0x60, 0x3b, 0x83, 0x5e, 0x99, 0xc4, 0x81, 0x0b, 0x52, 0xf9, 0x0c, - 0x7c, 0xa1, 0xc2, 0x47, 0xe0, 0x83, 0xa0, 0x3a, 0x49, 0xd7, 0x35, 0x2b, 0xec, 0x86, 0xc4, 0xc9, - 0xd1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xdc, 0xb5, 0xaa, 0x76, 0x8a, - 0xd8, 0x9e, 0x46, 0x1c, 0x5f, 0x8a, 0x7c, 0xe4, 0x3a, 0xa8, 0x89, 0x4f, 0x10, 0x54, 0x16, 0x8b, - 0x82, 0xeb, 0xf3, 0x47, 0x2f, 0x69, 0x6d, 0x75, 0xfb, 0xcf, 0x50, 0x66, 0x63, 0x5b, 0xdb, 0xd8, - 0xb2, 0x6e, 0xe7, 0x36, 0x68, 0x46, 0x3a, 0x79, 0x29, 0x3a, 0xa8, 0xf9, 0xf8, 0x0b, 0x7a, 0x53, - 0x0f, 0x42, 0x35, 0x3d, 0xc9, 0xe3, 0x47, 0x39, 0x9a, 0x2d, 0xa1, 0xcf, 0x9c, 0xf4, 0x73, 0xdc, - 0x75, 0xf1, 0x23, 0x80, 0xb4, 0x64, 0xb5, 0xee, 0x8b, 0x9e, 0x65, 0xe1, 0xda, 0x50, 0xa9, 0x58, - 0x76, 0x6c, 0x7b, 0xd9, 0xfe, 0x76, 0x89, 0x11, 0x45, 0xa5, 0x6a, 0x1a, 0xc8, 0x68, 0x57, 0x48, - 0x1c, 0xb3, 0xd0, 0xd3, 0x7f, 0xb6, 0x7d, 0x28, 0x79, 0xd4, 0x29, 0x28, 0x6e, 0x49, 0xbf, 0xd9, - 0x0f, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0xce, 0xe7, 0xbb, 0x1d, 0x1b, 0x06, 0x00, 0x00, + // 577 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x94, 0x4d, 0x6f, 0xd3, 0x30, + 0x18, 0xc7, 0xe5, 0x0c, 0x0a, 0x7b, 0xb4, 0x8e, 0xd6, 0x43, 0x10, 0xaa, 0x31, 0xaa, 0x74, 0x15, + 0xa8, 0xda, 0x1a, 0x54, 0x2e, 0xa8, 0xb7, 0xb2, 0x81, 0x28, 0x42, 0x02, 0xb5, 0xc0, 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, 0xbf, 0xf7, 0x30, 0x71, 0xfb, 0x54, 0x9c, 0x84, + 0x1e, 0xc5, 0x1c, 0xd6, 0xa7, 0x2b, 0x8a, 0xb7, 0x9b, 0xa7, 0x8f, 0x52, 0x73, 0xfe, 0x11, 0xa9, + 0x5c, 0x5f, 0x11, 0x4d, 0x0b, 0xb2, 0xea, 0xef, 0xbf, 0xff, 0xfc, 0x6a, 0xdc, 0xb0, 0x2a, 0x76, + 0x8a, 0xd8, 0x9e, 0x46, 0x1c, 0x5f, 0x8a, 0x7c, 0xe7, 0xda, 0xa8, 0x81, 0x3f, 0x20, 0x28, 0xcd, + 0x37, 0x05, 0xd7, 0x66, 0xaf, 0x5e, 0x31, 0xdb, 0xca, 0xee, 0x9f, 0xa1, 0xcc, 0xc6, 0xae, 0xb6, + 0xb1, 0x63, 0x5d, 0xcb, 0x6d, 0xd0, 0x8c, 0x74, 0xf2, 0x56, 0xb4, 0x51, 0xe3, 0xde, 0x67, 0xf4, + 0xb2, 0x16, 0x84, 0x6a, 0x72, 0x93, 0xc7, 0x8f, 0x73, 0x34, 0xfb, 0x84, 0x3e, 0x73, 0xd2, 0x9f, + 0xa3, 0x8e, 0x8b, 0xef, 0x02, 0xa4, 0x2d, 0xab, 0x76, 0x9e, 0x76, 0x2d, 0x0b, 0x57, 0x07, 0x4a, + 0xc5, 0xb2, 0x6d, 0xdb, 0xab, 0xce, 0xb7, 0x0a, 0x8c, 0x28, 0x2a, 0x55, 0xc3, 0x40, 0x46, 0xab, + 0x44, 0xe2, 0x98, 0x85, 0x9e, 0xfe, 0x6b, 0xdb, 0x47, 0x92, 0x47, 0xed, 0x05, 0xc5, 0x2d, 0xe8, + 0x97, 0xfb, 0xce, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xda, 0xa1, 0x88, 0x52, 0x21, 0x06, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/idl_dsrhub/dsrhub.proto b/idl_dsrhub/dsrhub.proto index c360396..3b0d966 100644 --- a/idl_dsrhub/dsrhub.proto +++ b/idl_dsrhub/dsrhub.proto @@ -23,7 +23,7 @@ option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = { message CreateDSRRequest { option (grpc.gateway.protoc_gen_swagger.options.openapiv2_schema) = { json_schema: { - required: ["regulation", "subjectRequestId", "subjectRequestType", "identityValue"] + required: ["regulation", "subject_request_id", "subject_request_type", "identity_value"] } }; @@ -50,7 +50,7 @@ message CreateDSRResponse { message ExchangeIdentityRequest { option (grpc.gateway.protoc_gen_swagger.options.openapiv2_schema) = { json_schema: { - required: ["identityValue"] + required: ["identity_value"] } }; diff --git a/idl_dsrhub/dsrhub.swagger.json b/idl_dsrhub/dsrhub.swagger.json index 4c46da3..6a3dbcb 100644 --- a/idl_dsrhub/dsrhub.swagger.json +++ b/idl_dsrhub/dsrhub.swagger.json @@ -90,30 +90,30 @@ "regulation": { "type": "string" }, - "statusCallbackUrl": { + "status_callback_url": { "type": "string" }, - "subjectRequestId": { + "subject_request_id": { "type": "string" }, - "subjectRequestType": { + "subject_request_type": { "type": "string" }, - "identityType": { + "identity_type": { "type": "string" }, - "identityFormat": { + "identity_format": { "type": "string" }, - "identityValue": { + "identity_value": { "type": "string" } }, "required": [ "regulation", - "subjectRequestId", - "subjectRequestType", - "identityValue" + "subject_request_id", + "subject_request_type", + "identity_value" ] }, "dsrhubCreateDSRResponse": { @@ -122,25 +122,25 @@ "regulation": { "type": "string" }, - "requestStatus": { + "request_status": { "type": "string" }, - "subjectRequestId": { + "subject_request_id": { "type": "string" }, - "subjectRequestType": { + "subject_request_type": { "type": "string" }, - "identityType": { + "identity_type": { "type": "string" }, - "identityFormat": { + "identity_format": { "type": "string" }, - "identityValue": { + "identity_value": { "type": "string" }, - "controllerId": { + "controller_id": { "type": "string" } } @@ -148,30 +148,30 @@ "dsrhubExchangeIdentityRequest": { "type": "object", "properties": { - "identityType": { + "identity_type": { "type": "string" }, - "identityFormat": { + "identity_format": { "type": "string" }, - "identityValue": { + "identity_value": { "type": "string" } }, "required": [ - "identityValue" + "identity_value" ] }, "dsrhubExchangeIdentityResponse": { "type": "object", "properties": { - "identityType": { + "identity_type": { "type": "string" }, - "identityFormat": { + "identity_format": { "type": "string" }, - "identityValue": { + "identity_value": { "type": "string" } } @@ -179,7 +179,7 @@ "protobufAny": { "type": "object", "properties": { - "typeUrl": { + "type_url": { "type": "string", "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." }, diff --git a/init/dsrhub_callback/main.go b/init/dsrhub_callback/main.go index 422ba20..c0878b4 100644 --- a/init/dsrhub_callback/main.go +++ b/init/dsrhub_callback/main.go @@ -37,8 +37,7 @@ type inCallback struct { ResolutionID string `path:"resolution_id" validate:"required"` StepName string `path:"step_name" validate:"required"` - // opendsr related fields - APIVersion string `json:"api_version"` + // dsrhub related fields Regulation string `json:"regulation" validate:"required"` ControllerID string `json:"controller_id" validate:"required"` RequestStatus string `json:"request_status" validate:"required"` diff --git a/mocks/go.mod b/mocks/go.mod index 37c4174..bbec1f0 100644 --- a/mocks/go.mod +++ b/mocks/go.mod @@ -3,8 +3,8 @@ module github.com/dsrhub/dsrhub/mocks go 1.14 require ( - github.com/checkr/openmock v0.3.1 - github.com/dsrhub/dsrhub v0.0.3 + github.com/checkr/openmock v0.3.2 + github.com/dsrhub/dsrhub v0.0.4 github.com/go-openapi/loads v0.19.5 github.com/golang/protobuf v1.4.2 github.com/jessevdk/go-flags v1.4.0 diff --git a/mocks/go.sum b/mocks/go.sum index c92ab7d..466815d 100644 --- a/mocks/go.sum +++ b/mocks/go.sum @@ -1,4 +1,5 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= github.com/Masterminds/semver v1.4.2 h1:WBLTQ37jOCzSLtXNdoo8bNM8876KhNqOKvrlGITgsTc= @@ -36,6 +37,7 @@ github.com/antchfx/xmlquery v0.0.0-20180726134140-2805f22c26c4 h1:ntzM+2QnQcuvKL github.com/antchfx/xmlquery v0.0.0-20180726134140-2805f22c26c4/go.mod h1:/+CnyD/DzHRnv2eRxrVbieRU/FIF6N0C+7oTtyUtCKk= github.com/antchfx/xpath v0.0.0-20180524052354-077bca4d2caa h1:UgmswLpr8R1msC4cA74MD6zt66QSQckaD5ph7XFyOfY= github.com/antchfx/xpath v0.0.0-20180524052354-077bca4d2caa/go.mod h1:Yee4kTMuNiPYJ7nSNorELQMr1J33uOpXDMByNYhvtNk= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/aokoli/goutils v1.0.1 h1:7fpzNGoJ3VA8qcrm++XEE1QUe0mIwNeLa02Nwq7RDkg= github.com/aokoli/goutils v1.0.1/go.mod h1:SijmP0QR8LtwsmDs8Yii5Z/S4trXFGFC2oO5g9DP+DQ= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= @@ -53,8 +55,8 @@ github.com/caarlos0/env v3.3.0+incompatible/go.mod h1:tdCsowwCzMLdkqRYDlHpZCp2Uo github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/checkr/openmock v0.3.1 h1:8UhDY/F6MpXXhRG4BwBvzd03PoY9i4WlYiRNf0nWqsI= -github.com/checkr/openmock v0.3.1/go.mod h1:SwtoCO+1c504mMZGlQLSEnayyML92lgFFVJSEobILeI= +github.com/checkr/openmock v0.3.2 h1:INXTLPgQ36CQs+sHD9lMFvpD5rkQG2YY9h3RR9340EQ= +github.com/checkr/openmock v0.3.2/go.mod h1:hH6vASAHIGi6UgiU8B2iIqDEzp1vqmcasimCF2IJxmM= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= @@ -74,8 +76,8 @@ github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8 github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/dsrhub/dsrhub v0.0.3 h1:lWBnMDBPZ5R5ntgDKaLViF0KN3n1SKjJVGD+L3knrz8= -github.com/dsrhub/dsrhub v0.0.3/go.mod h1:baThsa2cvn6xHI0BRGMppU4JpzA5tJk28yf4JB7Pmsg= +github.com/dsrhub/dsrhub v0.0.4 h1:TJBkUbiUTqEPDusxcv2SMOASZIoni6SuIyMiHDmPmtw= +github.com/dsrhub/dsrhub v0.0.4/go.mod h1:5z/TMxnohVer6ePmQHlEmIBejEBUxnJUt966Pol9bT8= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 h1:YEetp8/yCZMuEPMUDHG0CW/brkkEp8mzqk2+ODEitlw= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= @@ -252,15 +254,18 @@ github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoA github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.14.6 h1:8ERzHx8aj1Sc47mu9n/AksaKCSWrMchFtkdrS4BIj5o= +github.com/grpc-ecosystem/grpc-gateway v1.14.6/go.mod h1:zdiPV4Yse/1gnckTHtghG4GkDEdKCRJduHpTxT3/jcw= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huandu/xstrings v1.0.0/go.mod h1:4qWG/gcEcfX4z/mBDHJ++3ReCw9ibxbsNJbcucJdbSo= github.com/huandu/xstrings v1.3.1 h1:4jgBlKK6tLKFvO8u5pmYjG91cqytmDCDvGh7ECVFfFs= github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= -github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.8 h1:CGgOkSJeqMRmt0D9XLWExdT4m4F1vd3FV3VPt+0VxkQ= github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/imdario/mergo v0.3.9 h1:UauaLniWCFHWd+Jp9oCEkTBj8VO/9DKg3PV3VCNMDIg= +github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jinzhu/now v1.0.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= @@ -395,6 +400,7 @@ github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a h1:9ZKAASQSHhD github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/robertkrimen/otto v0.0.0-20191219234010-c382bd3c16ff/go.mod h1:xvqspoSXJTIpemEonrMDFq6XzwHYYgToXWj5eRX1OtY= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4/go.mod h1:qgYeAmZ5ZIpBWTGllZSQnw97Dj+woV0toclVaRGI8pc= github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= @@ -441,8 +447,14 @@ github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/teamwork/reload v1.3.0 h1:ElBaBhtRwVRxsPRGK1wYugr2knciOXFMZT5ltPpEwAI= github.com/teamwork/reload v1.3.0/go.mod h1:kHdVPdfdmA+ygkBbigWUeerpy6EK4Kcukx1TNyePXHA= +github.com/tidwall/gjson v1.6.0 h1:9VEQWz6LLMUsUl6PueE49ir4Ka6CzLymOAZDxpFsTDc= +github.com/tidwall/gjson v1.6.0/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls= +github.com/tidwall/match v1.0.1 h1:PnKP62LPNxHKTwvHHZZzdOAOCtsJTjo6dZLCwpKm5xc= +github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E= github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= +github.com/tidwall/pretty v1.0.1 h1:WE4RBSZ1x6McVVC8S/Md+Qse8YUv6HRObAx6ke00NY8= +github.com/tidwall/pretty v1.0.1/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/ugorji/go v1.1.2/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= @@ -496,6 +508,7 @@ golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190320064053-1272bf9dcd53/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -506,9 +519,11 @@ golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190921015927-1a5e07d1ff72/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b h1:0mm1VjtFUOIlE1SbDlwjYaDxZVDP2S5ou6y0gSgXHu8= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -573,6 +588,8 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63 h1:YzfoEYWbODU5Fbt37+h7X16BWQbad7Q4S6gclTKFXM8= google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884 h1:fiNLklpBwWK1mth30Hlwk+fcdBmIALlgF5iy77O37Ig= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= @@ -580,6 +597,8 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.28.1 h1:C1QC6KzgSiLyBabDi87BbjaGreoRgGUF5nOyvfrAZ1k= google.golang.org/grpc v1.28.1/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1 h1:EC2SB8S04d2r73uptxphDSUG+kTKVgjRPF+N3xpxRB4= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -612,6 +631,7 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWD gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= diff --git a/mocks/main.go b/mocks/main.go index 7701a4a..00d3e05 100644 --- a/mocks/main.go +++ b/mocks/main.go @@ -50,7 +50,7 @@ func main() { om := &openmock.OpenMock{} om.ParseEnv() om.GRPCServiceMap = map[string]openmock.GRPCService{ - "idl.dsrhub.OpenDSRService": { + "idl.dsrhub.DSRHubService": { "CreateDSR": openmock.GRPCRequestResponsePair{ Request: proto.MessageV2(&idl_dsrhub.CreateDSRRequest{}), Response: proto.MessageV2(&idl_dsrhub.CreateDSRResponse{}), diff --git a/mocks/openmock_templates/grpc.yaml b/mocks/openmock_templates/grpc.yaml index 3aabd78..badebdd 100644 --- a/mocks/openmock_templates/grpc.yaml +++ b/mocks/openmock_templates/grpc.yaml @@ -1,15 +1,14 @@ -- key: opendsr_grpc +- key: dsrhub_grpc expect: grpc: - service: idl.dsrhub.OpenDSRService + service: idl.dsrhub.DSRHubService method: CreateDSR actions: - reply_grpc: payload: > { - "api_version": "2.0", "regulation": "gdpr", - "controller_id": "opendsr_grpc_mock", + "controller_id": "dsrhub_grpc_mock", "request_status": "completed", "subject_request_id": "{{.GRPCPayload | jsonPath `subject_request_id`}}", "subject_request_type": "erasure", diff --git a/mocks/openmock_templates/swagger.yaml b/mocks/openmock_templates/swagger.yaml index 441824f..38aa323 100644 --- a/mocks/openmock_templates/swagger.yaml +++ b/mocks/openmock_templates/swagger.yaml @@ -3,7 +3,7 @@ expect: http: method: POST - path: /:service_name/opendsr/identity_resolution + path: /:service_name/dsrhub/exchange_identity condition: '{{.HTTPPath | contains `email`}}' actions: - reply_http: @@ -20,7 +20,7 @@ expect: http: method: POST - path: /:service_name/opendsr/identity_resolution + path: /:service_name/dsrhub/exchange_identity condition: '{{.HTTPPath | contains `candidate`}}' actions: - reply_http: @@ -37,7 +37,7 @@ expect: http: method: POST - path: /:service_name/opendsr/identity_resolution + path: /:service_name/dsrhub/exchange_identity condition: '{{.HTTPPath | contains `provider`}}' actions: - reply_http: @@ -54,13 +54,12 @@ expect: http: method: POST - path: /:service_name/opendsr/requests + path: /:service_name/dsrhub/create_dsr_request actions: - reply_http: status_code: 200 body: >- { - "api_version": "2.0", "regulation": "gdpr", "controller_id": "{{ .HTTPPath }}", "request_status": "completed", @@ -78,7 +77,6 @@ method: POST body: >- { - "api_version": "2.0", "regulation": "gdpr", "controller_id": "{{ .HTTPPath }}", "request_status": "completed", diff --git a/templates/opendsr-request.yaml b/templates/dsrhub_http_create_dsr_request.yaml similarity index 80% rename from templates/opendsr-request.yaml rename to templates/dsrhub_http_create_dsr_request.yaml index d5860e7..90c5563 100644 --- a/templates/opendsr-request.yaml +++ b/templates/dsrhub_http_create_dsr_request.yaml @@ -1,6 +1,6 @@ -name: opendsr-request -title_format: 'opendsr-request {{.input.url}}' -description: opendsr request +name: dsrhub_http_create_dsr_request +title_format: 'dsrhub_http_create_dsr_requestd {{.input.url}}' +description: dsrhub http request (sync and async) auto_runnable: true result_format: controller_id: >- @@ -15,21 +15,21 @@ result_format: input: '{{.input | toJson}}' inputs: -# remote opendsr request +# remote dsrhub request - name: url - description: request url - default: 'http://openmock:9999/service-candidate-id/opendsr/requests' + description: dsrhub create_dsr_request url + default: 'http://openmock:9999/service-candidate-id/dsrhub/create_dsr_request' - name: callback_url_base description: callback url base default: 'http://utask:8081/dsrhub/callback' - name: request_type - description: opendsr request type + description: dsrhub request type default: erasure legal_values: - erasure - portability - name: regulation - description: opendsr regulation + description: dsrhub regulation default: gdpr legal_values: - gdpr @@ -51,7 +51,7 @@ inputs: steps: request: - description: Send opendsr request + description: Send dsrhub request action: type: http configuration: @@ -59,7 +59,6 @@ steps: method: POST body: > { - "api_version": "2.0", "subject_request_id": "{{.task.resolution_id}}", "subject_request_type": "{{.input.request_type}}", "identity_type": "{{.input.identity_type}}", @@ -69,7 +68,7 @@ steps: } callback: - description: Wait for remote opendsr callback + description: Wait for remote dsrhub callback dependencies: ["request"] action: type: echo @@ -92,10 +91,10 @@ steps: expected: 'completed' then: this: TO_RETRY - message: 'service is waiting for callback from remote opendsr service' + message: 'service is waiting for callback from remote dsrhub service' done: - description: notify dsrhub that the opendsr request is done + description: notify dsrhub that the dsrhub request is done dependencies: ["callback"] action: type: echo diff --git a/templates/opendsr-identity-resolution.yaml b/templates/dsrhub_http_exchange_identity.yaml similarity index 58% rename from templates/opendsr-identity-resolution.yaml rename to templates/dsrhub_http_exchange_identity.yaml index 9a5a69f..2e33c41 100644 --- a/templates/opendsr-identity-resolution.yaml +++ b/templates/dsrhub_http_exchange_identity.yaml @@ -1,16 +1,16 @@ -name: opendsr-identity-resolution -title_format: 'opendsr-identity-resolution {{.input.url}}' -description: opendsr identity resolution +name: dsrhub_http_exchange_identity +title_format: 'dsrhub_http_exchange_identity {{.input.url}}' +description: dsrhub exchange identity auto_runnable: true result_format: - identity_type: '{{.step.identity_resolution.output.identity_type}}' - identity_format: '{{.step.identity_resolution.output.identity_format}}' - identity_value: '{{.step.identity_resolution.output.identity_value}}' + identity_type: '{{.step.exchange_identity.output.identity_type}}' + identity_format: '{{.step.exchange_identity.output.identity_format}}' + identity_value: '{{.step.exchange_identity.output.identity_value}}' inputs: - name: url - description: request url - default: 'http://openmock:9999/service-candidate-id/opendsr/identity_resolution' + description: http exchange_identity url + default: 'http://openmock:9999/service-candidate-id/dsrhub/exchange_identity' - name: identity_type description: identity type default: email @@ -22,7 +22,7 @@ inputs: default: zzzz@example.com steps: - identity_resolution: + exchange_identity: description: Map incoming identity to the service's supported identity type action: type: http diff --git a/templates/example-complex-dsrhub-workflow.yaml b/templates/example-complex-dsrhub-workflow.yaml index fb1c7d2..1af6104 100644 --- a/templates/example-complex-dsrhub-workflow.yaml +++ b/templates/example-complex-dsrhub-workflow.yaml @@ -24,143 +24,142 @@ steps: configuration: url: 'openmock:50051' request: - api_version: '2.0' regulation: 'gdpr' subject_request_id: '{{.task.resolution_id}}' subject_request_type: 'email' identity_value: '{{.input.email}}' email_service_a: - description: send opendsr request + description: send dsrhub request dependencies: - start action: type: subtask configuration: - template: opendsr-request + template: dsrhub_http_create_dsr_request input: - url: 'http://openmock:9999/email-service-a/opendsr/requests' + url: 'http://openmock:9999/email-service-a/dsrhub/create_dsr_request' identity_type: email identity_value: '{{.input.email}}' email_service_b: - description: send opendsr request + description: send dsrhub request dependencies: - start action: type: subtask configuration: - template: opendsr-request + template: dsrhub_http_create_dsr_request input: - url: 'http://openmock:9999/email-service-b/opendsr/requests' + url: 'http://openmock:9999/email-service-b/dsrhub/create_dsr_request' identity_type: email identity_value: '{{.input.email}}' email_service_c: - description: send opendsr request + description: send dsrhub request dependencies: - start action: type: subtask configuration: - template: opendsr-request + template: dsrhub_http_create_dsr_request input: - url: 'http://openmock:9999/email-service-c/opendsr/requests' + url: 'http://openmock:9999/email-service-c/dsrhub/create_dsr_request' identity_type: email identity_value: '{{.input.email}}' - identity_resolution_candidate_id: - description: send opendsr identity resolution + exchange_identity_candidate_id: + description: send dsrhub exhange identity dependencies: - start action: type: subtask configuration: - template: opendsr-identity-resolution + template: dsrhub_http_exchange_identity input: - url: 'http://openmock:9999/candidate-service-a/opendsr/identity_resolution' + url: 'http://openmock:9999/candidate-service-a/dsrhub/exchange_identity' identity_type: email identity_value: '{{.input.email}}' candidate_service_a: dependencies: - - identity_resolution_candidate_id - description: send opendsr request + - exchange_identity_candidate_id + description: send dsrhub request action: type: subtask configuration: - template: opendsr-request + template: dsrhub_http_create_dsr_request input: - url: 'http://openmock:9999/candidate-service-a/opendsr/requests' - identity_type: '{{.step.identity_resolution_candidate_id.output.result.identity_type}}' - identity_value: '{{.step.identity_resolution_candidate_id.output.result.identity_value}}' + url: 'http://openmock:9999/candidate-service-a/dsrhub/create_dsr_request' + identity_type: '{{.step.exchange_identity_candidate_id.output.result.identity_type}}' + identity_value: '{{.step.exchange_identity_candidate_id.output.result.identity_value}}' candidate_service_b: dependencies: - - identity_resolution_candidate_id - description: send opendsr request + - exchange_identity_candidate_id + description: send dsrhub request action: type: subtask configuration: - template: opendsr-request + template: dsrhub_http_create_dsr_request input: - url: 'http://openmock:9999/candidate-service-b/opendsr/requests' - identity_type: '{{.step.identity_resolution_candidate_id.output.result.identity_type}}' - identity_value: '{{.step.identity_resolution_candidate_id.output.result.identity_value}}' + url: 'http://openmock:9999/candidate-service-b/dsrhub/create_dsr_request' + identity_type: '{{.step.exchange_identity_candidate_id.output.result.identity_type}}' + identity_value: '{{.step.exchange_identity_candidate_id.output.result.identity_value}}' candidate_service_c: dependencies: - - identity_resolution_candidate_id - description: send opendsr request + - exchange_identity_candidate_id + description: send dsrhub request action: type: subtask configuration: - template: opendsr-request + template: dsrhub_http_create_dsr_request input: - url: 'http://openmock:9999/candidate-service-c/opendsr/requests' - identity_type: '{{.step.identity_resolution_candidate_id.output.result.identity_type}}' - identity_value: '{{.step.identity_resolution_candidate_id.output.result.identity_value}}' + url: 'http://openmock:9999/candidate-service-c/dsrhub/create_dsr_request' + identity_type: '{{.step.exchange_identity_candidate_id.output.result.identity_type}}' + identity_value: '{{.step.exchange_identity_candidate_id.output.result.identity_value}}' candidate_service_d: dependencies: - - identity_resolution_candidate_id - description: send opendsr request + - exchange_identity_candidate_id + description: send dsrhub request action: type: subtask configuration: - template: opendsr-request + template: dsrhub_http_create_dsr_request input: - url: 'http://openmock:9999/candidate-service-d/opendsr/requests' - identity_type: '{{.step.identity_resolution_candidate_id.output.result.identity_type}}' - identity_value: '{{.step.identity_resolution_candidate_id.output.result.identity_value}}' - identity_resolution_provider_request_id: - description: send opendsr identity resolution + url: 'http://openmock:9999/candidate-service-d/dsrhub/create_dsr_request' + identity_type: '{{.step.exchange_identity_candidate_id.output.result.identity_type}}' + identity_value: '{{.step.exchange_identity_candidate_id.output.result.identity_value}}' + exchange_identity_provider_request_id: + description: send dsrhub exchange identity dependencies: - start action: type: subtask configuration: - template: opendsr-identity-resolution + template: dsrhub_http_exchange_identity input: - url: 'http://openmock:9999/provider-service-a/opendsr/identity_resolution' + url: 'http://openmock:9999/provider-service-a/dsrhub/exchange_identity' identity_type: email identity_value: '{{.input.email}}' provider_service_a: dependencies: - - identity_resolution_provider_request_id - description: send opendsr request + - exchange_identity_provider_request_id + description: send dsrhub request action: type: subtask configuration: - template: opendsr-request + template: dsrhub_http_create_dsr_request input: - url: 'http://openmock:9999/provider-service-a/opendsr/requests' - identity_type: '{{.step.identity_resolution_provider_request_id.output.result.identity_type}}' - identity_value: '{{.step.identity_resolution_provider_request_id.output.result.identity_value}}' + url: 'http://openmock:9999/provider-service-a/dsrhub/create_dsr_request' + identity_type: '{{.step.exchange_identity_provider_request_id.output.result.identity_type}}' + identity_value: '{{.step.exchange_identity_provider_request_id.output.result.identity_value}}' callback_enabled: false provider_service_b: dependencies: - - identity_resolution_provider_request_id - description: send opendsr request + - exchange_identity_provider_request_id + description: send dsrhub request action: type: subtask configuration: - template: opendsr-request + template: dsrhub_http_create_dsr_request input: - url: 'http://openmock:9999/provider-service-b/opendsr/requests' - identity_type: '{{.step.identity_resolution_provider_request_id.output.result.identity_type}}' - identity_value: '{{.step.identity_resolution_provider_request_id.output.result.identity_value}}' + url: 'http://openmock:9999/provider-service-b/dsrhub/create_dsr_request' + identity_type: '{{.step.exchange_identity_provider_request_id.output.result.identity_type}}' + identity_value: '{{.step.exchange_identity_provider_request_id.output.result.identity_value}}' diff --git a/templates/example-grpc-dsrhub-workflow.yaml b/templates/example-grpc-dsrhub-workflow.yaml index cfdb1f9..a4c71bc 100644 --- a/templates/example-grpc-dsrhub-workflow.yaml +++ b/templates/example-grpc-dsrhub-workflow.yaml @@ -24,7 +24,6 @@ steps: configuration: url: 'openmock:50051' request: - api_version: '2.0' regulation: 'gdpr' subject_request_id: '{{.task.resolution_id}}' subject_request_type: 'email'