Sha256: 6950bdaa99750ac7c063502e79d814e6c007bb06a19b252e050781011d0f194f

Contents?: true

Size: 866 Bytes

Versions: 4

Compression:

Stored size: 866 Bytes

Contents

module Fog
  module Compute
    class HuaweiCloud
      class Real
        def create_server_group(name, policy)
          Fog::Compute::HuaweiCloud::ServerGroup.validate_server_group_policy policy

          body = {'server_group' => {
            'name'     => name,
            'policies' => [policy]
          }}
          request(
            :body    => Fog::JSON.encode(body),
            :expects => 200,
            :method  => 'POST',
            :path    => 'os-server-groups'
          )
        end
      end

      class Mock
        def create_server_group(name, policy)
          Fog::Compute::HuaweiCloud::ServerGroup.validate_server_group_policy policy
          id = SecureRandom.uuid
          data[:server_groups][id] = {:name => name, :policies => [policy], :members => []}
          get_server_group id
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fog-huaweicloud-0.0.3 lib/fog/compute/huaweicloud/requests/create_server_group.rb
fog-huaweicloud-0.0.2 lib/fog/compute/huaweicloud/requests/create_server_group.rb
fog-huaweicloud-0.1.3 lib/fog/compute/huaweicloud/requests/create_server_group.rb
fog-huaweicloud-0.1.2 lib/fog/compute/huaweicloud/requests/create_server_group.rb