From f710bec559e841570d9defc8c5d067f07d699a1b Mon Sep 17 00:00:00 2001 From: Samuel Chiriluta Date: Mon, 12 Jun 2017 11:35:21 +0300 Subject: [PATCH 1/7] Create Policy.php --- src/Identity/v3/Models/Policy.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Identity/v3/Models/Policy.php b/src/Identity/v3/Models/Policy.php index 700685b5..6e2fc63e 100644 --- a/src/Identity/v3/Models/Policy.php +++ b/src/Identity/v3/Models/Policy.php @@ -32,6 +32,9 @@ class Policy extends OperatorResource implements Creatable, Listable, Retrievabl /** @var string */ public $userId; + protected $resourceKey = 'policy'; + protected $resourcesKey = 'policies'; + protected $aliases = [ 'project_id' => 'projectId', 'user_id' => 'userId' From fc8daf6f101dc639568985082bea9370711a099c Mon Sep 17 00:00:00 2001 From: Samuel Chiriluta Date: Mon, 12 Jun 2017 11:36:40 +0300 Subject: [PATCH 2/7] Create Api.php --- src/Identity/v3/Api.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Identity/v3/Api.php b/src/Identity/v3/Api.php index f1386d90..4c652490 100644 --- a/src/Identity/v3/Api.php +++ b/src/Identity/v3/Api.php @@ -772,6 +772,7 @@ public function postPolicies(): array return [ 'method' => 'POST', 'path' => 'policies', + 'jsonKey' => 'policy', 'params' => [ 'blob' => $this->params->blob(), 'projectId' => $this->params->projectId('policy'), From cd57c5cb4928f401e5964764c55292ea251fc902 Mon Sep 17 00:00:00 2001 From: Samuel Chiriluta Date: Tue, 13 Jun 2017 01:30:08 +0300 Subject: [PATCH 3/7] Create PolicyTest.php --- tests/unit/Identity/v3/Models/PolicyTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/Identity/v3/Models/PolicyTest.php b/tests/unit/Identity/v3/Models/PolicyTest.php index 78336265..57b4ffbc 100644 --- a/tests/unit/Identity/v3/Models/PolicyTest.php +++ b/tests/unit/Identity/v3/Models/PolicyTest.php @@ -37,7 +37,7 @@ public function test_it_creates() 'user_id' => 'id', ]; - $this->setupMock('POST', 'policies', $userJson, [], 'policy'); + $this->setupMock('POST', 'policy', $userJson, [], 'policy'); /** @var $policy \OpenStack\Identity\v3\Models\Policy */ $policy = $this->policy->create($userOptions); From 84429fa1c11313a15e12786767a26abb54a224db Mon Sep 17 00:00:00 2001 From: Samuel Chiriluta Date: Tue, 13 Jun 2017 01:32:14 +0300 Subject: [PATCH 4/7] Create ServiceTest.php --- tests/unit/Identity/v3/ServiceTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/Identity/v3/ServiceTest.php b/tests/unit/Identity/v3/ServiceTest.php index 825ce751..0873df02 100644 --- a/tests/unit/Identity/v3/ServiceTest.php +++ b/tests/unit/Identity/v3/ServiceTest.php @@ -435,7 +435,7 @@ public function test_it_creates_policy() 'user_id' => $userOptions['userId'], ]; - $this->setupMock('POST', 'policies', $userJson, [], 'policy'); + $this->setupMock('POST', 'policy', $userJson, [], 'policy'); /** @var $endpoint \OpenStack\Identity\v3\Models\Policy */ $policy = $this->service->createPolicy($userOptions); From 687d88f27c5dd0a79a9af18579a553b1473a01b7 Mon Sep 17 00:00:00 2001 From: Samuel Chiriluta Date: Tue, 13 Jun 2017 01:41:26 +0300 Subject: [PATCH 5/7] Create PolicyTest.php --- tests/unit/Identity/v3/Models/PolicyTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/Identity/v3/Models/PolicyTest.php b/tests/unit/Identity/v3/Models/PolicyTest.php index 57b4ffbc..dd41f5ce 100644 --- a/tests/unit/Identity/v3/Models/PolicyTest.php +++ b/tests/unit/Identity/v3/Models/PolicyTest.php @@ -37,7 +37,7 @@ public function test_it_creates() 'user_id' => 'id', ]; - $this->setupMock('POST', 'policy', $userJson, [], 'policy'); + $this->setupMock('POST', 'policies', ['policy' => $userJson], [], 'policy'); /** @var $policy \OpenStack\Identity\v3\Models\Policy */ $policy = $this->policy->create($userOptions); From aed55ebce92617744be2454da12ce758d30f2f20 Mon Sep 17 00:00:00 2001 From: Samuel Chiriluta Date: Tue, 13 Jun 2017 01:42:37 +0300 Subject: [PATCH 6/7] Create ServiceTest.php --- tests/unit/Identity/v3/ServiceTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/Identity/v3/ServiceTest.php b/tests/unit/Identity/v3/ServiceTest.php index 0873df02..c9ba7aa2 100644 --- a/tests/unit/Identity/v3/ServiceTest.php +++ b/tests/unit/Identity/v3/ServiceTest.php @@ -435,7 +435,7 @@ public function test_it_creates_policy() 'user_id' => $userOptions['userId'], ]; - $this->setupMock('POST', 'policy', $userJson, [], 'policy'); + $this->setupMock('POST', 'policies', ['policy' => $userJson], [], 'policy'); /** @var $endpoint \OpenStack\Identity\v3\Models\Policy */ $policy = $this->service->createPolicy($userOptions); From 4600b062687459d7e2e78842c3054d810e7357ea Mon Sep 17 00:00:00 2001 From: Samuel Chiriluta Date: Tue, 13 Jun 2017 01:52:14 +0300 Subject: [PATCH 7/7] Create Api.php realign keys --- src/Identity/v3/Api.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Identity/v3/Api.php b/src/Identity/v3/Api.php index 4c652490..b142e1e1 100644 --- a/src/Identity/v3/Api.php +++ b/src/Identity/v3/Api.php @@ -770,8 +770,8 @@ public function getRoleAssignments(): array public function postPolicies(): array { return [ - 'method' => 'POST', - 'path' => 'policies', + 'method' => 'POST', + 'path' => 'policies', 'jsonKey' => 'policy', 'params' => [ 'blob' => $this->params->blob(),