Skip to content

Commit cb8759a

Browse files
authored
Add UnitOperation resource (#15489)
1 parent d1a715b commit cb8759a

File tree

3 files changed

+498
-0
lines changed

3 files changed

+498
-0
lines changed
Lines changed: 275 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,275 @@
1+
# Copyright 2025 Google Inc.
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
14+
---
15+
name: UnitOperation
16+
description: A UnitOperation encapsulates the intent to change or interact with a Unit. Operations such as provisioning, upgrading, or deprovisioning a Unit are triggered by creating a UnitOperation resource.
17+
base_url: projects/{{project}}/locations/{{location}}/unitOperations
18+
self_link: projects/{{project}}/locations/{{location}}/unitOperations/{{unit_operation_id}}
19+
create_url: projects/{{project}}/locations/{{location}}/unitOperations?unitOperationId={{unit_operation_id}}
20+
id_format: projects/{{project}}/locations/{{location}}/unitOperations/{{unit_operation_id}}
21+
immutable: true
22+
import_format:
23+
- projects/{{project}}/locations/{{location}}/unitOperations/{{unit_operation_id}}
24+
examples:
25+
- name: saas_runtime_unit_operation_basic
26+
primary_resource_id: "provision_unit_operation"
27+
min_version: "beta"
28+
vars:
29+
saas_name: example-saas
30+
unitkind_name: vm-unitkind
31+
release_name: example-release
32+
tenant_name: example-tenant
33+
unit_name: example-unit
34+
provision_operation_name: provision-unit-operation
35+
upgrade_operation_name: upgrade-unit-operation
36+
deprovision_operation_name: deprovision-unit-operation
37+
actuation_service_account: actuator
38+
tenant_project_name: tenant
39+
test_env_vars:
40+
project: "PROJECT_NAME"
41+
project_number: "PROJECT_NUMBER"
42+
org_id: "ORG_ID"
43+
billing_account: "BILLING_ACCT"
44+
bootstrap_iam:
45+
- member: "serviceAccount:service-{project_number}@gcp-sa-saasservicemgmt.iam.gserviceaccount.com"
46+
role: "roles/saasservicemgmt.serviceAgent"
47+
ignore_read_extra:
48+
- "etag"
49+
- "error_category"
50+
- "state"
51+
- "update_time"
52+
- "conditions"
53+
autogen_async: false
54+
autogen_status: VW5pdE9wZXJhdGlvbg==
55+
virtual_fields:
56+
- name: wait_for_completion
57+
type: Boolean
58+
description: |
59+
If true, wait for the UnitOperation to reach a terminal state (SUCCEEDED, FAILED, CANCELLED)
60+
before completing the apply.
61+
default_value: true
62+
custom_code:
63+
post_create: "templates/terraform/post_create/saas_runtime_unit_operation_wait.go.tmpl"
64+
parameters:
65+
- name: location
66+
type: String
67+
description: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122.
68+
immutable: true
69+
url_param_only: true
70+
required: true
71+
- name: unitOperationId
72+
type: String
73+
description: The ID value for the new unit operation.
74+
immutable: true
75+
url_param_only: true
76+
required: true
77+
properties:
78+
- name: annotations
79+
type: KeyValueAnnotations
80+
description: |-
81+
Annotations is an unstructured key-value map stored with a resource that
82+
may be set by external tools to store and retrieve arbitrary metadata.
83+
They are not queryable and should be preserved when modifying objects.
84+
85+
More info: https://kubernetes.io/docs/user-guide/annotations
86+
- name: conditions
87+
type: Array
88+
description: |-
89+
A set of conditions which indicate the various conditions this resource can
90+
have.
91+
output: true
92+
item_type:
93+
type: NestedObject
94+
properties:
95+
- name: lastTransitionTime
96+
type: String
97+
description: Last time the condition transited from one status to another.
98+
output: true
99+
- name: message
100+
type: String
101+
description: Human readable message indicating details about the last transition.
102+
output: true
103+
- name: reason
104+
type: String
105+
description: Brief reason for the condition's last transition.
106+
output: true
107+
- name: status
108+
type: String
109+
description: |-
110+
Status of the condition.
111+
Possible values:
112+
STATUS_UNKNOWN
113+
STATUS_TRUE
114+
STATUS_FALSE
115+
output: true
116+
- name: type
117+
type: String
118+
description: |-
119+
Type of the condition.
120+
Possible values:
121+
TYPE_SCHEDULED
122+
TYPE_RUNNING
123+
TYPE_SUCCEEDED
124+
TYPE_CANCELLED
125+
output: true
126+
- name: createTime
127+
type: String
128+
description: The timestamp when the resource was created.
129+
output: true
130+
- name: deprovision
131+
type: NestedObject
132+
description: |-
133+
Deprovision is the unit operation that deprovision the underlying
134+
resources represented by a Unit. Can only execute if the Unit is currently
135+
provisioned.
136+
properties: []
137+
send_empty_value: true
138+
allow_empty_object: true
139+
- name: engineState
140+
type: String
141+
description: |-
142+
The engine state for on-going
143+
deployment engine operation(s).
144+
This field is opaque for external usage.
145+
output: true
146+
- name: errorCategory
147+
type: String
148+
description: |-
149+
Possible values:
150+
NOT_APPLICABLE
151+
FATAL
152+
RETRIABLE
153+
IGNORABLE
154+
STANDARD
155+
output: true
156+
- name: etag
157+
type: String
158+
description: |-
159+
An opaque value that uniquely identifies a version or
160+
generation of a resource. It can be used to confirm that the client
161+
and server agree on the ordering of a resource being written.
162+
output: true
163+
- name: labels
164+
type: KeyValueLabels
165+
description: |-
166+
The labels on the resource, which can be used for categorization.
167+
similar to Kubernetes resource labels.
168+
- name: name
169+
type: String
170+
description: |-
171+
Identifier. The resource name (full URI of the resource) following the standard naming
172+
scheme:
173+
174+
"projects/{project}/locations/{location}/unitOperations/{unitOperation}"
175+
output: true
176+
- name: provision
177+
type: NestedObject
178+
description: |-
179+
Provision is the unit operation that provision the underlying resources
180+
represented by a Unit. Can only execute if the Unit is not currently
181+
provisioned.
182+
properties:
183+
- name: inputVariables
184+
type: Array
185+
description: Set of input variables. Maximum 100. (optional)
186+
item_type:
187+
type: NestedObject
188+
properties:
189+
- name: type
190+
type: String
191+
description: |-
192+
Name of a supported variable type. Supported types are string, int, bool.
193+
Possible values:
194+
STRING
195+
INT
196+
BOOL
197+
immutable: true
198+
- name: value
199+
type: String
200+
description: String encoded value for the variable.
201+
- name: variable
202+
type: String
203+
description: Name of the variable from actuation configs.
204+
immutable: true
205+
required: true
206+
- name: release
207+
type: String
208+
description: Reference to the Release object to use for the Unit. (optional).
209+
- name: state
210+
type: String
211+
description: |-
212+
UnitOperationState describes the current state of the unit operation.
213+
Possible values:
214+
UNIT_OPERATION_STATE_UNKNOWN
215+
UNIT_OPERATION_STATE_PENDING
216+
UNIT_OPERATION_STATE_SCHEDULED
217+
UNIT_OPERATION_STATE_RUNNING
218+
UNIT_OPERATION_STATE_SUCCEEDED
219+
UNIT_OPERATION_STATE_FAILED
220+
UNIT_OPERATION_STATE_CANCELLED
221+
output: true
222+
- name: uid
223+
type: String
224+
description: |-
225+
The unique identifier of the resource. UID is unique in the time
226+
and space for this resource within the scope of the service. It is
227+
typically generated by the server on successful creation of a resource
228+
and must not be changed. UID is used to uniquely identify resources
229+
with resource name reuses. This should be a UUID4.
230+
output: true
231+
- name: unit
232+
type: String
233+
description: The Unit a given UnitOperation will act upon.
234+
immutable: true
235+
required: true
236+
- name: updateTime
237+
type: String
238+
description: |-
239+
The timestamp when the resource was last updated. Any
240+
change to the resource made by users must refresh this value.
241+
Changes to a resource made by the service should refresh this value.
242+
output: true
243+
- name: upgrade
244+
type: NestedObject
245+
description: |-
246+
Upgrade is the unit operation that upgrades a provisioned unit, which may
247+
also include the underlying resources represented by a Unit. Can only execute
248+
if the Unit is currently provisioned.
249+
properties:
250+
- name: inputVariables
251+
type: Array
252+
description: Set of input variables. Maximum 100. (optional)
253+
item_type:
254+
type: NestedObject
255+
properties:
256+
- name: type
257+
type: String
258+
description: |-
259+
Name of a supported variable type. Supported types are string, int, bool.
260+
Possible values:
261+
STRING
262+
INT
263+
BOOL
264+
immutable: true
265+
- name: value
266+
type: String
267+
description: String encoded value for the variable.
268+
- name: variable
269+
type: String
270+
description: Name of the variable from actuation configs.
271+
immutable: true
272+
required: true
273+
- name: release
274+
type: String
275+
description: Reference to the Release object to use for the Unit. (optional).

0 commit comments

Comments
 (0)