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 55FF678B1 for ; Wed, 7 Dec 2011 12:40:38 +0000 (UTC) Received: (qmail 56902 invoked by uid 500); 7 Dec 2011 12:40:38 -0000 Delivered-To: apmail-deltacloud-dev-archive@deltacloud.apache.org Received: (qmail 56884 invoked by uid 500); 7 Dec 2011 12:40:38 -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 56876 invoked by uid 99); 7 Dec 2011 12:40:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Dec 2011 12:40:38 +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 mandreou@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; Wed, 07 Dec 2011 12:40:31 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id pB7CeA5h024364 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 7 Dec 2011 07:40:10 -0500 Received: from [10.36.112.20] (ovpn-112-20.ams2.redhat.com [10.36.112.20]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id pB7Ce7kh017014 for ; Wed, 7 Dec 2011 07:40:09 -0500 Message-ID: <4EDF5EA7.7060908@redhat.com> Date: Wed, 07 Dec 2011 14:40:07 +0200 From: "marios@redhat.com" User-Agent: Mozilla/5.0 (X11; Linux i686; rv:8.0) Gecko/20111115 Thunderbird/8.0 MIME-Version: 1.0 To: dev@deltacloud.apache.org Subject: Re: [PATCH core] CIMI: Added MachineAdmin model operations (rev 2) References: <1323252496-11086-1-git-send-email-mfojtik@redhat.com> In-Reply-To: <1323252496-11086-1-git-send-email-mfojtik@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 ACK - whitespace nit (deltacloud/.git/rebase-apply/patch:46: new blank line at EOF) + minor comment below: On 07/12/11 12:08, mfojtik@redhat.com wrote: > From: Michal Fojtik > > > Signed-off-by: Michal fojtik > --- > server/lib/cimi/model.rb | 1 + > server/lib/cimi/model/base.rb | 8 ----- > server/lib/cimi/model/errors.rb | 40 ++++++++++++++++++++++++++ > server/lib/cimi/model/machine_admin.rb | 27 +++++++++++++++++- > server/lib/cimi/server.rb | 49 ++++++++++++++++++++++++++++++- > 5 files changed, 114 insertions(+), 11 deletions(-) > create mode 100644 server/lib/cimi/model/errors.rb > do we want to keep the 'with_capability' stuff below - we aren't using that for any other CIMI collections. It makes sense most for the 'create' operation, but CIMI addresses this through the *_Collection entity, i.e. you GET the MachineAdminCollection and discover the link for 'add' (to create new MachineAdmin) from there, if this is allowed. marios > +global_collection :machine_admins do > + description 'Machine Admin entity' > + > + operation :index do > + description "List all machine admins" > + with_capability :keys > + control do > + machine_admins = MachineAdmin.all(self) > + respond_to do |format| > + format.xml { machine_admins.to_xml_cimi_collection(self) } > + format.json { machine_admins.to_json_cimi_collection(self) } > + end > + end > + end > + > + operation :show do > + description "Show specific machine admin" > + param :id, :string, :required > + with_capability :key > + control do > + machine_admin = MachineAdmin.find(params[:id], self) > + respond_to do |format| > + format.xml { machine_admin.to_xml } > + format.json { machine_admin.to_json } > + end > + end > + end > + > + operation :create do > + description "Show specific machine admin" > + with_capability :create_key > + control do > + if request.content_type.end_with?("+json") > + new_admin = MachineAdmin.create_from_json(request.body.read, self) > + else > + new_admin = MachineAdmin.create_from_xml(request.body.read, self) > + end > + status 201 # Created > + respond_to do |format| > + format.json { new_admin.to_json } > + format.xml { new_admin.to_xml } > + end > + end > + end > + > +end