Skip to content
  • Auto
  • Light
  • Dark
Get Started

Create

Create
client.Policies.New(ctx, body) (*PolicyPolicyPolicyNewResponse, error)
post/api/v1/policies

Create a policy.

Parameters
bodyDisplayNamefieldDescriptionfieldPolicyStepsfieldPolicyTypefieldPostActionsfieldReassignTasksToDelegatesfieldRulesfieldPolicyNewParams
Hide ParametersShow Parameters
DisplayNamefield
param.Field[string]

The display name of the new policy.

Descriptionfield
optional
param.Field[string]

The description of the new policy.

PolicyStepsfield
optional
param.Field[map[string, PolicyNewParamsPolicyStep]]

The map of policy type to policy steps. The key is the stringified version of the enum. See other policies for examples.

Hide ParametersShow Parameters
Stepsarray
optional

An array of policy steps indicating the processing flow of a policy. These steps are oneOfs, and only one property may be set for each array index at a time.

Hide ParametersShow Parameters
AcceptAcceptMessagestringC1APIPolicyV1Accept
optional

This policy step indicates that a ticket should have an approved outcome. This is a terminal approval state and is used to explicitly define the end of approval steps.

ApprovalAgentApprovalAgentAllowedReassigneesarrayAllowReassignmentboolAppOwnersApprovalAppOwnersAssignedboolEntitlementOwnersApprovalEntitlementOwnersEscalationApprovalEscalationEscalationEnabledboolExpressionApprovalExpressionGroupApprovalGroupManagerApprovalManagerRequireApprovalReasonboolRequireDenialReasonboolRequireReassignmentReasonboolRequiresStepUpProviderIDstringResourceOwnersApprovalResourceOwnersSelfApprovalSelfUsersApprovalUsersWebhookApprovalWebhookApproval
optional

The Approval message.

This message contains a oneof named typ. Only a single field of the following list may be set at a time:

  • users
  • manager
  • appOwners
  • group
  • self
  • entitlementOwners
  • expression
  • webhook
  • resourceOwners
  • agent
ProvisionAssignedboolProvisionPolicyC1APIPolicyV1ProvisionPolicyProvisionTargetProvisionProvisionTargetProvision
optional

The provision step references a provision policy for this step.

RejectRejectMessagestringC1APIPolicyV1Reject
optional

This policy step indicates that a ticket should have a denied outcome. This is a terminal approval state and is used to explicitly define the end of approval steps.

WaitCommentOnFirstWaitstringCommentOnTimeoutstringConditionC1APIPolicyV1WaitConditionNamestringTimeoutDurationstringC1APIPolicyV1Wait
optional

Define a Wait step for a policy to wait on a condition to be met.

This message contains a oneof named until. Only a single field of the following list may be set at a time:

  • condition
PolicyTypefield
optional

The enum of the policy type.

Hide ParametersShow Parameters
PolicyNewParamsPolicyTypePolicyTypeUnspecifiedconst
"POLICY_TYPE_UNSPECIFIED"
PolicyNewParamsPolicyTypePolicyTypeGrantconst
"POLICY_TYPE_GRANT"
PolicyNewParamsPolicyTypePolicyTypeRevokeconst
"POLICY_TYPE_REVOKE"
PolicyNewParamsPolicyTypePolicyTypeCertifyconst
"POLICY_TYPE_CERTIFY"
PolicyNewParamsPolicyTypePolicyTypeAccessRequestconst
"POLICY_TYPE_ACCESS_REQUEST"
PolicyNewParamsPolicyTypePolicyTypeProvisionconst
"POLICY_TYPE_PROVISION"
PostActionsfield
optional
param.Field[[]CertifyRemediateImmediatelyboolPolicyPostActions]

Actions to occur after a policy finishes. As of now this is only valid on a certify policy to remediate a denied certification immediately.

Hide ParametersShow Parameters
CertifyRemediateImmediatelybool
optional

ONLY valid when used in a CERTIFY Ticket Type: Causes any deprovision or change in a grant to be applied when Certify Ticket is closed. This field is part of the action oneof. See the documentation for c1.api.policy.v1.PolicyPostActions for more details.

ReassignTasksToDelegatesfield
optional
param.Field[bool]

Allows reassigning tasks to delegates.

Rulesfield
optional
param.Field[[]ConditionstringPolicyKeystringRule]

The rules field.

Hide ParametersShow Parameters
Conditionstring
optional

The condition field.

PolicyKeystring
optional

This is a reference to a list of policy steps from policy_steps

Returns
PolicyNewResponsestruct

The CreatePolicyResponse message contains the created policy object.

Hide ParametersShow Parameters
PolicyIDstringCreatedAtTimeDeletedAtTimeDescriptionstringDisplayNamestringPolicyStepsmapPolicyTypePolicyPolicyTypePostActionsarrayReassignTasksToDelegatesboolRulesarraySystemBuiltinboolUpdatedAtTimePolicy
optional

