crossplane-function-sdk-python 0.4.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.
Files changed (31) hide show
  1. {crossplane_function_sdk_python-0.4.0 → crossplane_function_sdk_python-0.5.0}/.github/workflows/ci.yml +14 -13
  2. {crossplane_function_sdk_python-0.4.0 → crossplane_function_sdk_python-0.5.0}/PKG-INFO +5 -4
  3. {crossplane_function_sdk_python-0.4.0 → crossplane_function_sdk_python-0.5.0}/README.md +3 -3
  4. {crossplane_function_sdk_python-0.4.0 → crossplane_function_sdk_python-0.5.0}/crossplane/function/__version__.py +1 -1
  5. {crossplane_function_sdk_python-0.4.0 → crossplane_function_sdk_python-0.5.0}/crossplane/function/resource.py +27 -0
  6. {crossplane_function_sdk_python-0.4.0 → crossplane_function_sdk_python-0.5.0}/pyproject.toml +15 -21
  7. {crossplane_function_sdk_python-0.4.0 → crossplane_function_sdk_python-0.5.0}/tests/test_resource.py +79 -0
  8. crossplane_function_sdk_python-0.5.0/tests/testdata/models/io/k8s/apimachinery/pkg/apis/__init__.py +3 -0
  9. crossplane_function_sdk_python-0.5.0/tests/testdata/models/io/k8s/apimachinery/pkg/apis/meta/__init__.py +3 -0
  10. crossplane_function_sdk_python-0.5.0/tests/testdata/models/io/k8s/apimachinery/pkg/apis/meta/v1.py +301 -0
  11. crossplane_function_sdk_python-0.5.0/tests/testdata/models/io/upbound/aws/s3/__init__.py +3 -0
  12. crossplane_function_sdk_python-0.5.0/tests/testdata/models/io/upbound/aws/s3/v1beta2.py +800 -0
  13. {crossplane_function_sdk_python-0.4.0 → crossplane_function_sdk_python-0.5.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  14. {crossplane_function_sdk_python-0.4.0 → crossplane_function_sdk_python-0.5.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  15. {crossplane_function_sdk_python-0.4.0 → crossplane_function_sdk_python-0.5.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  16. {crossplane_function_sdk_python-0.4.0 → crossplane_function_sdk_python-0.5.0}/.gitignore +0 -0
  17. {crossplane_function_sdk_python-0.4.0 → crossplane_function_sdk_python-0.5.0}/LICENSE +0 -0
  18. {crossplane_function_sdk_python-0.4.0 → crossplane_function_sdk_python-0.5.0}/crossplane/function/logging.py +0 -0
  19. {crossplane_function_sdk_python-0.4.0 → crossplane_function_sdk_python-0.5.0}/crossplane/function/proto/v1/run_function.proto +0 -0
  20. {crossplane_function_sdk_python-0.4.0 → crossplane_function_sdk_python-0.5.0}/crossplane/function/proto/v1/run_function_pb2.py +0 -0
  21. {crossplane_function_sdk_python-0.4.0 → crossplane_function_sdk_python-0.5.0}/crossplane/function/proto/v1/run_function_pb2.pyi +0 -0
  22. {crossplane_function_sdk_python-0.4.0 → crossplane_function_sdk_python-0.5.0}/crossplane/function/proto/v1/run_function_pb2_grpc.py +0 -0
  23. {crossplane_function_sdk_python-0.4.0 → crossplane_function_sdk_python-0.5.0}/crossplane/function/proto/v1beta1/run_function.proto +0 -0
  24. {crossplane_function_sdk_python-0.4.0 → crossplane_function_sdk_python-0.5.0}/crossplane/function/proto/v1beta1/run_function_pb2.py +0 -0
  25. {crossplane_function_sdk_python-0.4.0 → crossplane_function_sdk_python-0.5.0}/crossplane/function/proto/v1beta1/run_function_pb2.pyi +0 -0
  26. {crossplane_function_sdk_python-0.4.0 → crossplane_function_sdk_python-0.5.0}/crossplane/function/proto/v1beta1/run_function_pb2_grpc.py +0 -0
  27. {crossplane_function_sdk_python-0.4.0 → crossplane_function_sdk_python-0.5.0}/crossplane/function/response.py +0 -0
  28. {crossplane_function_sdk_python-0.4.0 → crossplane_function_sdk_python-0.5.0}/crossplane/function/runtime.py +0 -0
  29. {crossplane_function_sdk_python-0.4.0 → crossplane_function_sdk_python-0.5.0}/renovate.json +0 -0
  30. {crossplane_function_sdk_python-0.4.0 → crossplane_function_sdk_python-0.5.0}/tests/test_response.py +0 -0
  31. {crossplane_function_sdk_python-0.4.0 → crossplane_function_sdk_python-0.5.0}/tests/test_runtime.py +0 -0
@@ -27,14 +27,15 @@ concurrency:
27
27
 
28
28
  env:
29
29
  # Common versions
30
- PYTHON_VERSION: '3.11.5'
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-22.04
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==1.7.0
49
+ run: pipx install hatch==${{ env.HATCH_VERSION }}
49
50
 
50
51
  - name: Lint
51
- run: hatch run lint:check
52
+ run: hatch fmt
52
53
 
53
54
  unit-test:
54
- runs-on: ubuntu-22.04
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==1.7.0
66
+ run: pipx install hatch==${{ env.HATCH_VERSION }}
66
67
 
67
68
  - name: Run Unit Tests
68
- run: hatch run test:unit
69
+ run: hatch test --all --randomize
69
70
 
70
71
 
71
72
  build:
72
- runs-on: ubuntu-22.04
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==1.7.0
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-22.04
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.10.1
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-22.04
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==1.7.0
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.4.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
@@ -15,6 +15,7 @@ Requires-Python: >=3.11
15
15
  Requires-Dist: grpcio-reflection==1.*
16
16
  Requires-Dist: grpcio==1.*
17
17
  Requires-Dist: protobuf==5.27.2
18
+ Requires-Dist: pydantic==2.*
18
19
  Requires-Dist: structlog==24.*
19
20
  Description-Content-Type: text/markdown
20
21
 
@@ -54,11 +55,11 @@ Some useful commands:
54
55
  # Generate gRPC stubs.
55
56
  hatch run generate:protoc
56
57
 
57
- # Lint the code.
58
- hatch run lint:check
58
+ # Format and lint the code.
59
+ hatch fmt
59
60
 
60
61
  # Run unit tests.
61
- hatch run test:unit
62
+ hatch test
62
63
 
63
64
  # Build an sdist and wheel.
64
65
  hatch build
@@ -34,11 +34,11 @@ Some useful commands:
34
34
  # Generate gRPC stubs.
35
35
  hatch run generate:protoc
36
36
 
37
- # Lint the code.
38
- hatch run lint:check
37
+ # Format and lint the code.
38
+ hatch fmt
39
39
 
40
40
  # Run unit tests.
41
- hatch run test:unit
41
+ hatch test
42
42
 
43
43
  # Build an sdist and wheel.
44
44
  hatch build
@@ -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.4.0"
18
+ __version__ = "0.5.0"
@@ -17,12 +17,39 @@
17
17
  import dataclasses
18
18
  import datetime
19
19
 
20
+ import pydantic
20
21
  from google.protobuf import struct_pb2 as structpb
21
22
 
23
+ import crossplane.function.proto.v1.run_function_pb2 as fnv1
24
+
22
25
  # TODO(negz): Do we really need dict_to_struct and struct_to_dict? They don't do
23
26
  # much, but are perhaps useful for discoverability/"documentation" purposes.
24
27
 
25
28
 
29
+ def update(r: fnv1.Resource, source: dict | structpb.Struct | pydantic.BaseModel):
30
+ """Update a composite or composed resource.
31
+
32
+ Use update to add or update the supplied resource. If the resource doesn't
33
+ exist, it'll be added. If the resource does exist, it'll be updated. The
34
+ update method semantics are the same as a dictionary's update method. Fields
35
+ that don't exist will be added. Fields that exist will be overwritten.
36
+
37
+ The source can be a dictionary, a protobuf Struct, or a Pydantic model.
38
+ """
39
+ match source:
40
+ case pydantic.BaseModel():
41
+ r.resource.update(source.model_dump(exclude_defaults=True, warnings=False))
42
+ case structpb.Struct():
43
+ # TODO(negz): Use struct_to_dict and update to match other semantics?
44
+ r.resource.MergeFrom(source)
45
+ case dict():
46
+ r.resource.update(source)
47
+ case _:
48
+ t = type(source)
49
+ msg = f"Unsupported type: {t}"
50
+ raise TypeError(msg)
51
+
52
+
26
53
  def dict_to_struct(d: dict) -> structpb.Struct:
27
54
  """Create a Struct well-known type from the supplied dict.
28
55
 
@@ -16,7 +16,13 @@ classifiers = [
16
16
  "Programming Language :: Python :: 3.11",
17
17
  ]
18
18
 
19
- dependencies = ["grpcio==1.*", "grpcio-reflection==1.*", "protobuf==5.27.2", "structlog==24.*"]
19
+ dependencies = [
20
+ "grpcio==1.*",
21
+ "grpcio-reflection==1.*",
22
+ "protobuf==5.27.2",
23
+ "pydantic==2.*",
24
+ "structlog==24.*",
25
+ ]
20
26
 
21
27
  dynamic = ["version"]
22
28
 
@@ -32,34 +38,17 @@ validate-bump = false # Allow going from 0.0.0.dev0+x to 0
32
38
  [tool.hatch.envs.default]
33
39
  type = "virtual"
34
40
  path = ".venv-default"
35
- dependencies = ["ipython==8.27.0"]
41
+ dependencies = ["ipython==8.28.0"]
36
42
 
37
43
  [tool.hatch.envs.generate]
38
44
  type = "virtual"
39
45
  detached = true
40
46
  path = ".venv-generate"
41
- dependencies = ["grpcio-tools==1.66.1"]
47
+ dependencies = ["grpcio-tools==1.66.2"]
42
48
 
43
49
  [tool.hatch.envs.generate.scripts]
44
50
  protoc = "python -m grpc_tools.protoc --proto_path=. --python_out=. --pyi_out=. --grpc_python_out=. crossplane/function/proto/v1beta1/run_function.proto crossplane/function/proto/v1/run_function.proto"
45
51
 
46
- [tool.hatch.envs.lint]
47
- type = "virtual"
48
- detached = true
49
- path = ".venv-lint"
50
- dependencies = ["ruff==0.6.5"]
51
-
52
- [tool.hatch.envs.lint.scripts]
53
- check = "ruff format crossplane tests && ruff check --fix crossplane tests"
54
-
55
-
56
- [tool.hatch.envs.test]
57
- type = "virtual"
58
- path = ".venv-test"
59
-
60
- [tool.hatch.envs.test.scripts]
61
- unit = "python -m unittest tests/*.py"
62
-
63
52
  [tool.hatch.envs.docs]
64
53
  type = "virtual"
65
54
  path = ".venv-docs"
@@ -71,9 +60,14 @@ generate = "pdoc -m google crossplane/function -o docs"
71
60
  [tool.hatch.build.targets.wheel]
72
61
  packages = ["crossplane"]
73
62
 
63
+ # This special environment is used by hatch fmt.
64
+ [tool.hatch.envs.hatch-static-analysis]
65
+ dependencies = ["ruff==0.6.9"]
66
+ config-path = "none" # Disable Hatch's default Ruff config.
67
+
74
68
  [tool.ruff]
75
69
  target-version = "py311"
76
- exclude = ["crossplane/function/proto/*"]
70
+ exclude = ["crossplane/function/proto/*", "tests/testdata/*"]
77
71
  lint.select = [
78
72
  "A",
79
73
  "ARG",
@@ -16,15 +16,94 @@ import dataclasses
16
16
  import datetime
17
17
  import unittest
18
18
 
19
+ import pydantic
20
+ from google.protobuf import json_format
19
21
  from google.protobuf import struct_pb2 as structpb
20
22
 
23
+ import crossplane.function.proto.v1.run_function_pb2 as fnv1
21
24
  from crossplane.function import logging, resource
25
+ from tests.testdata.models.io.upbound.aws.s3 import v1beta2
22
26
 
23
27
 
24
28
  class TestResource(unittest.TestCase):
25
29
  def setUp(self) -> None:
26
30
  logging.configure(level=logging.Level.DISABLED)
27
31
 
32
+ def test_add(self) -> None:
33
+ @dataclasses.dataclass
34
+ class TestCase:
35
+ reason: str
36
+ r: fnv1.Resource
37
+ source: dict | structpb.Struct | pydantic.BaseModel
38
+ want: fnv1.Resource
39
+
40
+ cases = [
41
+ TestCase(
42
+ reason="Updating from a dict should work.",
43
+ r=fnv1.Resource(),
44
+ source={"apiVersion": "example.org", "kind": "Resource"},
45
+ want=fnv1.Resource(
46
+ resource=resource.dict_to_struct(
47
+ {"apiVersion": "example.org", "kind": "Resource"}
48
+ ),
49
+ ),
50
+ ),
51
+ TestCase(
52
+ reason="Updating an existing resource from a dict should work.",
53
+ r=fnv1.Resource(
54
+ resource=resource.dict_to_struct(
55
+ {"apiVersion": "example.org", "kind": "Resource"}
56
+ ),
57
+ ),
58
+ source={
59
+ "metadata": {"name": "cool"},
60
+ },
61
+ want=fnv1.Resource(
62
+ resource=resource.dict_to_struct(
63
+ {
64
+ "apiVersion": "example.org",
65
+ "kind": "Resource",
66
+ "metadata": {"name": "cool"},
67
+ }
68
+ ),
69
+ ),
70
+ ),
71
+ TestCase(
72
+ reason="Updating from a struct should work.",
73
+ r=fnv1.Resource(),
74
+ source=resource.dict_to_struct(
75
+ {"apiVersion": "example.org", "kind": "Resource"}
76
+ ),
77
+ want=fnv1.Resource(
78
+ resource=resource.dict_to_struct(
79
+ {"apiVersion": "example.org", "kind": "Resource"}
80
+ ),
81
+ ),
82
+ ),
83
+ TestCase(
84
+ reason="Updating from a Pydantic model should work.",
85
+ r=fnv1.Resource(),
86
+ source=v1beta2.Bucket(
87
+ spec=v1beta2.Spec(
88
+ forProvider=v1beta2.ForProvider(region="us-west-2"),
89
+ ),
90
+ ),
91
+ want=fnv1.Resource(
92
+ resource=resource.dict_to_struct(
93
+ {"spec": {"forProvider": {"region": "us-west-2"}}}
94
+ ),
95
+ ),
96
+ ),
97
+ ]
98
+
99
+ for case in cases:
100
+ resource.update(case.r, case.source)
101
+ self.assertEqual(
102
+ json_format.MessageToDict(case.want),
103
+ json_format.MessageToDict(case.r),
104
+ "-want, +got",
105
+ )
106
+
28
107
  def test_get_condition(self) -> None:
29
108
  @dataclasses.dataclass
30
109
  class TestCase:
@@ -0,0 +1,3 @@
1
+ # generated by datamodel-codegen:
2
+ # filename: <stdin>
3
+ # timestamp: 2024-10-04T21:01:52+00:00
@@ -0,0 +1,3 @@
1
+ # generated by datamodel-codegen:
2
+ # filename: <stdin>
3
+ # timestamp: 2024-10-04T21:01:52+00:00
@@ -0,0 +1,301 @@
1
+ # generated by datamodel-codegen:
2
+ # filename: <stdin>
3
+ # timestamp: 2024-10-04T21:01:52+00:00
4
+
5
+ from __future__ import annotations
6
+
7
+ from typing import Dict, List, Optional
8
+
9
+ from pydantic import AwareDatetime, BaseModel, Field, RootModel
10
+
11
+
12
+ class FieldsV1(BaseModel):
13
+ pass
14
+
15
+
16
+ class ListMeta(BaseModel):
17
+ continue_: Optional[str] = Field(None, alias='continue')
18
+ """
19
+ continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a consistent list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response, unless you have received this token from an error message.
20
+ """
21
+ remainingItemCount: Optional[int] = None
22
+ """
23
+ remainingItemCount is the number of subsequent items in the list which are not included in this list response. If the list request contained label or field selectors, then the number of remaining items is unknown and the field will be left unset and omitted during serialization. If the list is complete (either because it is not chunking or because this is the last chunk), then there are no more remaining items and this field will be left unset and omitted during serialization. Servers older than v1.15 do not set this field. The intended use of the remainingItemCount is *estimating* the size of a collection. Clients should not rely on the remainingItemCount to be set or to be exact.
24
+ """
25
+ resourceVersion: Optional[str] = None
26
+ """
27
+ String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency
28
+ """
29
+ selfLink: Optional[str] = None
30
+ """
31
+ Deprecated: selfLink is a legacy read-only field that is no longer populated by the system.
32
+ """
33
+
34
+
35
+ class OwnerReference(BaseModel):
36
+ apiVersion: str
37
+ """
38
+ API version of the referent.
39
+ """
40
+ blockOwnerDeletion: Optional[bool] = None
41
+ """
42
+ If true, AND if the owner has the "foregroundDeletion" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. See https://kubernetes.io/docs/concepts/architecture/garbage-collection/#foreground-deletion for how the garbage collector interacts with this field and enforces the foreground deletion. Defaults to false. To set this field, a user needs "delete" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned.
43
+ """
44
+ controller: Optional[bool] = None
45
+ """
46
+ If true, this reference points to the managing controller.
47
+ """
48
+ kind: str
49
+ """
50
+ Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
51
+ """
52
+ name: str
53
+ """
54
+ Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names
55
+ """
56
+ uid: str
57
+ """
58
+ UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids
59
+ """
60
+
61
+
62
+ class Patch(BaseModel):
63
+ pass
64
+
65
+
66
+ class Preconditions(BaseModel):
67
+ resourceVersion: Optional[str] = None
68
+ """
69
+ Specifies the target ResourceVersion
70
+ """
71
+ uid: Optional[str] = None
72
+ """
73
+ Specifies the target UID.
74
+ """
75
+
76
+
77
+ class StatusCause(BaseModel):
78
+ field: Optional[str] = None
79
+ """
80
+ The field of the resource that has caused this error, as named by its JSON serialization. May include dot and postfix notation for nested attributes. Arrays are zero-indexed. Fields may appear more than once in an array of causes due to fields having multiple errors. Optional.
81
+
82
+ Examples:
83
+ "name" - the field "name" on the current resource
84
+ "items[0].name" - the field "name" on the first array entry in "items"
85
+ """
86
+ message: Optional[str] = None
87
+ """
88
+ A human-readable description of the cause of the error. This field may be presented as-is to a reader.
89
+ """
90
+ reason: Optional[str] = None
91
+ """
92
+ A machine-readable description of the cause of the error. If this value is empty there is no information available.
93
+ """
94
+
95
+
96
+ class StatusDetails(BaseModel):
97
+ causes: Optional[List[StatusCause]] = None
98
+ """
99
+ The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.
100
+ """
101
+ group: Optional[str] = None
102
+ """
103
+ The group attribute of the resource associated with the status StatusReason.
104
+ """
105
+ kind: Optional[str] = None
106
+ """
107
+ The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
108
+ """
109
+ name: Optional[str] = None
110
+ """
111
+ The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).
112
+ """
113
+ retryAfterSeconds: Optional[int] = None
114
+ """
115
+ If specified, the time in seconds before the operation should be retried. Some errors may indicate the client must take an alternate action - for those errors this field may indicate how long to wait before taking the alternate action.
116
+ """
117
+ uid: Optional[str] = None
118
+ """
119
+ UID of the resource. (when there is a single resource which can be described). More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids
120
+ """
121
+
122
+
123
+ class Time(RootModel[AwareDatetime]):
124
+ root: AwareDatetime
125
+ """
126
+ Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.
127
+ """
128
+
129
+
130
+ class DeleteOptions(BaseModel):
131
+ apiVersion: Optional[str] = None
132
+ """
133
+ APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
134
+ """
135
+ dryRun: Optional[List[str]] = None
136
+ """
137
+ When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
138
+ """
139
+ gracePeriodSeconds: Optional[int] = None
140
+ """
141
+ The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.
142
+ """
143
+ kind: Optional[str] = None
144
+ """
145
+ Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
146
+ """
147
+ orphanDependents: Optional[bool] = None
148
+ """
149
+ Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the "orphan" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both.
150
+ """
151
+ preconditions: Optional[Preconditions] = None
152
+ """
153
+ Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned.
154
+ """
155
+ propagationPolicy: Optional[str] = None
156
+ """
157
+ Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground.
158
+ """
159
+
160
+
161
+ class ManagedFieldsEntry(BaseModel):
162
+ apiVersion: Optional[str] = None
163
+ """
164
+ APIVersion defines the version of this resource that this field set applies to. The format is "group/version" just like the top-level APIVersion field. It is necessary to track the version of a field set because it cannot be automatically converted.
165
+ """
166
+ fieldsType: Optional[str] = None
167
+ """
168
+ FieldsType is the discriminator for the different fields format and version. There is currently only one possible value: "FieldsV1"
169
+ """
170
+ fieldsV1: Optional[FieldsV1] = None
171
+ """
172
+ FieldsV1 holds the first JSON version format as described in the "FieldsV1" type.
173
+ """
174
+ manager: Optional[str] = None
175
+ """
176
+ Manager is an identifier of the workflow managing these fields.
177
+ """
178
+ operation: Optional[str] = None
179
+ """
180
+ Operation is the type of operation which lead to this ManagedFieldsEntry being created. The only valid values for this field are 'Apply' and 'Update'.
181
+ """
182
+ subresource: Optional[str] = None
183
+ """
184
+ Subresource is the name of the subresource used to update that object, or empty string if the object was updated through the main resource. The value of this field is used to distinguish between managers, even if they share the same name. For example, a status update will be distinct from a regular update using the same manager name. Note that the APIVersion field is not related to the Subresource field and it always corresponds to the version of the main resource.
185
+ """
186
+ time: Optional[Time] = None
187
+ """
188
+ Time is the timestamp of when the ManagedFields entry was added. The timestamp will also be updated if a field is added, the manager changes any of the owned fields value or removes a field. The timestamp does not update when a field is removed from the entry because another manager took it over.
189
+ """
190
+
191
+
192
+ class ObjectMeta(BaseModel):
193
+ annotations: Optional[Dict[str, str]] = None
194
+ """
195
+ Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations
196
+ """
197
+ creationTimestamp: Optional[Time] = None
198
+ """
199
+ CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.
200
+
201
+ Populated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
202
+ """
203
+ deletionGracePeriodSeconds: Optional[int] = None
204
+ """
205
+ Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only.
206
+ """
207
+ deletionTimestamp: Optional[Time] = None
208
+ """
209
+ DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This field is set by the server when a graceful deletion is requested by the user, and is not directly settable by a client. The resource is expected to be deleted (no longer visible from resource lists, and not reachable by name) after the time in this field, once the finalizers list is empty. As long as the finalizers list contains items, deletion is blocked. Once the deletionTimestamp is set, this value may not be unset or be set further into the future, although it may be shortened or the resource may be deleted prior to this time. For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react by sending a graceful termination signal to the containers in the pod. After that 30 seconds, the Kubelet will send a hard termination signal (SIGKILL) to the container and after cleanup, remove the pod from the API. In the presence of network partitions, this object may still exist after this timestamp, until an administrator or automated process can determine the resource is fully terminated. If not set, graceful deletion of the object has not been requested.
210
+
211
+ Populated by the system when a graceful deletion is requested. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
212
+ """
213
+ finalizers: Optional[List[str]] = None
214
+ """
215
+ Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed. Finalizers may be processed and removed in any order. Order is NOT enforced because it introduces significant risk of stuck finalizers. finalizers is a shared field, any actor with permission can reorder it. If the finalizer list is processed in order, then this can lead to a situation in which the component responsible for the first finalizer in the list is waiting for a signal (field value, external system, or other) produced by a component responsible for a finalizer later in the list, resulting in a deadlock. Without enforced ordering finalizers are free to order amongst themselves and are not vulnerable to ordering changes in the list.
216
+ """
217
+ generateName: Optional[str] = None
218
+ """
219
+ GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.
220
+
221
+ If this field is specified and the generated name exists, the server will return a 409.
222
+
223
+ Applied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency
224
+ """
225
+ generation: Optional[int] = None
226
+ """
227
+ A sequence number representing a specific generation of the desired state. Populated by the system. Read-only.
228
+ """
229
+ labels: Optional[Dict[str, str]] = None
230
+ """
231
+ Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels
232
+ """
233
+ managedFields: Optional[List[ManagedFieldsEntry]] = None
234
+ """
235
+ ManagedFields maps workflow-id and version to the set of fields that are managed by that workflow. This is mostly for internal housekeeping, and users typically shouldn't need to set or understand this field. A workflow can be the user's name, a controller's name, or the name of a specific apply path like "ci-cd". The set of fields is always in the version that the workflow used when modifying the object.
236
+ """
237
+ name: Optional[str] = None
238
+ """
239
+ Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names
240
+ """
241
+ namespace: Optional[str] = None
242
+ """
243
+ Namespace defines the space within which each name must be unique. An empty namespace is equivalent to the "default" namespace, but "default" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty.
244
+
245
+ Must be a DNS_LABEL. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces
246
+ """
247
+ ownerReferences: Optional[List[OwnerReference]] = None
248
+ """
249
+ List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller.
250
+ """
251
+ resourceVersion: Optional[str] = None
252
+ """
253
+ An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources.
254
+
255
+ Populated by the system. Read-only. Value must be treated as opaque by clients and . More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency
256
+ """
257
+ selfLink: Optional[str] = None
258
+ """
259
+ Deprecated: selfLink is a legacy read-only field that is no longer populated by the system.
260
+ """
261
+ uid: Optional[str] = None
262
+ """
263
+ UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations.
264
+
265
+ Populated by the system. Read-only. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids
266
+ """
267
+
268
+
269
+ class Status(BaseModel):
270
+ apiVersion: Optional[str] = None
271
+ """
272
+ APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
273
+ """
274
+ code: Optional[int] = None
275
+ """
276
+ Suggested HTTP return code for this status, 0 if not set.
277
+ """
278
+ details: Optional[StatusDetails] = None
279
+ """
280
+ Extended data associated with the reason. Each reason may define its own extended details. This field is optional and the data returned is not guaranteed to conform to any schema except that defined by the reason type.
281
+ """
282
+ kind: Optional[str] = None
283
+ """
284
+ Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
285
+ """
286
+ message: Optional[str] = None
287
+ """
288
+ A human-readable description of the status of this operation.
289
+ """
290
+ metadata: Optional[ListMeta] = {}
291
+ """
292
+ Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
293
+ """
294
+ reason: Optional[str] = None
295
+ """
296
+ A machine-readable description of why this operation is in the "Failure" status. If this value is empty there is no information available. A Reason clarifies an HTTP status code but does not override it.
297
+ """
298
+ status: Optional[str] = None
299
+ """
300
+ Status of the operation. One of: "Success" or "Failure". More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
301
+ """