Method: projects.locations.instances.transactionPolicies.create

Proposes a new TransactionPolicy in an instance. The server assigns the TransactionPolicy ID.

The proposing Policy Author's authorization in authorizationInfo counts as the first approval. If only one Policy Author approval is required, the policy becomes active immediately. Otherwise, the policy waits for activation until the required number of Policy Author approvals are recorded through transactionPolicies.approve.

Returns the following error codes:

  • INVALID_ARGUMENT: The Cedar policy statement is invalid or the authorization in authorizationInfo cannot be verified.
  • ALREADY_EXISTS: The authorization in authorizationInfo was already used to create a TransactionPolicy in this instance.
  • PERMISSION_DENIED: The caller is not an authorized Policy Author.

HTTP request

POST https://mpc.googleapis.com/v1beta/{parent=projects/*/locations/*/instances/*}/transactionPolicies

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
parent

string

Required. The parent instance where the TransactionPolicy will be created. Format: projects/{project}/locations/{location}/instances/{instance} It takes the form projects/{project}/locations/{location}/instances/{instance}.

Request body

The request body contains data with the following structure:

JSON representation
{
  "transactionPolicy": {
    object (TransactionPolicy)
  },
  "authorizationInfo": {
    object (AuthorizationInfo)
  },
  "requestId": string
}
Fields
transactionPolicy

object (TransactionPolicy)

Required. The TransactionPolicy to create. Only displayName and rule are read; all other fields are ignored.

authorizationInfo

object (AuthorizationInfo)

Required. The Policy Author's authorization over a TransactionPolicySigningPayload with:

  • instance: set to parent
  • action: ACTIVATE
  • rule: set to transactionPolicy.rule

Recorded as the first entry in activationInfo.approvals.

requestId

string

Optional. An idempotency key. Because TransactionPolicy IDs are server-generated, a client must set this to retry a create safely. If a request with the same requestId was already completed, the server returns the TransactionPolicy it created.

Must be a UUID4 and not the zero UUID.

Response body

If successful, the response body contains a newly created instance of TransactionPolicy.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.