Scalr\Service\OpenStack\Services\Network\V2\NetworkApi::createSecurityGroup PHP Method

createSecurityGroup() public method

Creates Security group (POST /security-groups)
public createSecurityGroup ( string $name, string $description = null ) : object
$name string The name of the security group
$description string optional The description of the security group
return object Returns security group object
    public function createSecurityGroup($name, $description = null)
    {
        $result = null;
        $request = ['name' => $name];
        if (!empty($description)) {
            $request['description'] = $description;
        }
        $response = $this->getClient()->call($this->service, '/security-groups', ['security_group' => $request], 'POST');
        if ($response->hasError() === false) {
            $result = json_decode($response->getContent());
            $result = $result->security_group;
        }
        return $result;
    }