Sha256: 6cdf48f3c576bca37e4ecbe5d407b5e843d1bd10fc9441fbdd2d71d6a3ba0a91

Contents?: true

Size: 825 Bytes

Versions: 7

Compression:

Stored size: 825 Bytes

Contents

require "vmc/cli/domain/base"

module VMC::Domain
  class CreateDomain < Base
    desc "Create a domain"
    group :domains
    input :name, :desc => "Domain name to create", :argument => :required
    input :organization, :desc => "Organization to add the domain to",
          :aliases => %w{--org -o},
          :default => proc { client.current_organization },
          :from_given => by_name(:organization)
    input :shared, :desc => "Create a shared domain", :default => false
    def create_domain
      org = input[:organization]
      name = input[:name].sub(/^\*\./, "")

      domain = client.domain
      domain.name = name
      domain.owning_organization = org unless input[:shared]

      with_progress("Creating domain #{c(name, :name)}") do
        domain.create!
      end

      domain
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
vmc-0.5.0.beta.7 lib/vmc/cli/domain/create_domain.rb
vmc-0.5.0.beta.6 lib/vmc/cli/domain/create_domain.rb
vmc-0.5.0.beta.5 lib/vmc/cli/domain/create_domain.rb
vmc-0.5.0.beta.4 lib/vmc/cli/domain/create_domain.rb
vmc-0.5.0.beta.3 lib/vmc/cli/domain/create_domain.rb
vmc-0.5.0.beta.2 lib/vmc/cli/domain/create_domain.rb
vmc-0.5.0.beta.1 lib/vmc/cli/domain/create_domain.rb