Passed
Push — master ( be2d4f...7625ce )
by frey
01:09 queued 11s
created

Client::delete()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
c 0
b 0
f 0
dl 0
loc 8
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Freyo\ApiGateway\Service;
4
5
use Freyo\ApiGateway\Kernel\TencentCloudClient;
6
7
class Client extends TencentCloudClient
8
{
9
    /**
10
     * @return string
11
     */
12
    protected function getBaseUri()
13
    {
14
        return 'https://apigateway.api.qcloud.com/v2/';
15
    }
16
17
    /**
18
     * @param $serviceId
19
     *
20
     * @return array|\Freyo\ApiGateway\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
21
     * @throws \Freyo\ApiGateway\Kernel\Exceptions\InvalidConfigException
22
     */
23
    public function get($serviceId)
24
    {
25
        $params = [
26
            'Action' => 'DescribeService',
27
            'serviceId' => $serviceId,
28
        ];
29
30
        return $this->httpPost('index.php', $params);
31
    }
32
33
    /**
34
     * @param $serviceId
35
     *
36
     * @return array|\Freyo\ApiGateway\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
37
     * @throws \Freyo\ApiGateway\Kernel\Exceptions\InvalidConfigException
38
     */
39
    public function delete($serviceId)
40
    {
41
        $params = [
42
            'Action' => 'DeleteService',
43
            'serviceId' => $serviceId,
44
        ];
45
46
        return $this->httpPost('index.php', $params);
47
    }
48
49
    /**
50
     * @param $serviceId
51
     * @param $environmentName
52
     * @param $releaseDesc
53
     *
54
     * @return array|\Freyo\ApiGateway\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
55
     * @throws \Freyo\ApiGateway\Kernel\Exceptions\InvalidConfigException
56
     */
57
    public function release($serviceId, $environmentName, $releaseDesc)
58
    {
59
        $params = [
60
            'Action' => 'ReleaseService',
61
            'serviceId' => $serviceId,
62
            'environmentName' => $environmentName,
63
            'releaseDesc' => $releaseDesc,
64
        ];
65
66
        return $this->httpPost('index.php', $params);
67
    }
68
69
    /**
70
     * @param $protocol
71
     * @param $serviceName
72
     * @param $serviceDesc
73
     *
74
     * @return array|\Freyo\ApiGateway\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
75
     * @throws \Freyo\ApiGateway\Kernel\Exceptions\InvalidConfigException
76
     */
77
    public function create($protocol, $serviceName = null, $serviceDesc = null)
78
    {
79
        $params = [
80
            'Action' => 'CreateService',
81
            'protocol' => $protocol,
82
            'serviceName' => $serviceName,
83
            'serviceDesc' => $serviceDesc,
84
        ];
85
86
        return $this->httpPost('index.php', $params);
87
    }
88
89
    /**
90
     * @param $serviceId
91
     * @param $protocol
92
     * @param $serviceName
93
     * @param $serviceDesc
94
     *
95
     * @return array|\Freyo\ApiGateway\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
96
     * @throws \Freyo\ApiGateway\Kernel\Exceptions\InvalidConfigException
97
     */
98
    public function update($serviceId, $protocol = null, $serviceName = null, $serviceDesc = null)
99
    {
100
        $params = [
101
            'Action' => 'ModifyService',
102
            'serviceId' => $serviceId,
103
            'protocol' => $protocol,
104
            'serviceName' => $serviceName,
105
            'serviceDesc' => $serviceDesc,
106
        ];
107
108
        return $this->httpPost('index.php', $params);
109
    }
110
}