Create policy binding
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({roleId: '<string>', principalId: '<string>', scope: {id: '<string>'}})
};
fetch('https://api.example.com/v1/regions/global/iam/policies', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/regions/global/iam/policies"
payload := strings.NewReader("{\n \"roleId\": \"<string>\",\n \"principalId\": \"<string>\",\n \"scope\": {\n \"id\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}curl --request POST \
--url https://api.example.com/v1/regions/global/iam/policies \
--header 'Content-Type: application/json' \
--data '
{
"roleId": "<string>",
"principalId": "<string>",
"scope": {
"id": "<string>"
}
}
'import requests
url = "https://api.example.com/v1/regions/global/iam/policies"
payload = {
"roleId": "<string>",
"principalId": "<string>",
"scope": { "id": "<string>" }
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"success": true,
"data": {
"id": "<string>",
"roleId": "<string>",
"principalType": "user",
"principalId": "<string>",
"scope": {
"type": "organization",
"id": "<string>"
},
"createdAt": "2023-11-07T05:31:56Z"
}
}IAM Policies
Create policy binding
Bind a role to a principal at a specific scope
POST
/
v1
/
regions
/
global
/
iam
/
policies
Create policy binding
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({roleId: '<string>', principalId: '<string>', scope: {id: '<string>'}})
};
fetch('https://api.example.com/v1/regions/global/iam/policies', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/regions/global/iam/policies"
payload := strings.NewReader("{\n \"roleId\": \"<string>\",\n \"principalId\": \"<string>\",\n \"scope\": {\n \"id\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}curl --request POST \
--url https://api.example.com/v1/regions/global/iam/policies \
--header 'Content-Type: application/json' \
--data '
{
"roleId": "<string>",
"principalId": "<string>",
"scope": {
"id": "<string>"
}
}
'import requests
url = "https://api.example.com/v1/regions/global/iam/policies"
payload = {
"roleId": "<string>",
"principalId": "<string>",
"scope": { "id": "<string>" }
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"success": true,
"data": {
"id": "<string>",
"roleId": "<string>",
"principalType": "user",
"principalId": "<string>",
"scope": {
"type": "organization",
"id": "<string>"
},
"createdAt": "2023-11-07T05:31:56Z"
}
}Body
application/json
Was this page helpful?