crossplane-function-sdk-python 0.10.0__tar.gz → 0.12.0__tar.gz

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.
Files changed (39) hide show
  1. {crossplane_function_sdk_python-0.10.0 → crossplane_function_sdk_python-0.12.0}/.github/workflows/ci.yml +7 -7
  2. {crossplane_function_sdk_python-0.10.0 → crossplane_function_sdk_python-0.12.0}/PKG-INFO +3 -3
  3. {crossplane_function_sdk_python-0.10.0 → crossplane_function_sdk_python-0.12.0}/crossplane/function/__version__.py +1 -1
  4. {crossplane_function_sdk_python-0.10.0 → crossplane_function_sdk_python-0.12.0}/crossplane/function/proto/v1/run_function.proto +69 -3
  5. crossplane_function_sdk_python-0.12.0/crossplane/function/proto/v1/run_function_pb2.py +129 -0
  6. {crossplane_function_sdk_python-0.10.0/crossplane/function/proto/v1beta1 → crossplane_function_sdk_python-0.12.0/crossplane/function/proto/v1}/run_function_pb2.pyi +55 -6
  7. {crossplane_function_sdk_python-0.10.0 → crossplane_function_sdk_python-0.12.0}/crossplane/function/proto/v1beta1/run_function.proto +68 -2
  8. crossplane_function_sdk_python-0.12.0/crossplane/function/proto/v1beta1/run_function_pb2.py +129 -0
  9. {crossplane_function_sdk_python-0.10.0/crossplane/function/proto/v1 → crossplane_function_sdk_python-0.12.0/crossplane/function/proto/v1beta1}/run_function_pb2.pyi +55 -6
  10. crossplane_function_sdk_python-0.12.0/crossplane/function/request.py +226 -0
  11. {crossplane_function_sdk_python-0.10.0 → crossplane_function_sdk_python-0.12.0}/crossplane/function/resource.py +76 -2
  12. {crossplane_function_sdk_python-0.10.0 → crossplane_function_sdk_python-0.12.0}/crossplane/function/response.py +67 -0
  13. {crossplane_function_sdk_python-0.10.0 → crossplane_function_sdk_python-0.12.0}/pyproject.toml +2 -2
  14. {crossplane_function_sdk_python-0.10.0 → crossplane_function_sdk_python-0.12.0}/tests/test_request.py +143 -0
  15. {crossplane_function_sdk_python-0.10.0 → crossplane_function_sdk_python-0.12.0}/tests/test_resource.py +135 -1
  16. {crossplane_function_sdk_python-0.10.0 → crossplane_function_sdk_python-0.12.0}/tests/test_response.py +119 -0
  17. crossplane_function_sdk_python-0.10.0/crossplane/function/proto/v1/run_function_pb2.py +0 -115
  18. crossplane_function_sdk_python-0.10.0/crossplane/function/proto/v1beta1/run_function_pb2.py +0 -115
  19. crossplane_function_sdk_python-0.10.0/crossplane/function/request.py +0 -118
  20. {crossplane_function_sdk_python-0.10.0 → crossplane_function_sdk_python-0.12.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  21. {crossplane_function_sdk_python-0.10.0 → crossplane_function_sdk_python-0.12.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  22. {crossplane_function_sdk_python-0.10.0 → crossplane_function_sdk_python-0.12.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  23. {crossplane_function_sdk_python-0.10.0 → crossplane_function_sdk_python-0.12.0}/.gitignore +0 -0
  24. {crossplane_function_sdk_python-0.10.0 → crossplane_function_sdk_python-0.12.0}/CODEOWNERS +0 -0
  25. {crossplane_function_sdk_python-0.10.0 → crossplane_function_sdk_python-0.12.0}/LICENSE +0 -0
  26. {crossplane_function_sdk_python-0.10.0 → crossplane_function_sdk_python-0.12.0}/OWNERS.md +0 -0
  27. {crossplane_function_sdk_python-0.10.0 → crossplane_function_sdk_python-0.12.0}/README.md +0 -0
  28. {crossplane_function_sdk_python-0.10.0 → crossplane_function_sdk_python-0.12.0}/crossplane/function/logging.py +0 -0
  29. {crossplane_function_sdk_python-0.10.0 → crossplane_function_sdk_python-0.12.0}/crossplane/function/proto/v1/run_function_pb2_grpc.py +0 -0
  30. {crossplane_function_sdk_python-0.10.0 → crossplane_function_sdk_python-0.12.0}/crossplane/function/proto/v1beta1/run_function_pb2_grpc.py +0 -0
  31. {crossplane_function_sdk_python-0.10.0 → crossplane_function_sdk_python-0.12.0}/crossplane/function/py.typed +0 -0
  32. {crossplane_function_sdk_python-0.10.0 → crossplane_function_sdk_python-0.12.0}/crossplane/function/runtime.py +0 -0
  33. {crossplane_function_sdk_python-0.10.0 → crossplane_function_sdk_python-0.12.0}/renovate.json +0 -0
  34. {crossplane_function_sdk_python-0.10.0 → crossplane_function_sdk_python-0.12.0}/tests/test_runtime.py +0 -0
  35. {crossplane_function_sdk_python-0.10.0 → crossplane_function_sdk_python-0.12.0}/tests/testdata/models/io/k8s/apimachinery/pkg/apis/__init__.py +0 -0
  36. {crossplane_function_sdk_python-0.10.0 → crossplane_function_sdk_python-0.12.0}/tests/testdata/models/io/k8s/apimachinery/pkg/apis/meta/__init__.py +0 -0
  37. {crossplane_function_sdk_python-0.10.0 → crossplane_function_sdk_python-0.12.0}/tests/testdata/models/io/k8s/apimachinery/pkg/apis/meta/v1.py +0 -0
  38. {crossplane_function_sdk_python-0.10.0 → crossplane_function_sdk_python-0.12.0}/tests/testdata/models/io/upbound/aws/s3/__init__.py +0 -0
  39. {crossplane_function_sdk_python-0.10.0 → crossplane_function_sdk_python-0.12.0}/tests/testdata/models/io/upbound/aws/s3/v1beta2.py +0 -0
@@ -28,7 +28,7 @@ concurrency:
28
28
  env:
29
29
  # Common versions
30
30
  PYTHON_VERSION: '3.11'
31
- HATCH_VERSION: '1.12.0'
31
+ HATCH_VERSION: '1.16.5'
32
32
 
33
33
  # The PyPi project version to push. The default is v0.0.0+gitdate-gitsha.
34
34
  PYPI_VERSION: ${{ inputs.version }}
@@ -98,7 +98,7 @@ jobs:
98
98
  run: hatch build
99
99
 
100
100
  - name: Upload Sdist and Wheel to GitHub
101
- uses: actions/upload-artifact@v5
101
+ uses: actions/upload-artifact@v7
102
102
  with:
103
103
  name: dist
104
104
  path: "dist/*"
@@ -114,13 +114,13 @@ jobs:
114
114
  runs-on: ubuntu-24.04
115
115
  steps:
116
116
  - name: Download Sdist and Wheel from GitHub
117
- uses: actions/download-artifact@v6
117
+ uses: actions/download-artifact@v8
118
118
  with:
119
119
  name: dist
120
120
  path: "dist"
121
121
 
122
122
  - name: Publish to PyPI
123
- uses: pypa/gh-action-pypi-publish@v1.13.0
123
+ uses: pypa/gh-action-pypi-publish@v1.14.0
124
124
  with:
125
125
  # Note that this is currently being pushed to the 'crossplane' PyPI
126
126
  # user (not org). See @negz if you need access - PyPI requires 2FA to
@@ -150,13 +150,13 @@ jobs:
150
150
  run: hatch run docs:pdoc -d google crossplane/function -o docs
151
151
 
152
152
  - name: Setup Pages
153
- uses: actions/configure-pages@v5
153
+ uses: actions/configure-pages@v6
154
154
 
155
155
  - name: Upload artifact
156
- uses: actions/upload-pages-artifact@v4
156
+ uses: actions/upload-pages-artifact@v5
157
157
  with:
158
158
  path: docs
159
159
 
160
160
  - name: Deploy to GitHub Pages
161
161
  id: deployment
162
- uses: actions/deploy-pages@v4
162
+ uses: actions/deploy-pages@v5
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crossplane-function-sdk-python
3
- Version: 0.10.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.76.0
18
- Requires-Dist: protobuf==6.33.1
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
@@ -15,4 +15,4 @@
15
15
  """The version of function-sdk-python."""
16
16
 
17
17
  # This is set at build time, using "hatch version"
18
- __version__ = "0.10.0"
18
+ __version__ = "0.12.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 the XR.
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 the composed resources.
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
+ }
@@ -0,0 +1,129 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # NO CHECKED-IN PROTOBUF GENCODE
4
+ # source: crossplane/function/proto/v1/run_function.proto
5
+ # Protobuf Python Version: 6.31.1
6
+ """Generated protocol buffer code."""
7
+ from google.protobuf import descriptor as _descriptor
8
+ from google.protobuf import descriptor_pool as _descriptor_pool
9
+ from google.protobuf import runtime_version as _runtime_version
10
+ from google.protobuf import symbol_database as _symbol_database
11
+ from google.protobuf.internal import builder as _builder
12
+ _runtime_version.ValidateProtobufRuntimeVersion(
13
+ _runtime_version.Domain.PUBLIC,
14
+ 6,
15
+ 31,
16
+ 1,
17
+ '',
18
+ 'crossplane/function/proto/v1/run_function.proto'
19
+ )
20
+ # @@protoc_insertion_point(imports)
21
+
22
+ _sym_db = _symbol_database.Default()
23
+
24
+
25
+ from google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb2
26
+ from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2
27
+
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\"\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
+
31
+ _globals = globals()
32
+ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
33
+ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'crossplane.function.proto.v1.run_function_pb2', _globals)
34
+ if not _descriptor._USE_C_DESCRIPTORS:
35
+ _globals['DESCRIPTOR']._loaded_options = None
36
+ _globals['DESCRIPTOR']._serialized_options = b'Z/github.com/crossplane/crossplane/v2/proto/fn/v1'
37
+ _globals['_RUNFUNCTIONREQUEST_EXTRARESOURCESENTRY']._loaded_options = None
38
+ _globals['_RUNFUNCTIONREQUEST_EXTRARESOURCESENTRY']._serialized_options = b'8\001'
39
+ _globals['_RUNFUNCTIONREQUEST_CREDENTIALSENTRY']._loaded_options = None
40
+ _globals['_RUNFUNCTIONREQUEST_CREDENTIALSENTRY']._serialized_options = b'8\001'
41
+ _globals['_RUNFUNCTIONREQUEST_REQUIREDRESOURCESENTRY']._loaded_options = None
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'
45
+ _globals['_RUNFUNCTIONREQUEST'].fields_by_name['extra_resources']._loaded_options = None
46
+ _globals['_RUNFUNCTIONREQUEST'].fields_by_name['extra_resources']._serialized_options = b'\030\001'
47
+ _globals['_CREDENTIALDATA_DATAENTRY']._loaded_options = None
48
+ _globals['_CREDENTIALDATA_DATAENTRY']._serialized_options = b'8\001'
49
+ _globals['_REQUIREMENTS_EXTRARESOURCESENTRY']._loaded_options = None
50
+ _globals['_REQUIREMENTS_EXTRARESOURCESENTRY']._serialized_options = b'8\001'
51
+ _globals['_REQUIREMENTS_RESOURCESENTRY']._loaded_options = None
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'
55
+ _globals['_REQUIREMENTS'].fields_by_name['extra_resources']._loaded_options = None
56
+ _globals['_REQUIREMENTS'].fields_by_name['extra_resources']._serialized_options = b'\030\001'
57
+ _globals['_MATCHLABELS_LABELSENTRY']._loaded_options = None
58
+ _globals['_MATCHLABELS_LABELSENTRY']._serialized_options = b'8\001'
59
+ _globals['_STATE_RESOURCESENTRY']._loaded_options = None
60
+ _globals['_STATE_RESOURCESENTRY']._serialized_options = b'8\001'
61
+ _globals['_RESOURCE_CONNECTIONDETAILSENTRY']._loaded_options = None
62
+ _globals['_RESOURCE_CONNECTIONDETAILSENTRY']._serialized_options = b'8\001'
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
73
+ _globals['_RUNFUNCTIONREQUEST']._serialized_start=141
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
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
- 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]] = ...) -> None: ...
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
- def __init__(self, tag: _Optional[str] = ...) -> None: ...
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
- def __init__(self, extra_resources: _Optional[_Mapping[str, ResourceSelector]] = ..., resources: _Optional[_Mapping[str, ResourceSelector]] = ...) -> None: ...
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 the XR.
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 the composed resources.
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;