public static function fromJson($json) { if (is_object($json)) { $policy = new QuotaPolicy(); if (isset($json->quotas)) { $policy->setQuotas($json->quotas); } return $policy; } return NULL; }
public function getBucketQuota($bucket_name) { $uri = $this->formatUri($this->fds_config->getBaseUri(), $bucket_name, SubResource::QUOTA); $headers = $this->prepareRequestHeader($uri, Http::GET, Mime::JSON); $response = $this->invoke(Action::GetBucketQuota, $uri, $headers, Http::GET, Mime::JSON, null); if ($response->code == self::HTTP_OK) { $policy = QuotaPolicy::fromJson($response->body); return $policy; } else { $message = "Get bucket quota failed, status=" . $response->code . ", bucket_name=" . $bucket_name . ", reason=" . $response->raw_body; $this->printResponse($response); throw new GalaxyFDSClientException($message); } }