Skip to content
This repository has been archived by the owner on Sep 16, 2020. It is now read-only.

Commit

Permalink
Merge pull request #547 from willthames/application_organization
Browse files Browse the repository at this point in the history
Update application resource and documentation
  • Loading branch information
AlanCoding committed Jun 14, 2018
2 parents ade7f70 + 786bed3 commit 0a6ebff
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 5 deletions.
32 changes: 32 additions & 0 deletions docs/source/api_ref/resources/application.rst
@@ -0,0 +1,32 @@
Application
===========

Description
-----------

This resource is used for managing application resources in Tower.

Fields Table
------------
.. <table goes here>
+-------------------------+--------------------------------------------------------------------+------------------------------------+----------+-------+-----------+---------+
|name |type |help_text |read_only |unique |filterable |required |
+=========================+====================================================================+====================================+==========+=======+===========+=========+
|name |String |The name field. |False |True |True |True |
+-------------------------+--------------------------------------------------------------------+------------------------------------+----------+-------+-----------+---------+
|client_type |Choices: public, confidential |The client_type field. |False |False |True |True |
+-------------------------+--------------------------------------------------------------------+------------------------------------+----------+-------+-----------+---------+
|organization |Resource organization |The organization field. |False |False |True |True |
+-------------------------+--------------------------------------------------------------------+------------------------------------+----------+-------+-----------+---------+
|authorization_grant_type |Choices: authorization-code, implicit, password, client-credentials |The authorization_grant_type field. |False |False |True |True |
+-------------------------+--------------------------------------------------------------------+------------------------------------+----------+-------+-----------+---------+
|skip_authorization |BOOL |The skip_authorization field. |False |False |True |False |
+-------------------------+--------------------------------------------------------------------+------------------------------------+----------+-------+-----------+---------+

.. <table goes here>
API Specification
-----------------
.. autoclass:: tower_cli.resources.application.Resource
:members: copy, create, delete, get, list, modify
25 changes: 20 additions & 5 deletions tower_cli/resources/application.py
Expand Up @@ -13,19 +13,34 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import click

from tower_cli import models
from tower_cli.cli import types


CLIENT_TYPES = [
'confidential',
'public'
]

GRANT_TYPES = [
"authorization-code",
"implicit",
"password",
"client-credentials",
]


class Resource(models.Resource):
"""A resource for OAuth2 applications."""
cli_help = 'Manage OAuth2 applications.'
endpoint = '/applications/'

user = models.Field(type=types.Related('user'), required=True)
dependencies = ['organization']

name = models.Field(unique=True)
client_type = models.Field(required=True)
client_type = models.Field(type=click.Choice(CLIENT_TYPES), required=True)
redirect_uris = models.Field(required=False)
authorization_grant_type = models.Field(required=True)
skip_authorization = models.Field(required=False)
authorization_grant_type = models.Field(type=click.Choice(GRANT_TYPES), required=True)
skip_authorization = models.Field(type=click.BOOL, required=False)
organization = models.Field(type=types.Related('organization'), required=True)

0 comments on commit 0a6ebff

Please sign in to comment.