JavaScript 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
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);
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
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.iam.listGroups();console.log(result);
createGroup()
Create group
Parameters
namestring
requireddescriptionstring
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);
getGroup()
Get group
Parameters
group_idstring
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);
updateGroup()
Update group
Parameters
group_idstring
required- Group ID
namestring
descriptionstring
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);
deleteGroup()
Delete group
Parameters
group_idstring
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);
listGroupPolicies()
List group policies
Parameters
group_idstring
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);
attachGroupPolicy()
Attach policy to group
Parameters
group_idstring
required- Group ID
policy_idstring
requiredExample
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);
detachGroupPolicy()
Detach policy from group
Parameters
group_idstring
required- Group ID
policy_idstring
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);
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
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);
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
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);
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
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.iam.listPolicies();console.log(result);
createPolicy()
Create policy
Parameters
namestring
requireddescriptionstring
documentobject
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);
getPolicy()
Get policy
Parameters
policy_idstring
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);
updatePolicy()
Update policy
Parameters
policy_idstring
required- Policy ID
namestring
descriptionstring
documentobject
- 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);
deletePolicy()
Delete policy
Parameters
policy_idstring
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);
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
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);
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
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);
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
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);
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
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);
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
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.iam.listRoles();console.log(result);
createRole()
Create role
Parameters
namestring
requireddescriptionstring
trust_policyobject
- 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);
getRole()
Get role
Parameters
role_idstring
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);
updateRole()
Update role
Parameters
role_idstring
required- Role ID
namestring
descriptionstring
trust_policyobject
- 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);
deleteRole()
Delete role
Parameters
role_idstring
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);
listRolePolicies()
List role policies
Parameters
role_idstring
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);
attachRolePolicy()
Attach policy to role
Parameters
role_idstring
required- Role ID
policy_idstring
requiredExample
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);
detachRolePolicy()
Detach policy from role
Parameters
role_idstring
required- Role ID
policy_idstring
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);
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
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.iam.listServiceAccounts();console.log(result);
createServiceAccount()
Create service account
Parameters
namestring
requireddisplay_namestring
descriptionstring
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);
getServiceAccount()
Get service account
Parameters
service_account_idstring
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);
updateServiceAccount()
Update service account
Parameters
service_account_idstring
required- Service Account ID
display_namestring
descriptionstring
enabledboolean
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);
deleteServiceAccount()
Delete service account
Parameters
service_account_idstring
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);
listServiceAccountCredentials()
List credentials
Parameters
service_account_idstring
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);
createServiceAccountCredential()
Create credential
Parameters
service_account_idstring
required- Service Account ID
namestring
requiredexpires_atstring
- 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);
deleteServiceAccountCredential()
Delete credential
Parameters
service_account_idstring
required- Service Account ID
credential_idstring
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);
listServiceAccountGroups()
List service account groups
Parameters
service_account_idstring
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);
addServiceAccountToGroup()
Add service account to group
Parameters
service_account_idstring
required- Service Account ID
group_idstring
requiredExample
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);
removeServiceAccountFromGroup()
Remove service account from group
Parameters
service_account_idstring
required- Service Account ID
group_idstring
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);
listServiceAccountPolicies()
List service account policies
Parameters
service_account_idstring
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);
attachServiceAccountPolicy()
Attach policy to service account
Parameters
service_account_idstring
required- Service Account ID
policy_idstring
requiredExample
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);
detachServiceAccountPolicy()
Detach policy from service account
Parameters
service_account_idstring
required- Service Account ID
policy_idstring
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);
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
import { ByCloud } from "@bycoded/bycloud-sdk";const client = new ByCloud({token: "YOUR_ACCESS_TOKEN",});const result = await client.iam.listUsers();console.log(result);
addUser()
Add user to organization
Parameters
emailstring
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);
getUser()
Get user
Parameters
user_idstring
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);
removeUser()
Remove user from organization
Parameters
user_idstring
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);
listUserGroups()
List user groups
Parameters
user_idstring
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);
addUserToGroup()
Add user to group
Parameters
user_idstring
required- User ID
group_idstring
requiredExample
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);
removeUserFromGroup()
Remove user from group
Parameters
user_idstring
required- User ID
group_idstring
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);
listUserPolicies()
List user policies
Parameters
user_idstring
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);
attachUserPolicy()
Attach policy to user
Parameters
user_idstring
required- User ID
policy_idstring
requiredExample
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);
detachUserPolicy()
Detach policy from user
Parameters
user_idstring
required- User ID
policy_idstring
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);