Sha256: 564b35489a1efe4b7db6608eb58f48b2adac79b8f6c9d0c9199487f47f0f6ceb

Contents?: true

Size: 1.22 KB

Versions: 5

Compression:

Stored size: 1.22 KB

Contents

module Fog
  module Compute
    class OpenStack
      class Real

        def create_security_group(name, description)
          data = {
            'security_group' => {
              'name'       => name,
              'description' => description
            }
          }

          request(
            :body     => MultiJson.encode(data),
            :expects  => 200,
            :method   => 'POST',
            :path     => 'os-security-groups.json'
          )
        end

      end

      class Mock
        def create_security_group(name, description)
          response = Excon::Response.new
          response.status = 200
          response.headers = {
            "X-Compute-Request-Id" => "req-c373a42c-2825-4e60-8d34-99416ea850be",
            "Content-Type" => "application/json",
            "Content-Length" => "139",
            "Date" => Date.new}
          response.body = {
            "security_group" => [{
              "rules" => [],
              "tenant_id" => "d5183375ab0343f3a0b4b05f547aefc2",
              "id" => 999,
              "name" => name,
              "description" => description
            }]
          }
          response
        end
      end # mock
    end # openstack
  end # compute
end # fog

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
fog-parser-fix-1.6.1 lib/fog/openstack/requests/compute/create_security_group.rb
fog-test-again-1.6.0 lib/fog/openstack/requests/compute/create_security_group.rb
fog-parser-fix-1.6.0 lib/fog/openstack/requests/compute/create_security_group.rb
fog-1.6.0 lib/fog/openstack/requests/compute/create_security_group.rb
fog-1.5.0 lib/fog/openstack/requests/compute/create_security_group.rb