Sha256: 9fcbf338e0515c42be794596547dbcc60fc376591fac1687998c8caf0241c8c5

Contents?: true

Size: 882 Bytes

Versions: 11

Compression:

Stored size: 882 Bytes

Contents

require "vmc/cli/domain/base"

module VMC::Domain
  class CreateDomain < Base
    desc "Create a domain"
    group :domains
    input :name, :argument => :required,
          :desc => "Domain name to create"
    input :organization, :aliases => ["--org", "-o"],
          :from_given => by_name("organization"),
          :default => proc { client.current_organization },
          :desc => "Organization to add the domain to"
    input :shared, :type => :boolean, :default => false,
          :desc => "Create a shared domain (admin-only)"

    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

11 entries across 11 versions & 1 rubygems

Version Path
vmc-0.4.7 lib/vmc/cli/domain/create_domain.rb
vmc-0.4.6 lib/vmc/cli/domain/create_domain.rb
vmc-0.4.5 lib/vmc/cli/domain/create_domain.rb
vmc-0.4.4 lib/vmc/cli/domain/create_domain.rb
vmc-0.4.3 lib/vmc/cli/domain/create_domain.rb
vmc-0.4.2 lib/vmc/cli/domain/create_domain.rb
vmc-0.4.1 lib/vmc/cli/domain/create_domain.rb
vmc-0.4.0 lib/vmc/cli/domain/create_domain.rb
vmc-0.4.0.beta.97 vmc-ng/lib/vmc/cli/domain/create_domain.rb
vmc-0.4.0.beta.96 vmc-ng/lib/vmc/cli/domain/create_domain.rb
vmc-0.4.0.beta.94 vmc-ng/lib/vmc/cli/domain/create_domain.rb