-
Notifications
You must be signed in to change notification settings - Fork 28
added method for getQPS to zone, #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
f9c4bdb
883b45d
e58b60d
e26ccc0
c8de341
caad883
2026f20
06a7718
d95c633
b9a3063
c2d883d
bf72ae3
1799885
a29c0f5
de21998
112b428
e187b89
a8bbc71
3b33a10
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ | |
|
|
||
| use Dyn\TrafficManagement\Api\Client as ApiClient; | ||
| use Dyn\TrafficManagement\Zone; | ||
| use Symfony\Component\Config\Definition\Exception\Exception; | ||
| use Zend\Http\Client as HttpClient; | ||
|
|
||
| class TrafficManagement | ||
|
|
@@ -182,6 +183,29 @@ public function getZone($zoneName) | |
| return false; | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * @param $start int | ||
| * @param $end int | ||
| * @return bool|Zone | ||
| */ | ||
| public function getQpsJobs($start,$end) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Naming this function Also, could you make the parameters camel cased versions of the actual API call args? So I would be inclined to make this call return the actual data on success (rather than a response object), just so users of the function don't need to understand the structure of the response object as well: |
||
| { | ||
| $apiClient = $this->getApiClient(); | ||
|
|
||
| ///QPSReport/', ); | ||
| $result = $apiClient->post( | ||
| '/QPSReport/', | ||
| ['start_ts' => $start, 'end_ts' => $end, 'breakdown' => ['zones']] | ||
| ); | ||
|
|
||
| if ($result && $result->isComplete()) { | ||
| return $result; | ||
| } | ||
|
|
||
| return $apiClient->getLastHttpResponse(); | ||
| } | ||
|
|
||
| /** | ||
| * Returns an array of all zones from the account | ||
| * | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,6 +88,24 @@ public function getName() | |
| return $this->name; | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * | ||
| * API request for this zones QPS reports for the given timeframe | ||
| * | ||
| * @param $start int | ||
| * @param $end int | ||
| * @return ApiResponse|false | ||
| */ | ||
| public function getQPS($start, $end) | ||
| { | ||
| $path = '/QPSReport/'; | ||
|
|
||
| $result = $this->apiClient->post($path, ['start_ts'=>$start,'end_ts'=>$end,'zones'=>[$this->name]]); | ||
|
|
||
| return $result; | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same feedback here as for the |
||
|
|
||
| /** | ||
| * Setter for type | ||
| * | ||
|
|
@@ -215,6 +233,7 @@ public function getDefaultTtl($defaultTtl) | |
| return $this->defaultTtl; | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * Create the supplied record | ||
| * | ||
|
|
@@ -246,7 +265,7 @@ public function createRecord(RecordInterface $record, $fqdn = null) | |
| */ | ||
| public function createRecordFromParams($type, $fqdn, array $params) | ||
| { | ||
| $result = $this->apiClient->post('/'.$type.'Record/'.$this->getName().'/'.$fqdn.'/', $params); | ||
| $result = $this->apiClient->post('/'.$type.'Record/'.$this->getName().'/'.$fqdn.'/', $params); | ||
| if ($result && $result->isOk()) { | ||
| if ($result->isComplete()) { | ||
| return true; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you remove this import, as it doesn't appear to be used.