adds documentation for new tenant crud
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/7c7ace41 Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/7c7ace41 Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/7c7ace41 Branch: refs/heads/master Commit: 7c7ace4170c5adadaf4cbce553853a3899bfde09 Parents: da494df Author: Jeremy Mitchell <mitchell...@gmail.com> Authored: Thu Mar 16 21:13:50 2017 -0600 Committer: Jeremy Mitchell <mitchell...@gmail.com> Committed: Sun Mar 19 19:08:28 2017 -0600 ---------------------------------------------------------------------- docs/source/development/traffic_ops.rst | 1 + .../development/traffic_ops_api/v12/tenant.rst | 242 +++++++++++++++++++ 2 files changed, 243 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/7c7ace41/docs/source/development/traffic_ops.rst ---------------------------------------------------------------------- diff --git a/docs/source/development/traffic_ops.rst b/docs/source/development/traffic_ops.rst index 57ea3ef..41ad9cd 100644 --- a/docs/source/development/traffic_ops.rst +++ b/docs/source/development/traffic_ops.rst @@ -625,6 +625,7 @@ API 1.2 Reference traffic_ops_api/v12/static_dns traffic_ops_api/v12/status traffic_ops_api/v12/system + traffic_ops_api/v12/tenant traffic_ops_api/v12/to_extension traffic_ops_api/v12/type traffic_ops_api/v12/user http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/7c7ace41/docs/source/development/traffic_ops_api/v12/tenant.rst ---------------------------------------------------------------------- diff --git a/docs/source/development/traffic_ops_api/v12/tenant.rst b/docs/source/development/traffic_ops_api/v12/tenant.rst new file mode 100644 index 0000000..afdcaa7 --- /dev/null +++ b/docs/source/development/traffic_ops_api/v12/tenant.rst @@ -0,0 +1,242 @@ +.. +.. +.. Licensed 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. +.. + +.. _to-api-v12-tenant: + +Tenants +======= + +.. _to-api-v12-tenant-route: + +/api/1.2/tenants +++++++++++++++++++ + +**GET /api/1.2/tenants** + + Get all tenants. + + Authentication Required: Yes + + Role(s) Required: None + + **Response Properties** + + +----------------------+--------+-------------------------------------------------+ + | Parameter | Type | Description | + +======================+========+=================================================+ + |``id`` | int | Tenant id | + +----------------------+--------+-------------------------------------------------+ + |``name`` | string | Tenant name | + +----------------------+--------+-------------------------------------------------+ + |``active`` | bool | Active or inactive | + +----------------------+--------+-------------------------------------------------+ + |``parentId`` | int | Parent tenant | + +----------------------+--------+-------------------------------------------------+ + + **Response Example** :: + + { + "response": [ + { + "id": 1 + "name": "root", + "active": true, + "parentId": null, + }, + { + "id": 2 + "name": "tenant-a", + "active": true, + "parentId": 1 + } + ] + } + +| + + +**GET /api/1.2/tenants/:id** + + Get a tenant by ID. + + Authentication Required: Yes + + Role(s) Required: None + + **Response Properties** + + +----------------------+--------+-------------------------------------------------+ + | Parameter | Type | Description | + +======================+========+=================================================+ + |``id`` | int | Tenant id | + +----------------------+--------+-------------------------------------------------+ + |``name`` | string | Tenant name | + +----------------------+--------+-------------------------------------------------+ + |``active`` | bool | Active or inactive | + +----------------------+--------+-------------------------------------------------+ + |``parentId`` | int | Parent tenant | + +----------------------+--------+-------------------------------------------------+ + + **Response Example** :: + + { + "response": [ + { + "id": 2 + "name": "tenant-a", + "active": true, + "parentId": 1, + } + ] + } + +| + + +**PUT /api/1.2/tenants/:id** + + Update a tenant. + + Authentication Required: Yes + + Role(s) Required: admin or oper + + **Request Route Parameters** + + +-------------------+----------+------------------------------------------------+ + | Name | Type | Description | + +===================+==========+================================================+ + | ``id`` | int | Tenant id | + +-------------------+----------+------------------------------------------------+ + + **Request Properties** + + +-------------------+----------+--------------------------+ + | Parameter | Required | Description | + +===================+==========+==========================+ + | ``name`` | yes | The name of the tenant | + +-------------------+----------+--------------------------+ + | ``active`` | yes | True or false | + +-------------------+----------+--------------------------+ + | ``parentId`` | yes | Parent tenant | + +-------------------+----------+--------------------------+ + + **Request Example** :: + + { + "name": "my-tenant" + "active": true + "parentId": 1 + } + +| + + **Response Properties** + + +----------------------+--------+-------------------------------------------------+ + | Parameter | Type | Description | + +======================+========+=================================================+ + |``id`` | int | Tenant id | + +----------------------+--------+-------------------------------------------------+ + |``name`` | string | Tenant name | + +----------------------+--------+-------------------------------------------------+ + |``active`` | bool | Active or inactive | + +----------------------+--------+-------------------------------------------------+ + |``parentId`` | int | Parent tenant | + +----------------------+--------+-------------------------------------------------+ + + **Response Example** :: + + { + "response": { + "id": 2, + "name": "my-tenant", + "active": true, + "parentId": 1, + "lastUpdated": "2014-03-18 08:57:39" + }, + "alerts": [ + { + "level": "success", + "text": "Tenant update was successful." + } + ] + } + +| + + +**POST /api/1.2/tenants** + + Create a tenant. + + Authentication Required: Yes + + Role(s) Required: admin or oper + + **Request Properties** + + +-------------------+----------+--------------------------+ + | Parameter | Required | Description | + +===================+==========+==========================+ + | ``name`` | yes | The name of the tenant | + +-------------------+----------+--------------------------+ + | ``active`` | no | Defaults to false | + +-------------------+----------+--------------------------+ + | ``parentId`` | yes | Parent tenant | + +-------------------+----------+--------------------------+ + + **Request Example** :: + + { + "name": "your-tenant" + "parentId": 2 + } + +| + + **Response Properties** + + +----------------------+--------+-------------------------------------------------+ + | Parameter | Type | Description | + +======================+========+=================================================+ + |``id`` | int | Tenant id | + +----------------------+--------+-------------------------------------------------+ + |``name`` | string | Tenant name | + +----------------------+--------+-------------------------------------------------+ + |``active`` | bool | Active or inactive | + +----------------------+--------+-------------------------------------------------+ + |``parentId`` | int | Parent tenant | + +----------------------+--------+-------------------------------------------------+ + + **Response Example** :: + + { + "response": { + "id": 2, + "name": "your-tenant", + "active": false, + "parentId": 2, + "lastUpdated": "2014-03-18 08:57:39" + }, + "alerts": [ + { + "level": "success", + "text": "Tenant create was successful." + } + ] + } + +|