github.com/blystad/deis@v0.11.0/controller/api/urls.py (about)

     1  """
     2  RESTful URL patterns and routing for the Deis API app.
     3  
     4  
     5  Clusters
     6  ========
     7  
     8  .. http:get:: /api/clusters/(string:id)/
     9  
    10    Retrieve a :class:`~api.models.Cluster` by its `id`.
    11  
    12  .. http:delete:: /api/clusters/(string:id)/
    13  
    14    Destroy a :class:`~api.models.Cluster` by its `id`.
    15  
    16  .. http:get:: /api/clusters/
    17  
    18    List all :class:`~api.models.Cluster`\s.
    19  
    20  .. http:post:: /api/clusters/
    21  
    22    Create a new :class:`~api.models.Cluster`.
    23  
    24  
    25  Applications
    26  ============
    27  
    28  .. http:get:: /api/apps/(string:id)/
    29  
    30    Retrieve a :class:`~api.models.Application` by its `id`.
    31  
    32  .. http:delete:: /api/apps/(string:id)/
    33  
    34    Destroy a :class:`~api.models.App` by its `id`.
    35  
    36  .. http:get:: /api/apps/
    37  
    38    List all :class:`~api.models.App`\s.
    39  
    40  .. http:post:: /api/apps/
    41  
    42    Create a new :class:`~api.models.App`.
    43  
    44  
    45  Application Release Components
    46  ------------------------------
    47  
    48  .. http:get:: /api/apps/(string:id)/config/
    49  
    50    List all :class:`~api.models.Config`\s.
    51  
    52  .. http:post:: /api/apps/(string:id)/config/
    53  
    54    Create a new :class:`~api.models.Config`.
    55  
    56  .. http:get:: /api/apps/(string:id)/builds/(string:uuid)/
    57  
    58    Retrieve a :class:`~api.models.Build` by its `uuid`.
    59  
    60  .. http:get:: /api/apps/(string:id)/builds/
    61  
    62    List all :class:`~api.models.Build`\s.
    63  
    64  .. http:post:: /api/apps/(string:id)/builds/
    65  
    66    Create a new :class:`~api.models.Build`.
    67  
    68  .. http:get:: /api/apps/(string:id)/limits/
    69  
    70    Retrieve the latest :class:`~api.models.Limit`.
    71  
    72  .. http:post:: /api/apps/(string:id)/limits/
    73  
    74    Create a new :class:`~api.models.Limit`.
    75  
    76  .. http:get:: /api/apps/(string:id)/releases/(int:version)/
    77  
    78    Retrieve a :class:`~api.models.Release` by its `version`.
    79  
    80  .. http:get:: /api/apps/(string:id)/releases/
    81  
    82    List all :class:`~api.models.Release`\s.
    83  
    84  .. http:post:: /api/apps/(string:id)/releases/rollback/
    85  
    86    Rollback to a previous :class:`~api.models.Release`.
    87  
    88  
    89  Application Infrastructure
    90  --------------------------
    91  
    92  .. http:get:: /api/apps/(string:id)/containers/(string:type)/(int:num)/
    93  
    94    List all :class:`~api.models.Container`\s.
    95  
    96  .. http:get:: /api/apps/(string:id)/containers/(string:type)/
    97  
    98    List all :class:`~api.models.Container`\s.
    99  
   100  .. http:get:: /api/apps/(string:id)/containers/
   101  
   102    List all :class:`~api.models.Container`\s.
   103  
   104  
   105  Application Domains
   106  -------------------
   107  
   108  
   109  .. http:delete:: /api/apps/(string:id)/domains/(string:hostname)
   110  
   111    Destroy a :class:`~api.models.Domain` by its `hostname`
   112  
   113  .. http:get:: /api/apps/(string:id)/domains/
   114  
   115    List all :class:`~api.models.Domain`\s.
   116  
   117  .. http:post:: /api/apps/(string:id)/domains/
   118  
   119    Create a new :class:`~api.models.Domain`\s.
   120  
   121  
   122  Application Actions
   123  -------------------
   124  
   125  .. http:post:: /api/apps/(string:id)/scale/
   126  
   127    See also
   128    :meth:`AppViewSet.scale() <api.views.AppViewSet.scale>`
   129  
   130  .. http:post:: /api/apps/(string:id)/logs/
   131  
   132    See also
   133    :meth:`AppViewSet.logs() <api.views.AppViewSet.logs>`
   134  
   135  .. http:post:: /api/apps/(string:id)/run/
   136  
   137    See also
   138    :meth:`AppViewSet.run() <api.views.AppViewSet.run>`
   139  
   140  .. http:post:: /api/apps/(string:id)/calculate/
   141  
   142    See also
   143    :meth:`AppViewSet.calculate() <api.views.AppViewSet.calculate>`
   144  
   145  
   146  Application Sharing
   147  ===================
   148  
   149  .. http:delete:: /api/apps/(string:id)/perms/(string:username)/
   150  
   151    Destroy an app permission by its `username`.
   152  
   153  .. http:get:: /api/apps/(string:id)/perms/
   154  
   155    List all permissions granted to this app.
   156  
   157  .. http:post:: /api/apps/(string:id)/perms/
   158  
   159    Create a new app permission.
   160  
   161  
   162  Keys
   163  ====
   164  
   165  .. http:get:: /api/keys/(string:id)/
   166  
   167    Retrieve a :class:`~api.models.Key` by its `id`.
   168  
   169  .. http:delete:: /api/keys/(string:id)/
   170  
   171    Destroy a :class:`~api.models.Key` by its `id`.
   172  
   173  .. http:get:: /api/keys/
   174  
   175    List all :class:`~api.models.Key`\s.
   176  
   177  .. http:post:: /api/keys/
   178  
   179    Create a new :class:`~api.models.Key`.
   180  
   181  
   182  API Hooks
   183  =========
   184  
   185  .. http:post:: /api/hooks/push/
   186  
   187    Create a new :class:`~api.models.Push`.
   188  
   189  .. http:post:: /api/hooks/build/
   190  
   191    Create a new :class:`~api.models.Build`.
   192  
   193  .. http:post:: /api/hooks/config/
   194  
   195    Retrieve latest application :class:`~api.models.Config`.
   196  
   197  
   198  Auth
   199  ====
   200  
   201  .. http:post:: /api/auth/register/
   202  
   203    Create a new :class:`~django.contrib.auth.models.User`.
   204  
   205  .. http:delete:: /api/auth/register/
   206  
   207    Destroy the logged-in :class:`~django.contrib.auth.models.User`.
   208  
   209  .. http:post:: /api/auth/login
   210  
   211    Authenticate for the REST framework.
   212  
   213  .. http:post:: /api/auth/logout
   214  
   215    Clear authentication for the REST framework.
   216  
   217  .. http:get:: /api/generate-api-key/
   218  
   219    Generate an API key.
   220  
   221  
   222  Admin Sharing
   223  =============
   224  
   225  .. http:delete:: /api/admin/perms/(string:username)/
   226  
   227    Destroy an admin permission by its `username`.
   228  
   229  .. http:get:: /api/admin/perms/
   230  
   231    List all admin permissions granted.
   232  
   233  .. http:post:: /api/admin/perms/
   234  
   235    Create a new admin permission.
   236  
   237  """
   238  
   239  from __future__ import unicode_literals
   240  
   241  from django.conf import settings
   242  from django.conf.urls import include
   243  from django.conf.urls import patterns
   244  from django.conf.urls import url
   245  
   246  from api import routers
   247  from api import views
   248  
   249  
   250  router = routers.ApiRouter()
   251  
   252  # Add the generated REST URLs and login/logout endpoint
   253  urlpatterns = patterns(
   254      '',
   255      url(r'^', include(router.urls)),
   256      # clusters
   257      url(r'^clusters/(?P<id>[-_\w]+)/?',
   258          views.ClusterViewSet.as_view({
   259              'get': 'retrieve', 'patch': 'partial_update', 'delete': 'destroy'})),
   260      url(r'^clusters/?',
   261          views.ClusterViewSet.as_view({'get': 'list', 'post': 'create'})),
   262      # application release components
   263      url(r'^apps/(?P<id>{})/config/?'.format(settings.APP_URL_REGEX),
   264          views.AppConfigViewSet.as_view({'get': 'retrieve', 'post': 'create'})),
   265      url(r'^apps/(?P<id>{})/builds/(?P<uuid>[-_\w]+)/?'.format(settings.APP_URL_REGEX),
   266          views.AppBuildViewSet.as_view({'get': 'retrieve'})),
   267      url(r'^apps/(?P<id>{})/builds/?'.format(settings.APP_URL_REGEX),
   268          views.AppBuildViewSet.as_view({'get': 'list', 'post': 'create'})),
   269      url(r'^apps/(?P<id>{})/releases/v(?P<version>[0-9]+)/?'.format(settings.APP_URL_REGEX),
   270          views.AppReleaseViewSet.as_view({'get': 'retrieve'})),
   271      url(r'^apps/(?P<id>{})/releases/rollback/?'.format(settings.APP_URL_REGEX),
   272          views.AppReleaseViewSet.as_view({'post': 'rollback'})),
   273      url(r'^apps/(?P<id>{})/releases/?'.format(settings.APP_URL_REGEX),
   274          views.AppReleaseViewSet.as_view({'get': 'list'})),
   275      # application infrastructure
   276      url(r'^apps/(?P<id>{})/containers/(?P<type>[-_\w]+)/(?P<num>[-_\w]+)/?'.format(
   277          settings.APP_URL_REGEX),
   278          views.AppContainerViewSet.as_view({'get': 'retrieve'})),
   279      url(r'^apps/(?P<id>{})/containers/(?P<type>[-_\w.]+)/?'.format(settings.APP_URL_REGEX),
   280          views.AppContainerViewSet.as_view({'get': 'list'})),
   281      url(r'^apps/(?P<id>{})/containers/?'.format(settings.APP_URL_REGEX),
   282          views.AppContainerViewSet.as_view({'get': 'list'})),
   283      # application domains
   284      url(r'^apps/(?P<id>{})/domains/(?P<domain>[-\._\w]+)/?'.format(settings.APP_URL_REGEX),
   285          views.DomainViewSet.as_view({'delete': 'destroy'})),
   286      url(r'^apps/(?P<id>{})/domains/?'.format(settings.APP_URL_REGEX),
   287          views.DomainViewSet.as_view({'post': 'create', 'get': 'list'})),
   288      # application actions
   289      url(r'^apps/(?P<id>{})/scale/?'.format(settings.APP_URL_REGEX),
   290          views.AppViewSet.as_view({'post': 'scale'})),
   291      url(r'^apps/(?P<id>{})/logs/?'.format(settings.APP_URL_REGEX),
   292          views.AppViewSet.as_view({'post': 'logs'})),
   293      url(r'^apps/(?P<id>{})/run/?'.format(settings.APP_URL_REGEX),
   294          views.AppViewSet.as_view({'post': 'run'})),
   295      url(r'^apps/(?P<id>{})/calculate/?'.format(settings.APP_URL_REGEX),
   296          views.AppViewSet.as_view({'post': 'calculate'})),
   297      # apps sharing
   298      url(r'^apps/(?P<id>{})/perms/(?P<username>[-_\w]+)/?'.format(settings.APP_URL_REGEX),
   299          views.AppPermsViewSet.as_view({'delete': 'destroy'})),
   300      url(r'^apps/(?P<id>{})/perms/?'.format(settings.APP_URL_REGEX),
   301          views.AppPermsViewSet.as_view({'get': 'list', 'post': 'create'})),
   302      # apps base endpoint
   303      url(r'^apps/(?P<id>{})/?'.format(settings.APP_URL_REGEX),
   304          views.AppViewSet.as_view({'get': 'retrieve', 'delete': 'destroy'})),
   305      url(r'^apps/?',
   306          views.AppViewSet.as_view({'get': 'list', 'post': 'create'})),
   307      # key
   308      url(r'^keys/(?P<id>.+)/?',
   309          views.KeyViewSet.as_view({
   310              'get': 'retrieve', 'delete': 'destroy'})),
   311      url(r'^keys/?',
   312          views.KeyViewSet.as_view({'get': 'list', 'post': 'create'})),
   313      # hooks
   314      url(r'^hooks/push/?',
   315          views.PushHookViewSet.as_view({'post': 'create'})),
   316      url(r'^hooks/build/?',
   317          views.BuildHookViewSet.as_view({'post': 'create'})),
   318      url(r'^hooks/config/?',
   319          views.ConfigHookViewSet.as_view({'post': 'create'})),
   320      # authn / authz
   321      url(r'^auth/register/?',
   322          views.UserRegistrationView.as_view({'post': 'create'})),
   323      url(r'^auth/cancel/?',
   324          views.UserCancellationView.as_view({'delete': 'destroy'})),
   325      url(r'^auth/',
   326          include('rest_framework.urls', namespace='rest_framework')),
   327      url(r'^generate-api-key/',
   328          'rest_framework.authtoken.views.obtain_auth_token'),
   329      # admin sharing
   330      url(r'^admin/perms/(?P<username>[-_\w]+)/?',
   331          views.AdminPermsViewSet.as_view({'delete': 'destroy'})),
   332      url(r'^admin/perms/?',
   333          views.AdminPermsViewSet.as_view({'get': 'list', 'post': 'create'})),
   334  )