CreatePolicy
POST {{baseUrl}}/policies/
Creates a new policy in the specified compartment (either the tenancy or another of your compartments). If you're new to policies, see Getting Started with Policies.
You must specify a name for the policy, which must be unique across all policies in your tenancy and cannot be changed.
You must also specify a description for the policy (although it can be an empty string). It does not have to be unique, and you can change it anytime with UpdatePolicy.
You must specify one or more policy statements in the statements array. For information about writing policies, see How Policies Work and Common Policies.
After you send your request, the new object's lifecycleState
will temporarily be CREATING. Before using the
object, first make sure its lifecycleState
has changed to ACTIVE.
New policies take effect typically within 10 seconds.
Request Body
{"name"=>"Lorem nulla do ex", "compartmentId"=>"{{compartment_ocid}}", "statements"=>["Ut est proident minim cupidatat", "pariatur do sed"], "description"=>"Excepteur consequat", "versionDate"=>"1956-07-21T21:19:54.774Z"}
HEADERS
Key | Datatype | Required | Description |
---|---|---|---|
opc-retry-token | string | A token that uniquely identifies a request so it can be retried in case of a timeout or | |
server error without risk of executing that same action again. Retry tokens expire after 24 | |||
hours, but can be invalidated before then due to conflicting operations (e.g., if a resource | |||
has been deleted and purged from the system, then a retry of the original creation request | |||
may be rejected). | |||
Content-Type | string | ||
Date | string | (Required) Current Date | |
Authorization | string | (Required) Signature Authentication on Authorization header | |
x-content-sha256 | string | (Required) Content sha256 for POST, PUT and PATCH operations |
RESPONSES
status: OK
{"id":"proident in","compartmentId":"ea consequat","name":"aute esse aliqua proident dolor","statements":["aliqua enim ut Excepteur","elit aute labore"],"description":"eu aute sint ullamco","timeCreated":"1979-12-12T13:42:38.126Z","lifecycleState":"DELETING","definedTags":{},"freeformTags":{},"inactiveStatus":87262274,"versionDate":"1986-11-07T09:17:24.493Z"}