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

Redesign of import command #22

Closed
MarkCheshire opened this issue May 20, 2016 · 3 comments
Closed

Redesign of import command #22

MarkCheshire opened this issue May 20, 2016 · 3 comments

Comments

@MarkCheshire
Copy link

MarkCheshire commented May 20, 2016

After extensive brainstorming we determined that a lower level command is more useful and simpler in 80-90% of the use cases.

3scale import-(methods|metrics)
--destination https://<provide_key>@<admin_domain>-admin.3scale.net
--file <path_to_CSV>
--service (service-id|service-name)
[--force-delete] without this flag metric deletions will be prompted for confirmation

Example CSV file (commas not shown):

url_path http_method [system-name] [friendly-name]
/movies/biography GET movies_biography Movies (Biography)
/movies/drama GET movies_drama Movies (Drama)

http_method <GET | POST | PUT | DELETE | PATCH> in future add support for wildcard "*" and combos with "+"
[system-name] default will be to use url_path
[friendly-name] default will be to use url_path

Desired behavior if data already exists in the destination service in the 3scale account:

  • Metrics/methods:
    • New metrics/methods: always append
    • Update existing metric: ignore but notify as "Duplicate metric <system_name>, original metric definition unchanged"
    • Delete existing metric (i.e. previously the metric existed and in the new file it does not exist): If ´--force-delete´ option is not specified, prompt "The following metrics will be deleted: Confirm to delete? (Y/N)"
  • Mapping rules
    • If any mapping rules exist and ´--force-delete´ is not specified then prompt "There are existing mapping rules . Confirm to delete? (Y/N)"
    • ...then ALL existing mapping rules would be deleted and replaced with the new mappings in the CSV

The existing 3scale import command can be renamed to ´3scale import-extended´ with the same params and the file format changed to be more consistent with the format described here.

@mikz
Copy link
Contributor

mikz commented May 26, 2016

@MarkCheshire that is good path imo.

I have a small extension to it:

url_path http_method [delta] [redirect_url] [system-name] [friendly-name]
/movies/biography GET 2 http://example.com movies_biography Movies (Biography)
/movies/drama GET 2 http://example.com movies_drama Movies (Drama)

delta & redirect_url would be optional (delta defaulting to 1) and you could add any other attributes of the mapping rule and they would be passed to the api

that way, it is extensible to add new properties but still can stay small when you don't need it

@MarkCheshire
Copy link
Author

👍

@eguzki
Copy link
Member

eguzki commented Jul 3, 2019

Toolbox offers commands to import several 3scale objects.
closing it. Reopen if required.

@eguzki eguzki closed this as completed Jul 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants