aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordglFromAtt <dgl@research.att.com>2019-01-04 13:44:03 -0500
committerdglFromAtt <dgl@research.att.com>2019-01-04 13:44:11 -0500
commit536c6aabdfd2bcdc493501a9498fb8a97d208c0b (patch)
tree52e32020ce8eeabb2ba745c5ba275bd7ae82c99e
parent297ea699d8f7f3be96abea6c28e4204f7c4687a4 (diff)
Patch set 2: changes to MR_Client
Also introduces new AAF API call (userRoles) Change-Id: I9861fe7f3339ced504f006da7aaa159a3cd67b70 Signed-off-by: dglFromAtt <dgl@research.att.com> Issue-ID: DMAAP-856
-rw-r--r--docs/api.rst229
-rw-r--r--pom.xml2
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/aaf/AafService.java4
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/aaf/AafUserRole.java69
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/model/DmaapObject.java4
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/model/MR_Client.java45
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/model/Topic.java23
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/resources/MR_ClientResource.java17
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/resources/TopicResource.java7
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/service/MR_ClientService.java58
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/service/TopicService.java2
-rw-r--r--src/main/resources/schema_11.sql3
-rw-r--r--version.properties2
13 files changed, 278 insertions, 187 deletions
diff --git a/docs/api.rst b/docs/api.rst
index 5ba2eef..9eab4da 100644
--- a/docs/api.rst
+++ b/docs/api.rst
@@ -289,7 +289,6 @@ Type: :ref:`DcaeLocation <d_47d80e451933beb623fcf5257867cbcb>`
"local": true,
"openStackAvailabilityZone": "somestring",
"status": "EMPTY",
- "statusValid": true,
"subnet": "somestring"
}
@@ -371,7 +370,6 @@ Type: :ref:`DcaeLocation <d_47d80e451933beb623fcf5257867cbcb>`
"local": true,
"openStackAvailabilityZone": "somestring",
"status": "EMPTY",
- "statusValid": true,
"subnet": "somestring"
}
@@ -396,7 +394,6 @@ Type: :ref:`DcaeLocation <d_47d80e451933beb623fcf5257867cbcb>`
"local": true,
"openStackAvailabilityZone": "somestring",
"status": "EMPTY",
- "statusValid": true,
"subnet": "somestring"
}
@@ -478,7 +475,6 @@ Type: :ref:`DcaeLocation <d_47d80e451933beb623fcf5257867cbcb>`
"local": true,
"openStackAvailabilityZone": "somestring",
"status": "EMPTY",
- "statusValid": true,
"subnet": "somestring"
}
@@ -550,7 +546,6 @@ Type: :ref:`DcaeLocation <d_47d80e451933beb623fcf5257867cbcb>`
"local": true,
"openStackAvailabilityZone": "somestring",
"status": "EMPTY",
- "statusValid": true,
"subnet": "somestring"
}
@@ -632,7 +627,6 @@ Type: :ref:`DcaeLocation <d_47d80e451933beb623fcf5257867cbcb>`
"local": true,
"openStackAvailabilityZone": "somestring",
"status": "EMPTY",
- "statusValid": true,
"subnet": "somestring"
}
@@ -662,7 +656,7 @@ DMAAP
~~~~~
-Endpoint for this instance of DMaaP object containing values for this OpenDCAE deployment
+V2 Endpoint for this instance of DMaaP object containing values for this OpenDCAE deployment
@@ -713,7 +707,6 @@ Type: :ref:`Dmaap <d_4ea0e7758a1f8502222793e4a13b04f7>`
"loggingUrl": "somestring",
"nodeKey": "somestring",
"status": "EMPTY",
- "statusValid": true,
"topicNsRoot": "somestring",
"version": "somestring"
}
@@ -786,7 +779,6 @@ Type: :ref:`Dmaap <d_4ea0e7758a1f8502222793e4a13b04f7>`
"loggingUrl": "somestring",
"nodeKey": "somestring",
"status": "EMPTY",
- "statusValid": true,
"topicNsRoot": "somestring",
"version": "somestring"
}
@@ -859,7 +851,6 @@ Type: :ref:`Dmaap <d_4ea0e7758a1f8502222793e4a13b04f7>`
"loggingUrl": "somestring",
"nodeKey": "somestring",
"status": "EMPTY",
- "statusValid": true,
"topicNsRoot": "somestring",
"version": "somestring"
}
@@ -932,7 +923,6 @@ Type: :ref:`Dmaap <d_4ea0e7758a1f8502222793e4a13b04f7>`
"loggingUrl": "somestring",
"nodeKey": "somestring",
"status": "EMPTY",
- "statusValid": true,
"topicNsRoot": "somestring",
"version": "somestring"
}
@@ -1005,7 +995,6 @@ Type: :ref:`Dmaap <d_4ea0e7758a1f8502222793e4a13b04f7>`
"loggingUrl": "somestring",
"nodeKey": "somestring",
"status": "EMPTY",
- "statusValid": true,
"topicNsRoot": "somestring",
"version": "somestring"
}
@@ -1078,7 +1067,6 @@ Type: :ref:`Dmaap <d_4ea0e7758a1f8502222793e4a13b04f7>`
"loggingUrl": "somestring",
"nodeKey": "somestring",
"status": "EMPTY",
- "statusValid": true,
"topicNsRoot": "somestring",
"version": "somestring"
}
@@ -1157,7 +1145,6 @@ Type: :ref:`DR_Node <d_d15e2cee407536866c875375e3f705e0>`
"hostName": "somestring",
"lastMod": "2015-01-01T15:00:00.000Z",
"status": "EMPTY",
- "statusValid": true,
"version": "somestring"
}
@@ -1236,7 +1223,6 @@ Type: :ref:`DR_Node <d_d15e2cee407536866c875375e3f705e0>`
"hostName": "somestring",
"lastMod": "2015-01-01T15:00:00.000Z",
"status": "EMPTY",
- "statusValid": true,
"version": "somestring"
}
@@ -1258,7 +1244,6 @@ Type: :ref:`DR_Node <d_d15e2cee407536866c875375e3f705e0>`
"hostName": "somestring",
"lastMod": "2015-01-01T15:00:00.000Z",
"status": "EMPTY",
- "statusValid": true,
"version": "somestring"
}
@@ -1337,7 +1322,6 @@ Type: :ref:`DR_Node <d_d15e2cee407536866c875375e3f705e0>`
"hostName": "somestring",
"lastMod": "2015-01-01T15:00:00.000Z",
"status": "EMPTY",
- "statusValid": true,
"version": "somestring"
}
@@ -1406,7 +1390,6 @@ Type: :ref:`DR_Node <d_d15e2cee407536866c875375e3f705e0>`
"hostName": "somestring",
"lastMod": "2015-01-01T15:00:00.000Z",
"status": "EMPTY",
- "statusValid": true,
"version": "somestring"
}
@@ -1485,7 +1468,6 @@ Type: :ref:`DR_Node <d_d15e2cee407536866c875375e3f705e0>`
"hostName": "somestring",
"lastMod": "2015-01-01T15:00:00.000Z",
"status": "EMPTY",
- "statusValid": true,
"version": "somestring"
}
@@ -1563,7 +1545,6 @@ Type: :ref:`DR_Pub <d_e926d3fa8701e0cc9c8ed1761b3255cd>`
"lastMod": "2015-01-01T15:00:00.000Z",
"pubId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"username": "somestring",
"userpwd": "somestring"
}
@@ -1643,7 +1624,6 @@ Type: :ref:`DR_Pub <d_e926d3fa8701e0cc9c8ed1761b3255cd>`
"lastMod": "2015-01-01T15:00:00.000Z",
"pubId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"username": "somestring",
"userpwd": "somestring"
}
@@ -1666,7 +1646,6 @@ Type: :ref:`DR_Pub <d_e926d3fa8701e0cc9c8ed1761b3255cd>`
"lastMod": "2015-01-01T15:00:00.000Z",
"pubId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"username": "somestring",
"userpwd": "somestring"
}
@@ -1746,7 +1725,6 @@ Type: :ref:`DR_Pub <d_e926d3fa8701e0cc9c8ed1761b3255cd>`
"lastMod": "2015-01-01T15:00:00.000Z",
"pubId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"username": "somestring",
"userpwd": "somestring"
}
@@ -1816,7 +1794,6 @@ Type: :ref:`DR_Pub <d_e926d3fa8701e0cc9c8ed1761b3255cd>`
"lastMod": "2015-01-01T15:00:00.000Z",
"pubId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"username": "somestring",
"userpwd": "somestring"
}
@@ -1896,7 +1873,6 @@ Type: :ref:`DR_Pub <d_e926d3fa8701e0cc9c8ed1761b3255cd>`
"lastMod": "2015-01-01T15:00:00.000Z",
"pubId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"username": "somestring",
"userpwd": "somestring"
}
@@ -1981,7 +1957,6 @@ Type: :ref:`DR_Sub <d_48cf328d246f41e1d11a09251b042f02>`
"logURL": "somestring",
"owner": "somestring",
"status": "EMPTY",
- "statusValid": true,
"subId": "somestring",
"suspended": true,
"use100": true,
@@ -2070,7 +2045,6 @@ Type: :ref:`DR_Sub <d_48cf328d246f41e1d11a09251b042f02>`
"logURL": "somestring",
"owner": "somestring",
"status": "EMPTY",
- "statusValid": true,
"subId": "somestring",
"suspended": true,
"use100": true,
@@ -2159,7 +2133,6 @@ Type: :ref:`DR_Sub <d_48cf328d246f41e1d11a09251b042f02>`
"logURL": "somestring",
"owner": "somestring",
"status": "EMPTY",
- "statusValid": true,
"subId": "somestring",
"suspended": true,
"use100": true,
@@ -2238,7 +2211,6 @@ Type: :ref:`DR_Sub <d_48cf328d246f41e1d11a09251b042f02>`
"logURL": "somestring",
"owner": "somestring",
"status": "EMPTY",
- "statusValid": true,
"subId": "somestring",
"suspended": true,
"use100": true,
@@ -2327,7 +2299,6 @@ Type: :ref:`DR_Sub <d_48cf328d246f41e1d11a09251b042f02>`
"logURL": "somestring",
"owner": "somestring",
"status": "EMPTY",
- "statusValid": true,
"subId": "somestring",
"suspended": true,
"use100": true,
@@ -2435,7 +2406,6 @@ Type: :ref:`Feed <d_289ad39619725df26c9ff382d4c97c75>`
"lastMod": "2015-01-01T15:00:00.000Z",
"pubId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"username": "somestring",
"userpwd": "somestring"
},
@@ -2445,13 +2415,11 @@ Type: :ref:`Feed <d_289ad39619725df26c9ff382d4c97c75>`
"lastMod": "2015-01-01T15:00:00.000Z",
"pubId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"username": "somestring",
"userpwd": "somestring"
}
],
"status": "EMPTY",
- "statusValid": true,
"subs": [
{
"bytes": [
@@ -2465,7 +2433,6 @@ Type: :ref:`Feed <d_289ad39619725df26c9ff382d4c97c75>`
"logURL": "somestring",
"owner": "somestring",
"status": "EMPTY",
- "statusValid": true,
"subId": "somestring",
"suspended": true,
"use100": true,
@@ -2484,7 +2451,6 @@ Type: :ref:`Feed <d_289ad39619725df26c9ff382d4c97c75>`
"logURL": "somestring",
"owner": "somestring",
"status": "EMPTY",
- "statusValid": true,
"subId": "somestring",
"suspended": true,
"use100": true,
@@ -2587,7 +2553,6 @@ Type: :ref:`Feed <d_289ad39619725df26c9ff382d4c97c75>`
"lastMod": "2015-01-01T15:00:00.000Z",
"pubId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"username": "somestring",
"userpwd": "somestring"
},
@@ -2597,13 +2562,11 @@ Type: :ref:`Feed <d_289ad39619725df26c9ff382d4c97c75>`
"lastMod": "2015-01-01T15:00:00.000Z",
"pubId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"username": "somestring",
"userpwd": "somestring"
}
],
"status": "EMPTY",
- "statusValid": true,
"subs": [
{
"bytes": [
@@ -2617,7 +2580,6 @@ Type: :ref:`Feed <d_289ad39619725df26c9ff382d4c97c75>`
"logURL": "somestring",
"owner": "somestring",
"status": "EMPTY",
- "statusValid": true,
"subId": "somestring",
"suspended": true,
"use100": true,
@@ -2636,7 +2598,6 @@ Type: :ref:`Feed <d_289ad39619725df26c9ff382d4c97c75>`
"logURL": "somestring",
"owner": "somestring",
"status": "EMPTY",
- "statusValid": true,
"subId": "somestring",
"suspended": true,
"use100": true,
@@ -2682,7 +2643,6 @@ Type: :ref:`Feed <d_289ad39619725df26c9ff382d4c97c75>`
"lastMod": "2015-01-01T15:00:00.000Z",
"pubId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"username": "somestring",
"userpwd": "somestring"
},
@@ -2692,13 +2652,11 @@ Type: :ref:`Feed <d_289ad39619725df26c9ff382d4c97c75>`
"lastMod": "2015-01-01T15:00:00.000Z",
"pubId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"username": "somestring",
"userpwd": "somestring"
}
],
"status": "EMPTY",
- "statusValid": true,
"subs": [
{
"bytes": [
@@ -2712,7 +2670,6 @@ Type: :ref:`Feed <d_289ad39619725df26c9ff382d4c97c75>`
"logURL": "somestring",
"owner": "somestring",
"status": "EMPTY",
- "statusValid": true,
"subId": "somestring",
"suspended": true,
"use100": true,
@@ -2731,7 +2688,6 @@ Type: :ref:`Feed <d_289ad39619725df26c9ff382d4c97c75>`
"logURL": "somestring",
"owner": "somestring",
"status": "EMPTY",
- "statusValid": true,
"subId": "somestring",
"suspended": true,
"use100": true,
@@ -2818,7 +2774,6 @@ Type: :ref:`DR_Pub <d_e926d3fa8701e0cc9c8ed1761b3255cd>`
"lastMod": "2015-01-01T15:00:00.000Z",
"pubId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"username": "somestring",
"userpwd": "somestring"
}
@@ -2916,7 +2871,6 @@ Type: :ref:`Feed <d_289ad39619725df26c9ff382d4c97c75>`
"lastMod": "2015-01-01T15:00:00.000Z",
"pubId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"username": "somestring",
"userpwd": "somestring"
},
@@ -2926,13 +2880,11 @@ Type: :ref:`Feed <d_289ad39619725df26c9ff382d4c97c75>`
"lastMod": "2015-01-01T15:00:00.000Z",
"pubId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"username": "somestring",
"userpwd": "somestring"
}
],
"status": "EMPTY",
- "statusValid": true,
"subs": [
{
"bytes": [
@@ -2946,7 +2898,6 @@ Type: :ref:`Feed <d_289ad39619725df26c9ff382d4c97c75>`
"logURL": "somestring",
"owner": "somestring",
"status": "EMPTY",
- "statusValid": true,
"subId": "somestring",
"suspended": true,
"use100": true,
@@ -2965,7 +2916,6 @@ Type: :ref:`Feed <d_289ad39619725df26c9ff382d4c97c75>`
"logURL": "somestring",
"owner": "somestring",
"status": "EMPTY",
- "statusValid": true,
"subId": "somestring",
"suspended": true,
"use100": true,
@@ -3068,7 +3018,6 @@ Type: :ref:`Feed <d_289ad39619725df26c9ff382d4c97c75>`
"lastMod": "2015-01-01T15:00:00.000Z",
"pubId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"username": "somestring",
"userpwd": "somestring"
},
@@ -3078,13 +3027,11 @@ Type: :ref:`Feed <d_289ad39619725df26c9ff382d4c97c75>`
"lastMod": "2015-01-01T15:00:00.000Z",
"pubId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"username": "somestring",
"userpwd": "somestring"
}
],
"status": "EMPTY",
- "statusValid": true,
"subs": [
{
"bytes": [
@@ -3098,7 +3045,6 @@ Type: :ref:`Feed <d_289ad39619725df26c9ff382d4c97c75>`
"logURL": "somestring",
"owner": "somestring",
"status": "EMPTY",
- "statusValid": true,
"subId": "somestring",
"suspended": true,
"use100": true,
@@ -3117,7 +3063,6 @@ Type: :ref:`Feed <d_289ad39619725df26c9ff382d4c97c75>`
"logURL": "somestring",
"owner": "somestring",
"status": "EMPTY",
- "statusValid": true,
"subId": "somestring",
"suspended": true,
"use100": true,
@@ -3206,7 +3151,6 @@ Type: :ref:`Dmaap <d_4ea0e7758a1f8502222793e4a13b04f7>`
"loggingUrl": "somestring",
"nodeKey": "somestring",
"status": "EMPTY",
- "statusValid": true,
"topicNsRoot": "somestring",
"version": "somestring"
}
@@ -3250,14 +3194,14 @@ POST ``/mr_clients``
Summary
+++++++
-return MR_Client details
+Associate an MR_Client object to a Topic
Description
+++++++++++
.. raw:: html
- Create a `MR_Client` object.
+ Create a `MR_Client` object.The `dcaeLocation` attribute is used to match an `MR_Cluster` object with the same value, with the intent of localizing message traffic. In legacy implementation, the `clientRole` is granted appropriate permission in AAF. Newer implementions may instead specify an AAF Identity, which will be added to the appropriate `Topic` role.
Request
@@ -3284,13 +3228,13 @@ Type: :ref:`MR_Client <d_56ff81dc98986e27074d9be2731e3f4c>`
"somestring",
"somestring"
],
+ "clientIdentity": "somestring",
"clientRole": "somestring",
"dcaeLocationName": "somestring",
"fqtn": "somestring",
"lastMod": "2015-01-01T15:00:00.000Z",
"mrClientId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"topicURL": "somestring"
}
@@ -3324,7 +3268,7 @@ DELETE ``/mr_clients/{subId}``
Summary
+++++++
-return MR_Client details
+Delete an MR_Client object
Description
+++++++++++
@@ -3368,13 +3312,13 @@ Type: :ref:`MR_Client <d_56ff81dc98986e27074d9be2731e3f4c>`
"somestring",
"somestring"
],
+ "clientIdentity": "somestring",
"clientRole": "somestring",
"dcaeLocationName": "somestring",
"fqtn": "somestring",
"lastMod": "2015-01-01T15:00:00.000Z",
"mrClientId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"topicURL": "somestring"
}
@@ -3395,13 +3339,13 @@ Type: :ref:`MR_Client <d_56ff81dc98986e27074d9be2731e3f4c>`
"somestring",
"somestring"
],
+ "clientIdentity": "somestring",
"clientRole": "somestring",
"dcaeLocationName": "somestring",
"fqtn": "somestring",
"lastMod": "2015-01-01T15:00:00.000Z",
"mrClientId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"topicURL": "somestring"
}
@@ -3469,13 +3413,13 @@ Type: :ref:`MR_Client <d_56ff81dc98986e27074d9be2731e3f4c>`
"somestring",
"somestring"
],
+ "clientIdentity": "somestring",
"clientRole": "somestring",
"dcaeLocationName": "somestring",
"fqtn": "somestring",
"lastMod": "2015-01-01T15:00:00.000Z",
"mrClientId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"topicURL": "somestring"
}
@@ -3553,13 +3497,13 @@ Type: :ref:`MR_Client <d_56ff81dc98986e27074d9be2731e3f4c>`
"somestring",
"somestring"
],
+ "clientIdentity": "somestring",
"clientRole": "somestring",
"dcaeLocationName": "somestring",
"fqtn": "somestring",
"lastMod": "2015-01-01T15:00:00.000Z",
"mrClientId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"topicURL": "somestring"
}
@@ -3593,7 +3537,7 @@ PUT ``/mr_clients/{clientId}``
Summary
+++++++
-return MR_Client details
+Update an MR_Client object
Description
+++++++++++
@@ -3637,13 +3581,13 @@ Type: :ref:`MR_Client <d_56ff81dc98986e27074d9be2731e3f4c>`
"somestring",
"somestring"
],
+ "clientIdentity": "somestring",
"clientRole": "somestring",
"dcaeLocationName": "somestring",
"fqtn": "somestring",
"lastMod": "2015-01-01T15:00:00.000Z",
"mrClientId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"topicURL": "somestring"
}
@@ -3722,7 +3666,6 @@ Type: :ref:`MR_Cluster <d_eec7176a0080debe1b19c2dad2e97c24>`
"replicationGroup": "somestring",
"sourceReplicationPort": "somestring",
"status": "EMPTY",
- "statusValid": true,
"targetReplicationPort": "somestring",
"topicPort": "somestring",
"topicProtocol": "somestring"
@@ -3804,7 +3747,6 @@ Type: :ref:`MR_Cluster <d_eec7176a0080debe1b19c2dad2e97c24>`
"replicationGroup": "somestring",
"sourceReplicationPort": "somestring",
"status": "EMPTY",
- "statusValid": true,
"targetReplicationPort": "somestring",
"topicPort": "somestring",
"topicProtocol": "somestring"
@@ -3829,7 +3771,6 @@ Type: :ref:`MR_Cluster <d_eec7176a0080debe1b19c2dad2e97c24>`
"replicationGroup": "somestring",
"sourceReplicationPort": "somestring",
"status": "EMPTY",
- "statusValid": true,
"targetReplicationPort": "somestring",
"topicPort": "somestring",
"topicProtocol": "somestring"
@@ -3911,7 +3852,6 @@ Type: :ref:`MR_Cluster <d_eec7176a0080debe1b19c2dad2e97c24>`
"replicationGroup": "somestring",
"sourceReplicationPort": "somestring",
"status": "EMPTY",
- "statusValid": true,
"targetReplicationPort": "somestring",
"topicPort": "somestring",
"topicProtocol": "somestring"
@@ -3983,7 +3923,6 @@ Type: :ref:`MR_Cluster <d_eec7176a0080debe1b19c2dad2e97c24>`
"replicationGroup": "somestring",
"sourceReplicationPort": "somestring",
"status": "EMPTY",
- "statusValid": true,
"targetReplicationPort": "somestring",
"topicPort": "somestring",
"topicProtocol": "somestring"
@@ -4065,7 +4004,6 @@ Type: :ref:`MR_Cluster <d_eec7176a0080debe1b19c2dad2e97c24>`
"replicationGroup": "somestring",
"sourceReplicationPort": "somestring",
"status": "EMPTY",
- "statusValid": true,
"targetReplicationPort": "somestring",
"topicPort": "somestring",
"topicProtocol": "somestring"
@@ -4110,14 +4048,14 @@ POST ``/topics``
Summary
+++++++
-return Topic details
+Create a Topic object
Description
+++++++++++
.. raw:: html
- Create `Topic` object.
+ Create `Topic` object.For convenience, the message body may populate the `clients` array, in which case each entry will be added as an `MR_Client`. Beginning in ONAP Dublin Release, dbcapi will create two AAF Roles by default, one each for the publisher and subscriber per topic. MR_Clients can then specify an AAF Identity to be added to the appropriate default Role, avoiding the need to create Role(s) in advance.
Parameters
++++++++++
@@ -4150,23 +4088,19 @@ Type: :ref:`Topic <d_2e99841971da81b9d240071b86bf168d>`
.. code-block:: javascript
{
- "bytes": [
- "somestring",
- "somestring"
- ],
"clients": [
{
"action": [
"somestring",
"somestring"
],
+ "clientIdentity": "somestring",
"clientRole": "somestring",
"dcaeLocationName": "somestring",
"fqtn": "somestring",
"lastMod": "2015-01-01T15:00:00.000Z",
"mrClientId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"topicURL": "somestring"
},
{
@@ -4174,13 +4108,13 @@ Type: :ref:`Topic <d_2e99841971da81b9d240071b86bf168d>`
"somestring",
"somestring"
],
+ "clientIdentity": "somestring",
"clientRole": "somestring",
"dcaeLocationName": "somestring",
"fqtn": "somestring",
"lastMod": "2015-01-01T15:00:00.000Z",
"mrClientId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"topicURL": "somestring"
}
],
@@ -4189,13 +4123,13 @@ Type: :ref:`Topic <d_2e99841971da81b9d240071b86bf168d>`
"fqtnStyle": "FQTN_NOT_SPECIFIED",
"globalMrURL": "somestring",
"lastMod": "2015-01-01T15:00:00.000Z",
- "numClients": 1,
"owner": "somestring",
"partitionCount": "somestring",
+ "publisherRole": "somestring",
"replicationCase": "REPLICATION_NOT_SPECIFIED",
"replicationCount": "somestring",
"status": "EMPTY",
- "statusValid": true,
+ "subscriberRole": "somestring",
"tnxEnabled": "somestring",
"topicDescription": "somestring",
"topicName": "somestring",
@@ -4272,23 +4206,19 @@ Type: :ref:`Topic <d_2e99841971da81b9d240071b86bf168d>`
.. code-block:: javascript
{
- "bytes": [
- "somestring",
- "somestring"
- ],
"clients": [
{
"action": [
"somestring",
"somestring"
],
+ "clientIdentity": "somestring",
"clientRole": "somestring",
"dcaeLocationName": "somestring",
"fqtn": "somestring",
"lastMod": "2015-01-01T15:00:00.000Z",
"mrClientId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"topicURL": "somestring"
},
{
@@ -4296,13 +4226,13 @@ Type: :ref:`Topic <d_2e99841971da81b9d240071b86bf168d>`
"somestring",
"somestring"
],
+ "clientIdentity": "somestring",
"clientRole": "somestring",
"dcaeLocationName": "somestring",
"fqtn": "somestring",
"lastMod": "2015-01-01T15:00:00.000Z",
"mrClientId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"topicURL": "somestring"
}
],
@@ -4311,13 +4241,13 @@ Type: :ref:`Topic <d_2e99841971da81b9d240071b86bf168d>`
"fqtnStyle": "FQTN_NOT_SPECIFIED",
"globalMrURL": "somestring",
"lastMod": "2015-01-01T15:00:00.000Z",
- "numClients": 1,
"owner": "somestring",
"partitionCount": "somestring",
+ "publisherRole": "somestring",
"replicationCase": "REPLICATION_NOT_SPECIFIED",
"replicationCount": "somestring",
"status": "EMPTY",
- "statusValid": true,
+ "subscriberRole": "somestring",
"tnxEnabled": "somestring",
"topicDescription": "somestring",
"topicName": "somestring",
@@ -4337,23 +4267,19 @@ Type: :ref:`Topic <d_2e99841971da81b9d240071b86bf168d>`
.. code-block:: javascript
{
- "bytes": [
- "somestring",
- "somestring"
- ],
"clients": [
{
"action": [
"somestring",
"somestring"
],
+ "clientIdentity": "somestring",
"clientRole": "somestring",
"dcaeLocationName": "somestring",
"fqtn": "somestring",
"lastMod": "2015-01-01T15:00:00.000Z",
"mrClientId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"topicURL": "somestring"
},
{
@@ -4361,13 +4287,13 @@ Type: :ref:`Topic <d_2e99841971da81b9d240071b86bf168d>`
"somestring",
"somestring"
],
+ "clientIdentity": "somestring",
"clientRole": "somestring",
"dcaeLocationName": "somestring",
"fqtn": "somestring",
"lastMod": "2015-01-01T15:00:00.000Z",
"mrClientId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"topicURL": "somestring"
}
],
@@ -4376,13 +4302,13 @@ Type: :ref:`Topic <d_2e99841971da81b9d240071b86bf168d>`
"fqtnStyle": "FQTN_NOT_SPECIFIED",
"globalMrURL": "somestring",
"lastMod": "2015-01-01T15:00:00.000Z",
- "numClients": 1,
"owner": "somestring",
"partitionCount": "somestring",
+ "publisherRole": "somestring",
"replicationCase": "REPLICATION_NOT_SPECIFIED",
"replicationCount": "somestring",
"status": "EMPTY",
- "statusValid": true,
+ "subscriberRole": "somestring",
"tnxEnabled": "somestring",
"topicDescription": "somestring",
"topicName": "somestring",
@@ -4459,23 +4385,19 @@ Type: :ref:`Topic <d_2e99841971da81b9d240071b86bf168d>`
.. code-block:: javascript
{
- "bytes": [
- "somestring",
- "somestring"
- ],
"clients": [
{
"action": [
"somestring",
"somestring"
],
+ "clientIdentity": "somestring",
"clientRole": "somestring",
"dcaeLocationName": "somestring",
"fqtn": "somestring",
"lastMod": "2015-01-01T15:00:00.000Z",
"mrClientId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"topicURL": "somestring"
},
{
@@ -4483,13 +4405,13 @@ Type: :ref:`Topic <d_2e99841971da81b9d240071b86bf168d>`
"somestring",
"somestring"
],
+ "clientIdentity": "somestring",
"clientRole": "somestring",
"dcaeLocationName": "somestring",
"fqtn": "somestring",
"lastMod": "2015-01-01T15:00:00.000Z",
"mrClientId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"topicURL": "somestring"
}
],
@@ -4498,13 +4420,13 @@ Type: :ref:`Topic <d_2e99841971da81b9d240071b86bf168d>`
"fqtnStyle": "FQTN_NOT_SPECIFIED",
"globalMrURL": "somestring",
"lastMod": "2015-01-01T15:00:00.000Z",
- "numClients": 1,
"owner": "somestring",
"partitionCount": "somestring",
+ "publisherRole": "somestring",
"replicationCase": "REPLICATION_NOT_SPECIFIED",
"replicationCount": "somestring",
"status": "EMPTY",
- "statusValid": true,
+ "subscriberRole": "somestring",
"tnxEnabled": "somestring",
"topicDescription": "somestring",
"topicName": "somestring",
@@ -4571,23 +4493,19 @@ Type: :ref:`Topic <d_2e99841971da81b9d240071b86bf168d>`
.. code-block:: javascript
{
- "bytes": [
- "somestring",
- "somestring"
- ],
"clients": [
{
"action": [
"somestring",
"somestring"
],
+ "clientIdentity": "somestring",
"clientRole": "somestring",
"dcaeLocationName": "somestring",
"fqtn": "somestring",
"lastMod": "2015-01-01T15:00:00.000Z",
"mrClientId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"topicURL": "somestring"
},
{
@@ -4595,13 +4513,13 @@ Type: :ref:`Topic <d_2e99841971da81b9d240071b86bf168d>`
"somestring",
"somestring"
],
+ "clientIdentity": "somestring",
"clientRole": "somestring",
"dcaeLocationName": "somestring",
"fqtn": "somestring",
"lastMod": "2015-01-01T15:00:00.000Z",
"mrClientId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"topicURL": "somestring"
}
],
@@ -4610,13 +4528,13 @@ Type: :ref:`Topic <d_2e99841971da81b9d240071b86bf168d>`
"fqtnStyle": "FQTN_NOT_SPECIFIED",
"globalMrURL": "somestring",
"lastMod": "2015-01-01T15:00:00.000Z",
- "numClients": 1,
"owner": "somestring",
"partitionCount": "somestring",
+ "publisherRole": "somestring",
"replicationCase": "REPLICATION_NOT_SPECIFIED",
"replicationCount": "somestring",
"status": "EMPTY",
- "statusValid": true,
+ "subscriberRole": "somestring",
"tnxEnabled": "somestring",
"topicDescription": "somestring",
"topicName": "somestring",
@@ -4693,23 +4611,19 @@ Type: :ref:`Topic <d_2e99841971da81b9d240071b86bf168d>`
.. code-block:: javascript
{
- "bytes": [
- "somestring",
- "somestring"
- ],
"clients": [
{
"action": [
"somestring",
"somestring"
],
+ "clientIdentity": "somestring",
"clientRole": "somestring",
"dcaeLocationName": "somestring",
"fqtn": "somestring",
"lastMod": "2015-01-01T15:00:00.000Z",
"mrClientId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"topicURL": "somestring"
},
{
@@ -4717,13 +4631,13 @@ Type: :ref:`Topic <d_2e99841971da81b9d240071b86bf168d>`
"somestring",
"somestring"
],
+ "clientIdentity": "somestring",
"clientRole": "somestring",
"dcaeLocationName": "somestring",
"fqtn": "somestring",
"lastMod": "2015-01-01T15:00:00.000Z",
"mrClientId": "somestring",
"status": "EMPTY",
- "statusValid": true,
"topicURL": "somestring"
}
],
@@ -4732,13 +4646,13 @@ Type: :ref:`Topic <d_2e99841971da81b9d240071b86bf168d>`
"fqtnStyle": "FQTN_NOT_SPECIFIED",
"globalMrURL": "somestring",
"lastMod": "2015-01-01T15:00:00.000Z",
- "numClients": 1,
"owner": "somestring",
"partitionCount": "somestring",
+ "publisherRole": "somestring",
"replicationCase": "REPLICATION_NOT_SPECIFIED",
"replicationCount": "somestring",
"status": "EMPTY",
- "statusValid": true,
+ "subscriberRole": "somestring",
"tnxEnabled": "somestring",
"topicDescription": "somestring",
"topicName": "somestring",
@@ -4813,9 +4727,8 @@ DR_Node Model Structure
dcaeLocationName | No | string | | |
fqdn | No | string | | |
hostName | No | string | | |
- lastMod | No | string | date-time | |
+ lastMod | No | string | date-time | | datestamp for last update to this object
status | No | string | | {'enum': ['EMPTY', 'NEW', 'STAGED', 'VALID', 'INVALID', 'DELETED']} |
- statusValid | No | boolean | | |
version | No | string | | |
.. _d_e926d3fa8701e0cc9c8ed1761b3255cd:
@@ -4830,10 +4743,9 @@ DR_Pub Model Structure
dcaeLocationName | No | string | | |
feedId | No | string | | |
- lastMod | No | string | date-time | |
+ lastMod | No | string | date-time | | datestamp for last update to this object
pubId | No | string | | |
status | No | string | | {'enum': ['EMPTY', 'NEW', 'STAGED', 'VALID', 'INVALID', 'DELETED']} |
- statusValid | No | boolean | | |
username | No | string | | |
userpwd | No | string | | |
@@ -4851,11 +4763,10 @@ DR_Sub Model Structure
dcaeLocationName | No | string | | |
deliveryURL | No | string | | |
feedId | No | string | | |
- lastMod | No | string | date-time | |
+ lastMod | No | string | date-time | | datestamp for last update to this object
logURL | No | string | | |
owner | No | string | | |
status | No | string | | {'enum': ['EMPTY', 'NEW', 'STAGED', 'VALID', 'INVALID', 'DELETED']} |
- statusValid | No | boolean | | |
subId | No | string | | |
suspended | No | boolean | | |
use100 | No | boolean | | |
@@ -4876,11 +4787,10 @@ DcaeLocation Model Structure
clli | No | string | | |
dcaeLayer | No | string | | |
dcaeLocationName | No | string | | |
- lastMod | No | string | date-time | |
+ lastMod | No | string | date-time | | datestamp for last update to this object
local | No | boolean | | |
openStackAvailabilityZone | No | string | | |
status | No | string | | {'enum': ['EMPTY', 'NEW', 'STAGED', 'VALID', 'INVALID', 'DELETED']} |
- statusValid | No | boolean | | |
subnet | No | string | | |
.. _d_4ea0e7758a1f8502222793e4a13b04f7:
@@ -4897,11 +4807,10 @@ Dmaap Model Structure
bridgeAdminTopic | No | string | | |
dmaapName | No | string | | |
drProvUrl | No | string | | |
- lastMod | No | string | date-time | |
+ lastMod | No | string | date-time | | datestamp for last update to this object
loggingUrl | No | string | | |
nodeKey | No | string | | |
status | No | string | | {'enum': ['EMPTY', 'NEW', 'STAGED', 'VALID', 'INVALID', 'DELETED']} |
- statusValid | No | boolean | | |
topicNsRoot | No | string | | |
version | No | string | | |
@@ -4922,13 +4831,12 @@ Feed Model Structure
feedName | No | string | | |
feedVersion | No | string | | |
formatUuid | No | string | | |
- lastMod | No | string | date-time | |
+ lastMod | No | string | date-time | | datestamp for last update to this object
logURL | No | string | | |
owner | No | string | | |
publishURL | No | string | | |
pubs | No | array of :ref:`DR_Pub <d_e926d3fa8701e0cc9c8ed1761b3255cd>` | | |
status | No | string | | {'enum': ['EMPTY', 'NEW', 'STAGED', 'VALID', 'INVALID', 'DELETED']} |
- statusValid | No | boolean | | |
subs | No | array of :ref:`DR_Sub <d_48cf328d246f41e1d11a09251b042f02>` | | |
subscribeURL | No | string | | |
suspended | No | boolean | | |
@@ -4943,15 +4851,15 @@ MR_Client Model Structure
:header: "Name", "Required", "Type", "Format", "Properties", "Description"
:widths: 20, 10, 15, 15, 30, 25
- action | No | array of string | | |
- clientRole | No | string | | |
- dcaeLocationName | No | string | | |
- fqtn | No | string | | |
- lastMod | No | string | date-time | |
- mrClientId | No | string | | |
+ action | No | array of string | | | one or more actions from the set ('pub', 'sub', 'view') for which this client needs Permission
+ clientIdentity | No | string | | | an AAF identity to be associated to an appropriate topic Role
+ clientRole | No | string | | | an AAF Role to be granted an appropriate Permission. If specified, takes precedence over clientIdentity, for backwards compatibility.
+ dcaeLocationName | No | string | | | a tag indicating a logical deployment site
+ fqtn | No | string | | | Fully Qualified Topic Name constructed by dbcapi
+ lastMod | No | string | date-time | | datestamp for last update to this object
+ mrClientId | No | string | | | a unique identifier generated by dbcapi for this client
status | No | string | | {'enum': ['EMPTY', 'NEW', 'STAGED', 'VALID', 'INVALID', 'DELETED']} |
- statusValid | No | boolean | | |
- topicURL | No | string | | |
+ topicURL | No | string | | | the URL for a MR instance - typically in the same dcaeLocation - that this client should use to access the topic
.. _d_eec7176a0080debe1b19c2dad2e97c24:
@@ -4969,7 +4877,6 @@ MR_Cluster Model Structure
replicationGroup | No | string | | |
sourceReplicationPort | No | string | | |
status | No | string | | {'enum': ['EMPTY', 'NEW', 'STAGED', 'VALID', 'INVALID', 'DELETED']} |
- statusValid | No | boolean | | |
targetReplicationPort | No | string | | |
topicPort | No | string | | |
topicProtocol | No | string | | |
@@ -4984,11 +4891,10 @@ MirrorMaker Model Structure
:header: "Name", "Required", "Type", "Format", "Properties", "Description"
:widths: 20, 10, 15, 15, 30, 25
- lastMod | No | string | date-time | |
+ lastMod | No | string | date-time | | datestamp for last update to this object
mmName | No | string | | |
sourceCluster | No | string | | |
status | No | string | | {'enum': ['EMPTY', 'NEW', 'STAGED', 'VALID', 'INVALID', 'DELETED']} |
- statusValid | No | boolean | | |
targetCluster | No | string | | |
topicCount | No | integer | int32 | |
topics | No | array of string | | |
@@ -5004,22 +4910,21 @@ Topic Model Structure
:header: "Name", "Required", "Type", "Format", "Properties", "Description"
:widths: 20, 10, 15, 15, 30, 25
- bytes | No | array of string | | |
- clients | No | array of :ref:`MR_Client <d_56ff81dc98986e27074d9be2731e3f4c>` | | |
- formatUuid | No | string | | |
- fqtn | No | string | | |
- fqtnStyle | No | string | | {'enum': ['FQTN_NOT_SPECIFIED', 'FQTN_LEGACY_FORMAT', 'FQTN_PROJECTID_FORMAT', 'FQTN_PROJECTID_VERSION_FORMAT']} |
- globalMrURL | No | string | | |
- lastMod | No | string | date-time | |
- numClients | No | integer | int32 | |
- owner | No | string | | |
- partitionCount | No | string | | |
- replicationCase | No | string | | {'enum': ['REPLICATION_NOT_SPECIFIED', 'REPLICATION_NONE', 'REPLICATION_EDGE_TO_CENTRAL', 'REPLICATION_EDGE_TO_CENTRAL_TO_GLOBAL', 'REPLICATION_CENTRAL_TO_EDGE', 'REPLICATION_CENTRAL_TO_GLOBAL', 'REPLICATION_GLOBAL_TO_CENTRAL', 'REPLICATION_GLOBAL_TO_CENTRAL_TO_EDGE', 'REPLICATION_EDGE_TO_FQDN', 'REPLICATION_FQDN_TO_EDGE', 'REPLICATION_FQDN_TO_GLOBAL', 'REPLICATION_GLOBAL_TO_FQDN', 'REPLICATION_EDGE_TO_FQDN_TO_GLOBAL', 'REPLICATION_GLOBAL_TO_FQDN_TO_EDGE']} |
- replicationCount | No | string | | |
+ clients | No | array of :ref:`MR_Client <d_56ff81dc98986e27074d9be2731e3f4c>` | | | an array of `MR_Client` objects associated to this `Topic`
+ formatUuid | No | string | | | a reference to an identifier that describes a data format used for this `Topic`
+ fqtn | No | string | | | Fully Qualified Topic Name constructed by dbcapi, following the rules for `fqtnStyle`
+ fqtnStyle | No | string | | {'enum': ['FQTN_NOT_SPECIFIED', 'FQTN_LEGACY_FORMAT', 'FQTN_PROJECTID_FORMAT', 'FQTN_PROJECTID_VERSION_FORMAT']} | the construction rule for the `fqtn` field
+ globalMrURL | No | string | | | the URL of an outside MR instance
+ lastMod | No | string | date-time | | datestamp for last update to this object
+ owner | No | string | | | a label used to identify who requested this `Topic` to be provisioned. In the future this may be an AAF Identity.
+ partitionCount | No | string | | | the kafka attribute for specifying the number of partitions
+ publisherRole | No | string | | | a value generated by dbcapi, this AAF Role has permission to publish to this `Topic`
+ replicationCase | No | string | | {'enum': ['REPLICATION_NOT_SPECIFIED', 'REPLICATION_NONE', 'REPLICATION_EDGE_TO_CENTRAL', 'REPLICATION_EDGE_TO_CENTRAL_TO_GLOBAL', 'REPLICATION_CENTRAL_TO_EDGE', 'REPLICATION_CENTRAL_TO_GLOBAL', 'REPLICATION_GLOBAL_TO_CENTRAL', 'REPLICATION_GLOBAL_TO_CENTRAL_TO_EDGE', 'REPLICATION_EDGE_TO_FQDN', 'REPLICATION_FQDN_TO_EDGE', 'REPLICATION_FQDN_TO_GLOBAL', 'REPLICATION_GLOBAL_TO_FQDN', 'REPLICATION_EDGE_TO_FQDN_TO_GLOBAL', 'REPLICATION_GLOBAL_TO_FQDN_TO_EDGE']} | An indicator for how this `Topic` should be replicated when there are more than one `MR_Cluster` instances
+ replicationCount | No | string | | | the kafka attribute for specifying replication within an `MR_Cluster` instance
status | No | string | | {'enum': ['EMPTY', 'NEW', 'STAGED', 'VALID', 'INVALID', 'DELETED']} |
- statusValid | No | boolean | | |
+ subscriberRole | No | string | | | a value generated by dbcapi, this AAF Role has permission to subscribe to this `Topic`
tnxEnabled | No | string | | |
- topicDescription | No | string | | |
- topicName | No | string | | |
- version | No | string | | |
+ topicDescription | No | string | | | a description of what this Topic is used for
+ topicName | No | string | | | the short name used by humans, and utilized to construct the `FQTN`
+ version | No | string | | | a hook for any versioning needed for managing a `Topic` over time
diff --git a/pom.xml b/pom.xml
index fdef5cb..8db05b1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -381,7 +381,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jettyVersion>9.3.8.RC0</jettyVersion>
<eelf.version>1.0.0</eelf.version>
- <artifact.version>1.0.19-SNAPSHOT</artifact.version>
+ <artifact.version>1.0.20-SNAPSHOT</artifact.version>
<!-- SONAR -->
<jacoco.version>0.7.7.201606060606</jacoco.version>
<sonar-jacoco-listeners.version>3.2</sonar-jacoco-listeners.version>
diff --git a/src/main/java/org/onap/dmaap/dbcapi/aaf/AafService.java b/src/main/java/org/onap/dmaap/dbcapi/aaf/AafService.java
index 4778aff..253ad11 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/aaf/AafService.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/aaf/AafService.java
@@ -112,6 +112,10 @@ public class AafService extends BaseLoggingClass {
logger.info( "entry: addGrant() " );
return doPost( grant, "authz/role/perm", 201 );
}
+ public int addUserRole( AafUserRole ur ) {
+ logger.info( "entry: addUserRole() " );
+ return doPost( ur, "authz/userRole", 201 );
+ }
public int delGrant( DmaapGrant grant ) {
int rc = -1;
diff --git a/src/main/java/org/onap/dmaap/dbcapi/aaf/AafUserRole.java b/src/main/java/org/onap/dmaap/dbcapi/aaf/AafUserRole.java
new file mode 100644
index 0000000..7b4f882
--- /dev/null
+++ b/src/main/java/org/onap/dmaap/dbcapi/aaf/AafUserRole.java
@@ -0,0 +1,69 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * org.onap.dmaap
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.dmaap.dbcapi.aaf;
+
+import org.apache.log4j.Logger;
+
+
+public class AafUserRole extends AafObject {
+ static final Logger logger = Logger.getLogger(AafUserRole.class);
+
+ private String identity;
+ private String role;
+
+
+
+ public AafUserRole(String identity, String role ) {
+ super();
+ this.identity = identity;
+ this.role = role;
+ }
+
+ public void setRole(String role) {
+ this.role = role;
+ }
+ public String getRole() {
+ return role;
+ }
+
+ public String getIdentity() {
+ return identity;
+ }
+
+ public void setIdentity(String identity) {
+ this.identity = identity;
+ }
+
+ public String toJSON() {
+
+ String postJSON = String.format(" { \"user\": \"%s\", \"role\": \"%s\" }",
+ this.getIdentity(),
+ this.getRole()
+ );
+ logger.info( "returning JSON: " + postJSON);
+
+ return postJSON;
+ }
+
+
+
+
+}
diff --git a/src/main/java/org/onap/dmaap/dbcapi/model/DmaapObject.java b/src/main/java/org/onap/dmaap/dbcapi/model/DmaapObject.java
index 8e804b2..1b3f824 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/model/DmaapObject.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/model/DmaapObject.java
@@ -30,8 +30,11 @@ import javax.xml.bind.annotation.XmlRootElement;
import org.onap.dmaap.dbcapi.logging.BaseLoggingClass;
+import io.swagger.annotations.ApiModelProperty;
+
@XmlRootElement
public abstract class DmaapObject extends BaseLoggingClass {
+ @ApiModelProperty( value = "datestamp for last update to this object")
protected Date lastMod;
protected DmaapObject_Status status;
@@ -81,6 +84,7 @@ public abstract class DmaapObject extends BaseLoggingClass {
}
}
+ @ApiModelProperty( hidden=true )
public boolean isStatusValid() {
if ( this.status == DmaapObject_Status.VALID ) {
return true;
diff --git a/src/main/java/org/onap/dmaap/dbcapi/model/MR_Client.java b/src/main/java/org/onap/dmaap/dbcapi/model/MR_Client.java
index 580800c..f182fd6 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/model/MR_Client.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/model/MR_Client.java
@@ -26,15 +26,25 @@ import javax.xml.bind.annotation.XmlRootElement;
import org.onap.dmaap.dbcapi.database.DatabaseClass;
+import io.swagger.annotations.ApiModelProperty;
+
@XmlRootElement
public class MR_Client extends DmaapObject {
+ @ApiModelProperty( value="a tag indicating a logical deployment site")
private String dcaeLocationName;
+ @ApiModelProperty( value="the URL for a MR instance - typically in the same dcaeLocation - that this client should use to access the topic")
private String topicURL;
+ @ApiModelProperty( value="Fully Qualified Topic Name constructed by dbcapi")
private String fqtn;
+ @ApiModelProperty( value="an AAF Role to be granted an appropriate Permission. If specified, takes precedence over clientIdentity, for backwards compatibility.")
private String clientRole;
+ @ApiModelProperty( value="one or more actions from the set (\"pub\", \"sub\", \"view\") for which this client needs Permission")
private String[] action;
+ @ApiModelProperty( value="a unique identifier generated by dbcapi for this client")
private String mrClientId;
+ @ApiModelProperty( value="an AAF identity to be associated to an appropriate topic Role")
+ private String clientIdentity;
public MR_Client() {
@@ -97,7 +107,24 @@ public class MR_Client extends DmaapObject {
public void setAction(String[] action) {
this.action = action;
}
-
+
+ @ApiModelProperty( hidden=true )
+ public boolean isPublisher() {
+ return hasAction( "pub");
+ }
+ @ApiModelProperty( hidden=true )
+ public boolean isSubscriber() {
+ return hasAction( "sub");
+ }
+
+ public boolean hasAction( String val ) {
+ for (String s: this.action) {
+ if ( s!= null && s.equals(val)) {
+ return true;
+ }
+ }
+ return false;
+ }
public String getMrClientId() {
return mrClientId;
}
@@ -115,5 +142,21 @@ public class MR_Client extends DmaapObject {
public void setTopicURL(String topicURL) {
this.topicURL = topicURL;
}
+
+ public String getClientIdentity() {
+ return clientIdentity;
+ }
+
+ public void setClientIdentity(String clientIdentity) {
+ this.clientIdentity = clientIdentity;
+ }
+ public boolean hasClientIdentity() {
+ if ( this.clientIdentity == null || this.clientIdentity.isEmpty() ) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
}
diff --git a/src/main/java/org/onap/dmaap/dbcapi/model/Topic.java b/src/main/java/org/onap/dmaap/dbcapi/model/Topic.java
index bfd948b..7eea5f1 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/model/Topic.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/model/Topic.java
@@ -30,6 +30,8 @@ import javax.xml.bind.annotation.XmlRootElement;
import org.onap.dmaap.dbcapi.util.DmaapConfig;
+import io.swagger.annotations.ApiModelProperty;
+
import org.onap.dmaap.dbcapi.service.DmaapService;
import org.onap.dmaap.dbcapi.service.TopicService;
@@ -37,22 +39,36 @@ import org.onap.dmaap.dbcapi.service.TopicService;
@XmlRootElement
public class Topic extends DmaapObject {
+ @ApiModelProperty( value="Fully Qualified Topic Name constructed by dbcapi, following the rules for `fqtnStyle`")
private String fqtn;
+ @ApiModelProperty( value="the short name used by humans, and utilized to construct the `FQTN`")
private String topicName;
+ @ApiModelProperty( value="a description of what this Topic is used for")
private String topicDescription;
private String tnxEnabled;
+ @ApiModelProperty( value="a label used to identify who requested this `Topic` to be provisioned. In the future this "
+ + "may be an AAF Identity.")
private String owner;
+ @ApiModelProperty( value="a reference to an identifier that describes a data format used for this `Topic`")
private String formatUuid;
+ @ApiModelProperty( value="An indicator for how this `Topic` should be replicated when there are more than one `MR_Cluster` instances")
private ReplicationType replicationCase;
+ @ApiModelProperty( value="the URL of an outside MR instance")
private String globalMrURL; // optional: URL of global MR to replicate to/from
+ @ApiModelProperty( value="the construction rule for the `fqtn` field")
private FqtnType fqtnStyle;
- private String version;
+ @ApiModelProperty( value="a hook for any versioning needed for managing a `Topic` over time")
+ private String version;
+ @ApiModelProperty( value="the kafka attribute for specifying the number of partitions")
private String partitionCount;
+ @ApiModelProperty( value="the kafka attribute for specifying replication within an `MR_Cluster` instance")
private String replicationCount;
+ @ApiModelProperty( value="a value generated by dbcapi, this AAF Role has permission to publish to this `Topic`")
private String publisherRole;
+ @ApiModelProperty( value="a value generated by dbcapi, this AAF Role has permission to subscribe to this `Topic`")
private String subscriberRole;
-
+ @ApiModelProperty( value="an array of `MR_Client` objects associated to this `Topic`")
private ArrayList<MR_Client> clients;
@@ -222,6 +238,7 @@ public class Topic extends DmaapObject {
return clients;
}
+ @ApiModelProperty( hidden=true )
public int getNumClients() {
if ( this.clients == null ) {
return 0;
@@ -311,7 +328,7 @@ public class Topic extends DmaapObject {
logger.info( str.toString() );
return str.toString();
}
-
+ @ApiModelProperty( hidden=true )
public byte[] getBytes() {
return toProvJSON().getBytes(StandardCharsets.UTF_8);
}
diff --git a/src/main/java/org/onap/dmaap/dbcapi/resources/MR_ClientResource.java b/src/main/java/org/onap/dmaap/dbcapi/resources/MR_ClientResource.java
index 1ca4a53..a621338 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/resources/MR_ClientResource.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/resources/MR_ClientResource.java
@@ -79,8 +79,11 @@ public class MR_ClientResource extends BaseLoggingClass {
}
@POST
- @ApiOperation( value = "return MR_Client details",
- notes = "Create a `MR_Client` object.",
+ @ApiOperation( value = "Associate an MR_Client object to a Topic",
+ notes = "Create a `MR_Client` object."
+ + "The `dcaeLocation` attribute is used to match an `MR_Cluster` object with the same value, with the intent of localizing message traffic."
+ + " In legacy implementation, the `clientRole` is granted appropriate permission in AAF."
+ + " Newer implementions may instead specify an AAF Identity, which will be added to the appropriate `Topic` role.",
response = MR_Client.class)
@ApiResponses( value = {
@ApiResponse( code = 200, message = "Success", response = MR_Client.class),
@@ -94,7 +97,11 @@ public class MR_ClientResource extends BaseLoggingClass {
try {
resp.required( "fqtn", client.getFqtn(), "");
resp.required( "dcaeLocationName", client.getDcaeLocationName(), "");
- resp.required( "clientRole", client.getClientRole(), "" );
+ String s = client.getClientRole();
+ if ( s == null ) {
+ s = client.getClientIdentity();
+ }
+ resp.required( "clientRole or clientIdentity", s, "" );
resp.required( "action", client.getAction(), "");
} catch ( RequiredFieldException rfe ) {
@@ -139,7 +146,7 @@ public class MR_ClientResource extends BaseLoggingClass {
}
@PUT
- @ApiOperation( value = "return MR_Client details",
+ @ApiOperation( value = "Update an MR_Client object",
notes = "Update a `MR_Client` object, specified by clientId",
response = MR_Client.class)
@ApiResponses( value = {
@@ -175,7 +182,7 @@ public class MR_ClientResource extends BaseLoggingClass {
}
@DELETE
- @ApiOperation( value = "return MR_Client details",
+ @ApiOperation( value = "Delete an MR_Client object",
notes = "Delete a `MR_Client` object, specified by clientId",
response = MR_Client.class)
@ApiResponses( value = {
diff --git a/src/main/java/org/onap/dmaap/dbcapi/resources/TopicResource.java b/src/main/java/org/onap/dmaap/dbcapi/resources/TopicResource.java
index 5f027aa..be1b3ac 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/resources/TopicResource.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/resources/TopicResource.java
@@ -91,8 +91,11 @@ public class TopicResource extends BaseLoggingClass {
}
@POST
- @ApiOperation( value = "return Topic details",
- notes = "Create `Topic` object.",
+ @ApiOperation( value = "Create a Topic object",
+ notes = "Create `Topic` object."
+ + "For convenience, the message body may populate the `clients` array, in which case each entry will be added as an `MR_Client`."
+ + " Beginning in ONAP Dublin Release, dbcapi will create two AAF Roles by default, one each for the publisher and subscriber per topic."
+ + " MR_Clients can then specify an AAF Identity to be added to the appropriate default Role, avoiding the need to create Role(s) in advance.",
response = Topic.class)
@ApiResponses( value = {
@ApiResponse( code = 200, message = "Success", response = Topic.class),
diff --git a/src/main/java/org/onap/dmaap/dbcapi/service/MR_ClientService.java b/src/main/java/org/onap/dmaap/dbcapi/service/MR_ClientService.java
index 5bd62cb..186a003 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/service/MR_ClientService.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/service/MR_ClientService.java
@@ -38,6 +38,7 @@ import org.onap.dmaap.dbcapi.aaf.AafService;
import org.onap.dmaap.dbcapi.aaf.DmaapGrant;
import org.onap.dmaap.dbcapi.aaf.DmaapPerm;
import org.onap.dmaap.dbcapi.aaf.AafService.ServiceType;
+import org.onap.dmaap.dbcapi.aaf.AafUserRole;
import org.onap.dmaap.dbcapi.client.MrProvConnection;
import org.onap.dmaap.dbcapi.database.DatabaseClass;
import org.onap.dmaap.dbcapi.logging.BaseLoggingClass;
@@ -128,7 +129,22 @@ public class MR_ClientService extends BaseLoggingClass{
logger.info( "Client dcaeLocation that doesn't exist or not specified" );
return null;
}
- grantClientPerms( client, err);
+ // original style: clients specified Role. This has precedence for backwards
+ // compatibility.
+ // ONAP style: clients specify Identity to be assigned to generated Role
+ String role = client.getClientRole();
+ if ( role != null ) {
+ grantClientRolePerms( client, err);
+ } else if ( client.hasClientIdentity() ){
+ if ( client.isSubscriber() ) {
+ role = topic.getSubscriberRole();
+ assignIdentityToRole( client, role, err );
+ }
+ if (client.isPublisher() ) {
+ role = topic.getPublisherRole();
+ assignIdentityToRole( client, role, err );
+ }
+ }
if ( ! client.isStatusValid()) {
return null;
}
@@ -189,26 +205,46 @@ public class MR_ClientService extends BaseLoggingClass{
return DmaapObject_Status.INVALID;
}
- private void grantClientPerms( MR_Client client, ApiError err) {
+ private void grantClientRolePerms( MR_Client client, ApiError err) {
AafService aaf = new AafService(ServiceType.AAF_TopicMgr);
String instance = ":topic." + client.getFqtn();
client.setStatus( DmaapObject_Status.VALID);
+ String role = client.getClientRole();
for( String want : client.getAction() ) {
int rc;
DmaapPerm perm = new DmaapPerm( dmaap.getTopicPerm(), instance, want );
- DmaapGrant g = new DmaapGrant( perm, client.getClientRole() );
- rc = aaf.addGrant( g );
- if ( rc != 201 && rc != 409 ) {
- client.setStatus( DmaapObject_Status.INVALID);
- err.setCode(rc);
- err.setMessage( "Grant of " + dmaap.getTopicPerm() + "|" + instance + "|" + want + " failed for " + client.getClientRole() );
- logger.warn( err.getMessage());
- return;
- }
+ if ( role != null ) {
+ DmaapGrant g = new DmaapGrant( perm, role );
+ rc = aaf.addGrant( g );
+ if ( rc != 201 && rc != 409 ) {
+ client.setStatus( DmaapObject_Status.INVALID);
+ err.setCode(rc);
+ err.setMessage( "Grant of " + dmaap.getTopicPerm() + "|" + instance + "|" + want + " failed for " + role );
+ logger.warn( err.getMessage());
+ return;
+ }
+ } else {
+ logger.warn( "No Grant of " + dmaap.getTopicPerm() + "|" + instance + "|" + want + " because role is null " );
+ }
}
}
+ private void assignIdentityToRole( MR_Client client, String role, ApiError err ) {
+ AafService aaf = new AafService(ServiceType.AAF_TopicMgr);
+
+ AafUserRole ur = new AafUserRole( client.getClientIdentity(), role );
+ int rc = aaf.addUserRole( ur );
+ if ( rc != 201 && rc != 409 ) {
+ client.setStatus( DmaapObject_Status.INVALID);
+ err.setCode(rc);
+ err.setMessage( "Failed to add user " + client.getClientIdentity()+ " to " + role );
+ logger.warn( err.getMessage());
+ return;
+ }
+ client.setStatus( DmaapObject_Status.VALID);
+
+ }
private void revokeClientPerms( MR_Client client, ApiError err) {
AafService aaf = new AafService(ServiceType.AAF_TopicMgr);
diff --git a/src/main/java/org/onap/dmaap/dbcapi/service/TopicService.java b/src/main/java/org/onap/dmaap/dbcapi/service/TopicService.java
index a26205c..cfec54e 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/service/TopicService.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/service/TopicService.java
@@ -61,7 +61,6 @@ public class TopicService extends BaseLoggingClass {
private Map<String, Topic> mr_topics = DatabaseClass.getTopics();
private static DmaapService dmaapSvc = new DmaapService();
- private static Dmaap dmaap = new DmaapService().getDmaap();
private MR_ClientService clientService = new MR_ClientService();
private MR_ClusterService clusters = new MR_ClusterService();
private DcaeLocationService locations = new DcaeLocationService();
@@ -258,6 +257,7 @@ public class TopicService extends BaseLoggingClass {
logger.info( "c fqtn=" + c.getFqtn() + " ID=" + c.getMrClientId() + " url=" + c.getTopicURL());
MR_Client nc = new MR_Client( c.getDcaeLocationName(), topic.getFqtn(), c.getClientRole(), c.getAction());
nc.setFqtn(topic.getFqtn());
+ nc.setClientIdentity( c.getClientIdentity());
logger.info( "nc fqtn=" + nc.getFqtn() + " ID=" + nc.getMrClientId() + " url=" + nc.getTopicURL());
clients2.add( clientService.addMr_Client(nc, topic, err));
if ( ! err.is2xx()) {
diff --git a/src/main/resources/schema_11.sql b/src/main/resources/schema_11.sql
index de848b1..3bf7b1f 100644
--- a/src/main/resources/schema_11.sql
+++ b/src/main/resources/schema_11.sql
@@ -23,5 +23,8 @@
add column publisher_role varchar(100),
add column subscriber_role varchar(100)
;
+@alter table mr_client
+ add column client_identity varchar(100)
+;
update dmaapbc_sch_ver set version = 11 where version = 10;
diff --git a/version.properties b/version.properties
index e09bb38..6623284 100644
--- a/version.properties
+++ b/version.properties
@@ -27,7 +27,7 @@
major=1
minor=0
-patch=19
+patch=20
base_version=${major}.${minor}.${patch}
# Release must be completed with git revision # in Jenkins