Return-Path: X-Original-To: apmail-deltacloud-dev-archive@www.apache.org Delivered-To: apmail-deltacloud-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DC454D398 for ; Tue, 18 Dec 2012 17:26:59 +0000 (UTC) Received: (qmail 49240 invoked by uid 500); 18 Dec 2012 17:26:59 -0000 Delivered-To: apmail-deltacloud-dev-archive@deltacloud.apache.org Received: (qmail 49225 invoked by uid 500); 18 Dec 2012 17:26:59 -0000 Mailing-List: contact dev-help@deltacloud.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@deltacloud.apache.org Delivered-To: mailing list dev@deltacloud.apache.org Received: (qmail 48901 invoked by uid 99); 18 Dec 2012 17:26:58 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Dec 2012 17:26:58 +0000 X-ASF-Spam-Status: No, hits=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of marios@redhat.com designates 209.132.183.28 as permitted sender) Received: from [209.132.183.28] (HELO mx1.redhat.com) (209.132.183.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Dec 2012 17:26:52 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qBIHQUUe013157 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 18 Dec 2012 12:26:31 -0500 Received: from name.redhat.com (ovpn-112-20.ams2.redhat.com [10.36.112.20]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qBIHQPxw010885 for ; Tue, 18 Dec 2012 12:26:29 -0500 From: marios@redhat.com To: dev@deltacloud.apache.org Subject: [PATCH 1/3] CIMI: tidy up - add features for Machine and missing VolumeTemplates Date: Tue, 18 Dec 2012 19:26:21 +0200 Message-Id: <1355851583-20476-2-git-send-email-marios@redhat.com> In-Reply-To: <1355851583-20476-1-git-send-email-marios@redhat.com> References: <1355851583-20476-1-git-send-email-marios@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Virus-Checked: Checked by ClamAV on apache.org From: marios Signed-off-by: marios --- server/lib/cimi/collections/machines.rb | 3 ++ server/lib/cimi/collections/volume_templates.rb | 47 +++++++++++++++++++++++++ server/lib/cimi/models/volume_template.rb | 3 ++ 3 files changed, 53 insertions(+) create mode 100644 server/lib/cimi/collections/volume_templates.rb diff --git a/server/lib/cimi/collections/machines.rb b/server/lib/cimi/collections/machines.rb index b18fb1c..e5e1836 100644 --- a/server/lib/cimi/collections/machines.rb +++ b/server/lib/cimi/collections/machines.rb @@ -16,7 +16,10 @@ module CIMI::Collections class Machines < Base + include CIMI::Features + set :capability, lambda { |m| driver.respond_to? m } + check_features :for => lambda { |c, f| driver.class.has_feature?(c, f) } collection :machines do description 'List all machine' diff --git a/server/lib/cimi/collections/volume_templates.rb b/server/lib/cimi/collections/volume_templates.rb new file mode 100644 index 0000000..c73934e --- /dev/null +++ b/server/lib/cimi/collections/volume_templates.rb @@ -0,0 +1,47 @@ +# 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. + +module CIMI::Collections + class VolumeTemplates < Base + +# set :capability, lambda { |m| driver.respond_to? m } + + collection :volume_templates do + + operation :index do + description "Get list all VolumeTemplates" + control do + volume_template = VolumeTemplates.list(self).filter_by(params['$select']) + respond_to do |format| + format.xml { volume_template.to_xml } + format.json { volume_template.to_json } + end + end + end + + operation :show do + description "Get a specific VolumeTemplate" + control do + volume_template = VolumeTemplate.find(params[:id], self) + respond_to do |format| + format.xml { volume_template.to_xml } + format.json { volume_template.json } + end + end + end + end + + end +end diff --git a/server/lib/cimi/models/volume_template.rb b/server/lib/cimi/models/volume_template.rb index b2ac323..bb632c6 100644 --- a/server/lib/cimi/models/volume_template.rb +++ b/server/lib/cimi/models/volume_template.rb @@ -22,4 +22,7 @@ class CIMI::Model::VolumeTemplate < CIMI::Model::Base array :operations do scalar :rel, :href end + + def self.find(id, context) + end end -- 1.7.11.7