Module: OneviewSDK::ImageStreamer

Defined in:
lib/oneview-sdk/image_streamer.rb,
lib/oneview-sdk/image-streamer/client.rb,
lib/oneview-sdk/image-streamer/resource/api_300.rb,
lib/oneview-sdk/image-streamer/resource/api300/resource.rb,
lib/oneview-sdk/image-streamer/resource/api300/os_volume.rb,
lib/oneview-sdk/image-streamer/resource/api300/build_plan.rb,
lib/oneview-sdk/image-streamer/resource/api300/plan_script.rb,
lib/oneview-sdk/image-streamer/resource/api300/golden_image.rb,
lib/oneview-sdk/image-streamer/resource/api300/artifact_bundle.rb,
lib/oneview-sdk/image-streamer/resource/api300/deployment_plan.rb,
lib/oneview-sdk/image-streamer/resource/api300/deployment_group.rb

Overview

Module Image Streamer

Defined Under Namespace

Modules: API300 Classes: Client

Constant Summary collapse

SUPPORTED_API_VERSIONS =
[300].freeze
DEFAULT_API_VERSION =
300

Class Method Summary collapse

Class Method Details

.api_versionObject

Get the current API version


28
29
30
# File 'lib/oneview-sdk/image_streamer.rb', line 28

def self.api_version
  @api_version
end

.api_version=(version) ⇒ Object

Set the default API version


33
34
35
36
37
38
39
# File 'lib/oneview-sdk/image_streamer.rb', line 33

def self.api_version=(version)
  version = version.to_i rescue version
  raise "API version #{version} is not supported!" unless SUPPORTED_API_VERSIONS.include?(version)
  raise "The module for API version #{@api_version} is undefined" unless constants.include?("API#{@api_version}".to_sym)
  @api_version_updated = true
  @api_version = version
end

.api_version_updated?TrueClass, FalseClass

Has the API version been set by the user?

Returns:

  • (TrueClass, FalseClass)

43
44
45
# File 'lib/oneview-sdk/image_streamer.rb', line 43

def self.api_version_updated?
  @api_version_updated
end

.const_missing(const) ⇒ Object

Helps redirect resources to the correct API module for Image Streamer


48
49
50
51
52
53
# File 'lib/oneview-sdk/image_streamer.rb', line 48

def self.const_missing(const)
  api_module = OneviewSDK::ImageStreamer.const_get("API#{@api_version}")
  api_module.const_get(const)
rescue NameError
  raise NameError, "The #{const} method or resource does not exist for Image Streamer API version #{@api_version}."
end

.resource_named(type, api_ver = @api_version, variant = nil) ⇒ Class

Get resource class that matches the type given

Parameters:

  • type (String)

    Name of the desired class type

  • api_ver (Fixnum) (defaults to: @api_version)

    API module version to fetch resource from

  • variant (String) (defaults to: nil)

    API module variant to fetch resource from

Returns:

  • (Class)

    Resource class or nil if not found


60
61
62
63
64
65
66
# File 'lib/oneview-sdk/image_streamer.rb', line 60

def self.resource_named(type, api_ver = @api_version, variant = nil)
  unless SUPPORTED_API_VERSIONS.include?(api_ver)
    raise UnsupportedVersion, "API version #{api_ver} is not supported! Try one of: #{SUPPORTED_API_VERSIONS}"
  end
  api_module = OneviewSDK::ImageStreamer.const_get("API#{api_ver}")
  variant ? api_module.resource_named(type, variant) : api_module.resource_named(type)
end