Sha256: 203b36fd3c6562ef41b788495710568c95291855b6c3c3bc3f56d8d6f3fbf26e

Contents?: true

Size: 1.33 KB

Versions: 9

Compression:

Stored size: 1.33 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)
        client = GoodData.connect(opts)

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

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

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

        GoodData::Command::Domain.add_user(domain, email, password, :client => client)
      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)
        client = GoodData.connect(opts)

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

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
gooddata-0.6.20 lib/gooddata/cli/commands/domain_cmd.rb
gooddata-0.6.19 lib/gooddata/cli/commands/domain_cmd.rb
gooddata-0.6.18 lib/gooddata/cli/commands/domain_cmd.rb
gooddata-0.6.17 lib/gooddata/cli/commands/domain_cmd.rb
gooddata-0.6.16 lib/gooddata/cli/commands/domain_cmd.rb
gooddata-0.6.15 lib/gooddata/cli/commands/domain_cmd.rb
gooddata-0.6.14 lib/gooddata/cli/commands/domain_cmd.rb
gooddata-0.6.13 lib/gooddata/cli/commands/domain_cmd.rb
gooddata-0.6.12 lib/gooddata/cli/commands/domain_cmd.rb