A policy describes the behavior of the ConductorOne system when processing a task. You can describe the type, approvers, fallback behavior, and escalation processes.

Request example Go
package main

import (
  "context"
  "fmt"

  "github.com/stainless-sdks/-go"
  "github.com/stainless-sdks/-go/option"
)

func main() {
  client := conductoronesdk.NewClient(
    option.WithAPIKey("My API Key"),
  )
  policy, err := client.Policies.New(context.TODO(), conductoronesdk.PolicyNewParams{
    DisplayName: "displayName",
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", policy.Policy)
}
200 Example
{
  "policy": {
    "description": "description",
    "displayName": "displayName",
    "policySteps": {
      "foo": {
        "steps": [
          {
            "accept": {
              "acceptMessage": "acceptMessage"
            },
            "approval": {
              "agent": {
                "agentMode": "APPROVAL_AGENT_MODE_UNSPECIFIED",
                "agentUserId": "agentUserId",
                "instructions": "instructions",
                "policyIds": [
                  "string"
                ]
              },
              "allowedReassignees": [
                "string"
              ],
              "allowReassignment": true,
              "appOwners": {
                "allowSelfApproval": true
              },
              "entitlementOwners": {
                "allowSelfApproval": true,
                "fallback": true,
                "fallbackUserIds": [
                  "string"
                ]
              },
              "escalation": {
                "escalationComment": "escalationComment",
                "expiration": "expiration",
                "reassignToApprovers": {
                  "approverIds": [
                    "string"
                  ]
                },
                "replacePolicy": {
                  "policyId": "policyId"
                }
              },
              "escalationEnabled": true,
              "expression": {
                "allowSelfApproval": true,
                "expressions": [
                  "string"
                ],
                "fallback": true,
                "fallbackUserIds": [
                  "string"
                ]
              },
              "group": {
                "allowSelfApproval": true,
                "appGroupId": "appGroupId",
                "appId": "appId",
                "fallback": true,
                "fallbackUserIds": [
                  "string"
                ]
              },
              "manager": {
                "allowSelfApproval": true,
                "fallback": true,
                "fallbackUserIds": [
                  "string"
                ]
              },
              "requireApprovalReason": true,
              "requireDenialReason": true,
              "requireReassignmentReason": true,
              "requiresStepUpProviderId": "requiresStepUpProviderId",
              "resourceOwners": {
                "allowSelfApproval": true,
                "fallback": true,
                "fallbackUserIds": [
                  "string"
                ]
              },
              "self": {
                "fallback": true,
                "fallbackUserIds": [
                  "string"
                ]
              },
              "users": {
                "allowSelfApproval": true,
                "userIds": [
                  "string"
                ]
              },
              "webhook": {
                "webhookId": "webhookId"
              }
            },
            "provision": {
              "assigned": true,
              "provisionPolicy": {
                "connector": {
                  "account": {
                    "config": {
                      "foo": "bar"
                    },
                    "connectorId": "connectorId",
                    "doNotSave": {},
                    "saveToVault": {
                      "vaultIds": [
                        "string"
                      ]
                    },
                    "schemaId": "schemaId"
                  },
                  "defaultBehavior": {
                    "connectorId": "connectorId"
                  },
                  "deleteAccount": {
                    "connectorId": "connectorId"
                  }
                },
                "delegated": {
                  "appId": "appId",
                  "entitlementId": "entitlementId",
                  "implicit": true
                },
                "externalTicket": {
                  "appId": "appId",
                  "connectorId": "connectorId",
                  "externalTicketProvisionerConfigId": "externalTicketProvisionerConfigId",
                  "instructions": "instructions"
                },
                "manual": {
                  "instructions": "instructions",
                  "userIds": [
                    "string"
                  ]
                },
                "unconfigured": {},
                "webhook": {
                  "webhookId": "webhookId"
                }
              },
              "provisionTarget": {
                "appEntitlementId": "appEntitlementId",
                "appId": "appId",
                "appUserId": "appUserId",
                "grantDuration": "grantDuration"
              }
            },
            "reject": {
              "rejectMessage": "rejectMessage"
            },
            "wait": {
              "commentOnFirstWait": "commentOnFirstWait",
              "commentOnTimeout": "commentOnTimeout",
              "condition": {
                "condition": "condition"
              },
              "name": "name",
              "timeoutDuration": "timeoutDuration"
            }
          }
        ]
      }
    },
    "policyType": "POLICY_TYPE_UNSPECIFIED",
    "postActions": [
      {
        "certifyRemediateImmediately": true
      }
    ],
    "reassignTasksToDelegates": true,
    "rules": [
      {
        "condition": "condition",
        "policyKey": "policyKey"
      }
    ]
  }
}