PHP SDK
IAM
Users, service accounts, groups, roles, policies, and authorization
52 methods
assumeRole()
Assume role
Parameters
role_idstring
requiredduration_secondsinteger
- Credential validity duration (15 min to 12 hours)
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->assumeRole(['role_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
listGroups()
List groups
Parameters
limitinteger
- Maximum number of items to return
markerstring
- ID of the last item from the previous page (for pagination)
namestring
- Filter by name (exact match or prefix with *)
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->listGroups();print_r($result);
createGroup()
Create group
Parameters
namestring
requireddescriptionstring
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->createGroup(['name' => 'developers']);print_r($result);
getGroup()
Get group
Parameters
group_idstring
required- Group ID
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->getGroup(['group_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
updateGroup()
Update group
Parameters
group_idstring
required- Group ID
namestring
descriptionstring
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->updateGroup(['group_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
deleteGroup()
Delete group
Parameters
group_idstring
required- Group ID
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->deleteGroup(['group_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
listGroupPolicies()
List group policies
Parameters
group_idstring
required- Group ID
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->listGroupPolicies(['group_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
attachGroupPolicy()
Attach policy to group
Parameters
group_idstring
required- Group ID
policy_idstring
requiredExample
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->attachGroupPolicy(['group_id' => '550e8400-e29b-41d4-a716-446655440000','policy_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
detachGroupPolicy()
Detach policy from group
Parameters
group_idstring
required- Group ID
policy_idstring
required- Policy ID
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->detachGroupPolicy(['group_id' => '550e8400-e29b-41d4-a716-446655440000','policy_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
listGroupServiceAccounts()
List group service accounts
Parameters
group_idstring
required- Group ID
limitinteger
- Maximum number of items to return
markerstring
- ID of the last item from the previous page (for pagination)
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->listGroupServiceAccounts(['group_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
listGroupUsers()
List group users
Parameters
group_idstring
required- Group ID
limitinteger
- Maximum number of items to return
markerstring
- ID of the last item from the previous page (for pagination)
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->listGroupUsers(['group_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
listPolicies()
List policies
Parameters
limitinteger
- Maximum number of items to return
markerstring
- ID of the last item from the previous page (for pagination)
namestring
- Filter by name (exact match or prefix with *)
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->listPolicies();print_r($result);
createPolicy()
Create policy
Parameters
namestring
requireddescriptionstring
documentobject
required- IAM-style policy document
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->createPolicy(['name' => 'S3BucketAccess','document' => ['version' => '2024-01-01','statements' => [['sid' => 'AllowS3Read','effect' => 'allow','actions' => ['s3:GetObject','s3:ListBucket']]]]]);print_r($result);
getPolicy()
Get policy
Parameters
policy_idstring
required- Policy ID
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->getPolicy(['policy_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
updatePolicy()
Update policy
Parameters
policy_idstring
required- Policy ID
namestring
descriptionstring
documentobject
- IAM-style policy document
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->updatePolicy(['policy_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
deletePolicy()
Delete policy
Parameters
policy_idstring
required- Policy ID
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->deletePolicy(['policy_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
listPolicyGroups()
List groups with policy
Parameters
policy_idstring
required- Policy ID
limitinteger
- Maximum number of items to return
markerstring
- ID of the last item from the previous page (for pagination)
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->listPolicyGroups(['policy_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
listPolicyRoles()
List roles with policy
Parameters
policy_idstring
required- Policy ID
limitinteger
- Maximum number of items to return
markerstring
- ID of the last item from the previous page (for pagination)
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->listPolicyRoles(['policy_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
listPolicyServiceAccounts()
List service accounts with policy
Parameters
policy_idstring
required- Policy ID
limitinteger
- Maximum number of items to return
markerstring
- ID of the last item from the previous page (for pagination)
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->listPolicyServiceAccounts(['policy_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
listPolicyUsers()
List users with policy
Parameters
policy_idstring
required- Policy ID
limitinteger
- Maximum number of items to return
markerstring
- ID of the last item from the previous page (for pagination)
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->listPolicyUsers(['policy_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
listRoles()
List roles
Parameters
limitinteger
- Maximum number of items to return
markerstring
- ID of the last item from the previous page (for pagination)
namestring
- Filter by name (exact match or prefix with *)
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->listRoles();print_r($result);
createRole()
Create role
Parameters
namestring
requireddescriptionstring
trust_policyobject
- Defines who/what can assume this role using CRN patterns
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->createRole(['name' => 'S3ReadOnly']);print_r($result);
getRole()
Get role
Parameters
role_idstring
required- Role ID
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->getRole(['role_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
updateRole()
Update role
Parameters
role_idstring
required- Role ID
namestring
descriptionstring
trust_policyobject
- Defines who/what can assume this role using CRN patterns
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->updateRole(['role_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
deleteRole()
Delete role
Parameters
role_idstring
required- Role ID
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->deleteRole(['role_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
listRolePolicies()
List role policies
Parameters
role_idstring
required- Role ID
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->listRolePolicies(['role_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
attachRolePolicy()
Attach policy to role
Parameters
role_idstring
required- Role ID
policy_idstring
requiredExample
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->attachRolePolicy(['role_id' => '550e8400-e29b-41d4-a716-446655440000','policy_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
detachRolePolicy()
Detach policy from role
Parameters
role_idstring
required- Role ID
policy_idstring
required- Policy ID
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->detachRolePolicy(['role_id' => '550e8400-e29b-41d4-a716-446655440000','policy_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
listServiceAccounts()
List service accounts
Parameters
limitinteger
- Maximum number of items to return
markerstring
- ID of the last item from the previous page (for pagination)
namestring
- Filter by name (exact match or prefix with *)
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->listServiceAccounts();print_r($result);
createServiceAccount()
Create service account
Parameters
namestring
requireddisplay_namestring
descriptionstring
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->createServiceAccount(['name' => 'ci-cd-pipeline']);print_r($result);
getServiceAccount()
Get service account
Parameters
service_account_idstring
required- Service Account ID
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->getServiceAccount(['service_account_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
updateServiceAccount()
Update service account
Parameters
service_account_idstring
required- Service Account ID
display_namestring
descriptionstring
enabledboolean
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->updateServiceAccount(['service_account_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
deleteServiceAccount()
Delete service account
Parameters
service_account_idstring
required- Service Account ID
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->deleteServiceAccount(['service_account_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
listServiceAccountCredentials()
List credentials
Parameters
service_account_idstring
required- Service Account ID
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->listServiceAccountCredentials(['service_account_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
createServiceAccountCredential()
Create credential
Parameters
service_account_idstring
required- Service Account ID
namestring
requiredexpires_atstring
- Optional expiration date
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->createServiceAccountCredential(['service_account_id' => '550e8400-e29b-41d4-a716-446655440000','name' => 'production-key']);print_r($result);
deleteServiceAccountCredential()
Delete credential
Parameters
service_account_idstring
required- Service Account ID
credential_idstring
required- Credential ID
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->deleteServiceAccountCredential(['service_account_id' => '550e8400-e29b-41d4-a716-446655440000','credential_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
listServiceAccountGroups()
List service account groups
Parameters
service_account_idstring
required- Service Account ID
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->listServiceAccountGroups(['service_account_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
addServiceAccountToGroup()
Add service account to group
Parameters
service_account_idstring
required- Service Account ID
group_idstring
requiredExample
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->addServiceAccountToGroup(['service_account_id' => '550e8400-e29b-41d4-a716-446655440000','group_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
removeServiceAccountFromGroup()
Remove service account from group
Parameters
service_account_idstring
required- Service Account ID
group_idstring
required- Group ID
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->removeServiceAccountFromGroup(['service_account_id' => '550e8400-e29b-41d4-a716-446655440000','group_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
listServiceAccountPolicies()
List service account policies
Parameters
service_account_idstring
required- Service Account ID
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->listServiceAccountPolicies(['service_account_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
attachServiceAccountPolicy()
Attach policy to service account
Parameters
service_account_idstring
required- Service Account ID
policy_idstring
requiredExample
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->attachServiceAccountPolicy(['service_account_id' => '550e8400-e29b-41d4-a716-446655440000','policy_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
detachServiceAccountPolicy()
Detach policy from service account
Parameters
service_account_idstring
required- Service Account ID
policy_idstring
required- Policy ID
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->detachServiceAccountPolicy(['service_account_id' => '550e8400-e29b-41d4-a716-446655440000','policy_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
listUsers()
List users
Parameters
limitinteger
- Maximum number of items to return
markerstring
- ID of the last item from the previous page (for pagination)
namestring
- Filter by name (exact match or prefix with *)
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->listUsers();print_r($result);
addUser()
Add user to organization
Parameters
emailstring
required- Email of the platform user to add
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->addUser(['email' => 'john.doe@acme.com']);print_r($result);
getUser()
Get user
Parameters
user_idstring
required- User ID
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->getUser(['user_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
removeUser()
Remove user from organization
Parameters
user_idstring
required- User ID
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->removeUser(['user_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
listUserGroups()
List user groups
Parameters
user_idstring
required- User ID
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->listUserGroups(['user_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
addUserToGroup()
Add user to group
Parameters
user_idstring
required- User ID
group_idstring
requiredExample
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->addUserToGroup(['user_id' => '550e8400-e29b-41d4-a716-446655440000','group_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
removeUserFromGroup()
Remove user from group
Parameters
user_idstring
required- User ID
group_idstring
required- Group ID
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->removeUserFromGroup(['user_id' => '550e8400-e29b-41d4-a716-446655440000','group_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
listUserPolicies()
List user policies
Parameters
user_idstring
required- User ID
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->listUserPolicies(['user_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
attachUserPolicy()
Attach policy to user
Parameters
user_idstring
required- User ID
policy_idstring
requiredExample
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->attachUserPolicy(['user_id' => '550e8400-e29b-41d4-a716-446655440000','policy_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);
detachUserPolicy()
Detach policy from user
Parameters
user_idstring
required- User ID
policy_idstring
required- Policy ID
Example
<?phpuse ByCloud\SDK\ByCloud;$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);$result = $client->iam->detachUserPolicy(['user_id' => '550e8400-e29b-41d4-a716-446655440000','policy_id' => '550e8400-e29b-41d4-a716-446655440000']);print_r($result);