Skip to content

Commit

Permalink
Deprecating and Removing Crossbar API version 1 (2600hz#6152)
Browse files Browse the repository at this point in the history
Starting with next major version (v5.0) we no longer support Crossbar
version 1 modules. Version 1 has been deprecated for a long time and
we no longer use it.

* Removing all v1 modules.
* Move all v2 modules to non-versioned modules.
* Remove code that doing special cares for version 1.
* Remove v1 from supported version macro.
* Return `410 Gone` HTTP error for `/v1/` requests to let clients know
  that version 1 is not supported anymore.
* Remove deprecated Crossbar modules:
	* `cb_bulk `: Old unused, error prone, and version 1
          API. There is no substituted API.
	* `cb_freeswitch`: Old unused module. There is no substituted
          API.
	* `cb_global_provisioner_templates`: Long deprecated and
	  unsupported provisioner, you should use already migrated to
          the new 2600Hz provisioner.
	* `cb_local_provisioner_templates`: Long deprecated and
	  unsupported provisioner, you should use already migrated to
	  the new 2600Hz provisioner.
	* `cb_local_resources`: APIs for `/local_resources` and
	  `/global_resources` are deprecated for along time. Use the
	  new `/resources` API with or without `{ACCOUNT_ID}` for
	  configuring global or local resources instead.
	* `cb_onboard`: Old unused, error prone modules. There is no
          substituted API.
	* `cb_shared_auth`: Old unused module with possible security
	  issues.
	* `cb_templates`
	* `cb_ubiquiti_auth` and `cb_ubiquiti_util`
* Relocate non-api files from `modules` folder to another location
    * `src/modules/cb_migration_disable_notify.erl` →
      `src/crossbart_migration.erl`: refactor `cb_migration` to call
      `crossbar_migration` with migration type
    * `src/modules/cb_modules_util.erl` → `src/cb_modules_util.erl`
    * `src/modules/cb_jobs_listener.erl` → `crossbar_jobs_listener.erl`
    * `src/modules/notification_util.erl` → `src/crossbar_notify_util.erl`
    * `src/modules/phonebook.erl` → `core/kazoo_number_manager/src/knm_phonebook.erl`
* Combine `cb_local_resources` and `cb_resources`
* These long deprecated and unsupported provisioner are remove:
    * `super_awesome_provisioner`
    * `awesome_provisioner`
    * `simple_provisioner`
    * Database `global_provisioner` used by these provisioners are remove.
  • Loading branch information
icehess authored and jamesaimonetti committed Nov 22, 2019
1 parent 4526c80 commit 333e778
Show file tree
Hide file tree
Showing 150 changed files with 788 additions and 10,224 deletions.
2 changes: 0 additions & 2 deletions applications/blackhole/src/blackhole.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
,'bh_authz_subscribe'
]).

-define(VERSION_SUPPORTED, [<<"v1">>]).

-type bh_subscribe_result() :: {'ok', bh_context:context()} | {'error', kz_term:ne_binary()}.

