Bug 806395

Summary: [REST API] Provide a link within <alias> to remove the alias
Product: OKD Reporter: Xavier Coulon <xcoulon>
Component: MasterAssignee: Abhishek Gupta <abhgupta>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: low Docs Contact:
Priority: medium    
Version: 2.xCC: abhgupta, adietish, dmcphers, mpatel, wsun
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: devenv_2781 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-14 00:53:57 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Xavier Coulon 2012-03-23 15:54:47 UTC
To remain consistent with the other URLs, "alias" could be considered as a resource, and thus, we could have a response with the following structure:

<application>
      <framework>jbossas-7</framework>
      <domain-id>xcoulon</domain-id>
      <aliases>
      <alias>
       <name>test21</name>
       <link><rel>Remove alias</rel>... </link>
      </alias>
    </aliases>
   ...
</application>

and not have alias management via 'events' which could be used only to stop/start/restart the application

instead of :

<application>
      <framework>jbossas-7</framework>
      <domain-id>xcoulon</domain-id>
      <aliases>
      <alias>test21</alias>
    </aliases>
   ...
</application>

Comment 1 Xavier Coulon 2012-03-23 15:59:57 UTC
as a complement, it is hard to understand why aliases are not seen as subresources of an application, rather than 'events'.

Also, to keep consistency, the link to create an alias could be located inside of the <aliases> element.

Comment 2 Mrunal Patel 2012-03-26 22:43:15 UTC
Lowering priority since this could be addressed in a US.

Comment 3 Abhishek Gupta 2012-06-19 22:35:40 UTC
Short of a new user story, for now, maybe we could just list the current application aliases as the valid options for the remove alias link.

Thoughts???

Comment 4 Abhishek Gupta 2012-07-16 20:28:33 UTC
Can I get feedback on the proposed solution in Comment 3? Changing the response structure would require us to bump up the REST API version.

Comment 5 Andre Dietisheim 2012-07-30 09:56:26 UTC
I'd love to comment but I dont fully get how the new response structure would look like. Could you please provide some example xml/json?

Comment 6 Abhishek Gupta 2013-01-30 20:28:48 UTC
Sorry for the delay. As per my comment #3 above, the remove alias link could include the current list of application aliases as "valid-options". An example link structure is shown below.


        <link>
          <rel>Remove application alias</rel>
          <method>POST</method>
          <href>https://localhost/broker/rest/domains/agupta1/applications/app1/events</href>
          <required-params>
            <param>
              <name>event</name>
              <type>string</type>
              <description>event</description>
              <valid-options>
                <valid-option>remove-alias</valid-option>
              </valid-options>
              <invalid-options/>
            </param>
            <param>
              <name>alias</name>
              <type>string</type>
              <description>The application alias to be removed</description>
              <valid-options/>
              <invalid-options>
                <valid-option>app-alias-1</valid-option>
                <valid-option>app-alias-2</valid-option>
              </invalid-options/>
            </param>
          </required-params>
          <optional-params/>
        </link>

Comment 7 Abhishek Gupta 2013-01-30 20:31:40 UTC
Added the alias list in teh wrong place in the example link structure above. It should be in "valid-options" instead.

        <link>
          <rel>Remove application alias</rel>
          <method>POST</method>
          <href>https://localhost/broker/rest/domains/agupta1/applications/app1/events</href>
          <required-params>
            <param>
              <name>event</name>
              <type>string</type>
              <description>event</description>
              <valid-options>
                <valid-option>remove-alias</valid-option>
              </valid-options>
              <invalid-options/>
            </param>
            <param>
              <name>alias</name>
              <type>string</type>
              <description>The application alias to be removed</description>
              <valid-options>
                <valid-option>app-alias-1</valid-option>
                <valid-option>app-alias-2</valid-option>
              </valid-options>
              <invalid-options/>
            </param>
          </required-params>
          <optional-params/>
        </link>

Comment 8 Xavier Coulon 2013-01-31 10:52:22 UTC
Abhishek, that solution looks fine to me.

Comment 9 Abhishek Gupta 2013-02-06 06:53:22 UTC
Added the list of alias as valid options in this pull request --> https://github.com/openshift/origin-server/pull/1321

Comment 10 openshift-github-bot 2013-02-06 08:21:09 UTC
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/0ef35838175841aee4a050891e4adcaa550f0da6
Fix for bug 806395 - added list of alias as valid options in remove alias link for application in rest response

Comment 11 Abhishek Gupta 2013-02-06 17:58:35 UTC
Fixed in devenv_2781

Comment 12 Wei Sun 2013-02-07 07:02:50 UTC
Verified on devnev-stg_282

Result:

 <rel>Remove application alias</rel>
          <method>POST</method>
          <href>https://ec2-50-17-140-66.compute-1.amazonaws.com/broker/rest/domains/wsunoldstg282/applications/nds/events</href>
          <required-params>
            <param>
              <name>event</name>
              <type>string</type>
              <description>event</description>
              <valid-options>
                <valid-option>remove-alias</valid-option>
              </valid-options>
              <invalid-options/>
            </param>
            <param>
              <name>alias</name>
              <type>string</type>
              <description>The application alias to be removed</description>
              <valid-options>
                <valid-option>nds.test.com</valid-option>
              </valid-options>
              <invalid-options/>
            </param>
          </required-params>
          <optional-params/>
        </link>