Edits an existing access policy. You can't edit a global-level policy, as these are managed by Dynatrace.
If the specified policy doesn't exist, a new policy is created instead.
The request consumes and produces an application/json payload.
PUT |
|
To execute this request, you need the Allow IAM policy configuration for environments (iam-policies-management) permission assigned to your token. To learn how to obtain and use it, see OAuth clients.
| Parameter | Type | Description | In | Required |
|---|---|---|---|---|
| policyUuid | - | The ID of the required policy. | path | required |
| levelId | - | The ID of the policy level. Use one of the following values, depending on the level type:
| path | required |
| levelType | - | The type of the policy level. The following values are available:
Each level inherits the policies of the higher level and extends them with its own policies. | path | required |
| body | Create | The JSON body of the request. Contains the updated configuration of a policy. | body | required |
CreateOrUpdateLevelPolicyRequestDto object| Element | Type | Description | Required |
|---|---|---|---|
| name | string | The display name of the policy. | required |
| description | string | A short description of the policy. | required |
| tags | string[] | A list of tags. | optional |
| statementQuery | string | The statement of the policy. | required |
This is a model of the request body, showing the possible elements. It has to be adjusted for usage in an actual request.
{"name": "string","description": "string","tags": ["string"],"statementQuery": "string"}
| Code | Type | Description |
|---|---|---|
| 201 | Level | Success. The policy has been created. The response contains the configuration of the policy. |
| 204 | - | Success. The policy has been updated. The response doesn't have a body. |
| 400 | Error | Failed. The request is invalid |
| 404 | Error | Failed. The specified resource is not found. |
| 422 | Error | The specified response not found |
LevelPolicyDto object| Element | Type | Description |
|---|---|---|
| uuid | string | The ID of the policy. |
| name | string | The display name of the policy. |
| tags | string[] | A list of tags. |
| description | string | A short description of the policy. |
| statementQuery | string | The statement of the policy. |
| statements | Statement[] | The expanded form of the policy statement. |
Statement object| Element | Type | Description |
|---|---|---|
| effect | string | The effect of the policy (for example, allow something). |
| permissions | string[] | A list of granted permissions. |
| conditions | Condition[] | A list of conditions limiting the granted permissions. |
Condition object| Element | Type | Description |
|---|---|---|
| name | string | The name of the condition. It indicates which part of the services is checked by the condition. |
| operator | string | The operator of the condition. |
| values | string[] | A list of reference values of the condition. |
{"uuid": "string","name": "string","tags": ["string"],"description": "string","statementQuery": "string","statements": [{"effect": "string","permissions": ["string"],"conditions": [{"name": "string","operator": "string","values": ["string"]}]}]}
We recommend that you validate the payload before submitting it with an actual request. A response code of 200 indicates a valid payload.
The request consumes an application/json payload.
POST |
|
To execute this request, you need the Allow IAM policy configuration for environments (iam-policies-management) permission assigned to your token. To learn how to obtain and use it, see OAuth clients.
| Parameter | Type | Description | In | Required |
|---|---|---|---|---|
| policyUuid | - | The ID of the policy to be validated. | path | required |
| levelId | - | The ID of the policy level. Use one of the following values, depending on the level type:
| path | required |
| levelType | - | The type of the policy level. The following values are available:
Each level inherits the policies of the higher level and extends them with its own policies. | path | required |
| body | Create | The JSON body of the request. Contains the configuration of a policy to be validated. | body | required |
CreateOrUpdateLevelPolicyRequestDto object| Element | Type | Description | Required |
|---|---|---|---|
| name | string | The display name of the policy. | required |
| description | string | A short description of the policy. | required |
| tags | string[] | A list of tags. | optional |
| statementQuery | string | The statement of the policy. | required |
This is a model of the request body, showing the possible elements. It has to be adjusted for usage in an actual request.
{"name": "string","description": "string","tags": ["string"],"statementQuery": "string"}
In this example, the request updates the apiExample policy from the POST request example. It changes the name and adds permission to read objects (settings:objects:read in the value of the statementQuery parameter) based on the anomaly detection for services (builtin:anomaly-detection.services) schema from the Settings 2.0 framework. The response code of 204 indicates successful modification.
curl --request PUT \--url https://api.dynatrace.com/iam/v1/repo/environment/mySampleEnv/policies/0c621587-f978-4c7b-89ee-d2045f611b03 \--header 'Authorization: Bearer abcdefjhij1234567890' \--header 'Content-Type: application/json' \--data '{"name": "apiExample - updated","description": "Example of an API request","tags": [],"statementQuery": "ALLOW settings:schemas:read, settings:objects:write, settings:objects:read WHERE settings:schemaId = \"builtin:anomaly-detection.services\";"}'
https://api.dynatrace.com/iam/v1/repo/environment/mySampleEnv/policies/0c621587-f978-4c7b-89ee-d2045f611b03
{"name": "apiExample - updated","description": "Example of an API request","tags": [],"statementQuery": "ALLOW settings:schemas:read, settings:objects:write, settings:objects:read WHERE settings:schemaId = \"builtin:anomaly-detection.services\";"}
204