Was this content helpful?
How could we make this article more helpful?
You can update all the permission parameters, bucket permission, and their associated actions.
Performing a PUT operation on specific a permission updates the permission.
PUT /permissions/{permissionId}
{
"name": "string",
"description": "string",
"type": "bucket-names",
"actions": "all-operations",
"prefix": "string",
"buckets": [ "string" ],
"policy": {}
}
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| permissionId | path | string | true | Numeric ID of the permission to update. |
| name | body | string | true | Name of the permission. |
| description | body | string | true | Description of the permission. |
| type | body | string | true | The values for the permission type can be:
|
| actions | body | string | false | The values for the actions can be:
|
| prefix | body | string | false | Prefix of your bucket names to assign and apply the permission based on the permission type bucket-prefix. |
| buckets | body | string | false | Specify one or more bucket names based on permission type bucket-names. |
| policy | body | object | false | The policy file is based on permission type policy.For more information, see Managing bucket access permissions. |
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{
"application/json",
},
"Accept": []string{
"application/json",
},
"Authorization": []string{
"Bearer {access-token}",
},
}
jsonReq := "{json request body}" // replace with your JSON request body
data := bytes.NewBuffer([]byte(jsonReq))
req, err := http.NewRequest("POST", "https://api.lyvecloud.seagate.com/v2/permissions/{PermissionId}", data)
if err != nil {
// handle error
}
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
// handle error
}
// handle response }
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class Main {
public static void main(String[] args) {
try {
URL obj = new URL("https://api.lyvecloud.seagate.com/v2/permissions/{PermissionId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
// Set request headers
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("Authorization", "Bearer {access-token}");
int responseCode = con.getResponseCode();
System.out.println("Response Code : " + responseCode);
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
} catch (Exception e) { e.printStackTrace(); } } }
const inputBody = '{ "name": "string", "description": "string", "type": "all-buckets", "actions": "all-operations", "prefix": "string", "buckets": [ "string" ], "policy": {} }';
const headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
};
fetch('https://api.lyvecloud.seagate.com/v2/permissions/{PermissionId}', {
method: 'POST',
body: inputBody,
headers: headers
})
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json(); }) .then(body => { console.log(body); }) .catch(error => { console.error('There has been a problem with your fetch operation:', error); });
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
data = '{ "name": "string", "description": "string", "type": "all-buckets", "actions": "all-operations", "prefix": "string", "buckets": [ "string" ], "policy": {} }' # replace with your actual data
try:
r = requests.post('https://api.lyvecloud.seagate.com/v2/permissions/{PermissionId}', headers=headers, data=data)
r.raise_for_status() # Raises a HTTPError if the response status is 4xx, 5xx
except requests.exceptions.RequestException as err:
print(f"An error occurred: {err}")
else: print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post(
'https://api.lyvecloud.seagate.com/v2/permissions/{PermissionId}',
{}.to_json, # Convert params to JSON
headers
)
puts JSON.parse(result) # Use 'puts' instead of 'p' for printing
| Status | Description | Return JSON Payload | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| 200 | OK The update operation is successful. |
Successfully updated the permission. | ||||||||
| 400 | Bad Request It is an invalid request or invalid permission information. |
{
"code": "string",
"message": "string"
}
|
||||||||
| 403 | Forbidden The account has no services enabled. |
{
"code": "string",
"message": "string"
}
|
||||||||
| 404 | Not Found The permission to be updated is no longer available. |
{
"code": "string",
"message": "string"
}
|
||||||||
| 409 | The permission name already exists The permission is not ready for update operation and is being processed by some regions. |
{
"code": "string",
"message": "string"
}
|
||||||||
| 500 | Locked The server encountered an internal error. |
{
"code": "string",
"message": "string"
}
|
||||||||
| 503 | Service Unavailable |
{
"code": "string",
"message": "string"
}
|