Updates a custom policy
PUThttps://apis.<domain>/iam/policies/:id
This operation overwrites all fields excepting ID, including those omitted from the request, so be sure to specify all properties. Properties that you do not include are reset to empty values. The only exception is the policy ID, which is immutable; it can only be set at creation time.
While you can use this endpoint to update members on a policy, if that is the only property you wish to modify use one of these endpoints instead: Add policy members, Remove policy members, or Replace policy members.
Authorization Action:
iam:policies:update
Request
Path Parameters
id stringrequired
Unique ID. Cannot be changed.
- application/json
Bodyrequired
membersstring[]
Members affected by this policy.
statements object[]required
namestringrequired
Name for this policy.
tenantsstring[]
List of tenants this policy belongs to.
Responses
- 200
- default
A successful response.
- application/json
- Schema
- Example (auto)
Schema
policy object
{
"name": "My Updated Viewer Policy",
"members": [
"user:local:newuser",
"team:local:newteam"
],
"statements": [
{
"role": "viewer",
"tenants": [
"tenant1",
"tenant2"
],
"effect": "ALLOW"
},
{
"role": "myRole",
"tenants": [
"exampleTenant"
],
"effect": "ALLOW"
}
],
"tenants": []
}
An unexpected error response.
- application/json
- Schema
- Example (auto)
Schema
codeinteger<int32>
messagestring
details object[]
{
"code": 0,
"message": "string",
"details": [
{
"@type": "string"
}
]
}
- csharp
- curl
- dart
- go
- http
- java
- javascript
- kotlin
- c
- nodejs
- objective-c
- ocaml
- php
- powershell
- python
- r
- ruby
- rust
- shell
- swift
- HTTPCLIENT
- RESTSHARP
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Put, "https://apis.<domain>/iam/policies/:id");
request.Headers.Add("Accept", "application/json");
var content = new StringContent("{\n \"name\": \"My Updated Viewer Policy\",\n \"members\": [\n \"user:local:newuser\",\n \"team:local:newteam\"\n ],\n \"statements\": [\n {\n \"role\": \"viewer\",\n \"tenants\": [\n \"tenant1\",\n \"tenant2\"\n ],\n \"effect\": \"ALLOW\"\n },\n {\n \"role\": \"myRole\",\n \"tenants\": [\n \"exampleTenant\"\n ],\n \"effect\": \"ALLOW\"\n }\n ],\n \"tenants\": []\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());