Beispiel #1
0
 /**
  * Gets the list of the security group rules (GET /security-group-rules/[rules-security-groups-id] )
  *
  * Lists a summary of all OpenStack Networking security group rules that the specified tenant can access.
  *
  * @param   string $id optional
  *          The ID of the security group rule to view
  *
  * @param   ListSecurityGroupRulesFilter|array $filter optional
  *          The filter options. Filter doesn't apply to detailed info
  *
  * @param   array $fields optional
  *          The list of the fields to show
  *
  * @return  DefaultPaginationList|object Returns the list of the security groups or specified security group
  * @throws  RestClientException
  */
 public function listSecurityGroupRules($id = null, $filter = null, array $fields = null)
 {
     if ($filter !== null && !$filter instanceof ListSecurityGroupRulesFilter) {
         $filter = ListSecurityGroupRulesFilter::initArray($filter);
     }
     return $this->getApiHandler()->listSecurityGroupRules($id, $filter, $fields);
 }
Beispiel #2
0
 /**
  * Gets the list of the security group rules (GET /security-group-rules/[rules-security-groups-id] )
  *
  * Lists a summary of all OpenStack Networking security group rules that the specified tenant can access.
  *
  * @param   string $id optional
  *          The ID of the security group rule to view
  *
  * @param   ListSecurityGroupRulesFilter $filter optional
  *          The filter options. Filter doesn't apply to detailed info
  *
  * @param   array $fields optional
  *          The list of the fields to show
  *
  * @return  DefaultPaginationList|object Returns the list of the security groups or specified security group
  * @throws  RestClientException
  */
 public function listSecurityGroupRules($id = null, ListSecurityGroupRulesFilter $filter = null, array $fields = null)
 {
     $result = null;
     $detailed = $id !== null ? sprintf("/%s", $this->escape($id)) : '';
     if (!empty($fields)) {
         $acceptedFields = ['id', 'security_group_id', 'tenant_id', 'direction', 'ethertype', 'port_range_max', 'port_range_min', 'protocol', 'remote_group_id', 'remote_ip_prefix'];
         $fields = join('&fields=', array_map("rawurlencode", array_intersect(array_values($fields), $acceptedFields)));
     }
     $querystr = ($filter !== null && $detailed == '' ? $filter->getQueryString() : '') . ($fields ? '&fields=' . $fields : '');
     $querystr = !empty($querystr) ? '?' . ltrim($querystr, '&') : '';
     $response = $this->getClient()->call($this->service, '/security-group-rules' . $detailed . $querystr);
     if ($response->hasError() === false) {
         $result = json_decode($response->getContent());
         if (empty($detailed)) {
             $result = new DefaultPaginationList($this->service, 'security_group_rules', $result->security_group_rules, isset($result->security_group_rules_links) ? $result->security_group_rules_links : null);
         } else {
             $result = $result->security_group_rule;
         }
     }
     return $result;
 }