Skip to content

3scale application apply/create: cannot create an application if another app with the same user_key / app_id exists for another service #183

Description

@nmasse-itix

Current behavior

Create a service svc1, a plan and an app:

$ 3scale import openapi -d 3scale-saas -t svc1 https://raw.githubusercontent.com/rh-integration/3scale-toolbox-jenkins-samples/master/saas-usecase-apikey/swagger.yaml
Created service id: 2555417814790, name: Beer Catalog API
Service proxy updated
destroying all mapping rules
Created GET /api/beer/{name}$ endpoint
Created GET /api/beer/findByStatus/{status}$ endpoint
Created GET /api/beer$ endpoint

$ 3scale application-plan apply 3scale-saas svc1 test --name=test 
Applied application plan id: 2357356101963; Default: false

$ 3scale application apply 3scale-saas my-super-secret-key --account=nmasse+test@redhat.com --name="Test Application" --plan=test --service=svc1
Applied application id: 1409618476816

Create a service svc2, a plan and an app:

$ 3scale import openapi -d 3scale-saas -t svc2 https://raw.githubusercontent.com/rh-integration/3scale-toolbox-jenkins-samples/master/saas-usecase-apikey/swagger.yaml
Created service id: 2555417814794, name: Beer Catalog API
destroying all mapping rules
Created GET /api/beer/{name}$ endpoint
Created GET /api/beer/findByStatus/{status}$ endpoint
Created GET /api/beer$ endpoint
Service proxy updated

$ 3scale application-plan apply 3scale-saas svc2 test --name=test 
Applied application plan id: 2357356101966; Default: false

$ 3scale application apply 3scale-saas my-super-secret-key --account=nmasse+test@redhat.com --name="Test Application" --plan=test --service=svc2
Applied application id: 1409618476816

As you can see, the last call to application-plan apply update the application of svc1 instead of creating a new application for svc2.

Expected behavior

The last call to application-plan apply creates a new application for svc2:

$ 3scale application apply 3scale-saas my-super-secret-key --account=nmasse+test@redhat.com --name="Test Application" --plan=test --service=svc2
Applied application id: 123456

(When calling /admin/api/applications/find.json, specify the service_id to restrict the search to one specific service.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions