Class: UnimatrixCLI::Keymaker::Resource::ListCommand
- Defined in:
- lib/unimatrix_cli/keymaker/resource/list_command.rb
Instance Method Summary collapse
Methods inherited from Command
available_commands, descendants, #initialize, #read_file, #validate, #validate_collection, #write
Methods included from UnimatrixParser
Constructor Details
This class inherits a constructor from UnimatrixCLI::Command
Instance Method Details
#execute ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/unimatrix_cli/keymaker/resource/list_command.rb', line 11 def execute endpoint = "#{ Configuration.default_config[ 'keymaker_url' ] }/" + "resources?access_token=#{ Configuration.access_token }&" + "resource_server_uuid=#{ @options[ :resource_server_uuid ] }" resources_response = make_request( endpoint, 'Get' ) if resources_response.is_a?( Array ) resources_response.each do | resource | write( message: "Name: #{ resource[ 'name' ] }\n" + "Code Name: #{ resource[ 'code_name' ] }\n" + "Actions: #{ resource[ 'actions' ] }\n" + "UUID: #{ resource[ 'uuid' ] }\n\n" ) end else write( message: "Error retrieving resources: " + "#{ resources_response.inspect }", error: true ) end end |