Sha256: 216ced42dde9359bc758276c0fc67ab670b9102efb9eb7ca08dd7db895d5c18d

Contents?: true

Size: 975 Bytes

Versions: 10

Compression:

Stored size: 975 Bytes

Contents

module Fog
  module Compute
    class Google
      class Mock
        def add_instance_group_instances(_group_name, _zone, _instances)
          Fog::Mock.not_implemented
        end
      end

      class Real
        def add_instance_group_instances(group_name, zone, instances)
          api_method = @compute.instance_groups.add_instances

          parameters = {
            "project" => @project,
            "instanceGroup" => group_name,
            "zone" => zone
          }

          instances.map! do |instance|
            if instance.start_with?("https:")
              { "instance" => instance }
            else
              { "instance" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone}/instances/#{instance}\n" }
            end
          end

          body_object = {
            "instances" => instances
          }

          request(api_method, parameters, body_object)
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
fog-google-0.6.0 lib/fog/compute/google/requests/add_instance_group_instances.rb
fog-google-0.5.5 lib/fog/compute/google/requests/add_instance_group_instances.rb
fog-google-0.5.4 lib/fog/compute/google/requests/add_instance_group_instances.rb
fog-google-0.5.3 lib/fog/compute/google/requests/add_instance_group_instances.rb
fog-google-0.5.2 lib/fog/compute/google/requests/add_instance_group_instances.rb
fog-google-0.5.1 lib/fog/compute/google/requests/add_instance_group_instances.rb
fog-google-0.5.0 lib/fog/compute/google/requests/add_instance_group_instances.rb
fog-google-0.4.2 lib/fog/compute/google/requests/add_instance_group_instances.rb
fog-google-0.4.1 lib/fog/compute/google/requests/add_instance_group_instances.rb
fog-google-0.4.0 lib/fog/compute/google/requests/add_instance_group_instances.rb