Skip to content

Commit 12ab91a

Browse files
committed
fix: correct credentials structure
1 parent 46bc05b commit 12ab91a

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

src/Identity/v3/Api.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,7 @@ public function postCredentials(): array
694694
return [
695695
'method' => 'POST',
696696
'path' => 'credentials',
697+
'jsonKey' => 'credential',
697698
'params' => [
698699
'blob' => $this->params->blob(),
699700
'projectId' => $this->params->projectId(),
@@ -726,6 +727,7 @@ public function patchCredential(): array
726727
return [
727728
'method' => 'PATCH',
728729
'path' => 'credentials/{id}',
730+
'jsonKey' => 'credential',
729731
'params' => ['id' => $this->params->idUrl('credential')] + $this->postCredentials()['params'],
730732
];
731733
}

tests/unit/Identity/v3/Models/CredentialTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ public function test_it_updates()
3434
$this->credential->projectId = 'bar';
3535

3636
$expectedJson = [
37-
'type' => 'foo',
38-
'project_id' => 'bar',
37+
'credential' => [
38+
'type' => 'foo',
39+
'project_id' => 'bar',
40+
]
3941
];
4042

4143
$this->mockRequest('PATCH', 'credentials/CRED_ID', 'cred', $expectedJson, []);

tests/unit/Identity/v3/ServiceTest.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -501,17 +501,19 @@ public function test_it_gets_group()
501501
public function test_it_creates_credential()
502502
{
503503
$userOptions = [
504-
'blob' => "{\"access\":\"--access-key--\",\"secret\":\"--secret-key--\"}",
505-
'projectId' => 'project_id',
506-
'type' => 'ec2',
507-
'userId' => 'user_id'
504+
'blob' => "{\"access\":\"--access-key--\",\"secret\":\"--secret-key--\"}",
505+
'projectId' => 'project_id',
506+
'type' => 'ec2',
507+
'userId' => 'user_id',
508508
];
509509

510510
$userJson = [
511-
'blob' => $userOptions['blob'],
512-
'project_id' => $userOptions['projectId'],
513-
'type' => $userOptions['type'],
514-
'user_id' => $userOptions['userId'],
511+
'credential' => [
512+
'blob' => $userOptions['blob'],
513+
'project_id' => $userOptions['projectId'],
514+
'type' => $userOptions['type'],
515+
'user_id' => $userOptions['userId'],
516+
],
515517
];
516518

517519
$this->mockRequest('POST', 'credentials', 'cred', $userJson);

0 commit comments

Comments
 (0)