Insights::ignoreAlert()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 2
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace AcquiaCloudApi\Endpoints;
4
5
use AcquiaCloudApi\Response\InsightAlertResponse;
6
use AcquiaCloudApi\Response\InsightAlertsResponse;
7
use AcquiaCloudApi\Response\InsightModuleResponse;
8
use AcquiaCloudApi\Response\InsightModulesResponse;
9
use AcquiaCloudApi\Response\InsightResponse;
10
use AcquiaCloudApi\Response\InsightsResponse;
11
use AcquiaCloudApi\Response\OperationResponse;
12
13
/**
14
 * Class Insights
15
 *
16
 * @package AcquiaCloudApi\CloudApi
17
 */
18
class Insights extends CloudApiBase
19
{
20
    /**
21
     * Returns Insight data for all sites associated with the application by its
22
     * UUID.
23
     *
24
     * @return InsightsResponse<InsightResponse>
25
     */
26
    public function getAll(string $applicationUuid): InsightsResponse
27
    {
28
        return new InsightsResponse(
29
            $this->client->request(
30
                'get',
31
                "/applications/$applicationUuid/insight"
32
            )
33
        );
34
    }
35
36
    /**
37
     * Returns Insight data for all sites associated with the environment by its
38
     * UUID.
39
     *
40
     * @return InsightsResponse<InsightResponse>
41
     */
42
    public function getEnvironment(string $environmentUuid): InsightsResponse
43
    {
44
        return new InsightsResponse(
45
            $this->client->request(
46
                'get',
47
                "/environments/$environmentUuid/insight"
48
            )
49
        );
50
    }
51
52
    /**
53
     * Returns insight data for a particular site.
54
     */
55
    public function get(string $siteId): InsightResponse
56
    {
57
        return new InsightResponse(
58
            $this->client->request(
59
                'get',
60
                "/insight/$siteId"
61
            )
62
        );
63
    }
64
65
    /**
66
     * Returns a list of Insight alerts for this site.
67
     *
68
     * @return InsightAlertsResponse<InsightAlertResponse>
69
     */
70
    public function getAllAlerts(string $siteId): InsightAlertsResponse
71
    {
72
        return new InsightAlertsResponse(
73
            $this->client->request(
74
                'get',
75
                "/insight/$siteId/alerts"
76
            )
77
        );
78
    }
79
80
    /**
81
     * Returns a specific Insight alert for this site.
82
     */
83
    public function getAlert(string $siteId, string $alertUuid): InsightAlertResponse
84
    {
85
        return new InsightAlertResponse(
86
            $this->client->request(
87
                'get',
88
                "/insight/$siteId/alerts/$alertUuid"
89
            )
90
        );
91
    }
92
93
    /**
94
     * Ignores an alert. An ignored alert will be included will not be counted
95
     * in the Insight score calculation.
96
     */
97
    public function ignoreAlert(string $siteId, string $alertUuid): OperationResponse
98
    {
99
        return new OperationResponse(
100
            $this->client->request(
101
                'post',
102
                "/insight/$siteId/alerts/$alertUuid/actions/ignore"
103
            )
104
        );
105
    }
106
107
    /**
108
     * Restores an alert. A restored alert will be included in the calculation
109
     * of the Insight score.
110
     */
111
    public function restoreAlert(string $siteId, string $alertUuid): OperationResponse
112
    {
113
        return new OperationResponse(
114
            $this->client->request(
115
                'post',
116
                "/insight/$siteId/alerts/$alertUuid/actions/restore"
117
            )
118
        );
119
    }
120
121
    /**
122
     * Revokes an Insight install so it can no longer submit data using the
123
     * Acquia Connector module.
124
     */
125
    public function revoke(string $siteId): OperationResponse
126
    {
127
        return new OperationResponse(
128
            $this->client->request(
129
                'post',
130
                "/insight/$siteId/actions/revoke"
131
            )
132
        );
133
    }
134
135
    /**
136
     * Un-revokes an Insight site so it can once again submit data using the
137
     * Acquia Connector module. Note that the site must also be unblocked using
138
     * the Acquia Connector module.
139
     */
140
    public function unrevoke(string $siteId): OperationResponse
141
    {
142
        return new OperationResponse(
143
            $this->client->request(
144
                'post',
145
                "/insight/$siteId/actions/unrevoke"
146
            )
147
        );
148
    }
149
150
    /**
151
     * Returns a list of Drupal modules for this site.
152
     *
153
     * @return InsightModulesResponse<InsightModuleResponse>
154
     */
155
    public function getModules(string $siteId): InsightModulesResponse
156
    {
157
        return new InsightModulesResponse(
158
            $this->client->request(
159
                'get',
160
                "/insight/$siteId/modules"
161
            )
162
        );
163
    }
164
}
165