crossplane-function-pythonic 0.4.1__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.
Files changed (141) hide show
  1. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/PKG-INFO +72 -13
  2. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/README.md +71 -12
  3. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/crossplane/pythonic/__about__.py +1 -1
  4. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/crossplane/pythonic/__init__.py +2 -1
  5. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/crossplane/pythonic/command.py +2 -1
  6. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/crossplane/pythonic/composite.py +2 -5
  7. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/crossplane/pythonic/function.py +10 -12
  8. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/crossplane/pythonic/grpc.py +1 -1
  9. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/crossplane/pythonic/protobuf.py +9 -0
  10. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/crossplane/pythonic/render.py +333 -333
  11. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/aks-cluster/cluster-function-pythonic.yaml +1 -1
  12. crossplane_function_pythonic-0.4.1/examples/connection-details-composition/access-keys.yaml → crossplane_function_pythonic-0.5.0/examples/connection-details-composition/observed.yaml +19 -0
  13. crossplane_function_pythonic-0.5.0/examples/connection-details-composition/render.sh +5 -0
  14. crossplane_function_pythonic-0.5.0/examples/connections/render.sh +7 -0
  15. crossplane_function_pythonic-0.5.0/examples/connections/resources.yaml +27 -0
  16. crossplane_function_pythonic-0.5.0/examples/function-go-templating/context/render.sh +3 -0
  17. crossplane_function_pythonic-0.5.0/examples/function-go-templating/functions/getCredentialData/render.sh +3 -0
  18. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/inline/composition.yaml +1 -2
  19. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/recursive/render.sh +1 -1
  20. crossplane_function_pythonic-0.5.0/examples/function-go-templating/required-resources/render.sh +3 -0
  21. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/import-existing-vpc/render.sh +1 -1
  22. crossplane_function_pythonic-0.5.0/examples/inlined/composition.yaml +17 -0
  23. crossplane_function_pythonic-0.5.0/examples/inlined/definition.yaml +32 -0
  24. crossplane_function_pythonic-0.5.0/examples/inlined/render.sh +3 -0
  25. {crossplane_function_pythonic-0.4.1/examples/single-purpose → crossplane_function_pythonic-0.5.0/examples/inlined}/xr.yaml +3 -3
  26. crossplane_function_pythonic-0.5.0/examples/usages-extra/render.sh +3 -0
  27. crossplane_function_pythonic-0.4.1/examples/connection-details-composition/render.sh +0 -6
  28. crossplane_function_pythonic-0.4.1/examples/connection-details-composition/user.yaml +0 -18
  29. crossplane_function_pythonic-0.4.1/examples/connections/composite-connection.yaml +0 -8
  30. crossplane_function_pythonic-0.4.1/examples/connections/rds-connection.yaml +0 -8
  31. crossplane_function_pythonic-0.4.1/examples/connections/render.sh +0 -9
  32. crossplane_function_pythonic-0.4.1/examples/connections/step-credential.yaml +0 -8
  33. crossplane_function_pythonic-0.4.1/examples/function-go-templating/context/render.sh +0 -3
  34. crossplane_function_pythonic-0.4.1/examples/function-go-templating/functions/getCredentialData/render.sh +0 -3
  35. crossplane_function_pythonic-0.4.1/examples/function-go-templating/required-resources/render.sh +0 -3
  36. crossplane_function_pythonic-0.4.1/examples/single-purpose/render.sh +0 -3
  37. crossplane_function_pythonic-0.4.1/examples/usages-extra/render.sh +0 -3
  38. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/.gitignore +0 -0
  39. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/LICENSE +0 -0
  40. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/crossplane/pythonic/__main__.py +0 -0
  41. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/crossplane/pythonic/auto_ready.py +0 -0
  42. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/crossplane/pythonic/main.py +0 -0
  43. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/crossplane/pythonic/packages.py +0 -0
  44. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/crossplane/pythonic/version.py +0 -0
  45. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/aks-cluster/README.md +0 -0
  46. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/aks-cluster/aks/kubernetescluster.py +0 -0
  47. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/aks-cluster/aks/resourcegroup.py +0 -0
  48. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/aks-cluster/composition.yaml +0 -0
  49. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/aks-cluster/definition.yaml +0 -0
  50. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/aks-cluster/install.sh +0 -0
  51. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/aks-cluster/kustomization.yaml +0 -0
  52. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/aks-cluster/providers.yaml +0 -0
  53. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/aks-cluster/render.sh +0 -0
  54. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/aks-cluster/xr.yaml +0 -0
  55. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/connection-details-composition/composition.yaml +0 -0
  56. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/connection-details-composition/definition.yaml +0 -0
  57. crossplane_function_pythonic-0.4.1/examples/connection-details-composition/secrets.yaml → crossplane_function_pythonic-0.5.0/examples/connection-details-composition/resources.yaml +0 -0
  58. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/connection-details-composition/xr.yaml +0 -0
  59. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/connections/composition.yaml +0 -0
  60. crossplane_function_pythonic-0.4.1/examples/connections/rds-observed.yaml → crossplane_function_pythonic-0.5.0/examples/connections/observed.yaml +0 -0
  61. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/connections/xr.yaml +0 -0
  62. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/eks-cluster/composition-v2.yaml +0 -0
  63. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/eks-cluster/composition.yaml +0 -0
  64. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/eks-cluster/definition.yaml +0 -0
  65. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/eks-cluster/render-v2.sh +0 -0
  66. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/eks-cluster/render.sh +0 -0
  67. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/eks-cluster/xr.yaml +0 -0
  68. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/filing-system/README.md +0 -0
  69. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/filing-system/composition.yaml +0 -0
  70. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/filing-system/definition.yaml +0 -0
  71. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/filing-system/kustomization.yaml +0 -0
  72. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/filing-system/runtime.yaml +0 -0
  73. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/filing-system/vcluster.py +0 -0
  74. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/filing-system/vcluster.yaml +0 -0
  75. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/conditions/composition.yaml +0 -0
  76. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/conditions/render.sh +0 -0
  77. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/conditions/xr.yaml +0 -0
  78. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/conditions/xrd.yaml +0 -0
  79. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/context/composition.yaml +1 -1
  80. /crossplane_function_pythonic-0.4.1/examples/function-go-templating/context/environmentConfigs.yaml → /crossplane_function_pythonic-0.5.0/examples/function-go-templating/context/resources.yaml +0 -0
  81. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/context/xr.yaml +0 -0
  82. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/context/xrd.yaml +0 -0
  83. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/functions/fromYaml/composition.yaml +0 -0
  84. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/functions/fromYaml/render.sh +0 -0
  85. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/functions/fromYaml/xr.yaml +0 -0
  86. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/functions/getComposedResource/composition.yaml +0 -0
  87. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/functions/getComposedResource/observed.yaml +0 -0
  88. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/functions/getComposedResource/render.sh +0 -0
  89. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/functions/getComposedResource/xr.yaml +0 -0
  90. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/functions/getCompositeResource/composition.yaml +0 -0
  91. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/functions/getCompositeResource/render.sh +0 -0
  92. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/functions/getCompositeResource/xr.yaml +0 -0
  93. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/functions/getCredentialData/composition.yaml +0 -0
  94. /crossplane_function_pythonic-0.4.1/examples/function-go-templating/functions/getCredentialData/credentials.yaml → /crossplane_function_pythonic-0.5.0/examples/function-go-templating/functions/getCredentialData/resources.yaml +0 -0
  95. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/functions/getCredentialData/xr.yaml +0 -0
  96. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/functions/getResourceCondition/composition.yaml +0 -0
  97. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/functions/getResourceCondition/observed.yaml +0 -0
  98. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/functions/getResourceCondition/render.sh +0 -0
  99. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/functions/getResourceCondition/xr.yaml +0 -0
  100. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/functions/include/composition.yaml +0 -0
  101. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/functions/include/render.sh +0 -0
  102. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/functions/include/xr.yaml +0 -0
  103. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/functions/toYaml/composition.yaml +0 -0
  104. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/functions/toYaml/render.sh +0 -0
  105. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/functions/toYaml/xr.yaml +0 -0
  106. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/inline/render.sh +0 -0
  107. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/inline/xr.yaml +0 -0
  108. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/recursive/composition-real.yaml +0 -0
  109. /crossplane_function_pythonic-0.4.1/examples/function-go-templating/recursive/composition-wrapper.yaml → /crossplane_function_pythonic-0.5.0/examples/function-go-templating/recursive/composition.yaml +0 -0
  110. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/recursive/xr.yaml +0 -0
  111. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/required-resources/composition.yaml +0 -0
  112. /crossplane_function_pythonic-0.4.1/examples/function-go-templating/required-resources/required-resources.yaml → /crossplane_function_pythonic-0.5.0/examples/function-go-templating/required-resources/resources.yaml +0 -0
  113. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-go-templating/required-resources/xr.yaml +0 -0
  114. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-sequencer/composition.yaml +0 -0
  115. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-sequencer/observed.yaml +0 -0
  116. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-sequencer/render.sh +0 -0
  117. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-sequencer/sequencer.py +0 -0
  118. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/function-sequencer/xr.yaml +0 -0
  119. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/get-started-app/composition.yaml +0 -0
  120. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/get-started-app/definition.yaml +0 -0
  121. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/get-started-app/observed.yaml +0 -0
  122. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/get-started-app/render.sh +0 -0
  123. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/get-started-app/xr.yaml +0 -0
  124. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/helm-copy-secret/composition.yaml +0 -0
  125. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/helm-copy-secret/kustomization.yaml +0 -0
  126. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/helm-copy-secret/render.sh +0 -0
  127. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/helm-copy-secret/vcluster.py +0 -0
  128. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/helm-copy-secret/xr.yaml +0 -0
  129. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/helm-copy-secret/xrd.yaml +0 -0
  130. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/import-existing-vpc/README.md +0 -0
  131. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/import-existing-vpc/composition.yaml +0 -0
  132. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/import-existing-vpc/definition.yaml +0 -0
  133. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/import-existing-vpc/observed.yaml +0 -0
  134. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/import-existing-vpc/provider-ec2.yaml +0 -0
  135. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/import-existing-vpc/xr.yaml +0 -0
  136. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/run-all.sh +0 -0
  137. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/usages-extra/composition.yaml +0 -0
  138. /crossplane_function_pythonic-0.4.1/examples/usages-extra/observedResources.yaml → /crossplane_function_pythonic-0.5.0/examples/usages-extra/observed.yaml +0 -0
  139. /crossplane_function_pythonic-0.4.1/examples/usages-extra/extraResources.yaml → /crossplane_function_pythonic-0.5.0/examples/usages-extra/resources.yaml +0 -0
  140. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/examples/usages-extra/xr.yaml +0 -0
  141. {crossplane_function_pythonic-0.4.1 → crossplane_function_pythonic-0.5.0}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crossplane-function-pythonic
