Implement CLI for python-savannaclient

Registered by Sergey Lukjanov on 2013-04-01

Requirements -
 . MUST accept --os-username/env[OS_USERNAME] & --os-password/env[OS_PASSWORD] & --os-tenant-name/env[OS_TENANT_NAME] & --os-auth-url/env[OS_AUTH_URL] for authentication
 . MUST accept --service-type & --endpoint-type and perform keystone catalog lookup

https://savanna.readthedocs.org/en/latest/userdoc/rest_api_v1.0.html

==Plugins==
plugin-list
 -> GET /v1.0/{tenant_id}/plugins
plugin-show --name <plugin> [--version <version>]
 -> GET /v1.0/{tenant_id}/plugins/{plugin_name}[/{version}]

==Image Registry==
image-list [--tag <tag>]*
 -> GET /v1.0/{tenant_id}/images[?tags=tag]*
image-show --name <image>|--id <image_id>
 -> GET /v1.0/{tenant_id}/images/{image_id}
image-register --name <image>|--id <image_id> [--username <name>] [--description <desc>]
 -> POST /v1.0/{tenant_id}/images
image-unregister --name <image>|--id <image_id>
 -> DELETE /v1.0/{tenant_id}/images/{image_id}
image-add-tag --name <image>|--id <image_id> --tag <tag>+
 -> POST /v1.0/{tenant_id}/images/{image_id}/tag
image-remove-tag --name <image>|--id <image_id> --tag <tag>+
 -> POST /v1.0/{tenant_id}/images/{image_id}/untag

==Node Group Templates==
node-group-template-list
 -> GET /v1.0/{tenant_id}/node-group-templates
node-group-template-show --name <node_group_template>|--id <node_group_template_id> [--json]
 -> GET /v1.0/{tenant_id}/node-group-templates/{node_group_template_id}
node-group-template-create [--json <file>]
node-group-template-delete --name <node_group>|--id <node_group_template_id>
 -> DELETE /v1.0/{tenant_id}/node-group-templates/<node_group_template_id>

==Cluster Templates==
cluster-template-list
 -> GET /v1.0/{tenant_id}/cluster-templates
cluster-template-show --name <cluster_template>|--id <cluster_template_id> [--json]
 -> GET /v1.0/{tenant_id}/cluster-templates/{cluster_template_id}
cluster-template-create [--json <file>]
cluster-template-delete --name <cluster>|--id <cluster_template_id>
 -> DELETED /v1.0/{tenant_id}/cluster-templates/{cluster_template_id}

==Clusters==
cluster-list
 -> GET /v1.0/{tenant_id}/clusters
cluster-show --name <cluster>|--id <cluster_id> [--json]
 -> GET /v1.0/{tenant_id}/clusters/{cluster_id}
cluster-create [--json <file>]
cluster-scale
 * two operations, resize and add
 * resize existing group w/ new size
 * add new group
cluster-delete --name <cluster>|--id <cluster_id>
 -> DELETE /v1.0/{tenant_id}/clusters/{cluster_id}

https://savanna.readthedocs.org/en/latest/userdoc/rest_api_v1.1_EDP.html

==Data Sources==
data-source-list
-> GET /data-sources
data-source-show --name <name>|--id <id>
-> GET /data-sources/{id}
data-source-create --name <name> --type <type> --url <url> [--user <user> --password <password>] [--description <desc>]
NB: user & password if type is swift
-> POST /data-sources
data-source-delete --name <name>|--id <id>
-> DELETE /data-sources/{id}

==Job Binary Internals==
job-binary-data-list
-> GET /job-binary-internals
job-binary-data-show -- skip
job-binary-data-create [--file <file>]
NB: name param is required
-> PUT_FILE /job-binary-internals
job-binary-data-delete --id <id>
-> DELETE /job-binary-internals/{id}

==Job Binaries==
job-binary-list
-> GET /job-binaries
job-binary-show --name <name>|--id <id>
-> GET /job-binaries/{id}
job-binary-create --name <name> --url <url> [--user <user> --password <password>] [--description <desc>]
NB: user & password if url proto is swift-internal
NB: param for credentials should be "credentials" (like data-source) not "extra"
-> POST /job-binaries
job-binary-delete --name <name>|--id <id>
-> DELETE /job-binaries/{id}

==Jobs==
job-template-list
-> GET /jobs
job-template-show --name <name>|--id <id>
-> GET /jobs/{id}
job-template-create --name <name> --type <Pig|Hive|MapReduce|Java> --mains <array of string> --libs <array of string>
-> POST /jobs
job-template-delete --name <name>|--id <id>
-> DELETE /jobs/{id}

==Job Executions==
job-list
-> GET /job-executions
job-show --id <id>
-> GET /job-executions/{id}
job-create --job-template <id> --cluster <id> --input-data <id> --output-data <id> [--param <name=value>] [--arg <arg>] [--config <name=value>]
-> POST /jobs/{job_template_id}/execute
job-update -- skip
job-delete --id <id>
-> DELETE /job-executions/{id}

