Sha256: 35f5d1042aefc23159a8fd0a99d8bc58481d7a5bce8bf27c361f1dceac93d99a

Contents?: true

Size: 1.07 KB

Versions: 14

Compression:

Stored size: 1.07 KB

Contents

module Fog
  module Compute
    class Google
      class Mock
        def insert_instance_group(_group_name, _zone, _options = {})
          # :no-coverage:
          Fog::Mock.not_implemented
          # :no-coverage:
        end
      end

      class Real
        def insert_instance_group(group_name, zone, options = {})
          if options["network"]
            network_name = last_url_segment(options["network"])
          else
            network_name = GOOGLE_COMPUTE_DEFAULT_NETWORK
          end

          instance_group = ::Google::Apis::ComputeV1::InstanceGroup.new(
            description: options["description"],
            name: group_name,
            network: "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/global/networks/#{network_name}"
          )

          @compute.insert_instance_group(@project,
                                         last_url_segment(zone),
                                         instance_group)
        end

        def last_url_segment(network)
          network.split("/")[-1]
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
fog-google-1.24.1 lib/fog/compute/google/requests/insert_instance_group.rb
fog-google-1.24.0 lib/fog/compute/google/requests/insert_instance_group.rb
fog-google-1.23.0 lib/fog/compute/google/requests/insert_instance_group.rb
fog-google-1.22.0 lib/fog/compute/google/requests/insert_instance_group.rb
fog-google-1.21.1 lib/fog/compute/google/requests/insert_instance_group.rb
fog-google-1.21.0 lib/fog/compute/google/requests/insert_instance_group.rb
fog-google-1.20.0 lib/fog/compute/google/requests/insert_instance_group.rb
fog-google-1.19.0 lib/fog/compute/google/requests/insert_instance_group.rb
fog-google-1.18.0 lib/fog/compute/google/requests/insert_instance_group.rb
fog-google-1.17.0 lib/fog/compute/google/requests/insert_instance_group.rb
fog-google-1.16.1 lib/fog/compute/google/requests/insert_instance_group.rb
fog-google-1.16.0 lib/fog/compute/google/requests/insert_instance_group.rb
fog-google-1.15.0 lib/fog/compute/google/requests/insert_instance_group.rb
fog-google-1.14.0 lib/fog/compute/google/requests/insert_instance_group.rb