Sha256: 4b06c1fc3f3dcdfdb5eda042d2b2e3c40f1009ea5dea7af10ac467b5870f4da4

Contents?: true

Size: 1.23 KB

Versions: 6

Compression:

Stored size: 1.23 KB

Contents

# encoding: UTF-8

require_relative '../shared'
require_relative '../../commands/domain'

GoodData::CLI.module_eval do

  desc 'Manage domain'
  command :domain do |c|

    c.desc 'Add user to domain'
    c.command :add_user do |add_user|
      add_user.action do |global_options, options, args|
        opts = options.merge(global_options)
        GoodData.connect(opts)

        domain = args[0]
        fail 'Domain name has to be provided' if domain.nil? || domain.empty?

        email = args[1]
        fail 'Email has to be provided' if email.nil? || email.empty?

        password = args[2]
        fail 'Password has to be provided' if password.nil? || password.empty?

        GoodData::Command::Domain.add_user(domain, email, password)
      end
    end

    c.desc 'List users in domain'
    c.command :list_users do |list_users|
      list_users.action do |global_options, options, args|
        opts = options.merge(global_options)
        GoodData.connect(opts)

        domain = args[0]
        fail 'Domain name has to be provided' if domain.nil? || domain.empty?

        users = GoodData::Command::Domain.list_users(domain)
        puts users.map { |u| [u['firstName'], u['lastName'], u['login']].join(',') }
      end
    end
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gooddata-0.6.7 lib/gooddata/cli/commands/domain_cmd.rb
gooddata-0.6.6 lib/gooddata/cli/commands/domain_cmd.rb
gooddata-0.6.5 lib/gooddata/cli/commands/domain_cmd.rb
gooddata-0.6.4 lib/gooddata/cli/commands/domain_cmd.rb
gooddata-0.6.3 lib/gooddata/cli/commands/domain_cmd.rb
gooddata-0.6.2 lib/gooddata/cli/commands/domain_cmd.rb