Sha256: 1994d92a771cd4fbec2818776e2070e50945f4630d44b8f00bd6da9c0ae4255f

Contents?: true

Size: 841 Bytes

Versions: 4

Compression:

Stored size: 841 Bytes

Contents

module Fog
  module Identity
    class HuaweiCloud
      class V2
        class Real
          def create_role(name)
            data = {
              'role' => {
                'name' => name
              }
            }

            request(
              :body    => Fog::JSON.encode(data),
              :expects => [200, 202],
              :method  => 'POST',
              :path    => '/OS-KSADM/roles'
            )
          end
        end

        class Mock
          def create_role(name)
            data = {
              'id'   => Fog::Mock.random_hex(32),
              'name' => name
            }
            self.data[:roles][data['id']] = data
            Excon::Response.new(
              :body   => {'role' => data},
              :status => 202
            )
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fog-huaweicloud-0.0.3 lib/fog/identity/huaweicloud/v2/requests/create_role.rb
fog-huaweicloud-0.0.2 lib/fog/identity/huaweicloud/v2/requests/create_role.rb
fog-huaweicloud-0.1.3 lib/fog/identity/huaweicloud/v2/requests/create_role.rb
fog-huaweicloud-0.1.2 lib/fog/identity/huaweicloud/v2/requests/create_role.rb