Giter Club home page Giter Club logo

ocicmd's Introduction

ocicmd

A command line utility that provides additional functionality beyond that provided by the oci CLI from Oracle.

Currently the functionality is limited to generating compartment information. There is a lot of potential for features, like being able to list or manipulate resources across multiple compartments. Pull requests are very much welcome if you would like to contribute.

Being able to get a list of compartments that match certain filters can be useful in combination with the official oci CLI from Oracle. You can pass the compartment IDs to search for instances, databases, etc.

For example, you can list all compute instances in compartments whose names contain the word 'application':

ocicmd compartments list -r --filter 'application' | jq '.[].id' | tr -d '"' | while read line ; do oci compute instance list --compartment-id $line | jq '[.data[] | {id, "display-name", "availability-domain"}]' ; done

This process of passing the compartments to oci is an improvement over manually checking each compartment, but its still very clunky. This is a big area for potential improvements IMO, as we can just make calls to the SDK to get the instance information instead of having to do this nonsense with jq, while read line; do, etc.

Prerequisites

You will need a local configuration file in your environment. Follow Oracle's instructions on generating an API signing key for your user and creating the OCI config file.

go must be installed and available in your $PATH.

Build from source

Clone this repo then you can either install in your path or build and use from a location of your choosing.

Install

To install in $PATH:

go install

Build without installing

This can be useful if you need to test changes quickly and don't need to have the tool installed in your $PATH

The target directory (bin) can be changed depending on your preferences.

go build -o bin/ocicmd

Then you can run from the target directory:

./bin/ocicmd

Usage

Commands below assume you have installed ocicmd in your $PATH.

View command usage

ocicmd -h

# specifically compartments usage
ocicmd compartments -h

Listing all compartments recursively

ocicmd compartments -r

Filtering for specific compartments

ocicmd compartments -r --filter 'application'

ocicmd's People

Contributors

cwinters8 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.