crossplane-function-sdk-python 0.10.0__py3-none-any.whl → 0.12.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- crossplane/function/__version__.py +1 -1
- crossplane/function/proto/v1/run_function.proto +69 -3
- crossplane/function/proto/v1/run_function_pb2.py +70 -56
- crossplane/function/proto/v1/run_function_pb2.pyi +55 -6
- crossplane/function/proto/v1beta1/run_function.proto +68 -2
- crossplane/function/proto/v1beta1/run_function_pb2.py +70 -56
- crossplane/function/proto/v1beta1/run_function_pb2.pyi +55 -6
- crossplane/function/request.py +108 -0
- crossplane/function/resource.py +76 -2
- crossplane/function/response.py +67 -0
- {crossplane_function_sdk_python-0.10.0.dist-info → crossplane_function_sdk_python-0.12.0.dist-info}/METADATA +3 -3
- crossplane_function_sdk_python-0.12.0.dist-info/RECORD +19 -0
- {crossplane_function_sdk_python-0.10.0.dist-info → crossplane_function_sdk_python-0.12.0.dist-info}/WHEEL +1 -1
- crossplane_function_sdk_python-0.10.0.dist-info/RECORD +0 -19
- {crossplane_function_sdk_python-0.10.0.dist-info → crossplane_function_sdk_python-0.12.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -90,6 +90,13 @@ message RunFunctionRequest {
|
|
|
90
90
|
// satisfy the request. This field is only populated when the function uses
|
|
91
91
|
// resources in its requirements.
|
|
92
92
|
map<string, Resources> required_resources = 8;
|
|
93
|
+
|
|
94
|
+
// Optional schemas that the function specified in its requirements. The map
|
|
95
|
+
// key corresponds to the key in a RunFunctionResponse's requirements.schemas
|
|
96
|
+
// field. If a function requested a schema that could not be found, Crossplane
|
|
97
|
+
// sets the map key to an empty Schema message to indicate that it attempted
|
|
98
|
+
// to satisfy the request.
|
|
99
|
+
map<string, Schema> required_schemas = 9;
|
|
93
100
|
}
|
|
94
101
|
|
|
95
102
|
// Credentials that a function may use to communicate with an external system.
|
|
@@ -156,6 +163,44 @@ message RequestMeta {
|
|
|
156
163
|
// An opaque string identifying a request. Requests with identical tags will
|
|
157
164
|
// be otherwise identical.
|
|
158
165
|
string tag = 1;
|
|
166
|
+
|
|
167
|
+
// Capabilities supported by this version of Crossplane. Functions may use
|
|
168
|
+
// this to determine whether Crossplane will honor certain fields in their
|
|
169
|
+
// response, or populate certain fields in their request.
|
|
170
|
+
repeated Capability capabilities = 2;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Capability indicates that Crossplane supports a particular feature.
|
|
174
|
+
// Functions can check for capabilities to determine whether Crossplane will
|
|
175
|
+
// honor a particular request or response field.
|
|
176
|
+
enum Capability {
|
|
177
|
+
CAPABILITY_UNSPECIFIED = 0;
|
|
178
|
+
|
|
179
|
+
// Crossplane sends capabilities in RequestMeta. If this capability is
|
|
180
|
+
// present, the function knows that if another capability is absent, it's
|
|
181
|
+
// because Crossplane doesn't support it (not because Crossplane predates
|
|
182
|
+
// capability advertisement). Added in Crossplane v2.2.
|
|
183
|
+
CAPABILITY_CAPABILITIES = 1;
|
|
184
|
+
|
|
185
|
+
// Crossplane supports the requirements.resources field. Functions can return
|
|
186
|
+
// resource requirements and Crossplane will fetch the requested resources and
|
|
187
|
+
// return them in required_resources. Added in Crossplane v1.15.
|
|
188
|
+
CAPABILITY_REQUIRED_RESOURCES = 2;
|
|
189
|
+
|
|
190
|
+
// Crossplane supports the credentials field. Functions can receive
|
|
191
|
+
// credentials from secrets specified in the Composition. Added in Crossplane
|
|
192
|
+
// v1.16.
|
|
193
|
+
CAPABILITY_CREDENTIALS = 3;
|
|
194
|
+
|
|
195
|
+
// Crossplane supports the conditions field. Functions can return status
|
|
196
|
+
// conditions to be applied to the XR and optionally its claim. Added in
|
|
197
|
+
// Crossplane v1.17.
|
|
198
|
+
CAPABILITY_CONDITIONS = 4;
|
|
199
|
+
|
|
200
|
+
// Crossplane supports the requirements.schemas field. Functions can request
|
|
201
|
+
// OpenAPI schemas and Crossplane will return them in required_schemas. Added
|
|
202
|
+
// in Crossplane v2.2.
|
|
203
|
+
CAPABILITY_REQUIRED_SCHEMAS = 5;
|
|
159
204
|
}
|
|
160
205
|
|
|
161
206
|
// Requirements that must be satisfied for a function to run successfully.
|
|
@@ -169,6 +214,27 @@ message Requirements {
|
|
|
169
214
|
// Resources that this function requires. The map key uniquely identifies the
|
|
170
215
|
// group of resources.
|
|
171
216
|
map<string, ResourceSelector> resources = 2;
|
|
217
|
+
|
|
218
|
+
// Schemas that this function requires. The map key uniquely identifies the
|
|
219
|
+
// schema request.
|
|
220
|
+
map<string, SchemaSelector> schemas = 3;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// SchemaSelector identifies a resource kind whose OpenAPI schema is requested.
|
|
224
|
+
message SchemaSelector {
|
|
225
|
+
// API version of the resource kind, e.g. "example.org/v1".
|
|
226
|
+
string api_version = 1;
|
|
227
|
+
|
|
228
|
+
// Kind of resource, e.g. "MyResource".
|
|
229
|
+
string kind = 2;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// Schema represents the OpenAPI schema for a resource kind.
|
|
233
|
+
message Schema {
|
|
234
|
+
// The OpenAPI v3 schema of the resource kind as unstructured JSON.
|
|
235
|
+
// For CRDs this is the spec.versions[].schema.openAPIV3Schema field.
|
|
236
|
+
// Empty if Crossplane could not find a schema for the requested kind.
|
|
237
|
+
optional google.protobuf.Struct openapi_v3 = 1;
|
|
172
238
|
}
|
|
173
239
|
|
|
174
240
|
// ResourceSelector selects a group of resources, either by name or by label.
|
|
@@ -247,7 +313,7 @@ message Resource {
|
|
|
247
313
|
// the observed connection details of a composite or composed resource.
|
|
248
314
|
//
|
|
249
315
|
// * A function should set this field in a RunFunctionResponse to indicate the
|
|
250
|
-
// desired connection details of
|
|
316
|
+
// desired connection details of legacy XRs. For modern XRs, this will be ignored.
|
|
251
317
|
//
|
|
252
318
|
// * A function should not set this field in a RunFunctionResponse to indicate
|
|
253
319
|
// the desired connection details of a composed resource. This will be
|
|
@@ -267,7 +333,7 @@ message Resource {
|
|
|
267
333
|
// * A function should set this field to READY_TRUE in a RunFunctionResponse
|
|
268
334
|
// to indicate that a desired XR is ready. This overwrites the standard
|
|
269
335
|
// readiness detection that determines the ready state of the composite by the
|
|
270
|
-
// ready state of the
|
|
336
|
+
// ready state of the composed resources.
|
|
271
337
|
//
|
|
272
338
|
// Ready is only used for composition. It's ignored by Operations.
|
|
273
339
|
Ready ready = 3;
|
|
@@ -367,4 +433,4 @@ enum Status {
|
|
|
367
433
|
STATUS_CONDITION_TRUE = 2;
|
|
368
434
|
|
|
369
435
|
STATUS_CONDITION_FALSE = 3;
|
|
370
|
-
}
|
|
436
|
+
}
|
|
@@ -26,7 +26,7 @@ from google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb
|
|
|
26
26
|
from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n/crossplane/function/proto/v1/run_function.proto\x12\x19\x61piextensions.fn.proto.v1\x1a\x1egoogle/protobuf/duration.proto\x1a\x1cgoogle/protobuf/struct.proto\"\
|
|
29
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n/crossplane/function/proto/v1/run_function.proto\x12\x19\x61piextensions.fn.proto.v1\x1a\x1egoogle/protobuf/duration.proto\x1a\x1cgoogle/protobuf/struct.proto\"\x8c\x08\n\x12RunFunctionRequest\x12\x34\n\x04meta\x18\x01 \x01(\x0b\x32&.apiextensions.fn.proto.v1.RequestMeta\x12\x32\n\x08observed\x18\x02 \x01(\x0b\x32 .apiextensions.fn.proto.v1.State\x12\x31\n\x07\x64\x65sired\x18\x03 \x01(\x0b\x32 .apiextensions.fn.proto.v1.State\x12+\n\x05input\x18\x04 \x01(\x0b\x32\x17.google.protobuf.StructH\x00\x88\x01\x01\x12-\n\x07\x63ontext\x18\x05 \x01(\x0b\x32\x17.google.protobuf.StructH\x01\x88\x01\x01\x12^\n\x0f\x65xtra_resources\x18\x06 \x03(\x0b\x32\x41.apiextensions.fn.proto.v1.RunFunctionRequest.ExtraResourcesEntryB\x02\x18\x01\x12S\n\x0b\x63redentials\x18\x07 \x03(\x0b\x32>.apiextensions.fn.proto.v1.RunFunctionRequest.CredentialsEntry\x12`\n\x12required_resources\x18\x08 \x03(\x0b\x32\x44.apiextensions.fn.proto.v1.RunFunctionRequest.RequiredResourcesEntry\x12\\\n\x10required_schemas\x18\t \x03(\x0b\x32\x42.apiextensions.fn.proto.v1.RunFunctionRequest.RequiredSchemasEntry\x1a[\n\x13\x45xtraResourcesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x33\n\x05value\x18\x02 \x01(\x0b\x32$.apiextensions.fn.proto.v1.Resources:\x02\x38\x01\x1aZ\n\x10\x43redentialsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x35\n\x05value\x18\x02 \x01(\x0b\x32&.apiextensions.fn.proto.v1.Credentials:\x02\x38\x01\x1a^\n\x16RequiredResourcesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x33\n\x05value\x18\x02 \x01(\x0b\x32$.apiextensions.fn.proto.v1.Resources:\x02\x38\x01\x1aY\n\x14RequiredSchemasEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x30\n\x05value\x18\x02 \x01(\x0b\x32!.apiextensions.fn.proto.v1.Schema:\x02\x38\x01\x42\x08\n\x06_inputB\n\n\x08_context\"]\n\x0b\x43redentials\x12\x44\n\x0f\x63redential_data\x18\x01 \x01(\x0b\x32).apiextensions.fn.proto.v1.CredentialDataH\x00\x42\x08\n\x06source\"\x80\x01\n\x0e\x43redentialData\x12\x41\n\x04\x64\x61ta\x18\x01 \x03(\x0b\x32\x33.apiextensions.fn.proto.v1.CredentialData.DataEntry\x1a+\n\tDataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x0c:\x02\x38\x01\"?\n\tResources\x12\x32\n\x05items\x18\x01 \x03(\x0b\x32#.apiextensions.fn.proto.v1.Resource\"\xa0\x03\n\x13RunFunctionResponse\x12\x35\n\x04meta\x18\x01 \x01(\x0b\x32\'.apiextensions.fn.proto.v1.ResponseMeta\x12\x31\n\x07\x64\x65sired\x18\x02 \x01(\x0b\x32 .apiextensions.fn.proto.v1.State\x12\x32\n\x07results\x18\x03 \x03(\x0b\x32!.apiextensions.fn.proto.v1.Result\x12-\n\x07\x63ontext\x18\x04 \x01(\x0b\x32\x17.google.protobuf.StructH\x00\x88\x01\x01\x12=\n\x0crequirements\x18\x05 \x01(\x0b\x32\'.apiextensions.fn.proto.v1.Requirements\x12\x38\n\nconditions\x18\x06 \x03(\x0b\x32$.apiextensions.fn.proto.v1.Condition\x12,\n\x06output\x18\x07 \x01(\x0b\x32\x17.google.protobuf.StructH\x01\x88\x01\x01\x42\n\n\x08_contextB\t\n\x07_output\"W\n\x0bRequestMeta\x12\x0b\n\x03tag\x18\x01 \x01(\t\x12;\n\x0c\x63\x61pabilities\x18\x02 \x03(\x0e\x32%.apiextensions.fn.proto.v1.Capability\"\x98\x04\n\x0cRequirements\x12X\n\x0f\x65xtra_resources\x18\x01 \x03(\x0b\x32;.apiextensions.fn.proto.v1.Requirements.ExtraResourcesEntryB\x02\x18\x01\x12I\n\tresources\x18\x02 \x03(\x0b\x32\x36.apiextensions.fn.proto.v1.Requirements.ResourcesEntry\x12\x45\n\x07schemas\x18\x03 \x03(\x0b\x32\x34.apiextensions.fn.proto.v1.Requirements.SchemasEntry\x1a\x62\n\x13\x45xtraResourcesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12:\n\x05value\x18\x02 \x01(\x0b\x32+.apiextensions.fn.proto.v1.ResourceSelector:\x02\x38\x01\x1a]\n\x0eResourcesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12:\n\x05value\x18\x02 \x01(\x0b\x32+.apiextensions.fn.proto.v1.ResourceSelector:\x02\x38\x01\x1aY\n\x0cSchemasEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x38\n\x05value\x18\x02 \x01(\x0b\x32).apiextensions.fn.proto.v1.SchemaSelector:\x02\x38\x01\"3\n\x0eSchemaSelector\x12\x13\n\x0b\x61pi_version\x18\x01 \x01(\t\x12\x0c\n\x04kind\x18\x02 \x01(\t\"I\n\x06Schema\x12\x30\n\nopenapi_v3\x18\x01 \x01(\x0b\x32\x17.google.protobuf.StructH\x00\x88\x01\x01\x42\r\n\x0b_openapi_v3\"\xba\x01\n\x10ResourceSelector\x12\x13\n\x0b\x61pi_version\x18\x01 \x01(\t\x12\x0c\n\x04kind\x18\x02 \x01(\t\x12\x14\n\nmatch_name\x18\x03 \x01(\tH\x00\x12>\n\x0cmatch_labels\x18\x04 \x01(\x0b\x32&.apiextensions.fn.proto.v1.MatchLabelsH\x00\x12\x16\n\tnamespace\x18\x05 \x01(\tH\x01\x88\x01\x01\x42\x07\n\x05matchB\x0c\n\n_namespace\"\x80\x01\n\x0bMatchLabels\x12\x42\n\x06labels\x18\x01 \x03(\x0b\x32\x32.apiextensions.fn.proto.v1.MatchLabels.LabelsEntry\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"P\n\x0cResponseMeta\x12\x0b\n\x03tag\x18\x01 \x01(\t\x12+\n\x03ttl\x18\x02 \x01(\x0b\x32\x19.google.protobuf.DurationH\x00\x88\x01\x01\x42\x06\n\x04_ttl\"\xda\x01\n\x05State\x12\x36\n\tcomposite\x18\x01 \x01(\x0b\x32#.apiextensions.fn.proto.v1.Resource\x12\x42\n\tresources\x18\x02 \x03(\x0b\x32/.apiextensions.fn.proto.v1.State.ResourcesEntry\x1aU\n\x0eResourcesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x32\n\x05value\x18\x02 \x01(\x0b\x32#.apiextensions.fn.proto.v1.Resource:\x02\x38\x01\"\xf8\x01\n\x08Resource\x12)\n\x08resource\x18\x01 \x01(\x0b\x32\x17.google.protobuf.Struct\x12V\n\x12\x63onnection_details\x18\x02 \x03(\x0b\x32:.apiextensions.fn.proto.v1.Resource.ConnectionDetailsEntry\x12/\n\x05ready\x18\x03 \x01(\x0e\x32 .apiextensions.fn.proto.v1.Ready\x1a\x38\n\x16\x43onnectionDetailsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x0c:\x02\x38\x01\"\xb3\x01\n\x06Result\x12\x35\n\x08severity\x18\x01 \x01(\x0e\x32#.apiextensions.fn.proto.v1.Severity\x12\x0f\n\x07message\x18\x02 \x01(\t\x12\x13\n\x06reason\x18\x03 \x01(\tH\x00\x88\x01\x01\x12\x36\n\x06target\x18\x04 \x01(\x0e\x32!.apiextensions.fn.proto.v1.TargetH\x01\x88\x01\x01\x42\t\n\x07_reasonB\t\n\x07_target\"\xc1\x01\n\tCondition\x12\x0c\n\x04type\x18\x01 \x01(\t\x12\x31\n\x06status\x18\x02 \x01(\x0e\x32!.apiextensions.fn.proto.v1.Status\x12\x0e\n\x06reason\x18\x03 \x01(\t\x12\x14\n\x07message\x18\x04 \x01(\tH\x00\x88\x01\x01\x12\x36\n\x06target\x18\x05 \x01(\x0e\x32!.apiextensions.fn.proto.v1.TargetH\x01\x88\x01\x01\x42\n\n\x08_messageB\t\n\x07_target*\xc0\x01\n\nCapability\x12\x1a\n\x16\x43\x41PABILITY_UNSPECIFIED\x10\x00\x12\x1b\n\x17\x43\x41PABILITY_CAPABILITIES\x10\x01\x12!\n\x1d\x43\x41PABILITY_REQUIRED_RESOURCES\x10\x02\x12\x1a\n\x16\x43\x41PABILITY_CREDENTIALS\x10\x03\x12\x19\n\x15\x43\x41PABILITY_CONDITIONS\x10\x04\x12\x1f\n\x1b\x43\x41PABILITY_REQUIRED_SCHEMAS\x10\x05*?\n\x05Ready\x12\x15\n\x11READY_UNSPECIFIED\x10\x00\x12\x0e\n\nREADY_TRUE\x10\x01\x12\x0f\n\x0bREADY_FALSE\x10\x02*c\n\x08Severity\x12\x18\n\x14SEVERITY_UNSPECIFIED\x10\x00\x12\x12\n\x0eSEVERITY_FATAL\x10\x01\x12\x14\n\x10SEVERITY_WARNING\x10\x02\x12\x13\n\x0fSEVERITY_NORMAL\x10\x03*V\n\x06Target\x12\x16\n\x12TARGET_UNSPECIFIED\x10\x00\x12\x14\n\x10TARGET_COMPOSITE\x10\x01\x12\x1e\n\x1aTARGET_COMPOSITE_AND_CLAIM\x10\x02*\x7f\n\x06Status\x12 \n\x1cSTATUS_CONDITION_UNSPECIFIED\x10\x00\x12\x1c\n\x18STATUS_CONDITION_UNKNOWN\x10\x01\x12\x19\n\x15STATUS_CONDITION_TRUE\x10\x02\x12\x1a\n\x16STATUS_CONDITION_FALSE\x10\x03\x32\x87\x01\n\x15\x46unctionRunnerService\x12n\n\x0bRunFunction\x12-.apiextensions.fn.proto.v1.RunFunctionRequest\x1a..apiextensions.fn.proto.v1.RunFunctionResponse\"\x00\x42\x31Z/github.com/crossplane/crossplane/v2/proto/fn/v1b\x06proto3')
|
|
30
30
|
|
|
31
31
|
_globals = globals()
|
|
32
32
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
@@ -40,6 +40,8 @@ if not _descriptor._USE_C_DESCRIPTORS:
|
|
|
40
40
|
_globals['_RUNFUNCTIONREQUEST_CREDENTIALSENTRY']._serialized_options = b'8\001'
|
|
41
41
|
_globals['_RUNFUNCTIONREQUEST_REQUIREDRESOURCESENTRY']._loaded_options = None
|
|
42
42
|
_globals['_RUNFUNCTIONREQUEST_REQUIREDRESOURCESENTRY']._serialized_options = b'8\001'
|
|
43
|
+
_globals['_RUNFUNCTIONREQUEST_REQUIREDSCHEMASENTRY']._loaded_options = None
|
|
44
|
+
_globals['_RUNFUNCTIONREQUEST_REQUIREDSCHEMASENTRY']._serialized_options = b'8\001'
|
|
43
45
|
_globals['_RUNFUNCTIONREQUEST'].fields_by_name['extra_resources']._loaded_options = None
|
|
44
46
|
_globals['_RUNFUNCTIONREQUEST'].fields_by_name['extra_resources']._serialized_options = b'\030\001'
|
|
45
47
|
_globals['_CREDENTIALDATA_DATAENTRY']._loaded_options = None
|
|
@@ -48,6 +50,8 @@ if not _descriptor._USE_C_DESCRIPTORS:
|
|
|
48
50
|
_globals['_REQUIREMENTS_EXTRARESOURCESENTRY']._serialized_options = b'8\001'
|
|
49
51
|
_globals['_REQUIREMENTS_RESOURCESENTRY']._loaded_options = None
|
|
50
52
|
_globals['_REQUIREMENTS_RESOURCESENTRY']._serialized_options = b'8\001'
|
|
53
|
+
_globals['_REQUIREMENTS_SCHEMASENTRY']._loaded_options = None
|
|
54
|
+
_globals['_REQUIREMENTS_SCHEMASENTRY']._serialized_options = b'8\001'
|
|
51
55
|
_globals['_REQUIREMENTS'].fields_by_name['extra_resources']._loaded_options = None
|
|
52
56
|
_globals['_REQUIREMENTS'].fields_by_name['extra_resources']._serialized_options = b'\030\001'
|
|
53
57
|
_globals['_MATCHLABELS_LABELSENTRY']._loaded_options = None
|
|
@@ -56,60 +60,70 @@ if not _descriptor._USE_C_DESCRIPTORS:
|
|
|
56
60
|
_globals['_STATE_RESOURCESENTRY']._serialized_options = b'8\001'
|
|
57
61
|
_globals['_RESOURCE_CONNECTIONDETAILSENTRY']._loaded_options = None
|
|
58
62
|
_globals['_RESOURCE_CONNECTIONDETAILSENTRY']._serialized_options = b'8\001'
|
|
59
|
-
_globals['
|
|
60
|
-
_globals['
|
|
61
|
-
_globals['
|
|
62
|
-
_globals['
|
|
63
|
-
_globals['
|
|
64
|
-
_globals['
|
|
65
|
-
_globals['
|
|
66
|
-
_globals['
|
|
63
|
+
_globals['_CAPABILITY']._serialized_start=3898
|
|
64
|
+
_globals['_CAPABILITY']._serialized_end=4090
|
|
65
|
+
_globals['_READY']._serialized_start=4092
|
|
66
|
+
_globals['_READY']._serialized_end=4155
|
|
67
|
+
_globals['_SEVERITY']._serialized_start=4157
|
|
68
|
+
_globals['_SEVERITY']._serialized_end=4256
|
|
69
|
+
_globals['_TARGET']._serialized_start=4258
|
|
70
|
+
_globals['_TARGET']._serialized_end=4344
|
|
71
|
+
_globals['_STATUS']._serialized_start=4346
|
|
72
|
+
_globals['_STATUS']._serialized_end=4473
|
|
67
73
|
_globals['_RUNFUNCTIONREQUEST']._serialized_start=141
|
|
68
|
-
_globals['_RUNFUNCTIONREQUEST']._serialized_end=
|
|
69
|
-
_globals['_RUNFUNCTIONREQUEST_EXTRARESOURCESENTRY']._serialized_start=
|
|
70
|
-
_globals['_RUNFUNCTIONREQUEST_EXTRARESOURCESENTRY']._serialized_end=
|
|
71
|
-
_globals['_RUNFUNCTIONREQUEST_CREDENTIALSENTRY']._serialized_start=
|
|
72
|
-
_globals['_RUNFUNCTIONREQUEST_CREDENTIALSENTRY']._serialized_end=
|
|
73
|
-
_globals['_RUNFUNCTIONREQUEST_REQUIREDRESOURCESENTRY']._serialized_start=
|
|
74
|
-
_globals['_RUNFUNCTIONREQUEST_REQUIREDRESOURCESENTRY']._serialized_end=
|
|
75
|
-
_globals['
|
|
76
|
-
_globals['
|
|
77
|
-
_globals['
|
|
78
|
-
_globals['
|
|
79
|
-
_globals['
|
|
80
|
-
_globals['
|
|
81
|
-
_globals['
|
|
82
|
-
_globals['
|
|
83
|
-
_globals['
|
|
84
|
-
_globals['
|
|
85
|
-
_globals['
|
|
86
|
-
_globals['
|
|
87
|
-
_globals['
|
|
88
|
-
_globals['
|
|
89
|
-
_globals['
|
|
90
|
-
_globals['
|
|
91
|
-
_globals['
|
|
92
|
-
_globals['
|
|
93
|
-
_globals['
|
|
94
|
-
_globals['
|
|
95
|
-
_globals['
|
|
96
|
-
_globals['
|
|
97
|
-
_globals['
|
|
98
|
-
_globals['
|
|
99
|
-
_globals['
|
|
100
|
-
_globals['
|
|
101
|
-
_globals['
|
|
102
|
-
_globals['
|
|
103
|
-
_globals['
|
|
104
|
-
_globals['
|
|
105
|
-
_globals['
|
|
106
|
-
_globals['
|
|
107
|
-
_globals['
|
|
108
|
-
_globals['
|
|
109
|
-
_globals['
|
|
110
|
-
_globals['
|
|
111
|
-
_globals['
|
|
112
|
-
_globals['
|
|
113
|
-
_globals['
|
|
114
|
-
_globals['
|
|
74
|
+
_globals['_RUNFUNCTIONREQUEST']._serialized_end=1177
|
|
75
|
+
_globals['_RUNFUNCTIONREQUEST_EXTRARESOURCESENTRY']._serialized_start=785
|
|
76
|
+
_globals['_RUNFUNCTIONREQUEST_EXTRARESOURCESENTRY']._serialized_end=876
|
|
77
|
+
_globals['_RUNFUNCTIONREQUEST_CREDENTIALSENTRY']._serialized_start=878
|
|
78
|
+
_globals['_RUNFUNCTIONREQUEST_CREDENTIALSENTRY']._serialized_end=968
|
|
79
|
+
_globals['_RUNFUNCTIONREQUEST_REQUIREDRESOURCESENTRY']._serialized_start=970
|
|
80
|
+
_globals['_RUNFUNCTIONREQUEST_REQUIREDRESOURCESENTRY']._serialized_end=1064
|
|
81
|
+
_globals['_RUNFUNCTIONREQUEST_REQUIREDSCHEMASENTRY']._serialized_start=1066
|
|
82
|
+
_globals['_RUNFUNCTIONREQUEST_REQUIREDSCHEMASENTRY']._serialized_end=1155
|
|
83
|
+
_globals['_CREDENTIALS']._serialized_start=1179
|
|
84
|
+
_globals['_CREDENTIALS']._serialized_end=1272
|
|
85
|
+
_globals['_CREDENTIALDATA']._serialized_start=1275
|
|
86
|
+
_globals['_CREDENTIALDATA']._serialized_end=1403
|
|
87
|
+
_globals['_CREDENTIALDATA_DATAENTRY']._serialized_start=1360
|
|
88
|
+
_globals['_CREDENTIALDATA_DATAENTRY']._serialized_end=1403
|
|
89
|
+
_globals['_RESOURCES']._serialized_start=1405
|
|
90
|
+
_globals['_RESOURCES']._serialized_end=1468
|
|
91
|
+
_globals['_RUNFUNCTIONRESPONSE']._serialized_start=1471
|
|
92
|
+
_globals['_RUNFUNCTIONRESPONSE']._serialized_end=1887
|
|
93
|
+
_globals['_REQUESTMETA']._serialized_start=1889
|
|
94
|
+
_globals['_REQUESTMETA']._serialized_end=1976
|
|
95
|
+
_globals['_REQUIREMENTS']._serialized_start=1979
|
|
96
|
+
_globals['_REQUIREMENTS']._serialized_end=2515
|
|
97
|
+
_globals['_REQUIREMENTS_EXTRARESOURCESENTRY']._serialized_start=2231
|
|
98
|
+
_globals['_REQUIREMENTS_EXTRARESOURCESENTRY']._serialized_end=2329
|
|
99
|
+
_globals['_REQUIREMENTS_RESOURCESENTRY']._serialized_start=2331
|
|
100
|
+
_globals['_REQUIREMENTS_RESOURCESENTRY']._serialized_end=2424
|
|
101
|
+
_globals['_REQUIREMENTS_SCHEMASENTRY']._serialized_start=2426
|
|
102
|
+
_globals['_REQUIREMENTS_SCHEMASENTRY']._serialized_end=2515
|
|
103
|
+
_globals['_SCHEMASELECTOR']._serialized_start=2517
|
|
104
|
+
_globals['_SCHEMASELECTOR']._serialized_end=2568
|
|
105
|
+
_globals['_SCHEMA']._serialized_start=2570
|
|
106
|
+
_globals['_SCHEMA']._serialized_end=2643
|
|
107
|
+
_globals['_RESOURCESELECTOR']._serialized_start=2646
|
|
108
|
+
_globals['_RESOURCESELECTOR']._serialized_end=2832
|
|
109
|
+
_globals['_MATCHLABELS']._serialized_start=2835
|
|
110
|
+
_globals['_MATCHLABELS']._serialized_end=2963
|
|
111
|
+
_globals['_MATCHLABELS_LABELSENTRY']._serialized_start=2918
|
|
112
|
+
_globals['_MATCHLABELS_LABELSENTRY']._serialized_end=2963
|
|
113
|
+
_globals['_RESPONSEMETA']._serialized_start=2965
|
|
114
|
+
_globals['_RESPONSEMETA']._serialized_end=3045
|
|
115
|
+
_globals['_STATE']._serialized_start=3048
|
|
116
|
+
_globals['_STATE']._serialized_end=3266
|
|
117
|
+
_globals['_STATE_RESOURCESENTRY']._serialized_start=3181
|
|
118
|
+
_globals['_STATE_RESOURCESENTRY']._serialized_end=3266
|
|
119
|
+
_globals['_RESOURCE']._serialized_start=3269
|
|
120
|
+
_globals['_RESOURCE']._serialized_end=3517
|
|
121
|
+
_globals['_RESOURCE_CONNECTIONDETAILSENTRY']._serialized_start=3461
|
|
122
|
+
_globals['_RESOURCE_CONNECTIONDETAILSENTRY']._serialized_end=3517
|
|
123
|
+
_globals['_RESULT']._serialized_start=3520
|
|
124
|
+
_globals['_RESULT']._serialized_end=3699
|
|
125
|
+
_globals['_CONDITION']._serialized_start=3702
|
|
126
|
+
_globals['_CONDITION']._serialized_end=3895
|
|
127
|
+
_globals['_FUNCTIONRUNNERSERVICE']._serialized_start=4476
|
|
128
|
+
_globals['_FUNCTIONRUNNERSERVICE']._serialized_end=4611
|
|
115
129
|
# @@protoc_insertion_point(module_scope)
|
|
@@ -11,6 +11,15 @@ from typing import ClassVar as _ClassVar, Optional as _Optional, Union as _Union
|
|
|
11
11
|
|
|
12
12
|
DESCRIPTOR: _descriptor.FileDescriptor
|
|
13
13
|
|
|
14
|
+
class Capability(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
|
15
|
+
__slots__ = ()
|
|
16
|
+
CAPABILITY_UNSPECIFIED: _ClassVar[Capability]
|
|
17
|
+
CAPABILITY_CAPABILITIES: _ClassVar[Capability]
|
|
18
|
+
CAPABILITY_REQUIRED_RESOURCES: _ClassVar[Capability]
|
|
19
|
+
CAPABILITY_CREDENTIALS: _ClassVar[Capability]
|
|
20
|
+
CAPABILITY_CONDITIONS: _ClassVar[Capability]
|
|
21
|
+
CAPABILITY_REQUIRED_SCHEMAS: _ClassVar[Capability]
|
|
22
|
+
|
|
14
23
|
class Ready(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
|
15
24
|
__slots__ = ()
|
|
16
25
|
READY_UNSPECIFIED: _ClassVar[Ready]
|
|
@@ -36,6 +45,12 @@ class Status(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
|
|
36
45
|
STATUS_CONDITION_UNKNOWN: _ClassVar[Status]
|
|
37
46
|
STATUS_CONDITION_TRUE: _ClassVar[Status]
|
|
38
47
|
STATUS_CONDITION_FALSE: _ClassVar[Status]
|
|
48
|
+
CAPABILITY_UNSPECIFIED: Capability
|
|
49
|
+
CAPABILITY_CAPABILITIES: Capability
|
|
50
|
+
CAPABILITY_REQUIRED_RESOURCES: Capability
|
|
51
|
+
CAPABILITY_CREDENTIALS: Capability
|
|
52
|
+
CAPABILITY_CONDITIONS: Capability
|
|
53
|
+
CAPABILITY_REQUIRED_SCHEMAS: Capability
|
|
39
54
|
READY_UNSPECIFIED: Ready
|
|
40
55
|
READY_TRUE: Ready
|
|
41
56
|
READY_FALSE: Ready
|
|
@@ -52,7 +67,7 @@ STATUS_CONDITION_TRUE: Status
|
|
|
52
67
|
STATUS_CONDITION_FALSE: Status
|
|
53
68
|
|
|
54
69
|
class RunFunctionRequest(_message.Message):
|
|
55
|
-
__slots__ = ("meta", "observed", "desired", "input", "context", "extra_resources", "credentials", "required_resources")
|
|
70
|
+
__slots__ = ("meta", "observed", "desired", "input", "context", "extra_resources", "credentials", "required_resources", "required_schemas")
|
|
56
71
|
class ExtraResourcesEntry(_message.Message):
|
|
57
72
|
__slots__ = ("key", "value")
|
|
58
73
|
KEY_FIELD_NUMBER: _ClassVar[int]
|
|
@@ -74,6 +89,13 @@ class RunFunctionRequest(_message.Message):
|
|
|
74
89
|
key: str
|
|
75
90
|
value: Resources
|
|
76
91
|
def __init__(self, key: _Optional[str] = ..., value: _Optional[_Union[Resources, _Mapping]] = ...) -> None: ...
|
|
92
|
+
class RequiredSchemasEntry(_message.Message):
|
|
93
|
+
__slots__ = ("key", "value")
|
|
94
|
+
KEY_FIELD_NUMBER: _ClassVar[int]
|
|
95
|
+
VALUE_FIELD_NUMBER: _ClassVar[int]
|
|
96
|
+
key: str
|
|
97
|
+
value: Schema
|
|
98
|
+
def __init__(self, key: _Optional[str] = ..., value: _Optional[_Union[Schema, _Mapping]] = ...) -> None: ...
|
|
77
99
|
META_FIELD_NUMBER: _ClassVar[int]
|
|
78
100
|
OBSERVED_FIELD_NUMBER: _ClassVar[int]
|
|
79
101
|
DESIRED_FIELD_NUMBER: _ClassVar[int]
|
|
@@ -82,6 +104,7 @@ class RunFunctionRequest(_message.Message):
|
|
|
82
104
|
EXTRA_RESOURCES_FIELD_NUMBER: _ClassVar[int]
|
|
83
105
|
CREDENTIALS_FIELD_NUMBER: _ClassVar[int]
|
|
84
106
|
REQUIRED_RESOURCES_FIELD_NUMBER: _ClassVar[int]
|
|
107
|
+
REQUIRED_SCHEMAS_FIELD_NUMBER: _ClassVar[int]
|
|
85
108
|
meta: RequestMeta
|
|
86
109
|
observed: State
|
|
87
110
|
desired: State
|
|
@@ -90,7 +113,8 @@ class RunFunctionRequest(_message.Message):
|
|
|
90
113
|
extra_resources: _containers.MessageMap[str, Resources]
|
|
91
114
|
credentials: _containers.MessageMap[str, Credentials]
|
|
92
115
|
required_resources: _containers.MessageMap[str, Resources]
|
|
93
|
-
|
|
116
|
+
required_schemas: _containers.MessageMap[str, Schema]
|
|
117
|
+
def __init__(self, meta: _Optional[_Union[RequestMeta, _Mapping]] = ..., observed: _Optional[_Union[State, _Mapping]] = ..., desired: _Optional[_Union[State, _Mapping]] = ..., input: _Optional[_Union[_struct_pb2.Struct, _Mapping]] = ..., context: _Optional[_Union[_struct_pb2.Struct, _Mapping]] = ..., extra_resources: _Optional[_Mapping[str, Resources]] = ..., credentials: _Optional[_Mapping[str, Credentials]] = ..., required_resources: _Optional[_Mapping[str, Resources]] = ..., required_schemas: _Optional[_Mapping[str, Schema]] = ...) -> None: ...
|
|
94
118
|
|
|
95
119
|
class Credentials(_message.Message):
|
|
96
120
|
__slots__ = ("credential_data",)
|
|
@@ -136,13 +160,15 @@ class RunFunctionResponse(_message.Message):
|
|
|
136
160
|
def __init__(self, meta: _Optional[_Union[ResponseMeta, _Mapping]] = ..., desired: _Optional[_Union[State, _Mapping]] = ..., results: _Optional[_Iterable[_Union[Result, _Mapping]]] = ..., context: _Optional[_Union[_struct_pb2.Struct, _Mapping]] = ..., requirements: _Optional[_Union[Requirements, _Mapping]] = ..., conditions: _Optional[_Iterable[_Union[Condition, _Mapping]]] = ..., output: _Optional[_Union[_struct_pb2.Struct, _Mapping]] = ...) -> None: ...
|
|
137
161
|
|
|
138
162
|
class RequestMeta(_message.Message):
|
|
139
|
-
__slots__ = ("tag",)
|
|
163
|
+
__slots__ = ("tag", "capabilities")
|
|
140
164
|
TAG_FIELD_NUMBER: _ClassVar[int]
|
|
165
|
+
CAPABILITIES_FIELD_NUMBER: _ClassVar[int]
|
|
141
166
|
tag: str
|
|
142
|
-
|
|
167
|
+
capabilities: _containers.RepeatedScalarFieldContainer[Capability]
|
|
168
|
+
def __init__(self, tag: _Optional[str] = ..., capabilities: _Optional[_Iterable[_Union[Capability, str]]] = ...) -> None: ...
|
|
143
169
|
|
|
144
170
|
class Requirements(_message.Message):
|
|
145
|
-
__slots__ = ("extra_resources", "resources")
|
|
171
|
+
__slots__ = ("extra_resources", "resources", "schemas")
|
|
146
172
|
class ExtraResourcesEntry(_message.Message):
|
|
147
173
|
__slots__ = ("key", "value")
|
|
148
174
|
KEY_FIELD_NUMBER: _ClassVar[int]
|
|
@@ -157,11 +183,34 @@ class Requirements(_message.Message):
|
|
|
157
183
|
key: str
|
|
158
184
|
value: ResourceSelector
|
|
159
185
|
def __init__(self, key: _Optional[str] = ..., value: _Optional[_Union[ResourceSelector, _Mapping]] = ...) -> None: ...
|
|
186
|
+
class SchemasEntry(_message.Message):
|
|
187
|
+
__slots__ = ("key", "value")
|
|
188
|
+
KEY_FIELD_NUMBER: _ClassVar[int]
|
|
189
|
+
VALUE_FIELD_NUMBER: _ClassVar[int]
|
|
190
|
+
key: str
|
|
191
|
+
value: SchemaSelector
|
|
192
|
+
def __init__(self, key: _Optional[str] = ..., value: _Optional[_Union[SchemaSelector, _Mapping]] = ...) -> None: ...
|
|
160
193
|
EXTRA_RESOURCES_FIELD_NUMBER: _ClassVar[int]
|
|
161
194
|
RESOURCES_FIELD_NUMBER: _ClassVar[int]
|
|
195
|
+
SCHEMAS_FIELD_NUMBER: _ClassVar[int]
|
|
162
196
|
extra_resources: _containers.MessageMap[str, ResourceSelector]
|
|
163
197
|
resources: _containers.MessageMap[str, ResourceSelector]
|
|
164
|
-
|
|
198
|
+
schemas: _containers.MessageMap[str, SchemaSelector]
|
|
199
|
+
def __init__(self, extra_resources: _Optional[_Mapping[str, ResourceSelector]] = ..., resources: _Optional[_Mapping[str, ResourceSelector]] = ..., schemas: _Optional[_Mapping[str, SchemaSelector]] = ...) -> None: ...
|
|
200
|
+
|
|
201
|
+
class SchemaSelector(_message.Message):
|
|
202
|
+
__slots__ = ("api_version", "kind")
|
|
203
|
+
API_VERSION_FIELD_NUMBER: _ClassVar[int]
|
|
204
|
+
KIND_FIELD_NUMBER: _ClassVar[int]
|
|
205
|
+
api_version: str
|
|
206
|
+
kind: str
|
|
207
|
+
def __init__(self, api_version: _Optional[str] = ..., kind: _Optional[str] = ...) -> None: ...
|
|
208
|
+
|
|
209
|
+
class Schema(_message.Message):
|
|
210
|
+
__slots__ = ("openapi_v3",)
|
|
211
|
+
OPENAPI_V3_FIELD_NUMBER: _ClassVar[int]
|
|
212
|
+
openapi_v3: _struct_pb2.Struct
|
|
213
|
+
def __init__(self, openapi_v3: _Optional[_Union[_struct_pb2.Struct, _Mapping]] = ...) -> None: ...
|
|
165
214
|
|
|
166
215
|
class ResourceSelector(_message.Message):
|
|
167
216
|
__slots__ = ("api_version", "kind", "match_name", "match_labels", "namespace")
|
|
@@ -92,6 +92,13 @@ message RunFunctionRequest {
|
|
|
92
92
|
// satisfy the request. This field is only populated when the function uses
|
|
93
93
|
// resources in its requirements.
|
|
94
94
|
map<string, Resources> required_resources = 8;
|
|
95
|
+
|
|
96
|
+
// Optional schemas that the function specified in its requirements. The map
|
|
97
|
+
// key corresponds to the key in a RunFunctionResponse's requirements.schemas
|
|
98
|
+
// field. If a function requested a schema that could not be found, Crossplane
|
|
99
|
+
// sets the map key to an empty Schema message to indicate that it attempted
|
|
100
|
+
// to satisfy the request.
|
|
101
|
+
map<string, Schema> required_schemas = 9;
|
|
95
102
|
}
|
|
96
103
|
|
|
97
104
|
// Credentials that a function may use to communicate with an external system.
|
|
@@ -158,6 +165,44 @@ message RequestMeta {
|
|
|
158
165
|
// An opaque string identifying a request. Requests with identical tags will
|
|
159
166
|
// be otherwise identical.
|
|
160
167
|
string tag = 1;
|
|
168
|
+
|
|
169
|
+
// Capabilities supported by this version of Crossplane. Functions may use
|
|
170
|
+
// this to determine whether Crossplane will honor certain fields in their
|
|
171
|
+
// response, or populate certain fields in their request.
|
|
172
|
+
repeated Capability capabilities = 2;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Capability indicates that Crossplane supports a particular feature.
|
|
176
|
+
// Functions can check for capabilities to determine whether Crossplane will
|
|
177
|
+
// honor a particular request or response field.
|
|
178
|
+
enum Capability {
|
|
179
|
+
CAPABILITY_UNSPECIFIED = 0;
|
|
180
|
+
|
|
181
|
+
// Crossplane sends capabilities in RequestMeta. If this capability is
|
|
182
|
+
// present, the function knows that if another capability is absent, it's
|
|
183
|
+
// because Crossplane doesn't support it (not because Crossplane predates
|
|
184
|
+
// capability advertisement). Added in Crossplane v2.2.
|
|
185
|
+
CAPABILITY_CAPABILITIES = 1;
|
|
186
|
+
|
|
187
|
+
// Crossplane supports the requirements.resources field. Functions can return
|
|
188
|
+
// resource requirements and Crossplane will fetch the requested resources and
|
|
189
|
+
// return them in required_resources. Added in Crossplane v1.15.
|
|
190
|
+
CAPABILITY_REQUIRED_RESOURCES = 2;
|
|
191
|
+
|
|
192
|
+
// Crossplane supports the credentials field. Functions can receive
|
|
193
|
+
// credentials from secrets specified in the Composition. Added in Crossplane
|
|
194
|
+
// v1.16.
|
|
195
|
+
CAPABILITY_CREDENTIALS = 3;
|
|
196
|
+
|
|
197
|
+
// Crossplane supports the conditions field. Functions can return status
|
|
198
|
+
// conditions to be applied to the XR and optionally its claim. Added in
|
|
199
|
+
// Crossplane v1.17.
|
|
200
|
+
CAPABILITY_CONDITIONS = 4;
|
|
201
|
+
|
|
202
|
+
// Crossplane supports the requirements.schemas field. Functions can request
|
|
203
|
+
// OpenAPI schemas and Crossplane will return them in required_schemas. Added
|
|
204
|
+
// in Crossplane v2.2.
|
|
205
|
+
CAPABILITY_REQUIRED_SCHEMAS = 5;
|
|
161
206
|
}
|
|
162
207
|
|
|
163
208
|
// Requirements that must be satisfied for a function to run successfully.
|
|
@@ -171,6 +216,27 @@ message Requirements {
|
|
|
171
216
|
// Resources that this function requires. The map key uniquely identifies the
|
|
172
217
|
// group of resources.
|
|
173
218
|
map<string, ResourceSelector> resources = 2;
|
|
219
|
+
|
|
220
|
+
// Schemas that this function requires. The map key uniquely identifies the
|
|
221
|
+
// schema request.
|
|
222
|
+
map<string, SchemaSelector> schemas = 3;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// SchemaSelector identifies a resource kind whose OpenAPI schema is requested.
|
|
226
|
+
message SchemaSelector {
|
|
227
|
+
// API version of the resource kind, e.g. "example.org/v1".
|
|
228
|
+
string api_version = 1;
|
|
229
|
+
|
|
230
|
+
// Kind of resource, e.g. "MyResource".
|
|
231
|
+
string kind = 2;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// Schema represents the OpenAPI schema for a resource kind.
|
|
235
|
+
message Schema {
|
|
236
|
+
// The OpenAPI v3 schema of the resource kind as unstructured JSON.
|
|
237
|
+
// For CRDs this is the spec.versions[].schema.openAPIV3Schema field.
|
|
238
|
+
// Empty if Crossplane could not find a schema for the requested kind.
|
|
239
|
+
optional google.protobuf.Struct openapi_v3 = 1;
|
|
174
240
|
}
|
|
175
241
|
|
|
176
242
|
// ResourceSelector selects a group of resources, either by name or by label.
|
|
@@ -249,7 +315,7 @@ message Resource {
|
|
|
249
315
|
// the observed connection details of a composite or composed resource.
|
|
250
316
|
//
|
|
251
317
|
// * A function should set this field in a RunFunctionResponse to indicate the
|
|
252
|
-
// desired connection details of
|
|
318
|
+
// desired connection details of legacy XRs. For modern XRs, this will be ignored.
|
|
253
319
|
//
|
|
254
320
|
// * A function should not set this field in a RunFunctionResponse to indicate
|
|
255
321
|
// the desired connection details of a composed resource. This will be
|
|
@@ -269,7 +335,7 @@ message Resource {
|
|
|
269
335
|
// * A function should set this field to READY_TRUE in a RunFunctionResponse
|
|
270
336
|
// to indicate that a desired XR is ready. This overwrites the standard
|
|
271
337
|
// readiness detection that determines the ready state of the composite by the
|
|
272
|
-
// ready state of the
|
|
338
|
+
// ready state of the composed resources.
|
|
273
339
|
//
|
|
274
340
|
// Ready is only used for composition. It's ignored by Operations.
|
|
275
341
|
Ready ready = 3;
|
|
@@ -26,7 +26,7 @@ from google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb
|
|
|
26
26
|
from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n4crossplane/function/proto/v1beta1/run_function.proto\x12\x1e\x61piextensions.fn.proto.v1beta1\x1a\x1egoogle/protobuf/duration.proto\x1a\x1cgoogle/protobuf/struct.proto\"\
|
|
29
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n4crossplane/function/proto/v1beta1/run_function.proto\x12\x1e\x61piextensions.fn.proto.v1beta1\x1a\x1egoogle/protobuf/duration.proto\x1a\x1cgoogle/protobuf/struct.proto\"\xc3\x08\n\x12RunFunctionRequest\x12\x39\n\x04meta\x18\x01 \x01(\x0b\x32+.apiextensions.fn.proto.v1beta1.RequestMeta\x12\x37\n\x08observed\x18\x02 \x01(\x0b\x32%.apiextensions.fn.proto.v1beta1.State\x12\x36\n\x07\x64\x65sired\x18\x03 \x01(\x0b\x32%.apiextensions.fn.proto.v1beta1.State\x12+\n\x05input\x18\x04 \x01(\x0b\x32\x17.google.protobuf.StructH\x00\x88\x01\x01\x12-\n\x07\x63ontext\x18\x05 \x01(\x0b\x32\x17.google.protobuf.StructH\x01\x88\x01\x01\x12\x63\n\x0f\x65xtra_resources\x18\x06 \x03(\x0b\x32\x46.apiextensions.fn.proto.v1beta1.RunFunctionRequest.ExtraResourcesEntryB\x02\x18\x01\x12X\n\x0b\x63redentials\x18\x07 \x03(\x0b\x32\x43.apiextensions.fn.proto.v1beta1.RunFunctionRequest.CredentialsEntry\x12\x65\n\x12required_resources\x18\x08 \x03(\x0b\x32I.apiextensions.fn.proto.v1beta1.RunFunctionRequest.RequiredResourcesEntry\x12\x61\n\x10required_schemas\x18\t \x03(\x0b\x32G.apiextensions.fn.proto.v1beta1.RunFunctionRequest.RequiredSchemasEntry\x1a`\n\x13\x45xtraResourcesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x38\n\x05value\x18\x02 \x01(\x0b\x32).apiextensions.fn.proto.v1beta1.Resources:\x02\x38\x01\x1a_\n\x10\x43redentialsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12:\n\x05value\x18\x02 \x01(\x0b\x32+.apiextensions.fn.proto.v1beta1.Credentials:\x02\x38\x01\x1a\x63\n\x16RequiredResourcesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x38\n\x05value\x18\x02 \x01(\x0b\x32).apiextensions.fn.proto.v1beta1.Resources:\x02\x38\x01\x1a^\n\x14RequiredSchemasEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x35\n\x05value\x18\x02 \x01(\x0b\x32&.apiextensions.fn.proto.v1beta1.Schema:\x02\x38\x01\x42\x08\n\x06_inputB\n\n\x08_context\"b\n\x0b\x43redentials\x12I\n\x0f\x63redential_data\x18\x01 \x01(\x0b\x32..apiextensions.fn.proto.v1beta1.CredentialDataH\x00\x42\x08\n\x06source\"\x85\x01\n\x0e\x43redentialData\x12\x46\n\x04\x64\x61ta\x18\x01 \x03(\x0b\x32\x38.apiextensions.fn.proto.v1beta1.CredentialData.DataEntry\x1a+\n\tDataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x0c:\x02\x38\x01\"D\n\tResources\x12\x37\n\x05items\x18\x01 \x03(\x0b\x32(.apiextensions.fn.proto.v1beta1.Resource\"\xb9\x03\n\x13RunFunctionResponse\x12:\n\x04meta\x18\x01 \x01(\x0b\x32,.apiextensions.fn.proto.v1beta1.ResponseMeta\x12\x36\n\x07\x64\x65sired\x18\x02 \x01(\x0b\x32%.apiextensions.fn.proto.v1beta1.State\x12\x37\n\x07results\x18\x03 \x03(\x0b\x32&.apiextensions.fn.proto.v1beta1.Result\x12-\n\x07\x63ontext\x18\x04 \x01(\x0b\x32\x17.google.protobuf.StructH\x00\x88\x01\x01\x12\x42\n\x0crequirements\x18\x05 \x01(\x0b\x32,.apiextensions.fn.proto.v1beta1.Requirements\x12=\n\nconditions\x18\x06 \x03(\x0b\x32).apiextensions.fn.proto.v1beta1.Condition\x12,\n\x06output\x18\x07 \x01(\x0b\x32\x17.google.protobuf.StructH\x01\x88\x01\x01\x42\n\n\x08_contextB\t\n\x07_output\"\\\n\x0bRequestMeta\x12\x0b\n\x03tag\x18\x01 \x01(\t\x12@\n\x0c\x63\x61pabilities\x18\x02 \x03(\x0e\x32*.apiextensions.fn.proto.v1beta1.Capability\"\xb6\x04\n\x0cRequirements\x12]\n\x0f\x65xtra_resources\x18\x01 \x03(\x0b\x32@.apiextensions.fn.proto.v1beta1.Requirements.ExtraResourcesEntryB\x02\x18\x01\x12N\n\tresources\x18\x02 \x03(\x0b\x32;.apiextensions.fn.proto.v1beta1.Requirements.ResourcesEntry\x12J\n\x07schemas\x18\x03 \x03(\x0b\x32\x39.apiextensions.fn.proto.v1beta1.Requirements.SchemasEntry\x1ag\n\x13\x45xtraResourcesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12?\n\x05value\x18\x02 \x01(\x0b\x32\x30.apiextensions.fn.proto.v1beta1.ResourceSelector:\x02\x38\x01\x1a\x62\n\x0eResourcesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12?\n\x05value\x18\x02 \x01(\x0b\x32\x30.apiextensions.fn.proto.v1beta1.ResourceSelector:\x02\x38\x01\x1a^\n\x0cSchemasEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12=\n\x05value\x18\x02 \x01(\x0b\x32..apiextensions.fn.proto.v1beta1.SchemaSelector:\x02\x38\x01\"3\n\x0eSchemaSelector\x12\x13\n\x0b\x61pi_version\x18\x01 \x01(\t\x12\x0c\n\x04kind\x18\x02 \x01(\t\"I\n\x06Schema\x12\x30\n\nopenapi_v3\x18\x01 \x01(\x0b\x32\x17.google.protobuf.StructH\x00\x88\x01\x01\x42\r\n\x0b_openapi_v3\"\xbf\x01\n\x10ResourceSelector\x12\x13\n\x0b\x61pi_version\x18\x01 \x01(\t\x12\x0c\n\x04kind\x18\x02 \x01(\t\x12\x14\n\nmatch_name\x18\x03 \x01(\tH\x00\x12\x43\n\x0cmatch_labels\x18\x04 \x01(\x0b\x32+.apiextensions.fn.proto.v1beta1.MatchLabelsH\x00\x12\x16\n\tnamespace\x18\x05 \x01(\tH\x01\x88\x01\x01\x42\x07\n\x05matchB\x0c\n\n_namespace\"\x85\x01\n\x0bMatchLabels\x12G\n\x06labels\x18\x01 \x03(\x0b\x32\x37.apiextensions.fn.proto.v1beta1.MatchLabels.LabelsEntry\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"P\n\x0cResponseMeta\x12\x0b\n\x03tag\x18\x01 \x01(\t\x12+\n\x03ttl\x18\x02 \x01(\x0b\x32\x19.google.protobuf.DurationH\x00\x88\x01\x01\x42\x06\n\x04_ttl\"\xe9\x01\n\x05State\x12;\n\tcomposite\x18\x01 \x01(\x0b\x32(.apiextensions.fn.proto.v1beta1.Resource\x12G\n\tresources\x18\x02 \x03(\x0b\x32\x34.apiextensions.fn.proto.v1beta1.State.ResourcesEntry\x1aZ\n\x0eResourcesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x37\n\x05value\x18\x02 \x01(\x0b\x32(.apiextensions.fn.proto.v1beta1.Resource:\x02\x38\x01\"\x82\x02\n\x08Resource\x12)\n\x08resource\x18\x01 \x01(\x0b\x32\x17.google.protobuf.Struct\x12[\n\x12\x63onnection_details\x18\x02 \x03(\x0b\x32?.apiextensions.fn.proto.v1beta1.Resource.ConnectionDetailsEntry\x12\x34\n\x05ready\x18\x03 \x01(\x0e\x32%.apiextensions.fn.proto.v1beta1.Ready\x1a\x38\n\x16\x43onnectionDetailsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x0c:\x02\x38\x01\"\xbd\x01\n\x06Result\x12:\n\x08severity\x18\x01 \x01(\x0e\x32(.apiextensions.fn.proto.v1beta1.Severity\x12\x0f\n\x07message\x18\x02 \x01(\t\x12\x13\n\x06reason\x18\x03 \x01(\tH\x00\x88\x01\x01\x12;\n\x06target\x18\x04 \x01(\x0e\x32&.apiextensions.fn.proto.v1beta1.TargetH\x01\x88\x01\x01\x42\t\n\x07_reasonB\t\n\x07_target\"\xcb\x01\n\tCondition\x12\x0c\n\x04type\x18\x01 \x01(\t\x12\x36\n\x06status\x18\x02 \x01(\x0e\x32&.apiextensions.fn.proto.v1beta1.Status\x12\x0e\n\x06reason\x18\x03 \x01(\t\x12\x14\n\x07message\x18\x04 \x01(\tH\x00\x88\x01\x01\x12;\n\x06target\x18\x05 \x01(\x0e\x32&.apiextensions.fn.proto.v1beta1.TargetH\x01\x88\x01\x01\x42\n\n\x08_messageB\t\n\x07_target*\xc0\x01\n\nCapability\x12\x1a\n\x16\x43\x41PABILITY_UNSPECIFIED\x10\x00\x12\x1b\n\x17\x43\x41PABILITY_CAPABILITIES\x10\x01\x12!\n\x1d\x43\x41PABILITY_REQUIRED_RESOURCES\x10\x02\x12\x1a\n\x16\x43\x41PABILITY_CREDENTIALS\x10\x03\x12\x19\n\x15\x43\x41PABILITY_CONDITIONS\x10\x04\x12\x1f\n\x1b\x43\x41PABILITY_REQUIRED_SCHEMAS\x10\x05*?\n\x05Ready\x12\x15\n\x11READY_UNSPECIFIED\x10\x00\x12\x0e\n\nREADY_TRUE\x10\x01\x12\x0f\n\x0bREADY_FALSE\x10\x02*c\n\x08Severity\x12\x18\n\x14SEVERITY_UNSPECIFIED\x10\x00\x12\x12\n\x0eSEVERITY_FATAL\x10\x01\x12\x14\n\x10SEVERITY_WARNING\x10\x02\x12\x13\n\x0fSEVERITY_NORMAL\x10\x03*V\n\x06Target\x12\x16\n\x12TARGET_UNSPECIFIED\x10\x00\x12\x14\n\x10TARGET_COMPOSITE\x10\x01\x12\x1e\n\x1aTARGET_COMPOSITE_AND_CLAIM\x10\x02*\x7f\n\x06Status\x12 \n\x1cSTATUS_CONDITION_UNSPECIFIED\x10\x00\x12\x1c\n\x18STATUS_CONDITION_UNKNOWN\x10\x01\x12\x19\n\x15STATUS_CONDITION_TRUE\x10\x02\x12\x1a\n\x16STATUS_CONDITION_FALSE\x10\x03\x32\x91\x01\n\x15\x46unctionRunnerService\x12x\n\x0bRunFunction\x12\x32.apiextensions.fn.proto.v1beta1.RunFunctionRequest\x1a\x33.apiextensions.fn.proto.v1beta1.RunFunctionResponse\"\x00\x42\x36Z4github.com/crossplane/crossplane/v2/proto/fn/v1beta1b\x06proto3')
|
|
30
30
|
|
|
31
31
|
_globals = globals()
|
|
32
32
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
@@ -40,6 +40,8 @@ if not _descriptor._USE_C_DESCRIPTORS:
|
|
|
40
40
|
_globals['_RUNFUNCTIONREQUEST_CREDENTIALSENTRY']._serialized_options = b'8\001'
|
|
41
41
|
_globals['_RUNFUNCTIONREQUEST_REQUIREDRESOURCESENTRY']._loaded_options = None
|
|
42
42
|
_globals['_RUNFUNCTIONREQUEST_REQUIREDRESOURCESENTRY']._serialized_options = b'8\001'
|
|
43
|
+
_globals['_RUNFUNCTIONREQUEST_REQUIREDSCHEMASENTRY']._loaded_options = None
|
|
44
|
+
_globals['_RUNFUNCTIONREQUEST_REQUIREDSCHEMASENTRY']._serialized_options = b'8\001'
|
|
43
45
|
_globals['_RUNFUNCTIONREQUEST'].fields_by_name['extra_resources']._loaded_options = None
|
|
44
46
|
_globals['_RUNFUNCTIONREQUEST'].fields_by_name['extra_resources']._serialized_options = b'\030\001'
|
|
45
47
|
_globals['_CREDENTIALDATA_DATAENTRY']._loaded_options = None
|
|
@@ -48,6 +50,8 @@ if not _descriptor._USE_C_DESCRIPTORS:
|
|
|
48
50
|
_globals['_REQUIREMENTS_EXTRARESOURCESENTRY']._serialized_options = b'8\001'
|
|
49
51
|
_globals['_REQUIREMENTS_RESOURCESENTRY']._loaded_options = None
|
|
50
52
|
_globals['_REQUIREMENTS_RESOURCESENTRY']._serialized_options = b'8\001'
|
|
53
|
+
_globals['_REQUIREMENTS_SCHEMASENTRY']._loaded_options = None
|
|
54
|
+
_globals['_REQUIREMENTS_SCHEMASENTRY']._serialized_options = b'8\001'
|
|
51
55
|
_globals['_REQUIREMENTS'].fields_by_name['extra_resources']._loaded_options = None
|
|
52
56
|
_globals['_REQUIREMENTS'].fields_by_name['extra_resources']._serialized_options = b'\030\001'
|
|
53
57
|
_globals['_MATCHLABELS_LABELSENTRY']._loaded_options = None
|
|
@@ -56,60 +60,70 @@ if not _descriptor._USE_C_DESCRIPTORS:
|
|
|
56
60
|
_globals['_STATE_RESOURCESENTRY']._serialized_options = b'8\001'
|
|
57
61
|
_globals['_RESOURCE_CONNECTIONDETAILSENTRY']._loaded_options = None
|
|
58
62
|
_globals['_RESOURCE_CONNECTIONDETAILSENTRY']._serialized_options = b'8\001'
|
|
59
|
-
_globals['
|
|
60
|
-
_globals['
|
|
61
|
-
_globals['
|
|
62
|
-
_globals['
|
|
63
|
-
_globals['
|
|
64
|
-
_globals['
|
|
65
|
-
_globals['
|
|
66
|
-
_globals['
|
|
63
|
+
_globals['_CAPABILITY']._serialized_start=4093
|
|
64
|
+
_globals['_CAPABILITY']._serialized_end=4285
|
|
65
|
+
_globals['_READY']._serialized_start=4287
|
|
66
|
+
_globals['_READY']._serialized_end=4350
|
|
67
|
+
_globals['_SEVERITY']._serialized_start=4352
|
|
68
|
+
_globals['_SEVERITY']._serialized_end=4451
|
|
69
|
+
_globals['_TARGET']._serialized_start=4453
|
|
70
|
+
_globals['_TARGET']._serialized_end=4539
|
|
71
|
+
_globals['_STATUS']._serialized_start=4541
|
|
72
|
+
_globals['_STATUS']._serialized_end=4668
|
|
67
73
|
_globals['_RUNFUNCTIONREQUEST']._serialized_start=151
|
|
68
|
-
_globals['_RUNFUNCTIONREQUEST']._serialized_end=
|
|
69
|
-
_globals['_RUNFUNCTIONREQUEST_EXTRARESOURCESENTRY']._serialized_start=
|
|
70
|
-
_globals['_RUNFUNCTIONREQUEST_EXTRARESOURCESENTRY']._serialized_end=
|
|
71
|
-
_globals['_RUNFUNCTIONREQUEST_CREDENTIALSENTRY']._serialized_start=
|
|
72
|
-
_globals['_RUNFUNCTIONREQUEST_CREDENTIALSENTRY']._serialized_end=
|
|
73
|
-
_globals['_RUNFUNCTIONREQUEST_REQUIREDRESOURCESENTRY']._serialized_start=
|
|
74
|
-
_globals['_RUNFUNCTIONREQUEST_REQUIREDRESOURCESENTRY']._serialized_end=
|
|
75
|
-
_globals['
|
|
76
|
-
_globals['
|
|
77
|
-
_globals['
|
|
78
|
-
_globals['
|
|
79
|
-
_globals['
|
|
80
|
-
_globals['
|
|
81
|
-
_globals['
|
|
82
|
-
_globals['
|
|
83
|
-
_globals['
|
|
84
|
-
_globals['
|
|
85
|
-
_globals['
|
|
86
|
-
_globals['
|
|
87
|
-
_globals['
|
|
88
|
-
_globals['
|
|
89
|
-
_globals['
|
|
90
|
-
_globals['
|
|
91
|
-
_globals['
|
|
92
|
-
_globals['
|
|
93
|
-
_globals['
|
|
94
|
-
_globals['
|
|
95
|
-
_globals['
|
|
96
|
-
_globals['
|
|
97
|
-
_globals['
|
|
98
|
-
_globals['
|
|
99
|
-
_globals['
|
|
100
|
-
_globals['
|
|
101
|
-
_globals['
|
|
102
|
-
_globals['
|
|
103
|
-
_globals['
|
|
104
|
-
_globals['
|
|
105
|
-
_globals['
|
|
106
|
-
_globals['
|
|
107
|
-
_globals['
|
|
108
|
-
_globals['
|
|
109
|
-
_globals['
|
|
110
|
-
_globals['
|
|
111
|
-
_globals['
|
|
112
|
-
_globals['
|
|
113
|
-
_globals['
|
|
114
|
-
_globals['
|
|
74
|
+
_globals['_RUNFUNCTIONREQUEST']._serialized_end=1242
|
|
75
|
+
_globals['_RUNFUNCTIONREQUEST_EXTRARESOURCESENTRY']._serialized_start=830
|
|
76
|
+
_globals['_RUNFUNCTIONREQUEST_EXTRARESOURCESENTRY']._serialized_end=926
|
|
77
|
+
_globals['_RUNFUNCTIONREQUEST_CREDENTIALSENTRY']._serialized_start=928
|
|
78
|
+
_globals['_RUNFUNCTIONREQUEST_CREDENTIALSENTRY']._serialized_end=1023
|
|
79
|
+
_globals['_RUNFUNCTIONREQUEST_REQUIREDRESOURCESENTRY']._serialized_start=1025
|
|
80
|
+
_globals['_RUNFUNCTIONREQUEST_REQUIREDRESOURCESENTRY']._serialized_end=1124
|
|
81
|
+
_globals['_RUNFUNCTIONREQUEST_REQUIREDSCHEMASENTRY']._serialized_start=1126
|
|
82
|
+
_globals['_RUNFUNCTIONREQUEST_REQUIREDSCHEMASENTRY']._serialized_end=1220
|
|
83
|
+
_globals['_CREDENTIALS']._serialized_start=1244
|
|
84
|
+
_globals['_CREDENTIALS']._serialized_end=1342
|
|
85
|
+
_globals['_CREDENTIALDATA']._serialized_start=1345
|
|
86
|
+
_globals['_CREDENTIALDATA']._serialized_end=1478
|
|
87
|
+
_globals['_CREDENTIALDATA_DATAENTRY']._serialized_start=1435
|
|
88
|
+
_globals['_CREDENTIALDATA_DATAENTRY']._serialized_end=1478
|
|
89
|
+
_globals['_RESOURCES']._serialized_start=1480
|
|
90
|
+
_globals['_RESOURCES']._serialized_end=1548
|
|
91
|
+
_globals['_RUNFUNCTIONRESPONSE']._serialized_start=1551
|
|
92
|
+
_globals['_RUNFUNCTIONRESPONSE']._serialized_end=1992
|
|
93
|
+
_globals['_REQUESTMETA']._serialized_start=1994
|
|
94
|
+
_globals['_REQUESTMETA']._serialized_end=2086
|
|
95
|
+
_globals['_REQUIREMENTS']._serialized_start=2089
|
|
96
|
+
_globals['_REQUIREMENTS']._serialized_end=2655
|
|
97
|
+
_globals['_REQUIREMENTS_EXTRARESOURCESENTRY']._serialized_start=2356
|
|
98
|
+
_globals['_REQUIREMENTS_EXTRARESOURCESENTRY']._serialized_end=2459
|
|
99
|
+
_globals['_REQUIREMENTS_RESOURCESENTRY']._serialized_start=2461
|
|
100
|
+
_globals['_REQUIREMENTS_RESOURCESENTRY']._serialized_end=2559
|
|
101
|
+
_globals['_REQUIREMENTS_SCHEMASENTRY']._serialized_start=2561
|
|
102
|
+
_globals['_REQUIREMENTS_SCHEMASENTRY']._serialized_end=2655
|
|
103
|
+
_globals['_SCHEMASELECTOR']._serialized_start=2657
|
|
104
|
+
_globals['_SCHEMASELECTOR']._serialized_end=2708
|
|
105
|
+
_globals['_SCHEMA']._serialized_start=2710
|
|
106
|
+
_globals['_SCHEMA']._serialized_end=2783
|
|
107
|
+
_globals['_RESOURCESELECTOR']._serialized_start=2786
|
|
108
|
+
_globals['_RESOURCESELECTOR']._serialized_end=2977
|
|
109
|
+
_globals['_MATCHLABELS']._serialized_start=2980
|
|
110
|
+
_globals['_MATCHLABELS']._serialized_end=3113
|
|
111
|
+
_globals['_MATCHLABELS_LABELSENTRY']._serialized_start=3068
|
|
112
|
+
_globals['_MATCHLABELS_LABELSENTRY']._serialized_end=3113
|
|
113
|
+
_globals['_RESPONSEMETA']._serialized_start=3115
|
|
114
|
+
_globals['_RESPONSEMETA']._serialized_end=3195
|
|
115
|
+
_globals['_STATE']._serialized_start=3198
|
|
116
|
+
_globals['_STATE']._serialized_end=3431
|
|
117
|
+
_globals['_STATE_RESOURCESENTRY']._serialized_start=3341
|
|
118
|
+
_globals['_STATE_RESOURCESENTRY']._serialized_end=3431
|
|
119
|
+
_globals['_RESOURCE']._serialized_start=3434
|
|
120
|
+
_globals['_RESOURCE']._serialized_end=3692
|
|
121
|
+
_globals['_RESOURCE_CONNECTIONDETAILSENTRY']._serialized_start=3636
|
|
122
|
+
_globals['_RESOURCE_CONNECTIONDETAILSENTRY']._serialized_end=3692
|
|
123
|
+
_globals['_RESULT']._serialized_start=3695
|
|
124
|
+
_globals['_RESULT']._serialized_end=3884
|
|
125
|
+
_globals['_CONDITION']._serialized_start=3887
|
|
126
|
+
_globals['_CONDITION']._serialized_end=4090
|
|
127
|
+
_globals['_FUNCTIONRUNNERSERVICE']._serialized_start=4671
|
|
128
|
+
_globals['_FUNCTIONRUNNERSERVICE']._serialized_end=4816
|
|
115
129
|
# @@protoc_insertion_point(module_scope)
|
|
@@ -11,6 +11,15 @@ from typing import ClassVar as _ClassVar, Optional as _Optional, Union as _Union
|
|
|
11
11
|
|
|
12
12
|
DESCRIPTOR: _descriptor.FileDescriptor
|
|
13
13
|
|
|
14
|
+
class Capability(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
|
15
|
+
__slots__ = ()
|
|
16
|
+
CAPABILITY_UNSPECIFIED: _ClassVar[Capability]
|
|
17
|
+
CAPABILITY_CAPABILITIES: _ClassVar[Capability]
|
|
18
|
+
CAPABILITY_REQUIRED_RESOURCES: _ClassVar[Capability]
|
|
19
|
+
CAPABILITY_CREDENTIALS: _ClassVar[Capability]
|
|
20
|
+
CAPABILITY_CONDITIONS: _ClassVar[Capability]
|
|
21
|
+
CAPABILITY_REQUIRED_SCHEMAS: _ClassVar[Capability]
|
|
22
|
+
|
|
14
23
|
class Ready(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
|
15
24
|
__slots__ = ()
|
|
16
25
|
READY_UNSPECIFIED: _ClassVar[Ready]
|
|
@@ -36,6 +45,12 @@ class Status(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
|
|
36
45
|
STATUS_CONDITION_UNKNOWN: _ClassVar[Status]
|
|
37
46
|
STATUS_CONDITION_TRUE: _ClassVar[Status]
|
|
38
47
|
STATUS_CONDITION_FALSE: _ClassVar[Status]
|
|
48
|
+
CAPABILITY_UNSPECIFIED: Capability
|
|
49
|
+
CAPABILITY_CAPABILITIES: Capability
|
|
50
|
+
CAPABILITY_REQUIRED_RESOURCES: Capability
|
|
51
|
+
CAPABILITY_CREDENTIALS: Capability
|
|
52
|
+
CAPABILITY_CONDITIONS: Capability
|
|
53
|
+
CAPABILITY_REQUIRED_SCHEMAS: Capability
|
|
39
54
|
READY_UNSPECIFIED: Ready
|
|
40
55
|
READY_TRUE: Ready
|
|
41
56
|
READY_FALSE: Ready
|
|
@@ -52,7 +67,7 @@ STATUS_CONDITION_TRUE: Status
|
|
|
52
67
|
STATUS_CONDITION_FALSE: Status
|
|
53
68
|
|
|
54
69
|
class RunFunctionRequest(_message.Message):
|
|
55
|
-
__slots__ = ("meta", "observed", "desired", "input", "context", "extra_resources", "credentials", "required_resources")
|
|
70
|
+
__slots__ = ("meta", "observed", "desired", "input", "context", "extra_resources", "credentials", "required_resources", "required_schemas")
|
|
56
71
|
class ExtraResourcesEntry(_message.Message):
|
|
57
72
|
__slots__ = ("key", "value")
|
|
58
73
|
KEY_FIELD_NUMBER: _ClassVar[int]
|
|
@@ -74,6 +89,13 @@ class RunFunctionRequest(_message.Message):
|
|
|
74
89
|
key: str
|
|
75
90
|
value: Resources
|
|
76
91
|
def __init__(self, key: _Optional[str] = ..., value: _Optional[_Union[Resources, _Mapping]] = ...) -> None: ...
|
|
92
|
+
class RequiredSchemasEntry(_message.Message):
|
|
93
|
+
__slots__ = ("key", "value")
|
|
94
|
+
KEY_FIELD_NUMBER: _ClassVar[int]
|
|
95
|
+
VALUE_FIELD_NUMBER: _ClassVar[int]
|
|
96
|
+
key: str
|
|
97
|
+
value: Schema
|
|
98
|
+
def __init__(self, key: _Optional[str] = ..., value: _Optional[_Union[Schema, _Mapping]] = ...) -> None: ...
|
|
77
99
|
META_FIELD_NUMBER: _ClassVar[int]
|
|
78
100
|
OBSERVED_FIELD_NUMBER: _ClassVar[int]
|
|
79
101
|
DESIRED_FIELD_NUMBER: _ClassVar[int]
|
|
@@ -82,6 +104,7 @@ class RunFunctionRequest(_message.Message):
|
|
|
82
104
|
EXTRA_RESOURCES_FIELD_NUMBER: _ClassVar[int]
|
|
83
105
|
CREDENTIALS_FIELD_NUMBER: _ClassVar[int]
|
|
84
106
|
REQUIRED_RESOURCES_FIELD_NUMBER: _ClassVar[int]
|
|
107
|
+
REQUIRED_SCHEMAS_FIELD_NUMBER: _ClassVar[int]
|
|
85
108
|
meta: RequestMeta
|
|
86
109
|
observed: State
|
|
87
110
|
desired: State
|
|
@@ -90,7 +113,8 @@ class RunFunctionRequest(_message.Message):
|
|
|
90
113
|
extra_resources: _containers.MessageMap[str, Resources]
|
|
91
114
|
credentials: _containers.MessageMap[str, Credentials]
|
|
92
115
|
required_resources: _containers.MessageMap[str, Resources]
|
|
93
|
-
|
|
116
|
+
required_schemas: _containers.MessageMap[str, Schema]
|
|
117
|
+
def __init__(self, meta: _Optional[_Union[RequestMeta, _Mapping]] = ..., observed: _Optional[_Union[State, _Mapping]] = ..., desired: _Optional[_Union[State, _Mapping]] = ..., input: _Optional[_Union[_struct_pb2.Struct, _Mapping]] = ..., context: _Optional[_Union[_struct_pb2.Struct, _Mapping]] = ..., extra_resources: _Optional[_Mapping[str, Resources]] = ..., credentials: _Optional[_Mapping[str, Credentials]] = ..., required_resources: _Optional[_Mapping[str, Resources]] = ..., required_schemas: _Optional[_Mapping[str, Schema]] = ...) -> None: ...
|
|
94
118
|
|
|
95
119
|
class Credentials(_message.Message):
|
|
96
120
|
__slots__ = ("credential_data",)
|
|
@@ -136,13 +160,15 @@ class RunFunctionResponse(_message.Message):
|
|
|
136
160
|
def __init__(self, meta: _Optional[_Union[ResponseMeta, _Mapping]] = ..., desired: _Optional[_Union[State, _Mapping]] = ..., results: _Optional[_Iterable[_Union[Result, _Mapping]]] = ..., context: _Optional[_Union[_struct_pb2.Struct, _Mapping]] = ..., requirements: _Optional[_Union[Requirements, _Mapping]] = ..., conditions: _Optional[_Iterable[_Union[Condition, _Mapping]]] = ..., output: _Optional[_Union[_struct_pb2.Struct, _Mapping]] = ...) -> None: ...
|
|
137
161
|
|
|
138
162
|
class RequestMeta(_message.Message):
|
|
139
|
-
__slots__ = ("tag",)
|
|
163
|
+
__slots__ = ("tag", "capabilities")
|
|
140
164
|
TAG_FIELD_NUMBER: _ClassVar[int]
|
|
165
|
+
CAPABILITIES_FIELD_NUMBER: _ClassVar[int]
|
|
141
166
|
tag: str
|
|
142
|
-
|
|
167
|
+
capabilities: _containers.RepeatedScalarFieldContainer[Capability]
|
|
168
|
+
def __init__(self, tag: _Optional[str] = ..., capabilities: _Optional[_Iterable[_Union[Capability, str]]] = ...) -> None: ...
|
|
143
169
|
|
|
144
170
|
class Requirements(_message.Message):
|
|
145
|
-
__slots__ = ("extra_resources", "resources")
|
|
171
|
+
__slots__ = ("extra_resources", "resources", "schemas")
|
|
146
172
|
class ExtraResourcesEntry(_message.Message):
|
|
147
173
|
__slots__ = ("key", "value")
|
|
148
174
|
KEY_FIELD_NUMBER: _ClassVar[int]
|
|
@@ -157,11 +183,34 @@ class Requirements(_message.Message):
|
|
|
157
183
|
key: str
|
|
158
184
|
value: ResourceSelector
|
|
159
185
|
def __init__(self, key: _Optional[str] = ..., value: _Optional[_Union[ResourceSelector, _Mapping]] = ...) -> None: ...
|
|
186
|
+
class SchemasEntry(_message.Message):
|
|
187
|
+
__slots__ = ("key", "value")
|
|
188
|
+
KEY_FIELD_NUMBER: _ClassVar[int]
|
|
189
|
+
VALUE_FIELD_NUMBER: _ClassVar[int]
|
|
190
|
+
key: str
|
|
191
|
+
value: SchemaSelector
|
|
192
|
+
def __init__(self, key: _Optional[str] = ..., value: _Optional[_Union[SchemaSelector, _Mapping]] = ...) -> None: ...
|
|
160
193
|
EXTRA_RESOURCES_FIELD_NUMBER: _ClassVar[int]
|
|
161
194
|
RESOURCES_FIELD_NUMBER: _ClassVar[int]
|
|
195
|
+
SCHEMAS_FIELD_NUMBER: _ClassVar[int]
|
|
162
196
|
extra_resources: _containers.MessageMap[str, ResourceSelector]
|
|
163
197
|
resources: _containers.MessageMap[str, ResourceSelector]
|
|
164
|
-
|
|
198
|
+
schemas: _containers.MessageMap[str, SchemaSelector]
|
|
199
|
+
def __init__(self, extra_resources: _Optional[_Mapping[str, ResourceSelector]] = ..., resources: _Optional[_Mapping[str, ResourceSelector]] = ..., schemas: _Optional[_Mapping[str, SchemaSelector]] = ...) -> None: ...
|
|
200
|
+
|
|
201
|
+
class SchemaSelector(_message.Message):
|
|
202
|
+
__slots__ = ("api_version", "kind")
|
|
203
|
+
API_VERSION_FIELD_NUMBER: _ClassVar[int]
|
|
204
|
+
KIND_FIELD_NUMBER: _ClassVar[int]
|
|
205
|
+
api_version: str
|
|
206
|
+
kind: str
|
|
207
|
+
def __init__(self, api_version: _Optional[str] = ..., kind: _Optional[str] = ...) -> None: ...
|
|
208
|
+
|
|
209
|
+
class Schema(_message.Message):
|
|
210
|
+
__slots__ = ("openapi_v3",)
|
|
211
|
+
OPENAPI_V3_FIELD_NUMBER: _ClassVar[int]
|
|
212
|
+
openapi_v3: _struct_pb2.Struct
|
|
213
|
+
def __init__(self, openapi_v3: _Optional[_Union[_struct_pb2.Struct, _Mapping]] = ...) -> None: ...
|
|
165
214
|
|
|
166
215
|
class ResourceSelector(_message.Message):
|
|
167
216
|
__slots__ = ("api_version", "kind", "match_name", "match_labels", "namespace")
|
crossplane/function/request.py
CHANGED
|
@@ -41,6 +41,21 @@ def get_required_resources(req: fnv1.RunFunctionRequest, name: str) -> list[dict
|
|
|
41
41
|
Required resources are previously called "extra resources" in composition
|
|
42
42
|
functions. For operation functions, there are no observed resources, so
|
|
43
43
|
all resources are "required" resources that the function requested.
|
|
44
|
+
|
|
45
|
+
Note: This returns an empty list both when the requirement hasn't been
|
|
46
|
+
resolved yet, and when it was resolved but no resources matched. To
|
|
47
|
+
distinguish between these cases, check whether Crossplane resolved the
|
|
48
|
+
requirement using `name in req.required_resources`:
|
|
49
|
+
|
|
50
|
+
# Always declare requirements - Crossplane considers them satisfied
|
|
51
|
+
# when they stabilize across calls.
|
|
52
|
+
response.require_resources(rsp, name, ...)
|
|
53
|
+
|
|
54
|
+
if name in req.required_resources:
|
|
55
|
+
resources = request.get_required_resources(req, name)
|
|
56
|
+
if not resources:
|
|
57
|
+
# Crossplane resolved the requirement, but found no matches
|
|
58
|
+
response.fatal(rsp, "no matching resources found")
|
|
44
59
|
"""
|
|
45
60
|
if name not in req.required_resources:
|
|
46
61
|
return []
|
|
@@ -116,3 +131,96 @@ def get_credentials(req: fnv1.RunFunctionRequest, name: str) -> Credentials:
|
|
|
116
131
|
|
|
117
132
|
# If no recognized source type is set, return empty
|
|
118
133
|
return empty
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def advertises_capabilities(req: fnv1.RunFunctionRequest) -> bool:
|
|
137
|
+
"""Check whether Crossplane advertises its capabilities.
|
|
138
|
+
|
|
139
|
+
Args:
|
|
140
|
+
req: The RunFunctionRequest to check.
|
|
141
|
+
|
|
142
|
+
Returns:
|
|
143
|
+
True if Crossplane advertises its capabilities.
|
|
144
|
+
|
|
145
|
+
Crossplane v2.2 and later advertise their capabilities in the request
|
|
146
|
+
metadata. If this returns False, the calling Crossplane predates capability
|
|
147
|
+
advertisement and has_capability will always return False, even for features
|
|
148
|
+
the older Crossplane does support.
|
|
149
|
+
|
|
150
|
+
if not request.advertises_capabilities(req):
|
|
151
|
+
# Pre-v2.2 Crossplane, capabilities are unknown.
|
|
152
|
+
...
|
|
153
|
+
elif request.has_capability(req, fnv1.CAPABILITY_REQUIRED_SCHEMAS):
|
|
154
|
+
response.require_schema(rsp, "xr", xr_api_version, xr_kind)
|
|
155
|
+
"""
|
|
156
|
+
return fnv1.CAPABILITY_CAPABILITIES in req.meta.capabilities
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def has_capability(
|
|
160
|
+
req: fnv1.RunFunctionRequest,
|
|
161
|
+
cap: fnv1.Capability.ValueType,
|
|
162
|
+
) -> bool:
|
|
163
|
+
"""Check whether Crossplane advertises a particular capability.
|
|
164
|
+
|
|
165
|
+
Args:
|
|
166
|
+
req: The RunFunctionRequest to check.
|
|
167
|
+
cap: The capability to check for, e.g. fnv1.CAPABILITY_REQUIRED_SCHEMAS.
|
|
168
|
+
|
|
169
|
+
Returns:
|
|
170
|
+
True if the capability is present in the request metadata.
|
|
171
|
+
|
|
172
|
+
Crossplane sends its capabilities in the request metadata. Functions can use
|
|
173
|
+
this to determine whether Crossplane will honor certain fields in their
|
|
174
|
+
response, or populate certain fields in their request.
|
|
175
|
+
|
|
176
|
+
Use advertises_capabilities to check whether Crossplane advertises its
|
|
177
|
+
capabilities at all. If it doesn't, has_capability always returns False even
|
|
178
|
+
for features the older Crossplane does support.
|
|
179
|
+
|
|
180
|
+
if request.has_capability(req, fnv1.CAPABILITY_REQUIRED_SCHEMAS):
|
|
181
|
+
response.require_schema(rsp, "xr", xr_api_version, xr_kind)
|
|
182
|
+
"""
|
|
183
|
+
return cap in req.meta.capabilities
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
def get_required_schema(req: fnv1.RunFunctionRequest, name: str) -> dict | None:
|
|
187
|
+
"""Get a required OpenAPI schema by name from the request.
|
|
188
|
+
|
|
189
|
+
Args:
|
|
190
|
+
req: The RunFunctionRequest containing required schemas.
|
|
191
|
+
name: The name of the required schema to get.
|
|
192
|
+
|
|
193
|
+
Returns:
|
|
194
|
+
The OpenAPI v3 schema as a dictionary, or None if not found.
|
|
195
|
+
|
|
196
|
+
Note: This returns None both when the requirement hasn't been resolved yet,
|
|
197
|
+
and when it was resolved but the schema wasn't found. To distinguish between
|
|
198
|
+
these cases, check whether Crossplane resolved the requirement using
|
|
199
|
+
`name in req.required_schemas`:
|
|
200
|
+
|
|
201
|
+
# Always declare requirements - Crossplane considers them satisfied
|
|
202
|
+
# when they stabilize across calls.
|
|
203
|
+
response.require_schema(rsp, name, "example.org/v1", "MyKind")
|
|
204
|
+
|
|
205
|
+
if name in req.required_schemas:
|
|
206
|
+
schema = request.get_required_schema(req, name)
|
|
207
|
+
if schema is None:
|
|
208
|
+
# Crossplane resolved the requirement, but couldn't find it
|
|
209
|
+
response.fatal(rsp, "schema not found")
|
|
210
|
+
|
|
211
|
+
The returned schema can be used with libraries like openapi-schema-validator
|
|
212
|
+
or jsonschema for validation:
|
|
213
|
+
|
|
214
|
+
schema = request.get_required_schema(req, "my-schema")
|
|
215
|
+
if schema:
|
|
216
|
+
from openapi_schema_validator import validate
|
|
217
|
+
validate(resource, schema)
|
|
218
|
+
"""
|
|
219
|
+
if name not in req.required_schemas:
|
|
220
|
+
return None
|
|
221
|
+
|
|
222
|
+
schema = req.required_schemas[name]
|
|
223
|
+
if not schema.HasField("openapi_v3"):
|
|
224
|
+
return None
|
|
225
|
+
|
|
226
|
+
return resource.struct_to_dict(schema.openapi_v3)
|
crossplane/function/resource.py
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import dataclasses
|
|
18
18
|
import datetime
|
|
19
|
+
import hashlib
|
|
19
20
|
|
|
20
21
|
import pydantic
|
|
21
22
|
from google.protobuf import json_format
|
|
@@ -59,6 +60,25 @@ def update(r: fnv1.Resource, source: dict | structpb.Struct | pydantic.BaseModel
|
|
|
59
60
|
raise TypeError(msg)
|
|
60
61
|
|
|
61
62
|
|
|
63
|
+
def update_status(
|
|
64
|
+
r: fnv1.Resource,
|
|
65
|
+
status: dict | pydantic.BaseModel,
|
|
66
|
+
) -> None:
|
|
67
|
+
"""Update a resource's status.
|
|
68
|
+
|
|
69
|
+
Args:
|
|
70
|
+
r: A composite or composed resource to update.
|
|
71
|
+
status: The status to set, as a dictionary or Pydantic model.
|
|
72
|
+
|
|
73
|
+
Sets ``r.resource.status`` from the supplied status. When the status
|
|
74
|
+
is a Pydantic model, fields set to their default value are excluded,
|
|
75
|
+
matching the behavior of :func:`update`.
|
|
76
|
+
"""
|
|
77
|
+
if isinstance(status, pydantic.BaseModel):
|
|
78
|
+
status = status.model_dump(exclude_defaults=True, warnings=False)
|
|
79
|
+
update(r, {"status": status})
|
|
80
|
+
|
|
81
|
+
|
|
62
82
|
def dict_to_struct(d: dict) -> structpb.Struct:
|
|
63
83
|
"""Create a Struct well-known type from the supplied dict.
|
|
64
84
|
|
|
@@ -99,11 +119,17 @@ class Condition:
|
|
|
99
119
|
last_transition_time: datetime.time | None = None
|
|
100
120
|
|
|
101
121
|
|
|
102
|
-
def get_condition(
|
|
122
|
+
def get_condition(
|
|
123
|
+
resource: structpb.Struct | fnv1.Resource | None,
|
|
124
|
+
typ: str,
|
|
125
|
+
) -> Condition:
|
|
103
126
|
"""Get the supplied status condition of the supplied resource.
|
|
104
127
|
|
|
105
128
|
Args:
|
|
106
|
-
resource: A Crossplane resource.
|
|
129
|
+
resource: A Crossplane resource. Can be a protobuf Struct (the raw
|
|
130
|
+
resource), an fnv1.Resource wrapper, or None. When an
|
|
131
|
+
fnv1.Resource is supplied, the Struct is extracted automatically.
|
|
132
|
+
When None is supplied, an unknown condition is returned.
|
|
107
133
|
typ: The type of status condition to get (e.g. Ready).
|
|
108
134
|
|
|
109
135
|
Returns:
|
|
@@ -111,9 +137,23 @@ def get_condition(resource: structpb.Struct, typ: str) -> Condition:
|
|
|
111
137
|
|
|
112
138
|
A status condition is always returned. If the status condition isn't present
|
|
113
139
|
in the supplied resource, a condition with status "Unknown" is returned.
|
|
140
|
+
|
|
141
|
+
Accepting fnv1.Resource and None makes it safe to pass the result of a
|
|
142
|
+
protobuf map ``.get()`` call directly. This avoids auto-vivification, which
|
|
143
|
+
silently inserts a default entry when using bracket access on a missing
|
|
144
|
+
key::
|
|
145
|
+
|
|
146
|
+
# Safe — .get() returns None without mutating the map.
|
|
147
|
+
c = get_condition(req.observed.resources.get("bucket"), "Ready")
|
|
148
|
+
|
|
149
|
+
# Unsafe — bracket access auto-vivifies an empty Resource.
|
|
150
|
+
c = get_condition(req.observed.resources["bucket"].resource, "Ready")
|
|
114
151
|
"""
|
|
115
152
|
unknown = Condition(typ=typ, status="Unknown")
|
|
116
153
|
|
|
154
|
+
if isinstance(resource, fnv1.Resource):
|
|
155
|
+
resource = resource.resource
|
|
156
|
+
|
|
117
157
|
if not resource or "status" not in resource:
|
|
118
158
|
return unknown
|
|
119
159
|
|
|
@@ -140,3 +180,37 @@ def get_condition(resource: structpb.Struct, typ: str) -> Condition:
|
|
|
140
180
|
return condition
|
|
141
181
|
|
|
142
182
|
return unknown
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
_DNS_LABEL_MAX = 63
|
|
186
|
+
_HASH_LEN = 5
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
def child_name(*parts: str, sep: str = "-") -> str:
|
|
190
|
+
"""Build a deterministic, DNS-label-safe name for a child resource.
|
|
191
|
+
|
|
192
|
+
Args:
|
|
193
|
+
*parts: Name components to join (e.g. parent name, suffix).
|
|
194
|
+
sep: Separator between parts. Defaults to "-".
|
|
195
|
+
|
|
196
|
+
Returns:
|
|
197
|
+
A name that is at most 63 characters long.
|
|
198
|
+
|
|
199
|
+
Composition functions often derive child resource names from a parent
|
|
200
|
+
name and a discriminator. The resulting name must be a valid DNS label
|
|
201
|
+
(at most 63 characters). This function joins the parts, appends a
|
|
202
|
+
deterministic 5-character hash suffix for uniqueness, and truncates
|
|
203
|
+
the prefix to fit within the limit.
|
|
204
|
+
|
|
205
|
+
The hash suffix is always appended, even for short names, so that
|
|
206
|
+
names are visually consistent regardless of length::
|
|
207
|
+
|
|
208
|
+
child_name("my-xr", "bucket") # "my-xr-bucket-a1b2c"
|
|
209
|
+
child_name("my-very-long-xr-name",
|
|
210
|
+
"with-a-very-long-suffix") # truncated to 63 chars
|
|
211
|
+
"""
|
|
212
|
+
full = sep.join(parts)
|
|
213
|
+
h = hashlib.sha256(full.encode()).hexdigest()[:_HASH_LEN]
|
|
214
|
+
max_prefix = _DNS_LABEL_MAX - _HASH_LEN - 1
|
|
215
|
+
prefix = full[:max_prefix].rstrip(sep)
|
|
216
|
+
return f"{prefix}{sep}{h}"
|
crossplane/function/response.py
CHANGED
|
@@ -81,6 +81,44 @@ def fatal(rsp: fnv1.RunFunctionResponse, message: str) -> None:
|
|
|
81
81
|
)
|
|
82
82
|
|
|
83
83
|
|
|
84
|
+
_STATUS_MAP = {
|
|
85
|
+
"True": fnv1.STATUS_CONDITION_TRUE,
|
|
86
|
+
"False": fnv1.STATUS_CONDITION_FALSE,
|
|
87
|
+
"Unknown": fnv1.STATUS_CONDITION_UNKNOWN,
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def set_conditions(
|
|
92
|
+
rsp: fnv1.RunFunctionResponse,
|
|
93
|
+
*conditions: resource.Condition,
|
|
94
|
+
) -> None:
|
|
95
|
+
"""Set one or more conditions on the composite resource (XR).
|
|
96
|
+
|
|
97
|
+
Args:
|
|
98
|
+
rsp: The RunFunctionResponse to update.
|
|
99
|
+
*conditions: The conditions to set.
|
|
100
|
+
|
|
101
|
+
Each condition is appended to ``rsp.conditions``. Crossplane uses the
|
|
102
|
+
conditions returned by a function to set custom status conditions on
|
|
103
|
+
the composite resource.
|
|
104
|
+
|
|
105
|
+
The ``last_transition_time`` field of each condition is ignored.
|
|
106
|
+
Crossplane sets the transition time itself.
|
|
107
|
+
|
|
108
|
+
Do not set the ``Ready`` condition type. Crossplane manages it based
|
|
109
|
+
on resource readiness.
|
|
110
|
+
"""
|
|
111
|
+
for condition in conditions:
|
|
112
|
+
c = fnv1.Condition(
|
|
113
|
+
type=condition.typ,
|
|
114
|
+
status=_STATUS_MAP.get(condition.status, fnv1.STATUS_CONDITION_UNKNOWN),
|
|
115
|
+
reason=condition.reason or "",
|
|
116
|
+
)
|
|
117
|
+
if condition.message:
|
|
118
|
+
c.message = condition.message
|
|
119
|
+
rsp.conditions.append(c)
|
|
120
|
+
|
|
121
|
+
|
|
84
122
|
def set_output(rsp: fnv1.RunFunctionResponse, output: dict | structpb.Struct) -> None:
|
|
85
123
|
"""Set the output field in a RunFunctionResponse for operation functions.
|
|
86
124
|
|
|
@@ -149,3 +187,32 @@ def require_resources( # noqa: PLR0913
|
|
|
149
187
|
selector.namespace = namespace
|
|
150
188
|
|
|
151
189
|
rsp.requirements.resources[name].CopyFrom(selector)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def require_schema(
|
|
193
|
+
rsp: fnv1.RunFunctionResponse,
|
|
194
|
+
name: str,
|
|
195
|
+
api_version: str,
|
|
196
|
+
kind: str,
|
|
197
|
+
) -> None:
|
|
198
|
+
"""Add a schema requirement to the response.
|
|
199
|
+
|
|
200
|
+
Args:
|
|
201
|
+
rsp: The RunFunctionResponse to update.
|
|
202
|
+
name: The name to use for this requirement.
|
|
203
|
+
api_version: The API version of the resource kind, e.g. "example.org/v1".
|
|
204
|
+
kind: The kind of resource, e.g. "MyResource".
|
|
205
|
+
|
|
206
|
+
This tells Crossplane to fetch the OpenAPI schema for the specified resource
|
|
207
|
+
kind and include it in the next call to the function in
|
|
208
|
+
req.required_schemas[name]. Use request.get_required_schema to retrieve it.
|
|
209
|
+
|
|
210
|
+
For CRDs, Crossplane returns the spec.versions[].schema.openAPIV3Schema field.
|
|
211
|
+
If Crossplane cannot find a schema for the requested kind, the schema will be
|
|
212
|
+
empty (get_required_schema will return None).
|
|
213
|
+
"""
|
|
214
|
+
selector = fnv1.SchemaSelector(
|
|
215
|
+
api_version=api_version,
|
|
216
|
+
kind=kind,
|
|
217
|
+
)
|
|
218
|
+
rsp.requirements.schemas[name].CopyFrom(selector)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: crossplane-function-sdk-python
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.12.0
|
|
4
4
|
Summary: The Python SDK for Crossplane composition functions
|
|
5
5
|
Project-URL: Documentation, https://github.com/crossplane/function-sdk-python#readme
|
|
6
6
|
Project-URL: Issues, https://github.com/crossplane/function-sdk-python/issues
|
|
@@ -14,8 +14,8 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
14
14
|
Classifier: Typing :: Typed
|
|
15
15
|
Requires-Python: >=3.11
|
|
16
16
|
Requires-Dist: grpcio-reflection==1.*
|
|
17
|
-
Requires-Dist: grpcio==1.
|
|
18
|
-
Requires-Dist: protobuf==
|
|
17
|
+
Requires-Dist: grpcio==1.80.0
|
|
18
|
+
Requires-Dist: protobuf==7.35.0
|
|
19
19
|
Requires-Dist: pydantic==2.*
|
|
20
20
|
Requires-Dist: structlog==25.*
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
crossplane/function/__version__.py,sha256=gtv076U2x6TC6KinwdT_-8jd1AkxueHUDZc5tRyideE,705
|
|
2
|
+
crossplane/function/logging.py,sha256=Zawqq36FBzjkVg4bJ3VGK12-so7N8yAMoSPrhdwpBSA,2503
|
|
3
|
+
crossplane/function/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
crossplane/function/request.py,sha256=ncgGTyAvBOdZ8M7KPy_H9pL08_cYzKJ3D9q_rnSjPXo,8199
|
|
5
|
+
crossplane/function/resource.py,sha256=9tNOsxOzT2mpIbw-tUXfLxH8zs2mGkrkU2JRkFSUN_E,7697
|
|
6
|
+
crossplane/function/response.py,sha256=7LR5CFaMOpBU2Fv-TMFe_CFx0mgZXX9WDm7vV8FtwtY,6965
|
|
7
|
+
crossplane/function/runtime.py,sha256=2S-AheR2o0pJxJRhDZDoWpJxCleIv_aHTnzRGgrZv_8,5415
|
|
8
|
+
crossplane/function/proto/v1/run_function.proto,sha256=GbJ0wVUEjfpMsn2DsnhiPvtmL09z3oyMbWwf6viQtiw,16676
|
|
9
|
+
crossplane/function/proto/v1/run_function_pb2.py,sha256=eeQajHePjvswGCEH2FRxyr8P-K0Go55U5L4rAa32JA8,14440
|
|
10
|
+
crossplane/function/proto/v1/run_function_pb2.pyi,sha256=MvjcY39d1xJ4ZZmRibhehCKF1mHVGb6qfpoCQO8XYqE,14374
|
|
11
|
+
crossplane/function/proto/v1/run_function_pb2_grpc.py,sha256=qbkULVs_nvhjPDyNQgmgQp6e8prV9lgq7hqfPv-Nftc,3968
|
|
12
|
+
crossplane/function/proto/v1beta1/run_function.proto,sha256=EVYIEQCiPu1eOdGJQ3tuPVXVQ3y8UTQ9uiB5fKRBzCc,16784
|
|
13
|
+
crossplane/function/proto/v1beta1/run_function_pb2.py,sha256=G4TTK_cYTOQlRN5byADcEFPjTILYYWj3b4m19iiPO4g,14664
|
|
14
|
+
crossplane/function/proto/v1beta1/run_function_pb2.pyi,sha256=MvjcY39d1xJ4ZZmRibhehCKF1mHVGb6qfpoCQO8XYqE,14374
|
|
15
|
+
crossplane/function/proto/v1beta1/run_function_pb2_grpc.py,sha256=Hj5KCSTyT_vIpTXWwc5MwiKxwxaOhjbfY5Iedidx9AQ,4033
|
|
16
|
+
crossplane_function_sdk_python-0.12.0.dist-info/METADATA,sha256=2l-XG9JHoD_zywEhVUkZQ97iLT05wO4qFEpdeB8Gs3Y,3244
|
|
17
|
+
crossplane_function_sdk_python-0.12.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
18
|
+
crossplane_function_sdk_python-0.12.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
19
|
+
crossplane_function_sdk_python-0.12.0.dist-info/RECORD,,
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
crossplane/function/__version__.py,sha256=J_Hva5WMxFJV2bTYej-25rZSM1BvoTRP9j4BbzkI8S0,705
|
|
2
|
-
crossplane/function/logging.py,sha256=Zawqq36FBzjkVg4bJ3VGK12-so7N8yAMoSPrhdwpBSA,2503
|
|
3
|
-
crossplane/function/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
crossplane/function/request.py,sha256=kDAHouQjyudZZ2IOh6mD0--qL9EqoKK9ieQNHSb_RbA,3960
|
|
5
|
-
crossplane/function/resource.py,sha256=C9TFpDLhAEOFgKEpQ1C8ycfAllCruCWafLuU3tVr3oU,4950
|
|
6
|
-
crossplane/function/response.py,sha256=l77HNw3Yv4Xd6xP9sM9T5n5VHyOL7XFQSKpBqkKleew,4793
|
|
7
|
-
crossplane/function/runtime.py,sha256=2S-AheR2o0pJxJRhDZDoWpJxCleIv_aHTnzRGgrZv_8,5415
|
|
8
|
-
crossplane/function/proto/v1/run_function.proto,sha256=e-gj5H95muvLMGNBYRQUdCOq88jvJFs4gEkFw9G20SY,13797
|
|
9
|
-
crossplane/function/proto/v1/run_function_pb2.py,sha256=3M4f4DUJHiLbs7EECchLVmwU7wKARPb09VPw2pGFLls,12403
|
|
10
|
-
crossplane/function/proto/v1/run_function_pb2.pyi,sha256=qv4f04ncISLF_2Viuzkf5aSxiwqHaUS5AzUxaLWQlxQ,11993
|
|
11
|
-
crossplane/function/proto/v1/run_function_pb2_grpc.py,sha256=qbkULVs_nvhjPDyNQgmgQp6e8prV9lgq7hqfPv-Nftc,3968
|
|
12
|
-
crossplane/function/proto/v1beta1/run_function.proto,sha256=_AnAhzsua79FcnIsptAHhp4-vxSB55XmKiRcg5eC0ek,13906
|
|
13
|
-
crossplane/function/proto/v1beta1/run_function_pb2.py,sha256=v-Kzzqm56vwS_8Tp9he3WPeHVyi6M0ONMa9pdArZYCE,12609
|
|
14
|
-
crossplane/function/proto/v1beta1/run_function_pb2.pyi,sha256=qv4f04ncISLF_2Viuzkf5aSxiwqHaUS5AzUxaLWQlxQ,11993
|
|
15
|
-
crossplane/function/proto/v1beta1/run_function_pb2_grpc.py,sha256=Hj5KCSTyT_vIpTXWwc5MwiKxwxaOhjbfY5Iedidx9AQ,4033
|
|
16
|
-
crossplane_function_sdk_python-0.10.0.dist-info/METADATA,sha256=eig82FTF9RbrxStUTy_V7uq1bRUlAZHOKVUOXoV3LvI,3244
|
|
17
|
-
crossplane_function_sdk_python-0.10.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
18
|
-
crossplane_function_sdk_python-0.10.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
19
|
-
crossplane_function_sdk_python-0.10.0.dist-info/RECORD,,
|
|
File without changes
|