SDK for Ruby Cloud Shell Quick Start

This quick start shows you how to quickly get started running sample code with the Oracle Cloud Infrastructure SDK for Ruby using Cloud Shell.

This quick start shows you how to quickly get started running sample code with the Oracle Cloud Infrastructure SDK for Ruby using Cloud Shell. The OCI SDK for Ruby is installed in the cloud shell environment and automatically added to your GEM_PATH.

  1. Login to the Console.
  2. Click the Cloud Shell icon in the Console header. Note that Cloud Shell will execute commands against the region selected in the Console's Region selection menu when Cloud Shell was started.
  3. Create a file named list_users_example.rb with the following code, which lists the users in your tenancy:
    require 'oci'
     
    api = OCI::Identity::IdentityClient.new()
    response = api.list_users(OCI.config.tenancy)
    response.data.each { |user| puts user.name }
  4. Run the example:
    ruby list_users_example.rb