1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AcquiaCloudApi\Endpoints; |
4
|
|
|
|
5
|
|
|
use AcquiaCloudApi\Connector\ClientInterface; |
6
|
|
|
use AcquiaCloudApi\Response\OperationResponse; |
7
|
|
|
use AcquiaCloudApi\Response\IdentityProvidersResponse; |
8
|
|
|
use AcquiaCloudApi\Response\IdentityProviderResponse; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Class IdentityProviders |
12
|
|
|
* @package AcquiaCloudApi\CloudApi |
13
|
|
|
*/ |
14
|
|
|
class IdentityProviders extends CloudApiBase implements CloudApiInterface |
15
|
|
|
{ |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Returns a list of identity providers for the user. |
19
|
|
|
* |
20
|
|
|
* @return IdentityProvidersResponse |
21
|
|
|
*/ |
22
|
|
|
public function getAll() |
23
|
|
|
{ |
24
|
|
|
return new IdentityProvidersResponse( |
25
|
|
|
$this->client->request( |
|
|
|
|
26
|
|
|
'get', |
27
|
|
|
"/identity-providers" |
28
|
|
|
) |
29
|
|
|
); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Returns a specific identity provider by UUID. |
34
|
|
|
* |
35
|
|
|
* @param string $idpUuid The identity provider ID |
36
|
|
|
* @return IdentityProviderResponse |
37
|
|
|
*/ |
38
|
|
|
public function get($idpUuid) |
39
|
|
|
{ |
40
|
|
|
return new IdentityProviderResponse( |
41
|
|
|
$this->client->request( |
|
|
|
|
42
|
|
|
'get', |
43
|
|
|
"/identity-providers/${idpUuid}" |
44
|
|
|
) |
45
|
|
|
); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Delete a specific identity provider by UUID. |
50
|
|
|
* |
51
|
|
|
* @param string $idpUuid |
52
|
|
|
* @return OperationResponse |
53
|
|
|
*/ |
54
|
|
|
public function delete($idpUuid) |
55
|
|
|
{ |
56
|
|
|
return new OperationResponse( |
57
|
|
|
$this->client->request( |
|
|
|
|
58
|
|
|
'delete', |
59
|
|
|
"/identity-providers/${idpUuid}" |
60
|
|
|
) |
61
|
|
|
); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Disables an identity provider by UUID. |
66
|
|
|
* |
67
|
|
|
* @param string $idpUuid |
68
|
|
|
* @return OperationResponse |
69
|
|
|
*/ |
70
|
|
|
public function disable($idpUuid) |
71
|
|
|
{ |
72
|
|
|
return new OperationResponse( |
73
|
|
|
$this->client->request( |
|
|
|
|
74
|
|
|
'post', |
75
|
|
|
"/identity-providers/${idpUuid}/actions/disable" |
76
|
|
|
) |
77
|
|
|
); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* Enables an identity provider by UUID. |
82
|
|
|
* |
83
|
|
|
* @param string $idpUuid |
84
|
|
|
* @return OperationResponse |
85
|
|
|
*/ |
86
|
|
|
public function enable($idpUuid) |
87
|
|
|
{ |
88
|
|
|
return new OperationResponse( |
89
|
|
|
$this->client->request( |
|
|
|
|
90
|
|
|
'post', |
91
|
|
|
"/identity-providers/${idpUuid}/actions/enable" |
92
|
|
|
) |
93
|
|
|
); |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* Updates a identity provider by UUID. |
98
|
|
|
* |
99
|
|
|
* @param string $idpUuid |
100
|
|
|
* @param string $label |
101
|
|
|
* @param string $entityId |
102
|
|
|
* @param string $ssoUrl |
103
|
|
|
* @param string $certificate |
104
|
|
|
* @return OperationResponse |
105
|
|
|
*/ |
106
|
|
|
public function update($idpUuid, $label, $entityId, $ssoUrl, $certificate) |
107
|
|
|
{ |
108
|
|
|
|
109
|
|
|
$options = [ |
110
|
|
|
'form_params' => [ |
111
|
|
|
'label' => $label, |
112
|
|
|
'entity_id' => $entityId, |
113
|
|
|
'sso_url' => $ssoUrl, |
114
|
|
|
'certificate' => $certificate, |
115
|
|
|
], |
116
|
|
|
]; |
117
|
|
|
|
118
|
|
|
return new OperationResponse( |
119
|
|
|
$this->client->request( |
|
|
|
|
120
|
|
|
'put', |
121
|
|
|
"/identity-providers/${idpUuid}", |
122
|
|
|
$options |
123
|
|
|
) |
124
|
|
|
); |
125
|
|
|
} |
126
|
|
|
} |
127
|
|
|
|