Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
OCCI Examples

Examples

Quick reference guide

occi --endpoint http://localhost:3000/ --action list --resource os_tpl
occi --endpoint http://localhost:3000/ --action list --resource resource_tpl
occi --endpoint http://localhost:3000/ --action describe --resource os_tpl#debian6
occi --endpoint http://localhost:3000/ --action create --resource compute --mixin os_tpl#debian6 --mixin resource_tpl#small --attribute occi.core.title="My rOCCI VM"
occi --endpoint http://localhost:3000/ --action delete --resource /compute/65sd4f654sf65g4-s5fg65sfg465sfg-sf65g46sf5g4sdfg

Listing resources

occi --endpoint http://localhost:3000/ --action list --resource compute
occi --endpoint http://localhost:3000/ --action list --resource network
occi --endpoint http://localhost:3000/ --action list --resource storage
occi --endpoint http://localhost:3000/ --action list --resource os_tpl
occi --endpoint http://localhost:3000/ --action list --resource resource_tpl

Describing resources

occi --endpoint http://localhost:3000/ --action describe --resource compute
occi --endpoint http://localhost:3000/ --action describe --resource network
occi --endpoint http://localhost:3000/ --action describe --resource storage
occi --endpoint http://localhost:3000/ --action describe --resource os_tpl
occi --endpoint http://localhost:3000/ --action describe --resource resource_tpl

Creating resources

occi --endpoint http://localhost:3000/ --action create [ --attribute attribute_name='attribute_value' ]+ [ --mixin mixin_type#mixin_term ]+ --resource compute
occi --endpoint http://localhost:3000/ --action create [ --attribute attribute_name='attribute_value' ]+ [ --mixin mixin_type#mixin_term ]+ --resource network
occi --endpoint http://localhost:3000/ --action create [ --attribute attribute_name='attribute_value' ]+ [ --mixin mixin_type#mixin_term ]+ --resource storage

Linking/unlinking resources

occi --endpoint http://localhost:3000/ --action link --resource /compute/instance_id --link /network/instance_id
occi --endpoint http://localhost:3000/ --action link --resource /compute/instance_id --link /storage/instance_id

Deleting resources

occi --endpoint http://localhost:3000/ --action delete --resource compute
occi --endpoint http://localhost:3000/ --action delete --resource network
occi --endpoint http://localhost:3000/ --action delete --resource storage

Triggering actions on resources

occi --endpoint http://localhost:3000/ --action trigger --trigger-action action_scheme#action_term [ --attribute attribute_name='attribute_value' ]+ --resource compute
occi --endpoint http://localhost:3000/ --action trigger --trigger-action action_term [ --attribute attribute_name='attribute_value' ]+ --resource compute
occi --endpoint http://localhost:3000/ --action trigger --trigger-action action_scheme#action_term [ --attribute attribute_name='attribute_value' ]+ --resource network
occi --endpoint http://localhost:3000/ --action trigger --trigger-action action_term [ --attribute attribute_name='attribute_value' ]+ --resource network
occi --endpoint http://localhost:3000/ --action trigger --trigger-action action_scheme#action_term [ --attribute attribute_name='attribute_value' ]+ --resource storage
occi --endpoint http://localhost:3000/ --action trigger --trigger-action action_term [ --attribute attribute_name='attribute_value' ]+ --resource storage

Other

Authentication

occi --endpoint http://localhost:3000/ [ --auth none ]
occi --endpoint http://localhost:3000/ --auth basic [ --username user ] [ --password pass ]
occi --endpoint http://localhost:3000/ --auth digest [ --username user ] [ --password pass ]
occi --endpoint http://localhost:3000/ --auth x509 [ --user-cred /home/user/.globus/usercred.pem ] [ --ca-file /etc/grid-security/certificates/ca.pem ] [ --ca-path /etc/grid-security/certificates ] [ --voms ] [ --password pass ]
occi --endpoint http://localhost:3000/ --auth x509 --user-cred /home/user/.globus/usercred.pem
occi --endpoint http://localhost:3000/ --auth x509 --user-cred /tmp/x509_1000 --voms
occi --endpoint http://localhost:3000/ --auth x509 --user-cred /tmp/x509_1000 --ca-path /etc/grid-security/certificates --voms

Media types

occi --endpoint http://localhost:3000/ [ ... ] --media-type application/occi+json
occi --endpoint http://localhost:3000/ [ ... ] --media-type text/plain,text/occi
occi --endpoint http://localhost:3000/ [ ... ] --media-type text/plain
occi --endpoint http://localhost:3000/ [ ... ] --media-type text/occi

Output formats

occi --endpoint http://localhost:3000/ [ ... ] --output-format json
occi --endpoint http://localhost:3000/ [ ... ] --output-format plain
occi --endpoint http://localhost:3000/ [ ... ] --output-format json_pretty
occi --endpoint http://localhost:3000/ [ ... ] --output-format json_extended
occi --endpoint http://localhost:3000/ [ ... ] --output-format json_extended_pretty

Attribute values (type-casting)

occi --endpoint http://localhost:3000/ [ ... ] --attribute attribute_name='attribute_value'
occi --endpoint http://localhost:3000/ [ ... ] --attribute attribute_name='num(attribute_value)'
occi --endpoint http://localhost:3000/ [ ... ] --attribute attribute_name='float(attribute_value)'
occi --endpoint http://localhost:3000/ [ ... ] --attribute attribute_name='bool(attribute_value)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment