crossplane-function-sdk-python 0.3.0__tar.gz → 0.5.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.
- {crossplane_function_sdk_python-0.3.0 → crossplane_function_sdk_python-0.5.0}/.github/workflows/ci.yml +14 -13
- {crossplane_function_sdk_python-0.3.0 → crossplane_function_sdk_python-0.5.0}/PKG-INFO +6 -4
- {crossplane_function_sdk_python-0.3.0 → crossplane_function_sdk_python-0.5.0}/README.md +3 -3
- {crossplane_function_sdk_python-0.3.0 → crossplane_function_sdk_python-0.5.0}/crossplane/function/__version__.py +1 -1
- {crossplane_function_sdk_python-0.3.0/crossplane/function/proto/v1beta1 → crossplane_function_sdk_python-0.5.0/crossplane/function/proto/v1}/run_function.proto +71 -4
- crossplane_function_sdk_python-0.5.0/crossplane/function/proto/v1/run_function_pb2.py +103 -0
- {crossplane_function_sdk_python-0.3.0/crossplane/function/proto/v1beta1 → crossplane_function_sdk_python-0.5.0/crossplane/function/proto/v1}/run_function_pb2.pyi +44 -4
- crossplane_function_sdk_python-0.5.0/crossplane/function/proto/v1/run_function_pb2_grpc.py +101 -0
- crossplane_function_sdk_python-0.5.0/crossplane/function/proto/v1beta1/run_function.proto +328 -0
- crossplane_function_sdk_python-0.5.0/crossplane/function/proto/v1beta1/run_function_pb2.py +103 -0
- crossplane_function_sdk_python-0.5.0/crossplane/function/proto/v1beta1/run_function_pb2.pyi +232 -0
- {crossplane_function_sdk_python-0.3.0 → crossplane_function_sdk_python-0.5.0}/crossplane/function/proto/v1beta1/run_function_pb2_grpc.py +35 -4
- {crossplane_function_sdk_python-0.3.0 → crossplane_function_sdk_python-0.5.0}/crossplane/function/resource.py +31 -1
- {crossplane_function_sdk_python-0.3.0 → crossplane_function_sdk_python-0.5.0}/crossplane/function/response.py +14 -14
- {crossplane_function_sdk_python-0.3.0 → crossplane_function_sdk_python-0.5.0}/crossplane/function/runtime.py +35 -2
- {crossplane_function_sdk_python-0.3.0 → crossplane_function_sdk_python-0.5.0}/pyproject.toml +16 -21
- {crossplane_function_sdk_python-0.3.0 → crossplane_function_sdk_python-0.5.0}/tests/test_resource.py +116 -0
- {crossplane_function_sdk_python-0.3.0 → crossplane_function_sdk_python-0.5.0}/tests/test_response.py +11 -11
- crossplane_function_sdk_python-0.5.0/tests/test_runtime.py +71 -0
- crossplane_function_sdk_python-0.5.0/tests/testdata/models/io/k8s/apimachinery/pkg/apis/__init__.py +3 -0
- crossplane_function_sdk_python-0.5.0/tests/testdata/models/io/k8s/apimachinery/pkg/apis/meta/__init__.py +3 -0
- crossplane_function_sdk_python-0.5.0/tests/testdata/models/io/k8s/apimachinery/pkg/apis/meta/v1.py +301 -0
- crossplane_function_sdk_python-0.5.0/tests/testdata/models/io/upbound/aws/s3/__init__.py +3 -0
- crossplane_function_sdk_python-0.5.0/tests/testdata/models/io/upbound/aws/s3/v1beta2.py +800 -0
- crossplane_function_sdk_python-0.3.0/crossplane/function/proto/v1beta1/run_function_pb2.py +0 -86
- {crossplane_function_sdk_python-0.3.0 → crossplane_function_sdk_python-0.5.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {crossplane_function_sdk_python-0.3.0 → crossplane_function_sdk_python-0.5.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {crossplane_function_sdk_python-0.3.0 → crossplane_function_sdk_python-0.5.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {crossplane_function_sdk_python-0.3.0 → crossplane_function_sdk_python-0.5.0}/.gitignore +0 -0
- {crossplane_function_sdk_python-0.3.0 → crossplane_function_sdk_python-0.5.0}/LICENSE +0 -0
- {crossplane_function_sdk_python-0.3.0 → crossplane_function_sdk_python-0.5.0}/crossplane/function/logging.py +0 -0
- {crossplane_function_sdk_python-0.3.0 → crossplane_function_sdk_python-0.5.0}/renovate.json +0 -0
|
@@ -27,14 +27,15 @@ concurrency:
|
|
|
27
27
|
|
|
28
28
|
env:
|
|
29
29
|
# Common versions
|
|
30
|
-
PYTHON_VERSION: '3.11
|
|
30
|
+
PYTHON_VERSION: '3.11'
|
|
31
|
+
HATCH_VERSION: '1.12.0'
|
|
31
32
|
|
|
32
33
|
# The PyPi project version to push. The default is v0.0.0+gitdate-gitsha.
|
|
33
34
|
PYPI_VERSION: ${{ inputs.version }}
|
|
34
35
|
|
|
35
36
|
jobs:
|
|
36
37
|
lint:
|
|
37
|
-
runs-on: ubuntu-
|
|
38
|
+
runs-on: ubuntu-24.04
|
|
38
39
|
steps:
|
|
39
40
|
- name: Checkout
|
|
40
41
|
uses: actions/checkout@v4
|
|
@@ -45,13 +46,13 @@ jobs:
|
|
|
45
46
|
python-version: ${{ env.PYTHON_VERSION }}
|
|
46
47
|
|
|
47
48
|
- name: Setup Hatch
|
|
48
|
-
run: pipx install hatch
|
|
49
|
+
run: pipx install hatch==${{ env.HATCH_VERSION }}
|
|
49
50
|
|
|
50
51
|
- name: Lint
|
|
51
|
-
run: hatch
|
|
52
|
+
run: hatch fmt
|
|
52
53
|
|
|
53
54
|
unit-test:
|
|
54
|
-
runs-on: ubuntu-
|
|
55
|
+
runs-on: ubuntu-24.04
|
|
55
56
|
steps:
|
|
56
57
|
- name: Checkout
|
|
57
58
|
uses: actions/checkout@v4
|
|
@@ -62,14 +63,14 @@ jobs:
|
|
|
62
63
|
python-version: ${{ env.PYTHON_VERSION }}
|
|
63
64
|
|
|
64
65
|
- name: Setup Hatch
|
|
65
|
-
run: pipx install hatch
|
|
66
|
+
run: pipx install hatch==${{ env.HATCH_VERSION }}
|
|
66
67
|
|
|
67
68
|
- name: Run Unit Tests
|
|
68
|
-
run: hatch
|
|
69
|
+
run: hatch test --all --randomize
|
|
69
70
|
|
|
70
71
|
|
|
71
72
|
build:
|
|
72
|
-
runs-on: ubuntu-
|
|
73
|
+
runs-on: ubuntu-24.04
|
|
73
74
|
steps:
|
|
74
75
|
- name: Checkout
|
|
75
76
|
uses: actions/checkout@v4
|
|
@@ -80,7 +81,7 @@ jobs:
|
|
|
80
81
|
python-version: ${{ env.PYTHON_VERSION }}
|
|
81
82
|
|
|
82
83
|
- name: Setup Hatch
|
|
83
|
-
run: pipx install hatch
|
|
84
|
+
run: pipx install hatch==${{ env.HATCH_VERSION }}
|
|
84
85
|
|
|
85
86
|
# If a version wasn't explicitly passed as a workflow_dispatch input we
|
|
86
87
|
# default to version v0.0.0+<git-commit-date>-<git-short-sha>, for example
|
|
@@ -110,7 +111,7 @@ jobs:
|
|
|
110
111
|
if: ${{ inputs.version != '' }}
|
|
111
112
|
needs:
|
|
112
113
|
- build
|
|
113
|
-
runs-on: ubuntu-
|
|
114
|
+
runs-on: ubuntu-24.04
|
|
114
115
|
steps:
|
|
115
116
|
- name: Download Sdist and Wheel from GitHub
|
|
116
117
|
uses: actions/download-artifact@v4
|
|
@@ -119,7 +120,7 @@ jobs:
|
|
|
119
120
|
path: "dist"
|
|
120
121
|
|
|
121
122
|
- name: Publish to PyPI
|
|
122
|
-
uses: pypa/gh-action-pypi-publish@v1.
|
|
123
|
+
uses: pypa/gh-action-pypi-publish@v1.10.3
|
|
123
124
|
with:
|
|
124
125
|
# Note that this is currently being pushed to the 'crossplane' PyPI
|
|
125
126
|
# user (not org). See @negz if you need access - PyPI requires 2FA to
|
|
@@ -132,7 +133,7 @@ jobs:
|
|
|
132
133
|
# The simple docs tool we're using doesn't support versions, so our docs
|
|
133
134
|
# will only reflect what's in main.
|
|
134
135
|
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
|
135
|
-
runs-on: ubuntu-
|
|
136
|
+
runs-on: ubuntu-24.04
|
|
136
137
|
steps:
|
|
137
138
|
- name: Checkout
|
|
138
139
|
uses: actions/checkout@v4
|
|
@@ -143,7 +144,7 @@ jobs:
|
|
|
143
144
|
python-version: ${{ env.PYTHON_VERSION }}
|
|
144
145
|
|
|
145
146
|
- name: Setup Hatch
|
|
146
|
-
run: pipx install hatch
|
|
147
|
+
run: pipx install hatch==${{ env.HATCH_VERSION }}
|
|
147
148
|
|
|
148
149
|
- name: Build Documentation
|
|
149
150
|
run: hatch run docs:pdoc -d google crossplane/function -o docs
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: crossplane-function-sdk-python
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.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,6 +14,8 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
14
14
|
Requires-Python: >=3.11
|
|
15
15
|
Requires-Dist: grpcio-reflection==1.*
|
|
16
16
|
Requires-Dist: grpcio==1.*
|
|
17
|
+
Requires-Dist: protobuf==5.27.2
|
|
18
|
+
Requires-Dist: pydantic==2.*
|
|
17
19
|
Requires-Dist: structlog==24.*
|
|
18
20
|
Description-Content-Type: text/markdown
|
|
19
21
|
|
|
@@ -53,11 +55,11 @@ Some useful commands:
|
|
|
53
55
|
# Generate gRPC stubs.
|
|
54
56
|
hatch run generate:protoc
|
|
55
57
|
|
|
56
|
-
#
|
|
57
|
-
hatch
|
|
58
|
+
# Format and lint the code.
|
|
59
|
+
hatch fmt
|
|
58
60
|
|
|
59
61
|
# Run unit tests.
|
|
60
|
-
hatch
|
|
62
|
+
hatch test
|
|
61
63
|
|
|
62
64
|
# Build an sdist and wheel.
|
|
63
65
|
hatch build
|
|
@@ -34,11 +34,11 @@ Some useful commands:
|
|
|
34
34
|
# Generate gRPC stubs.
|
|
35
35
|
hatch run generate:protoc
|
|
36
36
|
|
|
37
|
-
#
|
|
38
|
-
hatch
|
|
37
|
+
# Format and lint the code.
|
|
38
|
+
hatch fmt
|
|
39
39
|
|
|
40
40
|
# Run unit tests.
|
|
41
|
-
hatch
|
|
41
|
+
hatch test
|
|
42
42
|
|
|
43
43
|
# Build an sdist and wheel.
|
|
44
44
|
hatch build
|
|
@@ -19,10 +19,9 @@ syntax = "proto3";
|
|
|
19
19
|
import "google/protobuf/struct.proto";
|
|
20
20
|
import "google/protobuf/duration.proto";
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
package apiextensions.fn.proto.v1beta1;
|
|
22
|
+
package apiextensions.fn.proto.v1;
|
|
23
|
+
|
|
24
|
+
option go_package = "github.com/crossplane/crossplane/apis/apiextensions/fn/proto/v1";
|
|
26
25
|
|
|
27
26
|
// A FunctionRunnerService is a Composition Function.
|
|
28
27
|
service FunctionRunnerService {
|
|
@@ -122,6 +121,10 @@ message RunFunctionResponse {
|
|
|
122
121
|
|
|
123
122
|
// Requirements that must be satisfied for this Function to run successfully.
|
|
124
123
|
Requirements requirements = 5;
|
|
124
|
+
|
|
125
|
+
// Status conditions to be applied to the composite resource. Conditions may also
|
|
126
|
+
// optionally be applied to the composite resource's associated claim.
|
|
127
|
+
repeated Condition conditions = 6;
|
|
125
128
|
}
|
|
126
129
|
|
|
127
130
|
// RequestMeta contains metadata pertaining to a RunFunctionRequest.
|
|
@@ -140,11 +143,18 @@ message Requirements {
|
|
|
140
143
|
|
|
141
144
|
// ResourceSelector selects a group of resources, either by name or by label.
|
|
142
145
|
message ResourceSelector {
|
|
146
|
+
// API version of resources to select.
|
|
143
147
|
string api_version = 1;
|
|
148
|
+
|
|
149
|
+
// Kind of resources to select.
|
|
144
150
|
string kind = 2;
|
|
145
151
|
|
|
152
|
+
// Resources to match.
|
|
146
153
|
oneof match {
|
|
154
|
+
// Match the resource with this name.
|
|
147
155
|
string match_name = 3;
|
|
156
|
+
|
|
157
|
+
// Match all resources with these labels.
|
|
148
158
|
MatchLabels match_labels = 4;
|
|
149
159
|
}
|
|
150
160
|
}
|
|
@@ -237,6 +247,13 @@ message Result {
|
|
|
237
247
|
|
|
238
248
|
// Human-readable details about the result.
|
|
239
249
|
string message = 2;
|
|
250
|
+
|
|
251
|
+
// Optional PascalCase, machine-readable reason for this result. If omitted,
|
|
252
|
+
// the value will be ComposeResources.
|
|
253
|
+
optional string reason = 3;
|
|
254
|
+
|
|
255
|
+
// The resources this result targets.
|
|
256
|
+
optional Target target = 4;
|
|
240
257
|
}
|
|
241
258
|
|
|
242
259
|
// Severity of Function results.
|
|
@@ -257,3 +274,53 @@ enum Severity {
|
|
|
257
274
|
// with the composite resource.
|
|
258
275
|
SEVERITY_NORMAL = 3;
|
|
259
276
|
}
|
|
277
|
+
|
|
278
|
+
// Target of Function results and conditions.
|
|
279
|
+
enum Target {
|
|
280
|
+
// If the target is unspecified, the result targets the composite resource.
|
|
281
|
+
TARGET_UNSPECIFIED = 0;
|
|
282
|
+
|
|
283
|
+
// Target the composite resource. Results that target the composite resource
|
|
284
|
+
// should include detailed, advanced information.
|
|
285
|
+
TARGET_COMPOSITE = 1;
|
|
286
|
+
|
|
287
|
+
// Target the composite and the claim. Results that target the composite and
|
|
288
|
+
// the claim should include only end-user friendly information.
|
|
289
|
+
TARGET_COMPOSITE_AND_CLAIM = 2;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// Status condition to be applied to the composite resource. Condition may also
|
|
293
|
+
// optionally be applied to the composite resource's associated claim. For
|
|
294
|
+
// detailed information on proper usage of status conditions, please see
|
|
295
|
+
// https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties.
|
|
296
|
+
message Condition {
|
|
297
|
+
// Type of condition in PascalCase.
|
|
298
|
+
string type = 1;
|
|
299
|
+
|
|
300
|
+
// Status of the condition.
|
|
301
|
+
Status status = 2;
|
|
302
|
+
|
|
303
|
+
// Reason contains a programmatic identifier indicating the reason for the
|
|
304
|
+
// condition's last transition. Producers of specific condition types may
|
|
305
|
+
// define expected values and meanings for this field, and whether the values
|
|
306
|
+
// are considered a guaranteed API. The value should be a PascalCase string.
|
|
307
|
+
// This field may not be empty.
|
|
308
|
+
string reason = 3;
|
|
309
|
+
|
|
310
|
+
// Message is a human readable message indicating details about the
|
|
311
|
+
// transition. This may be an empty string.
|
|
312
|
+
optional string message = 4;
|
|
313
|
+
|
|
314
|
+
// The resources this condition targets.
|
|
315
|
+
optional Target target = 5;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
enum Status {
|
|
319
|
+
STATUS_CONDITION_UNSPECIFIED = 0;
|
|
320
|
+
|
|
321
|
+
STATUS_CONDITION_UNKNOWN = 1;
|
|
322
|
+
|
|
323
|
+
STATUS_CONDITION_TRUE = 2;
|
|
324
|
+
|
|
325
|
+
STATUS_CONDITION_FALSE = 3;
|
|
326
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
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: 5.27.2
|
|
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
|
+
5,
|
|
15
|
+
27,
|
|
16
|
+
2,
|
|
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 struct_pb2 as google_dot_protobuf_dot_struct__pb2
|
|
26
|
+
from google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__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\x1cgoogle/protobuf/struct.proto\x1a\x1egoogle/protobuf/duration.proto\"\x8d\x05\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\x12Z\n\x0f\x65xtra_resources\x18\x06 \x03(\x0b\x32\x41.apiextensions.fn.proto.v1.RunFunctionRequest.ExtraResourcesEntry\x12S\n\x0b\x63redentials\x18\x07 \x03(\x0b\x32>.apiextensions.fn.proto.v1.RunFunctionRequest.CredentialsEntry\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\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\"\xe7\x02\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.ConditionB\n\n\x08_context\"\x1a\n\x0bRequestMeta\x12\x0b\n\x03tag\x18\x01 \x01(\t\"\xc8\x01\n\x0cRequirements\x12T\n\x0f\x65xtra_resources\x18\x01 \x03(\x0b\x32;.apiextensions.fn.proto.v1.Requirements.ExtraResourcesEntry\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\"\x94\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\x42\x07\n\x05match\"\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*?\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\x41Z?github.com/crossplane/crossplane/apis/apiextensions/fn/proto/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/apis/apiextensions/fn/proto/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['_CREDENTIALDATA_DATAENTRY']._loaded_options = None
|
|
42
|
+
_globals['_CREDENTIALDATA_DATAENTRY']._serialized_options = b'8\001'
|
|
43
|
+
_globals['_REQUIREMENTS_EXTRARESOURCESENTRY']._loaded_options = None
|
|
44
|
+
_globals['_REQUIREMENTS_EXTRARESOURCESENTRY']._serialized_options = b'8\001'
|
|
45
|
+
_globals['_MATCHLABELS_LABELSENTRY']._loaded_options = None
|
|
46
|
+
_globals['_MATCHLABELS_LABELSENTRY']._serialized_options = b'8\001'
|
|
47
|
+
_globals['_STATE_RESOURCESENTRY']._loaded_options = None
|
|
48
|
+
_globals['_STATE_RESOURCESENTRY']._serialized_options = b'8\001'
|
|
49
|
+
_globals['_RESOURCE_CONNECTIONDETAILSENTRY']._loaded_options = None
|
|
50
|
+
_globals['_RESOURCE_CONNECTIONDETAILSENTRY']._serialized_options = b'8\001'
|
|
51
|
+
_globals['_READY']._serialized_start=2894
|
|
52
|
+
_globals['_READY']._serialized_end=2957
|
|
53
|
+
_globals['_SEVERITY']._serialized_start=2959
|
|
54
|
+
_globals['_SEVERITY']._serialized_end=3058
|
|
55
|
+
_globals['_TARGET']._serialized_start=3060
|
|
56
|
+
_globals['_TARGET']._serialized_end=3146
|
|
57
|
+
_globals['_STATUS']._serialized_start=3148
|
|
58
|
+
_globals['_STATUS']._serialized_end=3275
|
|
59
|
+
_globals['_RUNFUNCTIONREQUEST']._serialized_start=141
|
|
60
|
+
_globals['_RUNFUNCTIONREQUEST']._serialized_end=794
|
|
61
|
+
_globals['_RUNFUNCTIONREQUEST_EXTRARESOURCESENTRY']._serialized_start=589
|
|
62
|
+
_globals['_RUNFUNCTIONREQUEST_EXTRARESOURCESENTRY']._serialized_end=680
|
|
63
|
+
_globals['_RUNFUNCTIONREQUEST_CREDENTIALSENTRY']._serialized_start=682
|
|
64
|
+
_globals['_RUNFUNCTIONREQUEST_CREDENTIALSENTRY']._serialized_end=772
|
|
65
|
+
_globals['_CREDENTIALS']._serialized_start=796
|
|
66
|
+
_globals['_CREDENTIALS']._serialized_end=889
|
|
67
|
+
_globals['_CREDENTIALDATA']._serialized_start=892
|
|
68
|
+
_globals['_CREDENTIALDATA']._serialized_end=1020
|
|
69
|
+
_globals['_CREDENTIALDATA_DATAENTRY']._serialized_start=977
|
|
70
|
+
_globals['_CREDENTIALDATA_DATAENTRY']._serialized_end=1020
|
|
71
|
+
_globals['_RESOURCES']._serialized_start=1022
|
|
72
|
+
_globals['_RESOURCES']._serialized_end=1085
|
|
73
|
+
_globals['_RUNFUNCTIONRESPONSE']._serialized_start=1088
|
|
74
|
+
_globals['_RUNFUNCTIONRESPONSE']._serialized_end=1447
|
|
75
|
+
_globals['_REQUESTMETA']._serialized_start=1449
|
|
76
|
+
_globals['_REQUESTMETA']._serialized_end=1475
|
|
77
|
+
_globals['_REQUIREMENTS']._serialized_start=1478
|
|
78
|
+
_globals['_REQUIREMENTS']._serialized_end=1678
|
|
79
|
+
_globals['_REQUIREMENTS_EXTRARESOURCESENTRY']._serialized_start=1580
|
|
80
|
+
_globals['_REQUIREMENTS_EXTRARESOURCESENTRY']._serialized_end=1678
|
|
81
|
+
_globals['_RESOURCESELECTOR']._serialized_start=1681
|
|
82
|
+
_globals['_RESOURCESELECTOR']._serialized_end=1829
|
|
83
|
+
_globals['_MATCHLABELS']._serialized_start=1832
|
|
84
|
+
_globals['_MATCHLABELS']._serialized_end=1960
|
|
85
|
+
_globals['_MATCHLABELS_LABELSENTRY']._serialized_start=1915
|
|
86
|
+
_globals['_MATCHLABELS_LABELSENTRY']._serialized_end=1960
|
|
87
|
+
_globals['_RESPONSEMETA']._serialized_start=1962
|
|
88
|
+
_globals['_RESPONSEMETA']._serialized_end=2042
|
|
89
|
+
_globals['_STATE']._serialized_start=2045
|
|
90
|
+
_globals['_STATE']._serialized_end=2263
|
|
91
|
+
_globals['_STATE_RESOURCESENTRY']._serialized_start=2178
|
|
92
|
+
_globals['_STATE_RESOURCESENTRY']._serialized_end=2263
|
|
93
|
+
_globals['_RESOURCE']._serialized_start=2266
|
|
94
|
+
_globals['_RESOURCE']._serialized_end=2514
|
|
95
|
+
_globals['_RESOURCE_CONNECTIONDETAILSENTRY']._serialized_start=2458
|
|
96
|
+
_globals['_RESOURCE_CONNECTIONDETAILSENTRY']._serialized_end=2514
|
|
97
|
+
_globals['_RESULT']._serialized_start=2517
|
|
98
|
+
_globals['_RESULT']._serialized_end=2696
|
|
99
|
+
_globals['_CONDITION']._serialized_start=2699
|
|
100
|
+
_globals['_CONDITION']._serialized_end=2892
|
|
101
|
+
_globals['_FUNCTIONRUNNERSERVICE']._serialized_start=3278
|
|
102
|
+
_globals['_FUNCTIONRUNNERSERVICE']._serialized_end=3413
|
|
103
|
+
# @@protoc_insertion_point(module_scope)
|
|
@@ -20,6 +20,19 @@ class Severity(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
|
|
20
20
|
SEVERITY_FATAL: _ClassVar[Severity]
|
|
21
21
|
SEVERITY_WARNING: _ClassVar[Severity]
|
|
22
22
|
SEVERITY_NORMAL: _ClassVar[Severity]
|
|
23
|
+
|
|
24
|
+
class Target(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
|
25
|
+
__slots__ = ()
|
|
26
|
+
TARGET_UNSPECIFIED: _ClassVar[Target]
|
|
27
|
+
TARGET_COMPOSITE: _ClassVar[Target]
|
|
28
|
+
TARGET_COMPOSITE_AND_CLAIM: _ClassVar[Target]
|
|
29
|
+
|
|
30
|
+
class Status(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
|
31
|
+
__slots__ = ()
|
|
32
|
+
STATUS_CONDITION_UNSPECIFIED: _ClassVar[Status]
|
|
33
|
+
STATUS_CONDITION_UNKNOWN: _ClassVar[Status]
|
|
34
|
+
STATUS_CONDITION_TRUE: _ClassVar[Status]
|
|
35
|
+
STATUS_CONDITION_FALSE: _ClassVar[Status]
|
|
23
36
|
READY_UNSPECIFIED: Ready
|
|
24
37
|
READY_TRUE: Ready
|
|
25
38
|
READY_FALSE: Ready
|
|
@@ -27,6 +40,13 @@ SEVERITY_UNSPECIFIED: Severity
|
|
|
27
40
|
SEVERITY_FATAL: Severity
|
|
28
41
|
SEVERITY_WARNING: Severity
|
|
29
42
|
SEVERITY_NORMAL: Severity
|
|
43
|
+
TARGET_UNSPECIFIED: Target
|
|
44
|
+
TARGET_COMPOSITE: Target
|
|
45
|
+
TARGET_COMPOSITE_AND_CLAIM: Target
|
|
46
|
+
STATUS_CONDITION_UNSPECIFIED: Status
|
|
47
|
+
STATUS_CONDITION_UNKNOWN: Status
|
|
48
|
+
STATUS_CONDITION_TRUE: Status
|
|
49
|
+
STATUS_CONDITION_FALSE: Status
|
|
30
50
|
|
|
31
51
|
class RunFunctionRequest(_message.Message):
|
|
32
52
|
__slots__ = ("meta", "observed", "desired", "input", "context", "extra_resources", "credentials")
|
|
@@ -86,18 +106,20 @@ class Resources(_message.Message):
|
|
|
86
106
|
def __init__(self, items: _Optional[_Iterable[_Union[Resource, _Mapping]]] = ...) -> None: ...
|
|
87
107
|
|
|
88
108
|
class RunFunctionResponse(_message.Message):
|
|
89
|
-
__slots__ = ("meta", "desired", "results", "context", "requirements")
|
|
109
|
+
__slots__ = ("meta", "desired", "results", "context", "requirements", "conditions")
|
|
90
110
|
META_FIELD_NUMBER: _ClassVar[int]
|
|
91
111
|
DESIRED_FIELD_NUMBER: _ClassVar[int]
|
|
92
112
|
RESULTS_FIELD_NUMBER: _ClassVar[int]
|
|
93
113
|
CONTEXT_FIELD_NUMBER: _ClassVar[int]
|
|
94
114
|
REQUIREMENTS_FIELD_NUMBER: _ClassVar[int]
|
|
115
|
+
CONDITIONS_FIELD_NUMBER: _ClassVar[int]
|
|
95
116
|
meta: ResponseMeta
|
|
96
117
|
desired: State
|
|
97
118
|
results: _containers.RepeatedCompositeFieldContainer[Result]
|
|
98
119
|
context: _struct_pb2.Struct
|
|
99
120
|
requirements: Requirements
|
|
100
|
-
|
|
121
|
+
conditions: _containers.RepeatedCompositeFieldContainer[Condition]
|
|
122
|
+
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]]] = ...) -> None: ...
|
|
101
123
|
|
|
102
124
|
class RequestMeta(_message.Message):
|
|
103
125
|
__slots__ = ("tag",)
|
|
@@ -184,9 +206,27 @@ class Resource(_message.Message):
|
|
|
184
206
|
def __init__(self, resource: _Optional[_Union[_struct_pb2.Struct, _Mapping]] = ..., connection_details: _Optional[_Mapping[str, bytes]] = ..., ready: _Optional[_Union[Ready, str]] = ...) -> None: ...
|
|
185
207
|
|
|
186
208
|
class Result(_message.Message):
|
|
187
|
-
__slots__ = ("severity", "message")
|
|
209
|
+
__slots__ = ("severity", "message", "reason", "target")
|
|
188
210
|
SEVERITY_FIELD_NUMBER: _ClassVar[int]
|
|
189
211
|
MESSAGE_FIELD_NUMBER: _ClassVar[int]
|
|
212
|
+
REASON_FIELD_NUMBER: _ClassVar[int]
|
|
213
|
+
TARGET_FIELD_NUMBER: _ClassVar[int]
|
|
190
214
|
severity: Severity
|
|
191
215
|
message: str
|
|
192
|
-
|
|
216
|
+
reason: str
|
|
217
|
+
target: Target
|
|
218
|
+
def __init__(self, severity: _Optional[_Union[Severity, str]] = ..., message: _Optional[str] = ..., reason: _Optional[str] = ..., target: _Optional[_Union[Target, str]] = ...) -> None: ...
|
|
219
|
+
|
|
220
|
+
class Condition(_message.Message):
|
|
221
|
+
__slots__ = ("type", "status", "reason", "message", "target")
|
|
222
|
+
TYPE_FIELD_NUMBER: _ClassVar[int]
|
|
223
|
+
STATUS_FIELD_NUMBER: _ClassVar[int]
|
|
224
|
+
REASON_FIELD_NUMBER: _ClassVar[int]
|
|
225
|
+
MESSAGE_FIELD_NUMBER: _ClassVar[int]
|
|
226
|
+
TARGET_FIELD_NUMBER: _ClassVar[int]
|
|
227
|
+
type: str
|
|
228
|
+
status: Status
|
|
229
|
+
reason: str
|
|
230
|
+
message: str
|
|
231
|
+
target: Target
|
|
232
|
+
def __init__(self, type: _Optional[str] = ..., status: _Optional[_Union[Status, str]] = ..., reason: _Optional[str] = ..., message: _Optional[str] = ..., target: _Optional[_Union[Target, str]] = ...) -> None: ...
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
|
2
|
+
"""Client and server classes corresponding to protobuf-defined services."""
|
|
3
|
+
import grpc
|
|
4
|
+
import warnings
|
|
5
|
+
|
|
6
|
+
from crossplane.function.proto.v1 import run_function_pb2 as crossplane_dot_function_dot_proto_dot_v1_dot_run__function__pb2
|
|
7
|
+
|
|
8
|
+
GRPC_GENERATED_VERSION = '1.66.0'
|
|
9
|
+
GRPC_VERSION = grpc.__version__
|
|
10
|
+
_version_not_supported = False
|
|
11
|
+
|
|
12
|
+
try:
|
|
13
|
+
from grpc._utilities import first_version_is_lower
|
|
14
|
+
_version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
|
|
15
|
+
except ImportError:
|
|
16
|
+
_version_not_supported = True
|
|
17
|
+
|
|
18
|
+
if _version_not_supported:
|
|
19
|
+
raise RuntimeError(
|
|
20
|
+
f'The grpc package installed is at version {GRPC_VERSION},'
|
|
21
|
+
+ f' but the generated code in crossplane/function/proto/v1/run_function_pb2_grpc.py depends on'
|
|
22
|
+
+ f' grpcio>={GRPC_GENERATED_VERSION}.'
|
|
23
|
+
+ f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
|
|
24
|
+
+ f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class FunctionRunnerServiceStub(object):
|
|
29
|
+
"""A FunctionRunnerService is a Composition Function.
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
def __init__(self, channel):
|
|
33
|
+
"""Constructor.
|
|
34
|
+
|
|
35
|
+
Args:
|
|
36
|
+
channel: A grpc.Channel.
|
|
37
|
+
"""
|
|
38
|
+
self.RunFunction = channel.unary_unary(
|
|
39
|
+
'/apiextensions.fn.proto.v1.FunctionRunnerService/RunFunction',
|
|
40
|
+
request_serializer=crossplane_dot_function_dot_proto_dot_v1_dot_run__function__pb2.RunFunctionRequest.SerializeToString,
|
|
41
|
+
response_deserializer=crossplane_dot_function_dot_proto_dot_v1_dot_run__function__pb2.RunFunctionResponse.FromString,
|
|
42
|
+
_registered_method=True)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class FunctionRunnerServiceServicer(object):
|
|
46
|
+
"""A FunctionRunnerService is a Composition Function.
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
def RunFunction(self, request, context):
|
|
50
|
+
"""RunFunction runs the Composition Function.
|
|
51
|
+
"""
|
|
52
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
53
|
+
context.set_details('Method not implemented!')
|
|
54
|
+
raise NotImplementedError('Method not implemented!')
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def add_FunctionRunnerServiceServicer_to_server(servicer, server):
|
|
58
|
+
rpc_method_handlers = {
|
|
59
|
+
'RunFunction': grpc.unary_unary_rpc_method_handler(
|
|
60
|
+
servicer.RunFunction,
|
|
61
|
+
request_deserializer=crossplane_dot_function_dot_proto_dot_v1_dot_run__function__pb2.RunFunctionRequest.FromString,
|
|
62
|
+
response_serializer=crossplane_dot_function_dot_proto_dot_v1_dot_run__function__pb2.RunFunctionResponse.SerializeToString,
|
|
63
|
+
),
|
|
64
|
+
}
|
|
65
|
+
generic_handler = grpc.method_handlers_generic_handler(
|
|
66
|
+
'apiextensions.fn.proto.v1.FunctionRunnerService', rpc_method_handlers)
|
|
67
|
+
server.add_generic_rpc_handlers((generic_handler,))
|
|
68
|
+
server.add_registered_method_handlers('apiextensions.fn.proto.v1.FunctionRunnerService', rpc_method_handlers)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
# This class is part of an EXPERIMENTAL API.
|
|
72
|
+
class FunctionRunnerService(object):
|
|
73
|
+
"""A FunctionRunnerService is a Composition Function.
|
|
74
|
+
"""
|
|
75
|
+
|
|
76
|
+
@staticmethod
|
|
77
|
+
def RunFunction(request,
|
|
78
|
+
target,
|
|
79
|
+
options=(),
|
|
80
|
+
channel_credentials=None,
|
|
81
|
+
call_credentials=None,
|
|
82
|
+
insecure=False,
|
|
83
|
+
compression=None,
|
|
84
|
+
wait_for_ready=None,
|
|
85
|
+
timeout=None,
|
|
86
|
+
metadata=None):
|
|
87
|
+
return grpc.experimental.unary_unary(
|
|
88
|
+
request,
|
|
89
|
+
target,
|
|
90
|
+
'/apiextensions.fn.proto.v1.FunctionRunnerService/RunFunction',
|
|
91
|
+
crossplane_dot_function_dot_proto_dot_v1_dot_run__function__pb2.RunFunctionRequest.SerializeToString,
|
|
92
|
+
crossplane_dot_function_dot_proto_dot_v1_dot_run__function__pb2.RunFunctionResponse.FromString,
|
|
93
|
+
options,
|
|
94
|
+
channel_credentials,
|
|
95
|
+
insecure,
|
|
96
|
+
call_credentials,
|
|
97
|
+
compression,
|
|
98
|
+
wait_for_ready,
|
|
99
|
+
timeout,
|
|
100
|
+
metadata,
|
|
101
|
+
_registered_method=True)
|