Skip to content

Commit f603fd6

Browse files
committed
Generated API change for v6.0.0b1
add PATCH to custom_objects_api documentation update: never let cluster-scoped resources skip webhooks
1 parent 3f4d09d commit f603fd6

File tree

8 files changed

+480
-5
lines changed

8 files changed

+480
-5
lines changed

kubernetes/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,8 @@ Class | Method | HTTP request | Description
618618
*CustomObjectsApi* | [**get_namespaced_custom_object**](docs/CustomObjectsApi.md#get_namespaced_custom_object) | **GET** /apis/{group}/{version}/namespaces/{namespace}/{plural}/{name} |
619619
*CustomObjectsApi* | [**list_cluster_custom_object**](docs/CustomObjectsApi.md#list_cluster_custom_object) | **GET** /apis/{group}/{version}/{plural} |
620620
*CustomObjectsApi* | [**list_namespaced_custom_object**](docs/CustomObjectsApi.md#list_namespaced_custom_object) | **GET** /apis/{group}/{version}/namespaces/{namespace}/{plural} |
621+
*CustomObjectsApi* | [**patch_cluster_custom_object**](docs/CustomObjectsApi.md#patch_cluster_custom_object) | **PATCH** /apis/{group}/{version}/{plural}/{name} |
622+
*CustomObjectsApi* | [**patch_namespaced_custom_object**](docs/CustomObjectsApi.md#patch_namespaced_custom_object) | **PATCH** /apis/{group}/{version}/namespaces/{namespace}/{plural}/{name} |
621623
*CustomObjectsApi* | [**replace_cluster_custom_object**](docs/CustomObjectsApi.md#replace_cluster_custom_object) | **PUT** /apis/{group}/{version}/{plural}/{name} |
622624
*CustomObjectsApi* | [**replace_namespaced_custom_object**](docs/CustomObjectsApi.md#replace_namespaced_custom_object) | **PUT** /apis/{group}/{version}/namespaces/{namespace}/{plural}/{name} |
623625
*EventsApi* | [**get_api_group**](docs/EventsApi.md#get_api_group) | **GET** /apis/events.k8s.io/ |

kubernetes/client/apis/custom_objects_api.py

Lines changed: 255 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,6 +1055,261 @@ def list_namespaced_custom_object_with_http_info(self, group, version, namespace
10551055
_request_timeout=params.get('_request_timeout'),
10561056
collection_formats=collection_formats)
10571057

1058+
def patch_cluster_custom_object(self, group, version, plural, name, body, **kwargs):
1059+
"""
1060+
patch the specified cluster scoped custom object
1061+
This method makes a synchronous HTTP request by default. To make an
1062+
asynchronous HTTP request, please pass async=True
1063+
>>> thread = api.patch_cluster_custom_object(group, version, plural, name, body, async=True)
1064+
>>> result = thread.get()
1065+
1066+
:param async bool
1067+
:param str group: the custom resource's group (required)
1068+
:param str version: the custom resource's version (required)
1069+
:param str plural: the custom object's plural name. For TPRs this would be lowercase plural kind. (required)
1070+
:param str name: the custom object's name (required)
1071+
:param object body: The JSON schema of the Resource to patch. (required)
1072+
:return: object
1073+
If the method is called asynchronously,
1074+
returns the request thread.
1075+
"""
1076+
kwargs['_return_http_data_only'] = True
1077+
if kwargs.get('async'):
1078+
return self.patch_cluster_custom_object_with_http_info(group, version, plural, name, body, **kwargs)
1079+
else:
1080+
(data) = self.patch_cluster_custom_object_with_http_info(group, version, plural, name, body, **kwargs)
1081+
return data
1082+
1083+
def patch_cluster_custom_object_with_http_info(self, group, version, plural, name, body, **kwargs):
1084+
"""
1085+
patch the specified cluster scoped custom object
1086+
This method makes a synchronous HTTP request by default. To make an
1087+
asynchronous HTTP request, please pass async=True
1088+
>>> thread = api.patch_cluster_custom_object_with_http_info(group, version, plural, name, body, async=True)
1089+
>>> result = thread.get()
1090+
1091+
:param async bool
1092+
:param str group: the custom resource's group (required)
1093+
:param str version: the custom resource's version (required)
1094+
:param str plural: the custom object's plural name. For TPRs this would be lowercase plural kind. (required)
1095+
:param str name: the custom object's name (required)
1096+
:param object body: The JSON schema of the Resource to patch. (required)
1097+
:return: object
1098+
If the method is called asynchronously,
1099+
returns the request thread.
1100+
"""
1101+
1102+
all_params = ['group', 'version', 'plural', 'name', 'body']
1103+
all_params.append('async')
1104+
all_params.append('_return_http_data_only')
1105+
all_params.append('_preload_content')
1106+
all_params.append('_request_timeout')
1107+
1108+
params = locals()
1109+
for key, val in iteritems(params['kwargs']):
1110+
if key not in all_params:
1111+
raise TypeError(
1112+
"Got an unexpected keyword argument '%s'"
1113+
" to method patch_cluster_custom_object" % key
1114+
)
1115+
params[key] = val
1116+
del params['kwargs']
1117+
# verify the required parameter 'group' is set
1118+
if ('group' not in params) or (params['group'] is None):
1119+
raise ValueError("Missing the required parameter `group` when calling `patch_cluster_custom_object`")
1120+
# verify the required parameter 'version' is set
1121+
if ('version' not in params) or (params['version'] is None):
1122+
raise ValueError("Missing the required parameter `version` when calling `patch_cluster_custom_object`")
1123+
# verify the required parameter 'plural' is set
1124+
if ('plural' not in params) or (params['plural'] is None):
1125+
raise ValueError("Missing the required parameter `plural` when calling `patch_cluster_custom_object`")
1126+
# verify the required parameter 'name' is set
1127+
if ('name' not in params) or (params['name'] is None):
1128+
raise ValueError("Missing the required parameter `name` when calling `patch_cluster_custom_object`")
1129+
# verify the required parameter 'body' is set
1130+
if ('body' not in params) or (params['body'] is None):
1131+
raise ValueError("Missing the required parameter `body` when calling `patch_cluster_custom_object`")
1132+
1133+
1134+
collection_formats = {}
1135+
1136+
path_params = {}
1137+
if 'group' in params:
1138+
path_params['group'] = params['group']
1139+
if 'version' in params:
1140+
path_params['version'] = params['version']
1141+
if 'plural' in params:
1142+
path_params['plural'] = params['plural']
1143+
if 'name' in params:
1144+
path_params['name'] = params['name']
1145+
1146+
query_params = []
1147+
1148+
header_params = {}
1149+
1150+
form_params = []
1151+
local_var_files = {}
1152+
1153+
body_params = None
1154+
if 'body' in params:
1155+
body_params = params['body']
1156+
# HTTP header `Accept`
1157+
header_params['Accept'] = self.api_client.\
1158+
select_header_accept(['application/json'])
1159+
1160+
# HTTP header `Content-Type`
1161+
header_params['Content-Type'] = self.api_client.\
1162+
select_header_content_type(['application/merge-patch+json'])
1163+
1164+
# Authentication setting
1165+
auth_settings = ['BearerToken']
1166+
1167+
return self.api_client.call_api('/apis/{group}/{version}/{plural}/{name}', 'PATCH',
1168+
path_params,
1169+
query_params,
1170+
header_params,
1171+
body=body_params,
1172+
post_params=form_params,
1173+
files=local_var_files,
1174+
response_type='object',
1175+
auth_settings=auth_settings,
1176+
async=params.get('async'),
1177+
_return_http_data_only=params.get('_return_http_data_only'),
1178+
_preload_content=params.get('_preload_content', True),
1179+
_request_timeout=params.get('_request_timeout'),
1180+
collection_formats=collection_formats)
1181+
1182+
def patch_namespaced_custom_object(self, group, version, namespace, plural, name, body, **kwargs):
1183+
"""
1184+
patch the specified namespace scoped custom object
1185+
This method makes a synchronous HTTP request by default. To make an
1186+
asynchronous HTTP request, please pass async=True
1187+
>>> thread = api.patch_namespaced_custom_object(group, version, namespace, plural, name, body, async=True)
1188+
>>> result = thread.get()
1189+
1190+
:param async bool
1191+
:param str group: the custom resource's group (required)
1192+
:param str version: the custom resource's version (required)
1193+
:param str namespace: The custom resource's namespace (required)
1194+
:param str plural: the custom resource's plural name. For TPRs this would be lowercase plural kind. (required)
1195+
:param str name: the custom object's name (required)
1196+
:param object body: The JSON schema of the Resource to patch. (required)
1197+
:return: object
1198+
If the method is called asynchronously,
1199+
returns the request thread.
1200+
"""
1201+
kwargs['_return_http_data_only'] = True
1202+
if kwargs.get('async'):
1203+
return self.patch_namespaced_custom_object_with_http_info(group, version, namespace, plural, name, body, **kwargs)
1204+
else:
1205+
(data) = self.patch_namespaced_custom_object_with_http_info(group, version, namespace, plural, name, body, **kwargs)
1206+
return data
1207+
1208+
def patch_namespaced_custom_object_with_http_info(self, group, version, namespace, plural, name, body, **kwargs):
1209+
"""
1210+
patch the specified namespace scoped custom object
1211+
This method makes a synchronous HTTP request by default. To make an
1212+
asynchronous HTTP request, please pass async=True
1213+
>>> thread = api.patch_namespaced_custom_object_with_http_info(group, version, namespace, plural, name, body, async=True)
1214+
>>> result = thread.get()
1215+
1216+
:param async bool
1217+
:param str group: the custom resource's group (required)
1218+
:param str version: the custom resource's version (required)
1219+
:param str namespace: The custom resource's namespace (required)
1220+
:param str plural: the custom resource's plural name. For TPRs this would be lowercase plural kind. (required)
1221+
:param str name: the custom object's name (required)
1222+
:param object body: The JSON schema of the Resource to patch. (required)
1223+
:return: object
1224+
If the method is called asynchronously,
1225+
returns the request thread.
1226+
"""
1227+
1228+
all_params = ['group', 'version', 'namespace', 'plural', 'name', 'body']
1229+
all_params.append('async')
1230+
all_params.append('_return_http_data_only')
1231+
all_params.append('_preload_content')
1232+
all_params.append('_request_timeout')
1233+
1234+
params = locals()
1235+
for key, val in iteritems(params['kwargs']):
1236+
if key not in all_params:
1237+
raise TypeError(
1238+
"Got an unexpected keyword argument '%s'"
1239+
" to method patch_namespaced_custom_object" % key
1240+
)
1241+
params[key] = val
1242+
del params['kwargs']
1243+
# verify the required parameter 'group' is set
1244+
if ('group' not in params) or (params['group'] is None):
1245+
raise ValueError("Missing the required parameter `group` when calling `patch_namespaced_custom_object`")
1246+
# verify the required parameter 'version' is set
1247+
if ('version' not in params) or (params['version'] is None):
1248+
raise ValueError("Missing the required parameter `version` when calling `patch_namespaced_custom_object`")
1249+
# verify the required parameter 'namespace' is set
1250+
if ('namespace' not in params) or (params['namespace'] is None):
1251+
raise ValueError("Missing the required parameter `namespace` when calling `patch_namespaced_custom_object`")
1252+
# verify the required parameter 'plural' is set
1253+
if ('plural' not in params) or (params['plural'] is None):
1254+
raise ValueError("Missing the required parameter `plural` when calling `patch_namespaced_custom_object`")
1255+
# verify the required parameter 'name' is set
1256+
if ('name' not in params) or (params['name'] is None):
1257+
raise ValueError("Missing the required parameter `name` when calling `patch_namespaced_custom_object`")
1258+
# verify the required parameter 'body' is set
1259+
if ('body' not in params) or (params['body'] is None):
1260+
raise ValueError("Missing the required parameter `body` when calling `patch_namespaced_custom_object`")
1261+
1262+
1263+
collection_formats = {}
1264+
1265+
path_params = {}
1266+
if 'group' in params:
1267+
path_params['group'] = params['group']
1268+
if 'version' in params:
1269+
path_params['version'] = params['version']
1270+
if 'namespace' in params:
1271+
path_params['namespace'] = params['namespace']
1272+
if 'plural' in params:
1273+
path_params['plural'] = params['plural']
1274+
if 'name' in params:
1275+
path_params['name'] = params['name']
1276+
1277+
query_params = []
1278+
1279+
header_params = {}
1280+
1281+
form_params = []
1282+
local_var_files = {}
1283+
1284+
body_params = None
1285+
if 'body' in params:
1286+
body_params = params['body']
1287+
# HTTP header `Accept`
1288+
header_params['Accept'] = self.api_client.\
1289+
select_header_accept(['application/json'])
1290+
1291+
# HTTP header `Content-Type`
1292+
header_params['Content-Type'] = self.api_client.\
1293+
select_header_content_type(['application/merge-patch+json'])
1294+
1295+
# Authentication setting
1296+
auth_settings = ['BearerToken']
1297+
1298+
return self.api_client.call_api('/apis/{group}/{version}/namespaces/{namespace}/{plural}/{name}', 'PATCH',
1299+
path_params,
1300+
query_params,
1301+
header_params,
1302+
body=body_params,
1303+
post_params=form_params,
1304+
files=local_var_files,
1305+
response_type='object',
1306+
auth_settings=auth_settings,
1307+
async=params.get('async'),
1308+
_return_http_data_only=params.get('_return_http_data_only'),
1309+
_preload_content=params.get('_preload_content', True),
1310+
_request_timeout=params.get('_request_timeout'),
1311+
collection_formats=collection_formats)
1312+
10581313
def replace_cluster_custom_object(self, group, version, plural, name, body, **kwargs):
10591314
"""
10601315
replace the specified cluster scoped custom object

kubernetes/client/models/v1beta1_webhook.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def name(self, name):
144144
def namespace_selector(self):
145145
"""
146146
Gets the namespace_selector of this V1beta1Webhook.
147-
NamespaceSelector decides whether to run the webhook on an object based on whether the namespace for that object matches the selector. If the object itself is a namespace, the matching is performed on object.metadata.labels. If the object is other cluster scoped resource, it is not subjected to the webhook. For example, to run the webhook on any objects whose namespace is not associated with \"runlevel\" of \"0\" or \"1\"; you will set the selector as follows: \"namespaceSelector\": { \"matchExpressions\": [ { \"key\": \"runlevel\", \"operator\": \"NotIn\", \"values\": [ \"0\", \"1\" ] } ] } If instead you want to only run the webhook on any objects whose namespace is associated with the \"environment\" of \"prod\" or \"staging\"; you will set the selector as follows: \"namespaceSelector\": { \"matchExpressions\": [ { \"key\": \"environment\", \"operator\": \"In\", \"values\": [ \"prod\", \"staging\" ] } ] } See https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ for more examples of label selectors. Default to the empty LabelSelector, which matches everything.
147+
NamespaceSelector decides whether to run the webhook on an object based on whether the namespace for that object matches the selector. If the object itself is a namespace, the matching is performed on object.metadata.labels. If the object is another cluster scoped resource, it never skips the webhook. For example, to run the webhook on any objects whose namespace is not associated with \"runlevel\" of \"0\" or \"1\"; you will set the selector as follows: \"namespaceSelector\": { \"matchExpressions\": [ { \"key\": \"runlevel\", \"operator\": \"NotIn\", \"values\": [ \"0\", \"1\" ] } ] } If instead you want to only run the webhook on any objects whose namespace is associated with the \"environment\" of \"prod\" or \"staging\"; you will set the selector as follows: \"namespaceSelector\": { \"matchExpressions\": [ { \"key\": \"environment\", \"operator\": \"In\", \"values\": [ \"prod\", \"staging\" ] } ] } See https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ for more examples of label selectors. Default to the empty LabelSelector, which matches everything.
148148
149149
:return: The namespace_selector of this V1beta1Webhook.
150150
:rtype: V1LabelSelector
@@ -155,7 +155,7 @@ def namespace_selector(self):
155155
def namespace_selector(self, namespace_selector):
156156
"""
157157
Sets the namespace_selector of this V1beta1Webhook.
158-
NamespaceSelector decides whether to run the webhook on an object based on whether the namespace for that object matches the selector. If the object itself is a namespace, the matching is performed on object.metadata.labels. If the object is other cluster scoped resource, it is not subjected to the webhook. For example, to run the webhook on any objects whose namespace is not associated with \"runlevel\" of \"0\" or \"1\"; you will set the selector as follows: \"namespaceSelector\": { \"matchExpressions\": [ { \"key\": \"runlevel\", \"operator\": \"NotIn\", \"values\": [ \"0\", \"1\" ] } ] } If instead you want to only run the webhook on any objects whose namespace is associated with the \"environment\" of \"prod\" or \"staging\"; you will set the selector as follows: \"namespaceSelector\": { \"matchExpressions\": [ { \"key\": \"environment\", \"operator\": \"In\", \"values\": [ \"prod\", \"staging\" ] } ] } See https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ for more examples of label selectors. Default to the empty LabelSelector, which matches everything.
158+
NamespaceSelector decides whether to run the webhook on an object based on whether the namespace for that object matches the selector. If the object itself is a namespace, the matching is performed on object.metadata.labels. If the object is another cluster scoped resource, it never skips the webhook. For example, to run the webhook on any objects whose namespace is not associated with \"runlevel\" of \"0\" or \"1\"; you will set the selector as follows: \"namespaceSelector\": { \"matchExpressions\": [ { \"key\": \"runlevel\", \"operator\": \"NotIn\", \"values\": [ \"0\", \"1\" ] } ] } If instead you want to only run the webhook on any objects whose namespace is associated with the \"environment\" of \"prod\" or \"staging\"; you will set the selector as follows: \"namespaceSelector\": { \"matchExpressions\": [ { \"key\": \"environment\", \"operator\": \"In\", \"values\": [ \"prod\", \"staging\" ] } ] } See https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ for more examples of label selectors. Default to the empty LabelSelector, which matches everything.
159159
160160
:param namespace_selector: The namespace_selector of this V1beta1Webhook.
161161
:type: V1LabelSelector

0 commit comments

Comments
 (0)