3
- Version: 0.4.1
3
+ Version: 0.5.0
4
4
  Summary: A Python centric Crossplane Function
5
5
  Project-URL: Documentation, https://github.com/crossplane-contrib/function-pythonic#readme
6
6
  Project-URL: Issues, https://github.com/crossplane-contrib/function-pythonic/issues
@@ -83,7 +83,7 @@ kind: Function
83
83
  metadata:
84
84
  name: function-pythonic
85
85
  spec:
86
- package: xpkg.upbound.io/crossplane-contrib/function-pythonic:v0.4.1
86
+ package: xpkg.upbound.io/crossplane-contrib/function-pythonic:v0.4.2
87
87
  ```
88
88
 
89
89
  ### Crossplane V1
@@ -95,7 +95,7 @@ kind: Function
95
95
  metadata:
96
96
  name: function-pythonic
97
97
  spec:
98
- package: xpkg.upbound.io/crossplane-contrib/function-pythonic:v0.4.1
98
+ package: xpkg.upbound.io/crossplane-contrib/function-pythonic:v0.4.2
99
99
  runtimeConfigRef:
100
100
  name: function-pythonic
101
101
  --
@@ -199,6 +199,11 @@ subnet.spec.forProvider.cidrBlock = '10.0.0.0/20'
199
199
  ```
