Groups

Add group

Show auth code
<?php

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
    'authUrl' => '{authUrl}',
    'region'  => '{region}',
    'user'    => [
        'id'       => '{userId}',
        'password' => '{password}'
    ],
    'scope' => [
        'project' => [
            'id' => '{projectId}'
        ]
    ]
]);
$identity = $openstack->identityV3(['region' => '{region}']);

$group = $identity->createGroup([
    'description' => '{description}',
    'name'        => '{name}',
]);

To see all the required and optional parameters for this operation, along with their types and descriptions, view the reference documentation.

List groups

Show auth code
<?php

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
    'authUrl' => '{authUrl}',
    'region'  => '{region}',
    'user'    => [
        'id'       => '{userId}',
        'password' => '{password}'
    ],
    'scope' => [
        'project' => [
            'id' => '{projectId}'
        ]
    ]
]);
$identity = $openstack->identityV3(['region' => '{region}']);

foreach ($identity->listGroups() as $group) {
}

To see all the required and optional parameters for this operation, along with their types and descriptions, view the reference documentation.

Show group details

Show auth code
<?php

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
    'authUrl' => '{authUrl}',
    'region'  => '{region}',
    'user'    => [
        'id'       => '{userId}',
        'password' => '{password}'
    ],
    'scope' => [
        'project' => [
            'id' => '{projectId}'
        ]
    ]
]);
$identity = $openstack->identityV3(['region' => '{region}']);

$group = $identity->getGroup('{groupId}');
$group->retrieve();

To see all the required and optional parameters for this operation, along with their types and descriptions, view the reference documentation.

Update group

Show auth code
<?php

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
    'authUrl' => '{authUrl}',
    'region'  => '{region}',
    'user'    => [
        'id'       => '{userId}',
        'password' => '{password}'
    ],
    'scope' => [
        'project' => [
            'id' => '{projectId}'
        ]
    ]
]);
$identity = $openstack->identityV3(['region' => '{region}']);

$group = $identity->getGroup('{groupId}');

$group->description = 'foo';
$group->name = 'bar';

$group->update();

To see all the required and optional parameters for this operation, along with their types and descriptions, view the reference documentation.

Delete group

Show auth code
<?php

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
    'authUrl' => '{authUrl}',
    'region'  => '{region}',
    'user'    => [
        'id'       => '{userId}',
        'password' => '{password}'
    ],
    'scope' => [
        'project' => [
            'id' => '{projectId}'
        ]
    ]
]);
$identity = $openstack->identityV3(['region' => '{region}']);

$group = $identity->getGroup('{groupId}');

$group->delete();

To see all the required and optional parameters for this operation, along with their types and descriptions, view the reference documentation.

List users in a group

Show auth code
<?php

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
    'authUrl' => '{authUrl}',
    'region'  => '{region}',
    'user'    => [
        'id'       => '{userId}',
        'password' => '{password}'
    ],
    'scope' => [
        'project' => [
            'id' => '{projectId}'
        ]
    ]
]);
$identity = $openstack->identityV3(['region' => '{region}']);

$group = $identity->getGroup('{groupId}');

foreach ($group->listUsers() as $user) {
}

To see all the required and optional parameters for this operation, along with their types and descriptions, view the reference documentation.

Add user to group

Show auth code
<?php

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
    'authUrl' => '{authUrl}',
    'region'  => '{region}',
    'user'    => [
        'id'       => '{userId}',
        'password' => '{password}'
    ],
    'scope' => [
        'project' => [
            'id' => '{projectId}'
        ]
    ]
]);
$identity = $openstack->identityV3(['region' => '{region}']);

$group = $identity->getGroup('{groupId}');

$group->addUser(['userId' => '{groupUserId}']);

To see all the required and optional parameters for this operation, along with their types and descriptions, view the reference documentation.

Remove user from group

Show auth code
<?php

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
    'authUrl' => '{authUrl}',
    'region'  => '{region}',
    'user'    => [
        'id'       => '{userId}',
        'password' => '{password}'
    ],
    'scope' => [
        'project' => [
            'id' => '{projectId}'
        ]
    ]
]);
$identity = $openstack->identityV3(['region' => '{region}']);

$group = $identity->getGroup('{groupId}');

$group->removeUser(['userId' => '{groupUserId}']);

To see all the required and optional parameters for this operation, along with their types and descriptions, view the reference documentation.

Check user membership in a group

Show auth code
<?php

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
    'authUrl' => '{authUrl}',
    'region'  => '{region}',
    'user'    => [
        'id'       => '{userId}',
        'password' => '{password}'
    ],
    'scope' => [
        'project' => [
            'id' => '{projectId}'
        ]
    ]
]);
$identity = $openstack->identityV3(['region' => '{region}']);

$group = $identity->getGroup('{groupId}');

$result = $group->checkMembership(['userId' => '{groupUserId}']);

if (true === $result) {
}

To see all the required and optional parameters for this operation, along with their types and descriptions, view the reference documentation.