Sha256: 95bba48e891004234b61a815dde801ba755985f2a4047ff68f8cfc8e39d162c9

Contents?: true

Size: 793 Bytes

Versions: 31

Compression:

Stored size: 793 Bytes

Contents

module Fog
  module Compute
    class Vsphere
      class Real
        def create_folder(datacenter, path, name)
          #Path cannot be nil but it can be an empty string
          raise ArgumentError, "Path cannot be nil" if path.nil?

          parent_folder = get_raw_vmfolder(path, datacenter)
          begin
            new_folder = parent_folder.CreateFolder(:name => name)
            # output is cleaned up to return the new path
            # new path will be path/name, example: "Production/Pool1"
            new_folder.path.reject { |a| a.first.class == "Folder" }.map { |a| a.first.name }.join("/").sub(/^\/?Datacenters\/#{datacenter}\/vm\/?/, '')
          rescue => e
            raise e, "failed to create folder: #{e}"
          end
        end
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 5 rubygems

Version Path
fog-1.36.0 lib/fog/vsphere/requests/compute/create_folder.rb
fog-vsphere-0.2.0 lib/fog/vsphere/requests/compute/create_folder.rb
fog-vsphere-0.1.1 lib/fog/vsphere/requests/compute/create_folder.rb
fog-vsphere-0.1.0 lib/fog/vsphere/requests/compute/create_folder.rb
fog-1.35.0 lib/fog/vsphere/requests/compute/create_folder.rb
fog-2.0.0.pre.0 lib/fog/vsphere/requests/compute/create_folder.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/lib/fog/vsphere/requests/compute/create_folder.rb
fog-1.34.0 lib/fog/vsphere/requests/compute/create_folder.rb
fog-1.33.0 lib/fog/vsphere/requests/compute/create_folder.rb
fog-1.32.0 lib/fog/vsphere/requests/compute/create_folder.rb
fog-1.31.0 lib/fog/vsphere/requests/compute/create_folder.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/vsphere/requests/compute/create_folder.rb
fog-1.30.0 lib/fog/vsphere/requests/compute/create_folder.rb
fog-1.29.0 lib/fog/vsphere/requests/compute/create_folder.rb
fog-1.28.0 lib/fog/vsphere/requests/compute/create_folder.rb
fog-1.27.0 lib/fog/vsphere/requests/compute/create_folder.rb
fog-1.26.0 lib/fog/vsphere/requests/compute/create_folder.rb
fog-1.25.0 lib/fog/vsphere/requests/compute/create_folder.rb
nsidc-fog-1.24.1 lib/fog/vsphere/requests/compute/create_folder.rb
fog-1.24.0 lib/fog/vsphere/requests/compute/create_folder.rb