Rename Deckhand bucket endpoint to buckets for consistency
According to guides like [0] RESTful resource name should use pluralization for nouns, for the sake of consistency. As such, this PS renames PUT bucket/{bucket_name}/documents to PUT buckets/{bucket_name}/documents Required renames have also been made to the following UCP projects: - Shipyard -> https://review.gerrithub.io/#/c/384121/ [0] https://restfulapi.net/resource-naming/ Change-Id: Icb01e29db0b8b12e66895135baa9be525ba7d72b
This commit is contained in:
parent
90a77d4278
commit
c729cd930d
2
AUTHORS
2
AUTHORS
@ -3,7 +3,9 @@ Anthony Lin <anthony.jclin@gmail.com>
|
||||
Bryan Strassner <bryan.strassner@gmail.com>
|
||||
Felipe Monteiro <felipe.monteiro@att.com>
|
||||
Felipe Monteiro <fmontei@users.noreply.github.com>
|
||||
Kochetov, Mikhail (mk899x) <mk899x@us.att.com>
|
||||
Mark Burnett <mark.m.burnett@gmail.com>
|
||||
Mike Kochetov <mike.nycmoma@gmail.com>
|
||||
Pete Birley <pete@port.direct>
|
||||
Scott Hussey <sh8121@att.com>
|
||||
Tin Lam <tin@irrational.io>
|
||||
|
@ -28,7 +28,7 @@ the new revision.""",
|
||||
[
|
||||
{
|
||||
'method': 'PUT',
|
||||
'path': '/api/v1.0/bucket/{bucket_name}/documents'
|
||||
'path': '/api/v1.0/buckets/{bucket_name}/documents'
|
||||
},
|
||||
{
|
||||
'method': 'POST',
|
||||
@ -50,7 +50,7 @@ the request body have a ``metadata.storagePolicy`` of "encrypted".""",
|
||||
[
|
||||
{
|
||||
'method': 'PUT',
|
||||
'path': '/api/v1.0/bucket/{bucket_name}/documents'
|
||||
'path': '/api/v1.0/buckets/{bucket_name}/documents'
|
||||
},
|
||||
{
|
||||
'method': 'POST',
|
||||
|
@ -36,7 +36,7 @@ LOG = log.getLogger(__name__)
|
||||
def configure_app(app, version=''):
|
||||
|
||||
v1_0_routes = [
|
||||
('bucket/{bucket_name}/documents', buckets.BucketsResource()),
|
||||
('buckets/{bucket_name}/documents', buckets.BucketsResource()),
|
||||
('health', health.HealthResource()),
|
||||
('revisions', revisions.RevisionsResource()),
|
||||
('revisions/{revision_id}', revisions.RevisionsResource()),
|
||||
|
@ -19,12 +19,12 @@ tests:
|
||||
|
||||
- name: create
|
||||
desc: Create initial documents
|
||||
PUT: /api/v1.0/bucket/a/documents
|
||||
PUT: /api/v1.0/buckets/a/documents
|
||||
status: 200
|
||||
data: <@resources/sample-doc.yaml
|
||||
|
||||
- name: error
|
||||
desc: Trigger error case
|
||||
PUT: /api/v1.0/bucket/b/documents
|
||||
PUT: /api/v1.0/buckets/b/documents
|
||||
status: 409
|
||||
data: <@resources/sample-doc.yaml
|
||||
|
@ -27,7 +27,7 @@ tests:
|
||||
|
||||
- name: create_a
|
||||
desc: Create documents in one bucket (a)
|
||||
PUT: /api/v1.0/bucket/a/documents
|
||||
PUT: /api/v1.0/buckets/a/documents
|
||||
status: 200
|
||||
data: <@resources/layering-needs-substitution-source.yaml
|
||||
|
||||
@ -51,7 +51,7 @@ tests:
|
||||
|
||||
- name: create_b
|
||||
desc: Create documents in a second bucket (b)
|
||||
PUT: /api/v1.0/bucket/b/documents
|
||||
PUT: /api/v1.0/buckets/b/documents
|
||||
status: 200
|
||||
data: <@resources/passphrase.yaml
|
||||
|
||||
|
@ -46,7 +46,7 @@ tests:
|
||||
|
||||
- name: initialize
|
||||
desc: Create initial documents
|
||||
PUT: /api/v1.0/bucket/mop/documents
|
||||
PUT: /api/v1.0/buckets/mop/documents
|
||||
status: 200
|
||||
data: <@resources/design-doc-layering-sample.yaml
|
||||
|
||||
@ -73,7 +73,7 @@ tests:
|
||||
|
||||
- name: ignore_duplicate
|
||||
desc: Push a duplicate bucket of documents
|
||||
PUT: /api/v1.0/bucket/mop/documents
|
||||
PUT: /api/v1.0/buckets/mop/documents
|
||||
status: 200
|
||||
data: <@resources/design-doc-layering-sample.yaml
|
||||
|
||||
@ -100,7 +100,7 @@ tests:
|
||||
|
||||
- name: update_single_document
|
||||
desc: Update a single document, ignore other documents in the bucket
|
||||
PUT: /api/v1.0/bucket/mop/documents
|
||||
PUT: /api/v1.0/buckets/mop/documents
|
||||
status: 200
|
||||
data: <@resources/design-doc-layering-sample-with-update.yaml
|
||||
|
||||
@ -150,7 +150,7 @@ tests:
|
||||
|
||||
- name: delete_document
|
||||
desc: Delete a single document
|
||||
PUT: /api/v1.0/bucket/mop/documents
|
||||
PUT: /api/v1.0/buckets/mop/documents
|
||||
status: 200
|
||||
data: <@resources/design-doc-layering-sample-with-delete.yaml
|
||||
|
||||
|
@ -19,13 +19,13 @@ tests:
|
||||
|
||||
- name: add_bucket_a
|
||||
desc: Create documents for bucket a
|
||||
PUT: /api/v1.0/bucket/a/documents
|
||||
PUT: /api/v1.0/buckets/a/documents
|
||||
status: 200
|
||||
data: <@resources/design-doc-substitution-sample-split-bucket-a.yaml
|
||||
|
||||
- name: add_bucket_b
|
||||
desc: Create documents for bucket b
|
||||
PUT: /api/v1.0/bucket/b/documents
|
||||
PUT: /api/v1.0/buckets/b/documents
|
||||
status: 200
|
||||
data: <@resources/design-doc-substitution-sample-split-bucket-b.yaml
|
||||
|
||||
|
@ -18,7 +18,7 @@ tests:
|
||||
|
||||
- name: initialize
|
||||
desc: Create initial documents
|
||||
PUT: /api/v1.0/bucket/mop/documents
|
||||
PUT: /api/v1.0/buckets/mop/documents
|
||||
status: 200
|
||||
data: <@resources/design-doc-substitution-sample.yaml
|
||||
|
||||
|
@ -24,7 +24,7 @@ tests:
|
||||
# Asserts that status code and response headers are correct.
|
||||
- name: initialize
|
||||
desc: Create initial documents
|
||||
PUT: /api/v1.0/bucket/mop/documents
|
||||
PUT: /api/v1.0/buckets/mop/documents
|
||||
status: 200
|
||||
data: <@resources/design-doc-layering-sample.yaml
|
||||
|
||||
|
@ -29,7 +29,7 @@ tests:
|
||||
|
||||
- name: create_a
|
||||
desc: Create documents in bucket a
|
||||
PUT: /api/v1.0/bucket/bucket_a/documents
|
||||
PUT: /api/v1.0/buckets/bucket_a/documents
|
||||
status: 200
|
||||
data: |-
|
||||
---
|
||||
@ -46,7 +46,7 @@ tests:
|
||||
|
||||
- name: create_b
|
||||
desc: Create documents in bucket b
|
||||
PUT: /api/v1.0/bucket/bucket_b/documents
|
||||
PUT: /api/v1.0/buckets/bucket_b/documents
|
||||
status: 200
|
||||
data: |-
|
||||
---
|
||||
@ -63,7 +63,7 @@ tests:
|
||||
|
||||
- name: create_c
|
||||
desc: Create documents in bucket c
|
||||
PUT: /api/v1.0/bucket/bucket_c/documents
|
||||
PUT: /api/v1.0/buckets/bucket_c/documents
|
||||
status: 200
|
||||
data: |-
|
||||
---
|
||||
@ -80,7 +80,7 @@ tests:
|
||||
|
||||
- name: create_d
|
||||
desc: Create documents in bucket d
|
||||
PUT: /api/v1.0/bucket/bucket_d/documents
|
||||
PUT: /api/v1.0/buckets/bucket_d/documents
|
||||
status: 200
|
||||
data: |-
|
||||
---
|
||||
@ -142,7 +142,7 @@ tests:
|
||||
|
||||
- name: update_c
|
||||
desc: Update document in bucket c
|
||||
PUT: /api/v1.0/bucket/bucket_c/documents
|
||||
PUT: /api/v1.0/buckets/bucket_c/documents
|
||||
status: 200
|
||||
data: |-
|
||||
---
|
||||
@ -170,13 +170,13 @@ tests:
|
||||
|
||||
- name: delete_b
|
||||
desc: Delete documents from bucket b
|
||||
PUT: /api/v1.0/bucket/bucket_b/documents
|
||||
PUT: /api/v1.0/buckets/bucket_b/documents
|
||||
status: 200
|
||||
data: ""
|
||||
|
||||
- name: create_mistake
|
||||
desc: Create documents in bucket mistake
|
||||
PUT: /api/v1.0/bucket/bucket_mistake/documents
|
||||
PUT: /api/v1.0/buckets/bucket_mistake/documents
|
||||
status: 200
|
||||
data: |-
|
||||
---
|
||||
@ -193,7 +193,7 @@ tests:
|
||||
|
||||
- name: delete_mistake
|
||||
desc: Delete documents from bucket mistake
|
||||
PUT: /api/v1.0/bucket/bucket_mistake/documents
|
||||
PUT: /api/v1.0/buckets/bucket_mistake/documents
|
||||
status: 200
|
||||
data: ""
|
||||
# Verification for whether a bucket_name was returned even though all the
|
||||
@ -214,7 +214,7 @@ tests:
|
||||
|
||||
- name: create_e
|
||||
desc: Create documents in bucket e
|
||||
PUT: /api/v1.0/bucket/bucket_e/documents
|
||||
PUT: /api/v1.0/buckets/bucket_e/documents
|
||||
status: 200
|
||||
data: |-
|
||||
---
|
||||
|
@ -20,7 +20,7 @@ tests:
|
||||
|
||||
- name: initialize
|
||||
desc: Create initial documents
|
||||
PUT: /api/v1.0/bucket/mop/documents
|
||||
PUT: /api/v1.0/buckets/mop/documents
|
||||
status: 200
|
||||
data: <@resources/design-doc-layering-sample.yaml
|
||||
|
||||
|
@ -20,7 +20,7 @@ tests:
|
||||
|
||||
- name: initialize
|
||||
desc: Create initial documents
|
||||
PUT: /api/v1.0/bucket/mop/documents
|
||||
PUT: /api/v1.0/buckets/mop/documents
|
||||
status: 200
|
||||
data: <@resources/design-doc-layering-sample.yaml
|
||||
|
||||
|
@ -17,7 +17,7 @@ tests:
|
||||
|
||||
- name: initialize
|
||||
desc: Create initial documents
|
||||
PUT: /api/v1.0/bucket/mop/documents
|
||||
PUT: /api/v1.0/buckets/mop/documents
|
||||
status: 200
|
||||
data: <@resources/design-doc-layering-sample.yaml
|
||||
|
||||
|
@ -38,7 +38,7 @@ tests:
|
||||
# Create a revision implicitly by creating a document.
|
||||
- name: initialize
|
||||
desc: Create initial documents
|
||||
PUT: /api/v1.0/bucket/mop/documents
|
||||
PUT: /api/v1.0/buckets/mop/documents
|
||||
status: 200
|
||||
data: <@resources/design-doc-layering-sample.yaml
|
||||
|
||||
|
@ -26,19 +26,19 @@ tests:
|
||||
|
||||
- name: initialize
|
||||
desc: Create initial documents
|
||||
PUT: /api/v1.0/bucket/mop/documents
|
||||
PUT: /api/v1.0/buckets/mop/documents
|
||||
status: 200
|
||||
data: <@resources/design-doc-layering-sample.yaml
|
||||
|
||||
- name: update_single_document
|
||||
desc: Update a single document, ignore other documents in the bucket
|
||||
PUT: /api/v1.0/bucket/mop/documents
|
||||
PUT: /api/v1.0/buckets/mop/documents
|
||||
status: 200
|
||||
data: <@resources/design-doc-layering-sample-with-update.yaml
|
||||
|
||||
- name: delete_document
|
||||
desc: Delete a single document
|
||||
PUT: /api/v1.0/bucket/mop/documents
|
||||
PUT: /api/v1.0/buckets/mop/documents
|
||||
status: 200
|
||||
data: <@resources/design-doc-layering-sample-with-delete.yaml
|
||||
|
||||
|
@ -22,7 +22,7 @@ tests:
|
||||
|
||||
- name: create_schema
|
||||
desc: Add example schema
|
||||
PUT: /api/v1.0/bucket/mop/documents
|
||||
PUT: /api/v1.0/buckets/mop/documents
|
||||
status: 200
|
||||
data: <@resources/sample-schema.yaml
|
||||
|
||||
@ -46,7 +46,7 @@ tests:
|
||||
|
||||
- name: add_valid_document
|
||||
desc: Add a document that follows the schema
|
||||
PUT: /api/v1.0/bucket/good/documents
|
||||
PUT: /api/v1.0/buckets/good/documents
|
||||
status: 200
|
||||
data: |-
|
||||
schema: example/Doc/v1
|
||||
@ -80,7 +80,7 @@ tests:
|
||||
|
||||
- name: add_invalid_document
|
||||
desc: Add a document that does not follow the schema
|
||||
PUT: /api/v1.0/bucket/bad/documents
|
||||
PUT: /api/v1.0/buckets/bad/documents
|
||||
status: 200
|
||||
data: |-
|
||||
schema: example/Doc/v1
|
||||
|
@ -74,7 +74,7 @@ class TestApi(test_base.DeckhandTestCase):
|
||||
api.init_application()
|
||||
|
||||
mock_falcon_api.add_route.assert_has_calls([
|
||||
mock.call('/api/v1.0/bucket/{bucket_name}/documents',
|
||||
mock.call('/api/v1.0/buckets/{bucket_name}/documents',
|
||||
self.buckets_resource()),
|
||||
mock.call('/api/v1.0/health', self.health_resource()),
|
||||
mock.call('/api/v1.0/revisions', self.revisions_resource()),
|
||||
|
@ -42,7 +42,7 @@ class TestBucketsController(test_base.BaseControllerTest):
|
||||
payload = documents_factory.gen_test(document_mapping)
|
||||
|
||||
resp = self.app.simulate_put(
|
||||
'/api/v1.0/bucket/mop/documents',
|
||||
'/api/v1.0/buckets/mop/documents',
|
||||
headers={'Content-Type': 'application/x-yaml'},
|
||||
body=yaml.safe_dump_all(payload))
|
||||
self.assertEqual(200, resp.status_code)
|
||||
@ -57,7 +57,7 @@ class TestBucketsController(test_base.BaseControllerTest):
|
||||
def test_put_bucket_with_secret(self):
|
||||
def _do_test(payload):
|
||||
resp = self.app.simulate_put(
|
||||
'/api/v1.0/bucket/mop/documents',
|
||||
'/api/v1.0/buckets/mop/documents',
|
||||
headers={'Content-Type': 'application/x-yaml'},
|
||||
body=yaml.safe_dump_all(payload))
|
||||
self.assertEqual(200, resp.status_code)
|
||||
@ -129,7 +129,7 @@ schema:
|
||||
|
||||
for idx, payload in enumerate(invalid_payloads):
|
||||
resp = self.app.simulate_put(
|
||||
'/api/v1.0/bucket/mop/documents',
|
||||
'/api/v1.0/buckets/mop/documents',
|
||||
headers={'Content-Type': 'application/x-yaml'},
|
||||
body=payload)
|
||||
self.assertEqual(400, resp.status_code)
|
||||
@ -143,7 +143,7 @@ schema:
|
||||
|
||||
# Create the first layering policy.
|
||||
resp = self.app.simulate_put(
|
||||
'/api/v1.0/bucket/mop/documents',
|
||||
'/api/v1.0/buckets/mop/documents',
|
||||
headers={'Content-Type': 'application/x-yaml'},
|
||||
body=yaml.safe_dump_all([payload]))
|
||||
self.assertEqual(200, resp.status_code)
|
||||
@ -154,7 +154,7 @@ schema:
|
||||
'the system.' % payload['metadata']['name'])
|
||||
payload['metadata']['name'] = test_utils.rand_name('layering-policy')
|
||||
resp = self.app.simulate_put(
|
||||
'/api/v1.0/bucket/mop/documents',
|
||||
'/api/v1.0/buckets/mop/documents',
|
||||
headers={'Content-Type': 'application/x-yaml'},
|
||||
body=yaml.safe_dump_all([payload]))
|
||||
self.assertEqual(409, resp.status_code)
|
||||
@ -175,7 +175,7 @@ class TestBucketsControllerNegativeRBAC(test_base.BaseControllerTest):
|
||||
payload = documents_factory.gen_test({})
|
||||
|
||||
resp = self.app.simulate_put(
|
||||
'/api/v1.0/bucket/mop/documents',
|
||||
'/api/v1.0/buckets/mop/documents',
|
||||
headers={'Content-Type': 'application/x-yaml'},
|
||||
body=yaml.safe_dump_all(payload))
|
||||
self.assertEqual(403, resp.status_code)
|
||||
@ -188,7 +188,7 @@ class TestBucketsControllerNegativeRBAC(test_base.BaseControllerTest):
|
||||
payload = [secrets_factory.gen_test('Certificate', 'cleartext')]
|
||||
|
||||
resp = self.app.simulate_put(
|
||||
'/api/v1.0/bucket/mop/documents',
|
||||
'/api/v1.0/buckets/mop/documents',
|
||||
headers={'Content-Type': 'application/x-yaml'},
|
||||
body=yaml.safe_dump_all(payload))
|
||||
self.assertEqual(403, resp.status_code)
|
||||
@ -201,7 +201,7 @@ class TestBucketsControllerNegativeRBAC(test_base.BaseControllerTest):
|
||||
payload = [secrets_factory.gen_test('Certificate', 'encrypted')]
|
||||
|
||||
resp = self.app.simulate_put(
|
||||
'/api/v1.0/bucket/mop/documents',
|
||||
'/api/v1.0/buckets/mop/documents',
|
||||
headers={'Content-Type': 'application/x-yaml'},
|
||||
body=yaml.safe_dump_all(payload))
|
||||
self.assertEqual(403, resp.status_code)
|
||||
|
@ -35,7 +35,7 @@ class TestErrorFormatting(test_base.BaseControllerTest):
|
||||
as m_enforce_rbac:
|
||||
m_enforce_rbac.side_effect = Exception
|
||||
resp = self.app.simulate_put(
|
||||
'/api/v1.0/bucket/test/documents',
|
||||
'/api/v1.0/buckets/test/documents',
|
||||
headers={'Content-Type': 'application/x-yaml'}, body=None)
|
||||
|
||||
expected = {
|
||||
@ -75,7 +75,7 @@ class TestErrorFormatting(test_base.BaseControllerTest):
|
||||
m_enforce_rbac.side_effect = falcon.HTTPForbidden(
|
||||
description=expected_msg)
|
||||
resp = self.app.simulate_put(
|
||||
'/api/v1.0/bucket/test/documents',
|
||||
'/api/v1.0/buckets/test/documents',
|
||||
headers={'Content-Type': 'application/x-yaml'}, body=None)
|
||||
|
||||
expected = {
|
||||
|
@ -62,7 +62,7 @@ class TestValidationsController(test_base.BaseControllerTest):
|
||||
documents_factory = factories.DocumentFactory(2, [1, 1])
|
||||
payload = documents_factory.gen_test({})
|
||||
resp = self.app.simulate_put(
|
||||
'/api/v1.0/bucket/mop/documents',
|
||||
'/api/v1.0/buckets/mop/documents',
|
||||
headers={'Content-Type': 'application/x-yaml'},
|
||||
body=yaml.safe_dump_all(payload))
|
||||
self.assertEqual(200, resp.status_code)
|
||||
|
@ -29,8 +29,8 @@ does not provide an official media type for YAML, this API will use
|
||||
This is a description of the ``v1.0`` API. Documented paths are considered
|
||||
relative to ``/api/v1.0``.
|
||||
|
||||
PUT ``/bucket/{bucket_name}/documents``
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
PUT ``/buckets/{bucket_name}/documents``
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Accepts a multi-document YAML body and creates a new revision that updates the
|
||||
contents of the ``bucket_name`` bucket. Documents from the specified bucket that
|
||||
|
@ -7,7 +7,7 @@
|
||||
# revision history, whereby the target revision's documents are re-
|
||||
# created for
|
||||
# the new revision.
|
||||
# PUT /api/v1.0/bucket/{bucket_name}/documents
|
||||
# PUT /api/v1.0/buckets/{bucket_name}/documents
|
||||
# POST /api/v1.0/rollback/{target_revision_id}
|
||||
#"deckhand:create_cleartext_documents": "rule:admin_api"
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
# Conditionally enforced for the endpoints below if the any of the
|
||||
# documents in
|
||||
# the request body have a ``metadata.storagePolicy`` of "encrypted".
|
||||
# PUT /api/v1.0/bucket/{bucket_name}/documents
|
||||
# PUT /api/v1.0/buckets/{bucket_name}/documents
|
||||
# POST /api/v1.0/rollback/{target_revision_id}
|
||||
#"deckhand:create_encrypted_documents": "rule:admin_api"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user