DeltaCloud

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Public Class Methods

add_class(name, parent=:base) click to toggle source
# File lib/base_object.rb, line 361
def self.add_class(name, parent=:base)
  parent = parent.to_s
  parent_class = "#{parent.classify}Object"
  @defined_classes ||= []
  class_name = "#{parent.classify}::#{name.classify}"
  unless @defined_classes.include?(class_name)
    DeltaCloud::API.class_eval("class #{class_name} < DeltaCloud::#{parent_class}; end")
    @defined_classes << class_name
  end

  DeltaCloud::API.const_get(parent.classify).const_get(name.classify)
end
driver_name(url) click to toggle source

Return a API driver for specified URL

@param [String, url] API URL (eg. localhost:3001/api)

# File lib/deltacloud.rb, line 62
def self.driver_name(url)
  API.new(nil, nil, url).driver_name
end
guess_model_type(response) click to toggle source
# File lib/base_object.rb, line 374
def self.guess_model_type(response)
  response = Nokogiri::XML(response.to_s)
  return :action if ((response/'//actions').length >= 1) and ((response/'//state').length == 0)
  return :stateful if ((response/'//actions').length >= 1) and ((response/'//state').length >= 1)
  return :base
end
new(user_name, password, api_url, &block) click to toggle source
Get a new API client instance

@param [String, user_name] API user name
@param [String, password] API password
@param [String, url] API URL (eg. http://localhost:3001/api)
@return [DeltaCloud::API]

def self.new(user_name, password, api_url, opts={}, &block)

opts ||= {}
API.new(user_name, password, api_url, opts, &block)

end

# File lib/deltacloud.rb, line 39
def self.new(user_name, password, api_url, &block)
  API.new(user_name, password, api_url, &block)
end
valid_credentials?(user_name, password, api_url, opts={}) click to toggle source

Check given credentials if their are valid against backend cloud provider

@param [String, user_name] API user name @param [String, password] API password @param [String, user_name] API URL (eg. localhost:3001/api) @return [true|false]

# File lib/deltacloud.rb, line 50
def self.valid_credentials?(user_name, password, api_url, opts={})
  api=API.new(user_name, password, api_url, opts)
  result = false
  api.request(:get, '', :force_auth => '1') do |response|
    result = true if response.code.eql?(200)
  end
  return result
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.