1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AcquiaCloudApi\Endpoints; |
4
|
|
|
|
5
|
|
|
use AcquiaCloudApi\Connector\ClientInterface; |
6
|
|
|
use AcquiaCloudApi\Response\ApplicationResponse; |
7
|
|
|
use AcquiaCloudApi\Response\ApplicationsResponse; |
8
|
|
|
use AcquiaCloudApi\Response\InvitationsResponse; |
9
|
|
|
use AcquiaCloudApi\Response\MembersResponse; |
10
|
|
|
use AcquiaCloudApi\Response\OrganizationsResponse; |
11
|
|
|
use AcquiaCloudApi\Response\RolesResponse; |
12
|
|
|
use AcquiaCloudApi\Response\TeamsResponse; |
13
|
|
|
use AcquiaCloudApi\Response\OperationResponse; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Class Client |
17
|
|
|
* @package AcquiaCloudApi\CloudApi |
18
|
|
|
*/ |
19
|
|
|
class Organization implements CloudApi |
20
|
|
|
{ |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* Client constructor. |
24
|
|
|
* |
25
|
|
|
* @param ConnectorInterface $connector |
|
|
|
|
26
|
|
|
*/ |
27
|
|
|
public function __construct(ClientInterface $client) |
28
|
|
|
{ |
29
|
|
|
$this->client = $client; |
|
|
|
|
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Show all organizations. |
34
|
|
|
* |
35
|
|
|
* @return OrganizationsResponse |
36
|
|
|
*/ |
37
|
|
|
public function getOrganizations() |
38
|
|
|
{ |
39
|
|
|
return new OrganizationsResponse($this->client->request('get', '/organizations')); |
|
|
|
|
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Show all applications in an organisation. |
44
|
|
|
* |
45
|
|
|
* @param string $organizationUuid |
46
|
|
|
* |
47
|
|
|
* @return ApplicationsResponse |
48
|
|
|
*/ |
49
|
|
|
public function getApplications($organizationUuid) |
50
|
|
|
{ |
51
|
|
|
return new ApplicationsResponse( |
52
|
|
|
$this->client->request('get', "/organizations/${organizationUuid}/applications") |
|
|
|
|
53
|
|
|
); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* Show all roles in an organization. |
58
|
|
|
* |
59
|
|
|
* @param string $organizationUuid |
60
|
|
|
* @return RolesResponse |
61
|
|
|
*/ |
62
|
|
|
public function getRoles($organizationUuid) |
63
|
|
|
{ |
64
|
|
|
return new RolesResponse( |
65
|
|
|
$this->client->request('get', "/organizations/${organizationUuid}/roles") |
|
|
|
|
66
|
|
|
); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* Create a new role. |
71
|
|
|
* |
72
|
|
|
* @param string $organizationUuid |
73
|
|
|
* @param string $name |
74
|
|
|
* @param array $permissions |
75
|
|
|
* @param null|string $description |
76
|
|
|
* @return OperationResponse |
77
|
|
|
*/ |
78
|
|
|
public function createRole($organizationUuid, $name, array $permissions, $description = null) |
79
|
|
|
{ |
80
|
|
|
$options = [ |
81
|
|
|
'form_params' => [ |
82
|
|
|
'name' => $name, |
83
|
|
|
'permissions' => $permissions, |
84
|
|
|
'description' => $description, |
85
|
|
|
], |
86
|
|
|
]; |
87
|
|
|
|
88
|
|
|
return new OperationResponse( |
89
|
|
|
$this->client->request('post', "/organizations/${organizationUuid}/roles", $options) |
|
|
|
|
90
|
|
|
); |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* Show all teams in an organization. |
95
|
|
|
* |
96
|
|
|
* @param string $organizationUuid |
97
|
|
|
* @return TeamsResponse |
98
|
|
|
*/ |
99
|
|
|
public function getTeams($organizationUuid) |
100
|
|
|
{ |
101
|
|
|
return new TeamsResponse( |
102
|
|
|
$this->client->request('get', "/organizations/${organizationUuid}/teams") |
|
|
|
|
103
|
|
|
); |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* Create a new team. |
108
|
|
|
* |
109
|
|
|
* @param string $organizationUuid |
110
|
|
|
* @param string $name |
111
|
|
|
* @return OperationResponse |
112
|
|
|
*/ |
113
|
|
|
public function createTeam($organizationUuid, $name) |
114
|
|
|
{ |
115
|
|
|
$options = [ |
116
|
|
|
'form_params' => [ |
117
|
|
|
'name' => $name, |
118
|
|
|
], |
119
|
|
|
]; |
120
|
|
|
|
121
|
|
|
return new OperationResponse( |
122
|
|
|
$this->client->request('post', "/organizations/${organizationUuid}/teams", $options) |
|
|
|
|
123
|
|
|
); |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* Show all members of an organisation. |
128
|
|
|
* |
129
|
|
|
* @param string $organizationUuid |
130
|
|
|
* @return MembersResponse |
131
|
|
|
*/ |
132
|
|
|
public function getMembers($organizationUuid) |
133
|
|
|
{ |
134
|
|
|
return new MembersResponse( |
135
|
|
|
$this->client->request('get', "/organizations/${organizationUuid}/members") |
|
|
|
|
136
|
|
|
); |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* Show all members invited to an organisation. |
141
|
|
|
* |
142
|
|
|
* @param string $organizationUuid |
143
|
|
|
* @return InvitationsResponse |
144
|
|
|
*/ |
145
|
|
|
public function getInvitees($organizationUuid) |
146
|
|
|
{ |
147
|
|
|
return new InvitationsResponse( |
148
|
|
|
$this->client->request('get', "/organizations/${organizationUuid}/team-invites") |
|
|
|
|
149
|
|
|
); |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
/** |
153
|
|
|
* Delete a member from an organisation. |
154
|
|
|
* |
155
|
|
|
* @param string $organizationUuid |
156
|
|
|
* @param string $memberUuid |
157
|
|
|
* @return OperationResponse |
158
|
|
|
*/ |
159
|
|
|
public function deleteMember($organizationUuid, $memberUuid) |
160
|
|
|
{ |
161
|
|
|
return new OperationResponse( |
162
|
|
|
$this->client->request( |
|
|
|
|
163
|
|
|
'delete', |
164
|
|
|
"/organizations/${organizationUuid}/members/${memberUuid}" |
165
|
|
|
) |
166
|
|
|
); |
167
|
|
|
} |
168
|
|
|
} |
169
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths