Sha256: 4044620dbd491a6629395359a4d9cbd1958eda7ed6d9504d61b756f5129439f4

Contents?: true

Size: 1.57 KB

Versions: 4

Compression:

Stored size: 1.57 KB

Contents

module VagrantPlugins
  module CommandServe
    class Client
      class BoxMetadata < Client
        def name
          client.box_name(Empty.new).name
        end

        # @param [String] url for the metadata
        def load_metadata(url)
          client.load_metadata(SDK::BoxMetadata::LoadMetadataRequest.new(
            url: url
          ))
        end

        # @param [String] version The version to return, this can also
        #   be a constraint.
        # @param [Array<String>] (optional) adds a provider constraint to the version 
        def version(version, provider=[])
          opts = []
          provider.each do |p|
            opts << SDK::BoxMetadata::BoxMetadataOpts.new(name: p)
          end

          v = client.version(SDK::BoxMetadata::VersionQuery.new(
            version: version, opts: opts,
          ))
          v.to_h
        end

        # @param [String] (optional) adds a provider constraint to the version list
        def list_versions(provider)
          v = client.list_versions(SDK::BoxMetadata::ListVersionsQuery.new(
            opts: [SDK::BoxMetadata::BoxMetadataOpts.new(name: provider)],
          ))
          v.versions
        end

        def provider(version, name)
          p = client.provider(SDK::BoxMetadata::ProviderRequest.new(
            version: version, name: name
          ))
          p.to_h
        end

        def list_providers(version)
          p = client.list_providers(SDK::BoxMetadata::ListProvidersRequest.new(
            version: version
          ))
          p.providers
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
vagrant-unbundled-2.3.6.0 plugins/commands/serve/client/box_metadata.rb
tamtam-vagrant-reload-1.2.1 vendor/cache/vagrant-2092df529ae7/plugins/commands/serve/client/box_metadata.rb
vagrant-unbundled-2.3.3.0 plugins/commands/serve/client/box_metadata.rb
vagrant-unbundled-2.3.2.0 plugins/commands/serve/client/box_metadata.rb