NOTES -
 . Do we provide a 'run' command that can create a template, create a job, wait for completion? -> bp cli-edp-run-cmd
 . Given the complexity of the templates, we likely want a way to dump/load them. 9 Jan 2014 meeting, this was agreed.
 . Consistency says to use -delete instead of -destroy. Agreed in 9 Jan 2014 meeting.
 . All the cmd roots be singular (plugin-list over plugins-list)
 . -I'm flexible on dash vs space, i.e. images-list vs images list- Not flexible on this anymore, dash is the way forward
 . We should enable tab completion instead of providing short arguments -> bp cli-tab-completion
 . Typo in rest_api_v1.0 3.4 should not have {image_id}? No, the image_id is a param passed via url instead of data.
 . Why does Cluster template create need node group name and id? -> https://answers.launchpad.net/savanna/+question/243126
 . Can POST cluster-templates really take a node-group-template spec? If so, I'm don't think we should expose that functionality in the CLI.
 . Can POST clusters really take a full cluster-template spec? If so, I'm don't think we should expose that functionality in the CLI.
 . We have complexity in the node-group-template name w/i the cluster-template, might not match

Blueprint information

Status:
Complete
Approver:
Sergey Lukjanov
Priority:
Medium
Drafter:
Matthew Farrellee
Direction:
Approved
Assignee:
Matthew Farrellee
Definition:
Approved
Series goal:
Accepted for 0.5.x
Implementation:
Implemented
Milestone target:
milestone icon 0.5.0
Started by
Matthew Farrellee on 2013-12-31
Completed by
Matthew Farrellee on 2014-02-04

Related branches

Sprints

Whiteboard

Gerrit topic: https://review.openstack.org/#q,topic:bp/python-savannaclient-cli,n,z

Addressed by: https://review.openstack.org/61565
    Add initial Savanna CLI

Addressed by: https://review.openstack.org/65464
    Add initial image-* commands to CLI

Addressed by: https://review.openstack.org/65721
    Add initial cluster-* commands to CLI

Addressed by: https://review.openstack.org/65929
    Add initial node-group-template-* commands to CLI

Addressed by: https://review.openstack.org/66134
    Add initial cluster-template-* commands to CLI

Addressed by: https://review.openstack.org/67660
    Make plugin commands singular

Addressed by: https://review.openstack.org/67663
    Add node-group-template-show command to CLI

Addressed by: https://review.openstack.org/67665
    Add cluster-template-show command to CLI

Addressed by: https://review.openstack.org/67669
    Refactor display of node group template

Addressed by: https://review.openstack.org/67670
    Refactor display of cluster template

Addressed by: https://review.openstack.org/67671
    Refactor display of cluster

Addressed by: https://review.openstack.org/67672
    Add --json option to node-group-template-show

Addressed by: https://review.openstack.org/67673
    Add --json option to cluster-template-show

Addressed by: https://review.openstack.org/67674
    Add --json option to cluster-show

Addressed by: https://review.openstack.org/67960
    Add node-group-template-create to CLI

Addressed by: https://review.openstack.org/68211
    Add cluster-template-create to CLI

Addressed by: https://review.openstack.org/68212
    Add cluster-create to CLI

Addressed by: https://review.openstack.org/68491
    Add data-source-list to CLI

Addressed by: https://review.openstack.org/68492
    Add data-source-show to CLI

Addressed by: https://review.openstack.org/68493
    Add data-source-delete to CLI

Addressed by: https://review.openstack.org/68494
    Add job-binary-data-list to CLI

Addressed by: https://review.openstack.org/68495
    Add job-binary-data-delete to CLI

Addressed by: https://review.openstack.org/68496
    Add job-binary-list to CLI

Addressed by: https://review.openstack.org/68497
    Add job-binary-show to CLI

Addressed by: https://review.openstack.org/68498
    Add job-binary-delete to CLI

Addressed by: https://review.openstack.org/68499
    Add job-template-list to CLI

Addressed by: https://review.openstack.org/68500
    Add job-template-show to CLI

Addressed by: https://review.openstack.org/68501
    Add job-template-delete to CLI

Addressed by: https://review.openstack.org/68502
    Add job-list to CLI

Addressed by: https://review.openstack.org/68503
    Add job-show to CLI

Addressed by: https://review.openstack.org/68504
    Add job-delete to CLI

Addressed by: https://review.openstack.org/68635
    Refactor display of job-binary-data elements

Addressed by: https://review.openstack.org/68636
    Add job-binary-data-create to CLI

Addressed by: https://review.openstack.org/68819
    Refactor display of a single data-source

Addressed by: https://review.openstack.org/68820
    Add data-source-create to CLI

Gerrit topic: https://review.openstack.org/#q,topic:bug/1272130,n,z

Addressed by: https://review.openstack.org/68842
    Refactor display of a job binary

Addressed by: https://review.openstack.org/68843
    Add job-binary-create to CLI

Addressed by: https://review.openstack.org/69468
    Add job-create to CLI

(?)

Work Items

Dependency tree

* Blueprints in grey have been implemented.

This blueprint contains Public information 
Everyone can see this information.