Sha256: fc63588d44e3ecd5b6ef15dfa03f0bf0190bc4d4e3f85d012aae82f7d866978b

Contents?: true

Size: 1.35 KB

Versions: 2

Compression:

Stored size: 1.35 KB

Contents

# frozen_string_literal: true

#
# Author:: Stephen Pearson (<stephen.pearson@oracle.com>)
#
# Copyright (C) 2019, Stephen Pearson
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

module Kitchen
  module Driver
    class Oci
      # models definitions
      module Models
        require_relative "instance"
        require_relative "blockstorage"

        def instance_class(config, state, oci, api, action)
          Oci::Models.const_get(config[:instance_type].capitalize).new(config, state, oci, api, action)
        end

        def volume_class(type, config, state, oci, api)
          Oci::Models.const_get(volume_attachment_type(type)).new(config, state, oci, api)
        end

        private

        def volume_attachment_type(type)
          if type.nil?
            "Paravirtual"
          else
            type.capitalize
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kitchen-oci-1.16.2 lib/kitchen/driver/oci/models.rb
kitchen-oci-1.16.1 lib/kitchen/driver/oci/models.rb