-record(bh_context, {auth_token = <<>> :: kz_term:api_binary() | '_'
Expand Down
10 changes: 5 additions & 5 deletions applications/cccp/doc/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@

####Add PIN

curl -X PUT -H X-Auth-Token:{AUTH_TOKEN} https://{SERVER}:8443/v1/accounts/{ACCOUNT_ID}/cccps -d '{"data":{"pin":"150674729083", "user_id":"e6da57c768533ebf0d349845394ccf26", "active":true, "cid_retain": false}}'
curl -X PUT -H X-Auth-Token:{AUTH_TOKEN} https://{SERVER}:8443/v2/accounts/{ACCOUNT_ID}/cccps -d '{"data":{"pin":"150674729083", "user_id":"e6da57c768533ebf0d349845394ccf26", "active":true, "cid_retain": false}}'

####Add CID

curl -X PUT -H X-Auth-Token:{AUTH_TOKEN} https://{SERVER}:8443/v1/accounts/{ACCOUNT_ID}/cccps -d '{"data":{"cid":"78121234567", "user_id":"e6da57c768533ebf0d349845394ccf26", "active":true, "cid_retain": true}}'
curl -X PUT -H X-Auth-Token:{AUTH_TOKEN} https://{SERVER}:8443/v2/accounts/{ACCOUNT_ID}/cccps -d '{"data":{"cid":"78121234567", "user_id":"e6da57c768533ebf0d349845394ccf26", "active":true, "cid_retain": true}}'

####Delete CID/PIN

curl -X DELETE -H X-Auth-Token:{AUTH_TOKEN} https://{SERVER}:8443/v1/accounts/{ACCOUNT_ID}/cccps/{DOC_ID}
curl -X DELETE -H X-Auth-Token:{AUTH_TOKEN} https://{SERVER}:8443/v2/accounts/{ACCOUNT_ID}/cccps/{DOC_ID}

####Call initiation over API:

curl -X PUT -H X-Auth-Token:{AUTH_TOKEN} https://{SERVER}:8443/v1/accounts/{ACCOUNT_ID}/cccps/autodial -d '{"data": { "a_leg_number": "1234567", "b_leg_number": "5579", "callback_delay": 10, "cid_retain": true, "media_id": "74c3e22b5dd9ff473de4ba2aea4e4183"}}'
curl -X PUT -H X-Auth-Token:{AUTH_TOKEN} https://{SERVER}:8443/v1/accounts/{ACCOUNT_ID}/cccps/autodial -d '{"data": { "a_leg_number": "1234567", "b_leg_number": "{CONFERENCE_ID}", "media_id": "74c3e22b5dd9ff473de4ba2aea4e4183"}}'
curl -X PUT -H X-Auth-Token:{AUTH_TOKEN} https://{SERVER}:8443/v2/accounts/{ACCOUNT_ID}/cccps/autodial -d '{"data": { "a_leg_number": "1234567", "b_leg_number": "5579", "callback_delay": 10, "cid_retain": true, "media_id": "74c3e22b5dd9ff473de4ba2aea4e4183"}}'
curl -X PUT -H X-Auth-Token:{AUTH_TOKEN} https://{SERVER}:8443/v2/accounts/{ACCOUNT_ID}/cccps/autodial -d '{"data": { "a_leg_number": "1234567", "b_leg_number": "{CONFERENCE_ID}", "media_id": "74c3e22b5dd9ff473de4ba2aea4e4183"}}'
6 changes: 2 additions & 4 deletions applications/crossbar/doc/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ Requests Crossbar follows this structure:

Here the explanation:

* `{VERSION}` - The version of the API you are calling.
* `v1` - Most APIs respond on the `v1`
* `v2` - A select number of APIs have newer behaviour. If you used the its `v1` version, it will work as before.
* `{VERSION}` - The version of the API you are calling. Currently the only support value is `v2`.
* `{ACCOUNT_ID}` - Most requests operate against a specific account and thus require the `account_id` to route the request properly
* `{RESOURCE_ID}` - When accessing a specific resource, like a device, user, or callflow, this is the `{RESOURCE_ID}` points to the specific instance you're accessing.

Expand Down Expand Up @@ -151,7 +149,7 @@ When receiving JSON responses, clients will receive the response in an envelope.

## Pagination

All listing APIs in `v2` will be paginated by default (`v1` will operate as before without pagination).
All listing APIs will be paginated by default.

Let's take a look at the CDRs API to see how to interpret pagination.

Expand Down
31 changes: 0 additions & 31 deletions applications/crossbar/doc/bulk.md

This file was deleted.

4 changes: 0 additions & 4 deletions applications/crossbar/doc/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,10 @@ Some modules use the `crossbar` namespace to create a specific `system_config` d
##### `crossbar.cdrs`
##### `crossbar.devices`
##### `crossbar.fax`
##### `crossbar.freeswitch`
##### `crossbar.local_resources`
##### `crossbar.media`
##### `crossbar.notifications`
##### `crossbar.onboard`
##### `crossbar.port_requests`
##### `crossbar.presence`
##### `crossbar.provisioner_templates`
##### `crossbar.queues`
##### `crossbar.resource_selectors`
##### `crossbar.resource_templates`
Expand Down
10 changes: 0 additions & 10 deletions applications/crossbar/doc/freeswitch.md

This file was deleted.

87 changes: 0 additions & 87 deletions applications/crossbar/doc/global_provisioner_templates.md

This file was deleted.

30 changes: 0 additions & 30 deletions applications/crossbar/doc/limits.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,36 +51,6 @@ curl -v -X GET \

> POST /v2/accounts/{ACCOUNT_ID}/limits
First using API v1 (simplest):

```shell
curl -v -X POST \
-H "X-Auth-Token: {AUTH_TOKEN}" \
-d '{"data": {
"twoway_trunks": 0,
"inbound_trunks": 11,
"id": "limits",
"allow_prepay": true,
"outbound_trunks": 5
}}' \
http://{SERVER}:8000/v1/accounts/{ACCOUNT_ID}/limits
```

```json
{
"data": {
"twoway_trunks": 0,
"inbound_trunks": 11,
"id": "limits",
"allow_prepay": true,
"outbound_trunks": 5
},
"status": "success",
}
```

Now with API v2:

```shell
curl -v -X POST \
-H "X-Auth-Token: {AUTH_TOKEN}" \
Expand Down
27 changes: 0 additions & 27 deletions applications/crossbar/doc/lists.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,30 +186,3 @@ curl -v -X GET \
-H "X-Auth-Token: {AUTH_TOKEN}" \
http://{SERVER}:8000/v2/accounts/{ACCOUNT_ID}/lists/{LIST_ID}/entries/{LIST_ENTRY_ID}/vcard
```


#### v1 examples.

##### Get lists and their entries
curl -v -X GET -H "X-Auth-Token: {AUTH_TOKEN}" http://server.com:8000/v1/accounts/{ACCOUNT_ID}/lists

##### Create new list
curl -v -X PUT -H "X-Auth-Token: {AUTH_TOKEN}" http://server.com:8000/v1/accounts/{ACCOUNT_ID}/lists -d '{"data": {"name": "List name"}}'

##### Get list with LIST_ID
curl -v -X GET -H "X-Auth-Token: {AUTH_TOKEN}" http://server.com:8000/v1/accounts/{ACCOUNT_ID}/lists/{LIST_ID}

##### Add new entry to list
curl -v -X PUT -H "X-Auth-Token: {AUTH_TOKEN}" http://server.com:8000/v1/accounts/{ACCOUNT_ID}/lists/{LIST_ID} -d '{"data": {"pattern": "345"}}'

##### Delete list
curl -v -X DELETE -H "X-Auth-Token: {AUTH_TOKEN}" http://server.com:8000/v1/accounts/{ACCOUNT_ID}/lists/{LIST_ID}

##### Get entry {LIST_ENTRY_ID} from list {LIST_ID}
curl -v -X GET -H "X-Auth-Token: {AUTH_TOKEN}" http://server.com:8000/v1/accounts/{ACCOUNT_ID}/lists/{LIST_ID}/{LIST_ENTRY_ID}

##### Rewrite entry {LIST_ENTRY_ID} in list {LIST_ID}
curl -v -X POST -H "X-Auth-Token: {AUTH_TOKEN}" http://server.com:8000/v1/accounts/{ACCOUNT_ID}/lists/{LIST_ID}/{LIST_ENTRY_ID} -d "{"data": {"132", "321"}}"

##### Delete entry from list
curl -v -X DELETE -H "X-Auth-Token: {AUTH_TOKEN}" http://server.com:8000/v1/accounts/{ACCOUNT_ID}/lists/{LIST_ID}/entries/{LIST_ENTRY_ID}
87 changes: 0 additions & 87 deletions applications/crossbar/doc/local_provisioner_templates.md

This file was deleted.

10 changes: 0 additions & 10 deletions applications/crossbar/doc/onboard.md

This file was deleted.

Loading

0 comments on commit 333e778

Please sign in to comment.