Sha256: 52eff662cd03d2322eb0925fd38b9f8547cc50d1adf8eed9812c35a377b6808c

Contents?: true

Size: 812 Bytes

Versions: 1

Compression:

Stored size: 812 Bytes

Contents

define_request :create_tenant do

  endpoint_type :admin
  api_version   :v2
  http_method   :post

  link_to 'documentation',
          'http://docs.openstack.org/api/openstack-identity-service/2.0/content/POST_addTenant_v2.0_tenants_.html'

  required_param :name
  required_param :description
  required_param :enabled


  def url
    service_spec = session_data[:access][:serviceCatalog].find{|s| s[:type] == 'identity' }
    "#{ service_spec[:endpoints][0][:adminURL] }/tenants"
  end

  
  def headers
    h = {}
    
    unless self.anonymous?
      h['X-Auth-Token'] = session_data[:access][:token][:id]
    end

    h
  end
  

  def body
    {
      tenant: {
        name:        params[:name],
        description: params[:description],
        enabled:     params[:enabled]
      }
    }
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aviator-0.0.2 lib/aviator/openstack/identity/v2/admin/create_tenant.rb