200
200
  Will generate the appropriate Crossplane Usage resource.
201
201
 
202
+ ## API Documentation
203
+
204
+ - [Composite API (`composite.py`)](https://github.com/crossplane-contrib/function-pythonic/blob/main/docs/composite.md)
205
+ - [Protobuf Wrapper API (`protobuf.py`)](https://github.com/crossplane-contrib/function-pythonic/blob/main/docs/protobuf.md)
206
+
202
207
  ## Pythonic access of Protobuf Messages
203
208
 
204
209
  All Protobuf messages are wrapped by a set of python classes which enable using
@@ -241,6 +246,7 @@ The following functions are provided to create Protobuf structures:
241
246
  | List | Create a new Protobuf list |
242
247
  | Unknown | Create a new Protobuf unknown placeholder |
243
248
  | Yaml | Create a new Protobuf structure from a yaml string |
249
+ | YamlAll | Create a new Protobuf list from a yaml string |
244
250
  | Json | Create a new Protobuf structure from a json string |
245
251
  | B64Encode | Encode a string into base 64 |
246
252
  | B64Decode | Decode a string from base 64 |
@@ -405,25 +411,78 @@ optionally to the Claim.
405
411
  | Result.message | String | Human-readable details about the result |
406
412
  | Result.claim | Boolean | Also apply the result to the claim |
407
413
 
408
- ## Single use Composites
414
+ ## Inlined Composites
409
415
 
410
416
  Tired of creating a CompositeResourceDefinition, a Composition, and a Composite
411
- just to run that Composition once in a single use or initialize task?
417
+ just to run that Composition once in a setup or initialize task?
412
418
 
413
- function-pythonic installs a `Composite` CompositeResourceDefinition that enables
414
- creating such tasks using a single Composite resource:
419
+ function-pythonic supports "inlined" Compositions, where the python module
420
+ is obtained from a field in the Composite's spec.
415
421
  ```yaml
416
- apiVersion: pythonic.fn.crossplane.io/v1alpha1
417
- kind: Composite
422
+ apiVersion: inlined.example.org/v1alpha1
423
+ kind: Step
418
424
  metadata:
419
- name: composite-example
425
+ name: inlined-example
420
426
  spec:
421
427
  composite: |
422
428
  class HelloComposite(BaseComposite):
423
429
  def compose(self):
424
- self.status.composite = 'Hello, World!'
430
+ self.status.step = 'Hello, World!'
431
+ ```
432
+ The CompositeResourceDefinition and Composition to support the above example:
433
+ ```yaml
434
+ apiVersion: apiextensions.crossplane.io/v1
435
+ kind: CompositeResourceDefinition
436
+ metadata:
437
+ name: inlined.example.org/v1alpha1
438
+ spec:
439
+ group: inlined.example.org
440
+ names:
441
+ kind: Step
442
+ plural: steps
443
+ defaultCompositionRef:
444
+ name: steps.inlined.example.org
445
+ versions:
446
+ - name: v1alpha1
447
+ served: true
448
+ referenceable: true
449
+ schema:
450
+ openAPIV3Schema:
451
+ type: object
452
+ properties:
453
+ spec:
454
+ type: object
455
+ properties:
456
+ composite:
457
+ type: string
458
+ description: 'A Python module that defines a class with the signature: class Composite(BaseComposite)'
459
+ required:
460
+ - composite
461
+ status:
462
+ type: object
463
+ properties:
464
+ composite:
465
+ x-kubernetes-preserve-unknown-fields: true
466
+ ```
467
+ ```yaml
468
+ apiVersion: apiextensions.crossplane.io/v1
469
+ kind: Composition
470
+ metadata:
471
+ name: steps.inlined.example.org
472
+ spec:
473
+ compositeTypeRef:
474
+ apiVersion: inlined.example.org/v1alpha1
475
+ kind: Step
476
+ mode: Pipeline
477
+ pipeline:
478
+ - step: inlined
479
+ functionRef:
480
+ name: function-pythonic
481
+ input:
482
+ apiVersion: pythonic.fn.crossplane.io/v1alpha1
483
+ kind: Composite
484
+ inlined: composite
425
485
  ```
426
-
427
486
  ## Quick Start Development
428
487
 
429
488
  function-pythonic includes a pure python implementation of the `crossplane render ...`
@@ -616,7 +675,7 @@ kind: Function
616
675
  metadata:
617
676
  name: function-pythonic
618
677
  spec:
619
- package: xpkg.upbound.io/crossplane-contrib/function-pythonic:v0.4.1
678
+ package: xpkg.upbound.io/crossplane-contrib/function-pythonic:v0.4.2
620
679
  runtimeConfigRef:
621
680
  name: function-pythonic
622
681
  ---
@@ -57,7 +57,7 @@ kind: Function
57
57
  metadata:
58
58
  name: function-pythonic
59
59
  spec:
60
- package: xpkg.upbound.io/crossplane-contrib/function-pythonic:v0.4.1
60
+ package: xpkg.upbound.io/crossplane-contrib/function-pythonic:v0.4.2
61
61
  ```
62
62
 
63
63
  ### Crossplane V1
@@ -69,7 +69,7 @@ kind: Function
69
69
  metadata:
70
70
  name: function-pythonic
71
71
  spec:
72
- package: xpkg.upbound.io/crossplane-contrib/function-pythonic:v0.4.1
72
+ package: xpkg.upbound.io/crossplane-contrib/function-pythonic:v0.4.2
73
73
  runtimeConfigRef:
74
74
  name: function-pythonic
75
75
  --
@@ -173,6 +173,11 @@ subnet.spec.forProvider.cidrBlock = '10.0.0.0/20'
173
173
  ```
174
174
  Will generate the appropriate Crossplane Usage resource.
175
175
 
176
+ ## API Documentation
177
+
178
+ - [Composite API (`composite.py`)](https://github.com/crossplane-contrib/function-pythonic/blob/main/docs/composite.md)
179
+ - [Protobuf Wrapper API (`protobuf.py`)](https://github.com/crossplane-contrib/function-pythonic/blob/main/docs/protobuf.md)
180
+
176
181
  ## Pythonic access of Protobuf Messages
177
182
 
178
183
  All Protobuf messages are wrapped by a set of python classes which enable using
@@ -215,6 +220,7 @@ The following functions are provided to create Protobuf structures:
215
220
  | List | Create a new Protobuf list |
216
221
  | Unknown | Create a new Protobuf unknown placeholder |
217
222
  | Yaml | Create a new Protobuf structure from a yaml string |
223
+ | YamlAll | Create a new Protobuf list from a yaml string |
218
224
  | Json | Create a new Protobuf structure from a json string |
219
225
  | B64Encode | Encode a string into base 64 |
220
226
  | B64Decode | Decode a string from base 64 |
@@ -379,25 +385,78 @@ optionally to the Claim.
379
385
  | Result.message | String | Human-readable details about the result |
380
386
  | Result.claim | Boolean | Also apply the result to the claim |
381
387
 
382
- ## Single use Composites
388
+ ## Inlined Composites
383
389
 
384
390
  Tired of creating a CompositeResourceDefinition, a Composition, and a Composite
385
- just to run that Composition once in a single use or initialize task?
391
+ just to run that Composition once in a setup or initialize task?
386
392
 
387
- function-pythonic installs a `Composite` CompositeResourceDefinition that enables
388
- creating such tasks using a single Composite resource:
393
+ function-pythonic supports "inlined" Compositions, where the python module
394
+ is obtained from a field in the Composite's spec.
389
395
  ```yaml
390
- apiVersion: pythonic.fn.crossplane.io/v1alpha1
391
- kind: Composite
396
+ apiVersion: inlined.example.org/v1alpha1
397
+ kind: Step
392
398
  metadata:
393
- name: composite-example
399
+ name: inlined-example
394
400
  spec:
395
401
  composite: |
396
402
  class HelloComposite(BaseComposite):
397
403
  def compose(self):
398
- self.status.composite = 'Hello, World!'
404
+ self.status.step = 'Hello, World!'
405
+ ```
406
+ The CompositeResourceDefinition and Composition to support the above example:
407
+ ```yaml
408
+ apiVersion: apiextensions.crossplane.io/v1
409
+ kind: CompositeResourceDefinition
410
+ metadata:
411
+ name: inlined.example.org/v1alpha1
412
+ spec:
413
+ group: inlined.example.org
414
+ names:
415
+ kind: Step
416
+ plural: steps
417
+ defaultCompositionRef:
418
+ name: steps.inlined.example.org
419
+ versions:
420
+ - name: v1alpha1
421
+ served: true
422
+ referenceable: true
423
+ schema:
424
+ openAPIV3Schema:
425
+ type: object
426
+ properties:
427
+ spec:
428
+ type: object
429
+ properties:
430
+ composite:
431
+ type: string
432
+ description: 'A Python module that defines a class with the signature: class Composite(BaseComposite)'
433
+ required:
434
+ - composite
435
+ status:
436
+ type: object
437
+ properties:
438
+ composite:
439
+ x-kubernetes-preserve-unknown-fields: true
440
+ ```
441
+ ```yaml
442
+ apiVersion: apiextensions.crossplane.io/v1
443
+ kind: Composition
444
+ metadata:
445
+ name: steps.inlined.example.org
446
+ spec:
447
+ compositeTypeRef:
448
+ apiVersion: inlined.example.org/v1alpha1
449
+ kind: Step
450
+ mode: Pipeline
451
+ pipeline:
452
+ - step: inlined
453
+ functionRef:
454
+ name: function-pythonic
455
+ input:
456
+ apiVersion: pythonic.fn.crossplane.io/v1alpha1
457
+ kind: Composite
458
+ inlined: composite
399
459
  ```
400
-
401
460
  ## Quick Start Development
402
461
 
403
462
  function-pythonic includes a pure python implementation of the `crossplane render ...`
@@ -590,7 +649,7 @@ kind: Function
590
649
  metadata:
591
650
  name: function-pythonic
592
651
  spec:
593
- package: xpkg.upbound.io/crossplane-contrib/function-pythonic:v0.4.1
652
+ package: xpkg.upbound.io/crossplane-contrib/function-pythonic:v0.4.2
594
653
  runtimeConfigRef:
595
654
  name: function-pythonic
596
655
  ---
@@ -1,2 +1,2 @@
1
1
  # This is set at build time, using "hatch version"
2
- __version__ = "0.4.1"
2
+ __version__ = "0.5.0"
@@ -1,7 +1,7 @@
1
1
 
2
2
 
3
3
  from .composite import BaseComposite
4
- from .protobuf import append, Map, List, Unknown, Yaml, Json, B64Encode, B64Decode
4
+ from .protobuf import append, Map, List, Unknown, Yaml, YamlAll, Json, B64Encode, B64Decode
5
5
 
6
6
  __all__ = [
7
7
  'BaseComposite',
@@ -10,6 +10,7 @@ __all__ = [
10
10
  'List',
11
11
  'Unknown',
12
12
  'Yaml',
13
+ 'YamlAll',
13
14
  'Json',
14
15
  'B64Encode',
15
16
  'B64Decode',
@@ -63,7 +63,7 @@ class Command:
63
63
  help='Enable Crossplane V1 compatibility mode',
64
64
  )
65
65
 
66
- def __init__(self, args):
66
+ def __init__(self, args=None):
67
67
  self.args = args
68
68
  self.initialize()
69
69
 
@@ -79,6 +79,7 @@ class Command:
79
79
  logger.setLevel(logging.DEBUG if self.args.debug else logging.INFO)
80
80
  # Suppress noisy libraries, these can be overriden using --logger-level
81
81
  logging.getLogger('asyncio').setLevel(logging.INFO)
82
+ logging.getLogger('grpc').setLevel(logging.INFO)
82
83
  logging.getLogger('httpcore').setLevel(logging.INFO)
83
84
  logging.getLogger('httpx').setLevel(logging.WARNING)
84
85
  logging.getLogger('kr8s').setLevel(logging.INFO)
@@ -89,7 +89,7 @@ class Ready:
89
89
 
90
90
 
91
91
  class BaseComposite:
92
- def __init__(self, crossplane_v1, request, single_use, logger):
92
+ def __init__(self, crossplane_v1, request, logger):
93
93
  self.crossplane_v1 = crossplane_v1
94
94
  self.request = protobuf.Message(None, 'request', request.DESCRIPTOR, request, 'Function Request')
95
95
  response = fnv1.RunFunctionResponse(
@@ -104,10 +104,7 @@ class BaseComposite:
104
104
  )
105
105
  self.response = protobuf.Message(None, 'response', response.DESCRIPTOR, response)
106
106
  self.logger = logger
107
- if single_use:
108
- self.parameters = self.request.observed.composite.resource.spec.parameters
109
- else:
110
- self.parameters = self.request.input.parameters
107
+ self.parameters = self.request.input.parameters
111
108
  self.credentials = Credentials(self.request)
112
109
  self.context = self.response.context
113
110
  self.environment = self.context['apiextensions.crossplane.io/environment']
@@ -17,9 +17,8 @@ logger = logging.getLogger(__name__)
17
17
  class FunctionRunner(grpcv1.FunctionRunnerService):
18
18
  """A FunctionRunner handles gRPC RunFunctionRequests."""
19
19
 
20
- def __init__(self, debug=False, renderUnknowns=False, crossplane_v1=False):
20
+ def __init__(self, renderUnknowns=False, crossplane_v1=False):
21
21
  """Create a new FunctionRunner."""
22
- self.debug = debug
23
22
  self.renderUnknowns = renderUnknowns
24
23
  self.crossplane_v1 = crossplane_v1
25
24
  self.clazzes = {}
@@ -49,15 +48,13 @@ class FunctionRunner(grpcv1.FunctionRunnerService):
49
48
  name.append(composite['metadata']['name'])
50
49
  logger = logging.getLogger('.'.join(name))
51
50
 
52
- if composite['apiVersion'] in ('pythonic.crossplane.io/v1alpha1', 'pythonic.fortra.com/v1alpha1') and composite['kind'] == 'Composite':
53
- if 'spec' not in composite or 'composite' not in composite['spec']:
54
- return self.fatal(request, logger, 'Missing spec "composite"')
55
- single_use = True
56
- composite = composite['spec']['composite']
51
+ if 'inlined' in request.input and request.input['inlined']:
52
+ if 'spec' not in composite or request.input['inlined'] not in composite['spec']:
53
+ return self.fatal(request, logger, f"Missing inlined spec.{request.input['inlined']}")
54
+ composite = composite['spec'][request.input['inlined']]
57
55
  else:
58
56
  if 'composite' not in request.input:
59
57
  return self.fatal(request, logger, 'Missing input "composite"')
60
- single_use = False
61
58
  composite = request.input['composite']
62
59
 
63
60
  # Ideally this is something the Function API provides
@@ -101,7 +98,7 @@ class FunctionRunner(grpcv1.FunctionRunnerService):
101
98
  self.clazzes[composite] = clazz
102
99
 
103
100
  try:
104
- composite = clazz(self.crossplane_v1, request, single_use, logger)
101
+ composite = clazz(self.crossplane_v1, request, logger)
105
102
  except Exception as e:
106
103
  return self.fatal(request, logger, 'Instantiate', e)
107
104
 
@@ -182,7 +179,7 @@ class FunctionRunner(grpcv1.FunctionRunnerService):
182
179
  for _, resource in sorted(entry for entry in composite.resources):
183
180
  dependencies = resource.desired._getDependencies
184
181
  if dependencies:
185
- if self.debug:
182
+ if composite.logger.isEnabledFor(logging.DEBUG):
186
183
  for destination, source in sorted(dependencies.items()):
187
184
  destination = self.trimFullName(destination)
188
185
  source = self.trimFullName(source)
@@ -278,7 +275,7 @@ class FunctionRunner(grpcv1.FunctionRunnerService):
278
275
  if resource.unknownsFatal or (resource.unknownsFatal is None and composite.unknownsFatal):
279
276
  fatalResources.append(name)
280
277
  fatal = True
281
- if self.debug:
278
+ if composite.logger.isEnabledFor(logging.DEBUG):
282
279
  for destination, source in sorted(unknowns.items()):
283
280
  destination = self.trimFullName(destination)
284
281
  source = self.trimFullName(source)
@@ -319,7 +316,7 @@ class FunctionRunner(grpcv1.FunctionRunnerService):
319
316
  message = 'All resources are composed'
320
317
  status = True
321
318
  result = None
322
- if not self.debug and level:
319
+ if not composite.logger.isEnabledFor(logging.DEBUG) and level:
323
320
  level(message)
324
321
  composite.conditions.ResourcesComposed(reason, message, status)
325
322
  if result:
@@ -378,6 +375,7 @@ class Module:
378
375
  self.List = pythonic.List
379
376
  self.Unknown = pythonic.Unknown
380
377
  self.Yaml = pythonic.Yaml
378
+ self.YamlAll = pythonic.YamlAll
381
379
  self.Json = pythonic.Json
382
380
  self.B64Encode = pythonic.B64Encode
383
381
  self.B64Decode = pythonic.B64Decode
@@ -88,7 +88,7 @@ class Command(command.Command):
88
88
 
89
89
  async def run(self):
90
90
  grpc.aio.init_grpc_aio()
91
- grpc_runner = function.FunctionRunner(self.args.debug, self.args.render_unknowns, self.args.crossplane_v1)
91
+ grpc_runner = function.FunctionRunner(self.args.render_unknowns, self.args.crossplane_v1)
92
92
  grpc_server = grpc.aio.server()
93
93
  grpcv1.add_FunctionRunnerServiceServicer_to_server(grpc_runner, grpc_server)
94
94
  if self.args.insecure:
@@ -42,6 +42,13 @@ def Yaml(string, readOnly=None):
42
42
  string = str(string)
43
43
  return Value(None, None, yaml.safe_load(string), readOnly)
44
44
 
45
+ def YamlAll(string, readOnly=None):
46
+ if isinstance(string, (FieldMessage, Value)):
47
+ if not string:
48
+ return string
49
+ string = str(string)
50
+ return Value(None, None, [document for document in yaml.safe_load_all(string)], readOnly)
51
+
45
52
  def Json(string, readOnly=None):
46
53
  if isinstance(string, (FieldMessage, Value)):
47
54
  if not string:
@@ -789,8 +796,10 @@ class Value:
789
796
  def __contains__(self, item):
790
797
  match self._kind:
791
798
  case 'struct_value':
799
+ item = self._validate_key(item)
792
800
  return item in self._value.struct_value.fields or item in self._unknowns
793
801
  case 'Struct':
802
+ item = self._validate_key(item)
794
803
  return item in self._value.fields or item in self._unknowns
795
804
  case 'list_value' | 'ListValue':
796
805
  for value in self: