ByCloud Docs
GuidesCLIAPISDK

JavaScript SDK

IAM

Users, service accounts, groups, roles, policies, and authorization

52 methods

POST

assumeRole()

Assume role

Parameters

role_id

string

required
duration_seconds

integer

- Credential validity duration (15 min to 12 hours)

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.assumeRole({
role_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
GET

listGroups()

List groups

Parameters

limit

integer

- Maximum number of items to return

marker

string

- ID of the last item from the previous page (for pagination)

name

string

- Filter by name (exact match or prefix with *)

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.listGroups();
console.log(result);
POST

createGroup()

Create group

Parameters

name

string

required
description

string

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.createGroup({
name: "developers"
});
console.log(result);
GET

getGroup()

Get group

Parameters

group_id

string

required

- Group ID

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.getGroup({
group_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
PATCH

updateGroup()

Update group

Parameters

group_id

string

required

- Group ID

name

string

description

string

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.updateGroup({
group_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
DELETE

deleteGroup()

Delete group

Parameters

group_id

string

required

- Group ID

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.deleteGroup({
group_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
GET

listGroupPolicies()

List group policies

Parameters

group_id

string

required

- Group ID

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.listGroupPolicies({
group_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
POST

attachGroupPolicy()

Attach policy to group

Parameters

group_id

string

required

- Group ID

policy_id

string

required

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.attachGroupPolicy({
group_id: "550e8400-e29b-41d4-a716-446655440000",
policy_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
DELETE

detachGroupPolicy()

Detach policy from group

Parameters

group_id

string

required

- Group ID

policy_id

string

required

- Policy ID

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.detachGroupPolicy({
group_id: "550e8400-e29b-41d4-a716-446655440000",
policy_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
GET

listGroupServiceAccounts()

List group service accounts

Parameters

group_id

string

required

- Group ID

limit

integer

- Maximum number of items to return

marker

string

- ID of the last item from the previous page (for pagination)

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.listGroupServiceAccounts({
group_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
GET

listGroupUsers()

List group users

Parameters

group_id

string

required

- Group ID

limit

integer

- Maximum number of items to return

marker

string

- ID of the last item from the previous page (for pagination)

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.listGroupUsers({
group_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
GET

listPolicies()

List policies

Parameters

limit

integer

- Maximum number of items to return

marker

string

- ID of the last item from the previous page (for pagination)

name

string

- Filter by name (exact match or prefix with *)

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.listPolicies();
console.log(result);
POST

createPolicy()

Create policy

Parameters

name

string

required
description

string

document

object

required

- IAM-style policy document

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.createPolicy({
name: "S3BucketAccess",
document: {
version: "2024-01-01",
statements: [
{
sid: "AllowS3Read",
effect: "allow",
actions: [
"s3:GetObject",
"s3:ListBucket"
]
}
]
}
});
console.log(result);
GET

getPolicy()

Get policy

Parameters

policy_id

string

required

- Policy ID

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.getPolicy({
policy_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
PATCH

updatePolicy()

Update policy

Parameters

policy_id

string

required

- Policy ID

name

string

description

string

document

object

- IAM-style policy document

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.updatePolicy({
policy_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
DELETE

deletePolicy()

Delete policy

Parameters

policy_id

string

required

- Policy ID

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.deletePolicy({
policy_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
GET

listPolicyGroups()

List groups with policy

Parameters

policy_id

string

required

- Policy ID

limit

integer

- Maximum number of items to return

marker

string

- ID of the last item from the previous page (for pagination)

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.listPolicyGroups({
policy_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
GET

listPolicyRoles()

List roles with policy

Parameters

policy_id

string

required

- Policy ID

limit

integer

- Maximum number of items to return

marker

string

- ID of the last item from the previous page (for pagination)

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.listPolicyRoles({
policy_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
GET

listPolicyServiceAccounts()

List service accounts with policy

Parameters

policy_id

string

required

- Policy ID

limit

integer

- Maximum number of items to return

marker

string

- ID of the last item from the previous page (for pagination)

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.listPolicyServiceAccounts({
policy_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
GET

listPolicyUsers()

List users with policy

Parameters

policy_id

string

required

- Policy ID

limit

integer

- Maximum number of items to return

marker

string

- ID of the last item from the previous page (for pagination)

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.listPolicyUsers({
policy_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
GET

listRoles()

List roles

Parameters

limit

integer

- Maximum number of items to return

marker

string

- ID of the last item from the previous page (for pagination)

name

string

- Filter by name (exact match or prefix with *)

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.listRoles();
console.log(result);
POST

createRole()

Create role

Parameters

name

string

required
description

string

trust_policy

object

- Defines who/what can assume this role using CRN patterns

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.createRole({
name: "S3ReadOnly"
});
console.log(result);
GET

getRole()

Get role

Parameters

role_id

string

required

- Role ID

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.getRole({
role_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
PATCH

updateRole()

Update role

Parameters

role_id

string

required

- Role ID

name

string

description

string

trust_policy

object

- Defines who/what can assume this role using CRN patterns

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.updateRole({
role_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
DELETE

deleteRole()

Delete role

Parameters

role_id

string

required

- Role ID

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.deleteRole({
role_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
GET

listRolePolicies()

List role policies

Parameters

role_id

string

required

- Role ID

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.listRolePolicies({
role_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
POST

attachRolePolicy()

Attach policy to role

Parameters

role_id

string

required

- Role ID

policy_id

string

required

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.attachRolePolicy({
role_id: "550e8400-e29b-41d4-a716-446655440000",
policy_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
DELETE

detachRolePolicy()

Detach policy from role

Parameters

role_id

string

required

- Role ID

policy_id

string

required

- Policy ID

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.detachRolePolicy({
role_id: "550e8400-e29b-41d4-a716-446655440000",
policy_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
GET

listServiceAccounts()

List service accounts

Parameters

limit

integer

- Maximum number of items to return

marker

string

- ID of the last item from the previous page (for pagination)

name

string

- Filter by name (exact match or prefix with *)

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.listServiceAccounts();
console.log(result);
POST

createServiceAccount()

Create service account

Parameters

name

string

required
display_name

string

description

string

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.createServiceAccount({
name: "ci-cd-pipeline"
});
console.log(result);
GET

getServiceAccount()

Get service account

Parameters

service_account_id

string

required

- Service Account ID

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.getServiceAccount({
service_account_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
PATCH

updateServiceAccount()

Update service account

Parameters

service_account_id

string

required

- Service Account ID

display_name

string

description

string

enabled

boolean

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.updateServiceAccount({
service_account_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
DELETE

deleteServiceAccount()

Delete service account

Parameters

service_account_id

string

required

- Service Account ID

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.deleteServiceAccount({
service_account_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
GET

listServiceAccountCredentials()

List credentials

Parameters

service_account_id

string

required

- Service Account ID

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.listServiceAccountCredentials({
service_account_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
POST

createServiceAccountCredential()

Create credential

Parameters

service_account_id

string

required

- Service Account ID

name

string

required
expires_at

string

- Optional expiration date

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.createServiceAccountCredential({
service_account_id: "550e8400-e29b-41d4-a716-446655440000",
name: "production-key"
});
console.log(result);
DELETE

deleteServiceAccountCredential()

Delete credential

Parameters

service_account_id

string

required

- Service Account ID

credential_id

string

required

- Credential ID

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.deleteServiceAccountCredential({
service_account_id: "550e8400-e29b-41d4-a716-446655440000",
credential_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
GET

listServiceAccountGroups()

List service account groups

Parameters

service_account_id

string

required

- Service Account ID

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.listServiceAccountGroups({
service_account_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
POST

addServiceAccountToGroup()

Add service account to group

Parameters

service_account_id

string

required

- Service Account ID

group_id

string

required

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.addServiceAccountToGroup({
service_account_id: "550e8400-e29b-41d4-a716-446655440000",
group_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
DELETE

removeServiceAccountFromGroup()

Remove service account from group

Parameters

service_account_id

string

required

- Service Account ID

group_id

string

required

- Group ID

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.removeServiceAccountFromGroup({
service_account_id: "550e8400-e29b-41d4-a716-446655440000",
group_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
GET

listServiceAccountPolicies()

List service account policies

Parameters

service_account_id

string

required

- Service Account ID

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.listServiceAccountPolicies({
service_account_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
POST

attachServiceAccountPolicy()

Attach policy to service account

Parameters

service_account_id

string

required

- Service Account ID

policy_id

string

required

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.attachServiceAccountPolicy({
service_account_id: "550e8400-e29b-41d4-a716-446655440000",
policy_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
DELETE

detachServiceAccountPolicy()

Detach policy from service account

Parameters

service_account_id

string

required

- Service Account ID

policy_id

string

required

- Policy ID

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.detachServiceAccountPolicy({
service_account_id: "550e8400-e29b-41d4-a716-446655440000",
policy_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
GET

listUsers()

List users

Parameters

limit

integer

- Maximum number of items to return

marker

string

- ID of the last item from the previous page (for pagination)

name

string

- Filter by name (exact match or prefix with *)

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.listUsers();
console.log(result);
POST

addUser()

Add user to organization

Parameters

email

string

required

- Email of the platform user to add

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.addUser({
email: "john.doe@acme.com"
});
console.log(result);
GET

getUser()

Get user

Parameters

user_id

string

required

- User ID

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.getUser({
user_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
DELETE

removeUser()

Remove user from organization

Parameters

user_id

string

required

- User ID

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.removeUser({
user_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
GET

listUserGroups()

List user groups

Parameters

user_id

string

required

- User ID

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.listUserGroups({
user_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
POST

addUserToGroup()

Add user to group

Parameters

user_id

string

required

- User ID

group_id

string

required

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.addUserToGroup({
user_id: "550e8400-e29b-41d4-a716-446655440000",
group_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
DELETE

removeUserFromGroup()

Remove user from group

Parameters

user_id

string

required

- User ID

group_id

string

required

- Group ID

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.removeUserFromGroup({
user_id: "550e8400-e29b-41d4-a716-446655440000",
group_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
GET

listUserPolicies()

List user policies

Parameters

user_id

string

required

- User ID

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.listUserPolicies({
user_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
POST

attachUserPolicy()

Attach policy to user

Parameters

user_id

string

required

- User ID

policy_id

string

required

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.attachUserPolicy({
user_id: "550e8400-e29b-41d4-a716-446655440000",
policy_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
DELETE

detachUserPolicy()

Detach policy from user

Parameters

user_id

string

required

- User ID

policy_id

string

required

- Policy ID

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.iam.detachUserPolicy({
user_id: "550e8400-e29b-41d4-a716-446655440000",
policy_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);