Skip to content

Commit e2c3727

Browse files
authored
feat(apig-group-response): add management (#598)
feat(apig-group-response): add management Reviewed-by: Anton Sidelnikov
1 parent 5dd0e18 commit e2c3727

21 files changed

+952
-0
lines changed

doc/source/sdk/guides/apig.rst

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,3 +1284,77 @@ API group over the past hour.
12841284

12851285
.. literalinclude:: ../examples/apig/list_api_calls_for_group.py
12861286
:lines: 16-24
1287+
1288+
1289+
Group Response
1290+
--------------
1291+
1292+
Creating a Group Response
1293+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
1294+
1295+
This example demonstrates how to create a group response in the API Gateway.
1296+
1297+
.. literalinclude:: ../examples/apig/create_group_response.py
1298+
:lines: 16-37
1299+
1300+
Querying Group Response Details
1301+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1302+
1303+
This example demonstrates how to retrieve details of a specific
1304+
group response.
1305+
1306+
.. literalinclude:: ../examples/apig/get_group_response.py
1307+
:lines: 16-25
1308+
1309+
Modifying a Group Response
1310+
^^^^^^^^^^^^^^^^^^^^^^^^^^
1311+
1312+
This example demonstrates how to update configuration of an existing
1313+
group response.
1314+
1315+
.. literalinclude:: ../examples/apig/update_group_response.py
1316+
:lines: 16-29
1317+
1318+
Deleting a Group Response
1319+
^^^^^^^^^^^^^^^^^^^^^^^^^^
1320+
1321+
This example demonstrates how to delete a group response from the API Gateway.
1322+
1323+
.. literalinclude:: ../examples/apig/delete_group_response.py
1324+
:lines: 16-25
1325+
1326+
Querying the Response of an Error Type
1327+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1328+
1329+
This example demonstrates how to retrieve the response configuration for a
1330+
specific error type.
1331+
1332+
.. literalinclude:: ../examples/apig/get_error_response.py
1333+
:lines: 16-25
1334+
1335+
Modifying the Response of an Error Type
1336+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1337+
1338+
This example demonstrates how to update the response settings for
1339+
a given error type.
1340+
1341+
.. literalinclude:: ../examples/apig/update_error_response.py
1342+
:lines: 16-30
1343+
1344+
Deleting the Response of an Error Type
1345+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1346+
1347+
This example demonstrates how to delete the response configuration for
1348+
a specific error type.
1349+
1350+
.. literalinclude:: ../examples/apig/delete_error_response.py
1351+
:lines: 16-25
1352+
1353+
Querying Group Responses
1354+
^^^^^^^^^^^^^^^^^^^^^^^^^
1355+
1356+
This example demonstrates how to list all group responses configured
1357+
in the API Gateway.
1358+
1359+
.. literalinclude:: ../examples/apig/list_group_responses.py
1360+
:lines: 16-23

doc/source/sdk/proxies/apig.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,3 +178,11 @@ Monitoring Information Query
178178
:noindex:
179179
:members: list_api_calls_for_period, list_api_calls_for_group,
180180
list_metric_data
181+
182+
Group Response Operations
183+
^^^^^^^^^^^^^^^^^^^^^^^^^
184+
.. autoclass:: otcextensions.sdk.apig.v2._proxy.Proxy
185+
:noindex:
186+
:members: create_group_response, update_group_response,
187+
delete_group_response, group_responses, get_group_response,
188+
get_error_response, update_error_response, delete_error_response

doc/source/sdk/resources/apig/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,5 @@ ApiGateway Resources
3131
v2/backend_server_group
3232
v2/api_call
3333
v2/metric_data
34+
v2/group_response
35+
v2/error_response
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
otcextensions.sdk.apig.v2.error_response
2+
========================================
3+
4+
.. automodule:: otcextensions.sdk.apig.v2.error_response
5+
6+
The ErrorResponse Class
7+
-----------------------
8+
9+
The ``ErrorResponse`` class inherits from
10+
:class:`~otcextensions.sdk.sdk_resource.Resource`.
11+
12+
.. autoclass:: otcextensions.sdk.apig.v2.error_response.ErrorResponse
13+
:members:
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
otcextensions.sdk.apig.v2.group_response
2+
========================================
3+
4+
.. automodule:: otcextensions.sdk.apig.v2.group_response
5+
6+
The GroupResponse Class
7+
-----------------------
8+
9+
The ``GroupResponse`` class inherits from
10+
:class:`~otcextensions.sdk.sdk_resource.Resource`.
11+
12+
.. autoclass:: otcextensions.sdk.apig.v2.group_response.GroupResponse
13+
:members:
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env python3
2+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
3+
# not use this file except in compliance with the License. You may obtain
4+
# a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11+
# License for the specific language governing permissions and limitations
12+
# under the License.
13+
"""
14+
Create group response for api group
15+
"""
16+
import openstack
17+
openstack.enable_logging(True)
18+
conn = openstack.connect(cloud='otc')
19+
20+
attrs = {
21+
"name": "test_group_response",
22+
"responses": {
23+
"NOT_FOUND": {
24+
"status": 404,
25+
"body": "Bad Request",
26+
"headers": [{
27+
"key": "Content-Type",
28+
"value": "application/json",
29+
}]
30+
}
31+
}
32+
}
33+
group_response = conn.apig.create_group_response(
34+
gateway="gateway_id",
35+
group="group_id",
36+
**attrs
37+
)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env python3
2+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
3+
# not use this file except in compliance with the License. You may obtain
4+
# a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11+
# License for the specific language governing permissions and limitations
12+
# under the License.
13+
"""
14+
Delete error response from api group
15+
"""
16+
import openstack
17+
18+
openstack.enable_logging(True)
19+
conn = openstack.connect(cloud='otc')
20+
response = conn.apig.delete_error_response(
21+
gateway="gateway_id",
22+
group="group_id",
23+
response="response_id",
24+
response_type='NOT_FOUND'
25+
)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env python3
2+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
3+
# not use this file except in compliance with the License. You may obtain
4+
# a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11+
# License for the specific language governing permissions and limitations
12+
# under the License.
13+
"""
14+
Delete group response from api group
15+
"""
16+
import openstack
17+
18+
openstack.enable_logging(True)
19+
conn = openstack.connect(cloud='otc')
20+
21+
conn.apig.delete_group_response(
22+
gateway="gateway_id",
23+
group="group_id",
24+
response="response_id"
25+
)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env python3
2+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
3+
# not use this file except in compliance with the License. You may obtain
4+
# a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11+
# License for the specific language governing permissions and limitations
12+
# under the License.
13+
"""
14+
Get error response for api group
15+
"""
16+
import openstack
17+
18+
openstack.enable_logging(True)
19+
conn = openstack.connect(cloud='otc')
20+
error_response = conn.apig.get_error_response(
21+
gateway="gateway_id",
22+
group="group_id",
23+
response="response_id",
24+
response_type='NOT_FOUND'
25+
)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env python3
2+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
3+
# not use this file except in compliance with the License. You may obtain
4+
# a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11+
# License for the specific language governing permissions and limitations
12+
# under the License.
13+
"""
14+
Get group response for api group
15+
"""
16+
import openstack
17+
18+
openstack.enable_logging(True)
19+
conn = openstack.connect(cloud='otc')
20+
21+
response = conn.apig.get_group_response(
22+
gateway="gateway_id",
23+
group="group_id",
24+
response="response_id"
25+
)

0 commit comments

Comments
 (0)