REST Resource: projects.locations.instances.transactionPolicies

Resource: TransactionPolicy

An immutable Cedar policy rule that governs whether transactions in an instance are permitted or denied before signing.

Every completed activation or disable transition gets a sequence number that only increases within the instance. The server records it once, in activationInfo.transition_sequence or deactivationInfo.transition_sequence. This value is the policy set version that the transition produces.

A withdrawal of a policy that still waits for activation gets no sequence number and does not advance the policy set version.

JSON representation
{
  "name": string,
  "uid": string,
  "displayName": string,
  "rule": {
    object (Rule)
  },
  "state": enum (State),
  "activationInfo": {
    object (ApprovalInfo)
  },
  "deactivationInfo": {
    object (ApprovalInfo)
  },
  "createTime": string,
  "updateTime": string
}
Fields
name

string

Identifier. The resource name of the TransactionPolicy. Format: projects/{project}/locations/{location}/instances/{instance}/transactionPolicies/{transactionPolicy}

uid

string

Output only. The unique server-generated identifier of the TransactionPolicy.

displayName

string

Optional. Immutable. User-assigned display name for the TransactionPolicy. Maximum length is 63 characters. Set at creation. TransactionPolicy resources are immutable and have no update method.

rule

object (Rule)

Required. Immutable. The policy rule that the server evaluates against transactions. To change a rule, a client disables this policy with transactionPolicies.disable and creates a new policy with transactionPolicies.create.

state

enum (State)

Output only. The lifecycle state of the TransactionPolicy.

activationInfo

object (ApprovalInfo)

Output only. The approval status and Policy Author approvals collected to activate this policy.

deactivationInfo

object (ApprovalInfo)

Output only. The approval status and Policy Author approvals collected to disable this policy. Unset until a Policy Author calls transactionPolicies.disable.

createTime

string (Timestamp format)

Output only. The time at which the TransactionPolicy was created.

Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z", "2014-10-02T15:01:23.045123456Z" or "2014-10-02T15:01:23+05:30".

updateTime

string (Timestamp format)

Output only. The time at which the TransactionPolicy was last updated.

Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z", "2014-10-02T15:01:23.045123456Z" or "2014-10-02T15:01:23+05:30".

Rule

The policy rule evaluated for a TransactionPolicy.

JSON representation
{

  // The following is a list of mutually exclusive fields. At most one of the
  // fields will be set in a response:
  "cedarDocument": string
  // End of mutually exclusive fields.
}
Fields
The rule definition for this TransactionPolicy. Must be set. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response:
cedarDocument

string

Optional. A single non-empty Cedar policy statement. Must be valid Cedar syntax. An invalid or empty statement fails with INVALID_ARGUMENT.

For how to write rules, how the server evaluates them, and which Cedar context attributes they can read, see https://docs.cloud.google.com/multi-party-compute/writing-rules and https://docs.cloud.google.com/multi-party-compute/policy-evaluation.

End of mutually exclusive fields.

State

The lifecycle state of a TransactionPolicy.

Enums
STATE_UNSPECIFIED Default value. This value is unused.
PENDING_ACTIVE A Policy Author proposed the policy, and it waits for the required number of Policy Author approvals before it becomes active. The server does not enforce it on transactions yet. A Policy Author can withdraw it with transactionPolicies.disable.
ACTIVE The policy is active and enforced on transactions.
PENDING_DISABLED A request to disable the policy waits for the required number of Policy Author approvals. The policy stays in effect, and the server enforces it on transactions until it records those approvals.
DISABLED The policy is permanently disabled, and the server does not enforce it on new transactions. Or a Policy Author withdrew it before it became active. The service keeps disabled policies for audit.

ApprovalInfo

Tracks the Policy Author approvals for activating or disabling a TransactionPolicy.

To build an AuthorizationInfo for a policy transition, a Policy Author serializes a TransactionPolicySigningPayload into signedPayload. Then the Policy Author signs those bytes into signature, with the private key for their registered User.authorization_key.

The service verifies signature over the exact signedPayload bytes as received. Then it unmarshals signedPayload as a TransactionPolicySigningPayload. It returns INVALID_ARGUMENT if the unmarshal fails or if any field does not match the transition that the request authorizes.

JSON representation
{
  "approvals": [
    {
      object (Approval)
    }
  ],
  "transitionSequence": string,
  "requiredApprovalCount": integer
}
Fields
approvals[]

object (Approval)

Output only. The Policy Author approvals collected for this transition. The first entry is the approval of the Policy Author who started the request. The server appends more entries when other Policy Authors call transactionPolicies.approve.

transitionSequence

string (int64 format)

Output only. The positive sequence number that the server assigns when the transition gets the required number of Policy Author approvals and completes. This value is the policy set version that this transition produces. Unset while the transition waits for approvals, and if the policy was withdrawn.

requiredApprovalCount

integer

Output only. The number of Policy Author approvals required to complete this transition. While the transition waits for approvals, this is the current threshold of the instance, and it changes if the threshold changes. After the transition completes, this keeps the threshold that was in effect at completion.

Approval

The recorded approval of one Policy Author for a policy transition.

JSON representation
{
  "user": string,
  "authorizationInfo": {
    object (AuthorizationInfo)
  },
  "approveTime": string
}
Fields
user

string

Output only. The resource name of the User who gave this approval, resolved from the authenticated identity of the caller. Format: projects/{project}/locations/{location}/instances/{instance}/users/{user}

authorizationInfo

object (AuthorizationInfo)

Output only. The cryptographic authorization provided by the Policy Author.

approveTime

string (Timestamp format)

Output only. The time at which the approval was recorded.

Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z", "2014-10-02T15:01:23.045123456Z" or "2014-10-02T15:01:23+05:30".

Methods

approve

Records a Policy Author's approval for a policy that is waiting to be activated or disabled.

create

Proposes a new TransactionPolicy in an instance.

disable

Starts disabling a policy, or withdraws a policy that is still waiting for activation.

get

Gets details of a single TransactionPolicy, including its Cedar rule, current lifecycle state, and recorded Policy Author approvals.

list

Lists TransactionPolicy resources in an instance, including disabled policies.