@@ -10,7 +10,7 @@ class AttributeMicroClient:
1010 _endpoint = {
1111 'all_items' : {
1212 'method' : 'GET' ,
13- 'url_template' : 'trafficTypes/{trafficTypeId}/schema ' ,
13+ 'url_template' : 'schema/ws/{workspaceId}/ trafficTypes/{trafficTypeId}' ,
1414 'headers' : [{
1515 'name' : 'Authorization' ,
1616 'template' : 'Bearer {value}' ,
@@ -20,8 +20,8 @@ class AttributeMicroClient:
2020 'response' : True ,
2121 },
2222 'create' : {
23- 'method' : 'PUT ' ,
24- 'url_template' : 'trafficTypes/{trafficTypeId}/schema ' ,
23+ 'method' : 'POST ' ,
24+ 'url_template' : 'schema/ws/{workspaceId}/ trafficTypes/{trafficTypeId}' ,
2525 'headers' : [{
2626 'name' : 'Authorization' ,
2727 'template' : 'Bearer {value}' ,
@@ -32,7 +32,7 @@ class AttributeMicroClient:
3232 },
3333 'delete' : {
3434 'method' : 'DELETE' ,
35- 'url_template' : 'trafficTypes/{trafficTypeId}/schema/{attributeId}' ,
35+ 'url_template' : 'schema/ws/{workspaceId}/ trafficTypes/{trafficTypeId}/schema/{attributeId}' ,
3636 'headers' : [{
3737 'name' : 'Authorization' ,
3838 'template' : 'Bearer {value}' ,
@@ -48,7 +48,7 @@ def __init__(self, http_client):
4848 '''
4949 self ._http_client = http_client
5050
51- def list (self , traffic_type_id ):
51+ def list (self , workspace_id , traffic_type_id ):
5252 '''
5353 Returns a list of TrafficType objects.
5454
@@ -58,7 +58,8 @@ def list(self, traffic_type_id):
5858 '''
5959 response = self ._http_client .make_request (
6060 self ._endpoint ['all_items' ],
61- trafficTypeId = traffic_type_id
61+ trafficTypeId = traffic_type_id ,
62+ workspaceId = workspace_id
6263 )
6364 return [Attribute (item , self ._http_client ) for item in response ]
6465
@@ -73,14 +74,18 @@ def save(self, attribute):
7374 :rtype: Attribute
7475 '''
7576 data = as_dict (attribute )
77+ wsId = data .get ('workspaceId' )
78+ del data ['workspaceId' ]
79+ del data ['isSearchable' ]
7680 response = self ._http_client .make_request (
7781 self ._endpoint ['create' ],
7882 data ,
79- trafficTypeId = data .get ('trafficTypeId' )
83+ trafficTypeId = data .get ('trafficTypeId' ),
84+ workspaceId = wsId
8085 )
8186 return Attribute (response , self ._http_client )
8287
83- def delete (self , attribute_id , traffic_type_id ):
88+ def delete (self , attribute_id , workspace_id , traffic_type_id ):
8489 '''
8590 Delete an attribute by specifying its id and it's traffic type id.
8691
@@ -90,7 +95,8 @@ def delete(self, attribute_id, traffic_type_id):
9095 return self ._http_client .make_request (
9196 self ._endpoint ['delete' ],
9297 trafficTypeId = traffic_type_id ,
93- attributeId = attribute_id
98+ attributeId = attribute_id ,
99+ workspaceId = workspace_id
94100 )
95101
96102 def delete_by_instance (self , attribute ):
@@ -102,5 +108,6 @@ def delete_by_instance(self, attribute):
102108 data = as_dict (attribute )
103109 return self .delete (
104110 data .get ('id' ),
105- data .get ('trafficTypeId' )
111+ data .get ('trafficTypeId' ),
112+ data .get ('workspaceId' )
106113 )
0 commit comments