diff --git a/kubernetes/README.md b/kubernetes/README.md index 2dcbfe6e2..13ccabe21 100644 --- a/kubernetes/README.md +++ b/kubernetes/README.md @@ -606,6 +606,11 @@ Class | Method | HTTP request | Description *StorageV1beta1Api* | [**patch_storage_class**](docs/StorageV1beta1Api.md#patch_storage_class) | **PATCH** /apis/storage.k8s.io/v1beta1/storageclasses/{name} | *StorageV1beta1Api* | [**read_storage_class**](docs/StorageV1beta1Api.md#read_storage_class) | **GET** /apis/storage.k8s.io/v1beta1/storageclasses/{name} | *StorageV1beta1Api* | [**replace_storage_class**](docs/StorageV1beta1Api.md#replace_storage_class) | **PUT** /apis/storage.k8s.io/v1beta1/storageclasses/{name} | +*ThirdPartyResourcesApi* | [**create_third_party_resource**](docs/ThirdPartyResourcesApi.md#create_third_party_resource) | **POST** /apis/{fqdn}/v1/namespaces/{namespace}/{resource} | Create a Resource +*ThirdPartyResourcesApi* | [**delete_third_party_resource**](docs/ThirdPartyResourcesApi.md#delete_third_party_resource) | **DELETE** /apis/{fqdn}/v1/namespaces/{namespace}/{resource}/{name} | Deletes a specific Resource +*ThirdPartyResourcesApi* | [**get_third_party_resource**](docs/ThirdPartyResourcesApi.md#get_third_party_resource) | **GET** /apis/{fqdn}/v1/namespaces/{namespace}/{resource}/{name} | Gets a specific Resource +*ThirdPartyResourcesApi* | [**list_third_party_resource**](docs/ThirdPartyResourcesApi.md#list_third_party_resource) | **GET** /apis/{fqdn}/v1/{resource} | Gets Resources +*ThirdPartyResourcesApi* | [**update_third_party_resource**](docs/ThirdPartyResourcesApi.md#update_third_party_resource) | **PUT** /apis/{fqdn}/v1/namespaces/{namespace}/{resource}/{name} | Update a Resource *VersionApi* | [**get_code**](docs/VersionApi.md#get_code) | **GET** /version/ | diff --git a/kubernetes/client/__init__.py b/kubernetes/client/__init__.py index 379d4584b..72e631e8f 100644 --- a/kubernetes/client/__init__.py +++ b/kubernetes/client/__init__.py @@ -373,6 +373,7 @@ from .apis.settings_v1alpha1_api import SettingsV1alpha1Api from .apis.storage_api import StorageApi from .apis.storage_v1_api import StorageV1Api from .apis.storage_v1beta1_api import StorageV1beta1Api +from .apis.third_party_resources_api import ThirdPartyResourcesApi from .apis.version_api import VersionApi # import ApiClient diff --git a/kubernetes/client/apis/__init__.py b/kubernetes/client/apis/__init__.py index ca1f5b9bc..b666fd8d7 100644 --- a/kubernetes/client/apis/__init__.py +++ b/kubernetes/client/apis/__init__.py @@ -33,4 +33,5 @@ from .settings_v1alpha1_api import SettingsV1alpha1Api from .storage_api import StorageApi from .storage_v1_api import StorageV1Api from .storage_v1beta1_api import StorageV1beta1Api +from .third_party_resources_api import ThirdPartyResourcesApi from .version_api import VersionApi diff --git a/kubernetes/client/apis/third_party_resources_api.py b/kubernetes/client/apis/third_party_resources_api.py new file mode 100644 index 000000000..cf18c3ba2 --- /dev/null +++ b/kubernetes/client/apis/third_party_resources_api.py @@ -0,0 +1,622 @@ +# coding: utf-8 + +""" + Kubernetes + + No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + + OpenAPI spec version: v1.6.3 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import sys +import os +import re + +# python 2 and python 3 compatibility library +from six import iteritems + +from ..configuration import Configuration +from ..api_client import ApiClient + + +class ThirdPartyResourcesApi(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + config = Configuration() + if api_client: + self.api_client = api_client + else: + if not config.api_client: + config.api_client = ApiClient() + self.api_client = config.api_client + + def create_third_party_resource(self, namespace, fqdn, resource, body, **kwargs): + """ + Create a Resource + Creates a third party resource of the type specified + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please define a `callback` function + to be invoked when receiving the response. + >>> def callback_function(response): + >>> pprint(response) + >>> + >>> thread = api.create_third_party_resource(namespace, fqdn, resource, body, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str namespace: The Resource's namespace (required) + :param str fqdn: The Third party Resource fqdn (required) + :param str resource: The Resource type (required) + :param object body: The JSON schema of the Resource to create. (required) + :return: object + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('callback'): + return self.create_third_party_resource_with_http_info(namespace, fqdn, resource, body, **kwargs) + else: + (data) = self.create_third_party_resource_with_http_info(namespace, fqdn, resource, body, **kwargs) + return data + + def create_third_party_resource_with_http_info(self, namespace, fqdn, resource, body, **kwargs): + """ + Create a Resource + Creates a third party resource of the type specified + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please define a `callback` function + to be invoked when receiving the response. + >>> def callback_function(response): + >>> pprint(response) + >>> + >>> thread = api.create_third_party_resource_with_http_info(namespace, fqdn, resource, body, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str namespace: The Resource's namespace (required) + :param str fqdn: The Third party Resource fqdn (required) + :param str resource: The Resource type (required) + :param object body: The JSON schema of the Resource to create. (required) + :return: object + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['namespace', 'fqdn', 'resource', 'body'] + all_params.append('callback') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method create_third_party_resource" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'namespace' is set + if ('namespace' not in params) or (params['namespace'] is None): + raise ValueError("Missing the required parameter `namespace` when calling `create_third_party_resource`") + # verify the required parameter 'fqdn' is set + if ('fqdn' not in params) or (params['fqdn'] is None): + raise ValueError("Missing the required parameter `fqdn` when calling `create_third_party_resource`") + # verify the required parameter 'resource' is set + if ('resource' not in params) or (params['resource'] is None): + raise ValueError("Missing the required parameter `resource` when calling `create_third_party_resource`") + # verify the required parameter 'body' is set + if ('body' not in params) or (params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `create_third_party_resource`") + + + collection_formats = {} + + resource_path = '/apis/{fqdn}/v1/namespaces/{namespace}/{resource}'.replace('{format}', 'json') + path_params = {} + if 'namespace' in params: + path_params['namespace'] = params['namespace'] + if 'fqdn' in params: + path_params['fqdn'] = params['fqdn'] + if 'resource' in params: + path_params['resource'] = params['resource'] + + query_params = {} + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # Authentication setting + auth_settings = [] + + return self.api_client.call_api(resource_path, 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='object', + auth_settings=auth_settings, + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_third_party_resource(self, body, **kwargs): + """ + Deletes a specific Resource + Deletes the specified Resource in the specified namespace + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please define a `callback` function + to be invoked when receiving the response. + >>> def callback_function(response): + >>> pprint(response) + >>> + >>> thread = api.delete_third_party_resource(body, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param V1DeleteOptions body: (required) + :param int grace_period_seconds: 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. + :param bool orphan_dependents: 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. + :param str propagation_policy: 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. + :return: object + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('callback'): + return self.delete_third_party_resource_with_http_info(body, **kwargs) + else: + (data) = self.delete_third_party_resource_with_http_info(body, **kwargs) + return data + + def delete_third_party_resource_with_http_info(self, body, **kwargs): + """ + Deletes a specific Resource + Deletes the specified Resource in the specified namespace + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please define a `callback` function + to be invoked when receiving the response. + >>> def callback_function(response): + >>> pprint(response) + >>> + >>> thread = api.delete_third_party_resource_with_http_info(body, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param V1DeleteOptions body: (required) + :param int grace_period_seconds: 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. + :param bool orphan_dependents: 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. + :param str propagation_policy: 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. + :return: object + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'grace_period_seconds', 'orphan_dependents', 'propagation_policy'] + all_params.append('callback') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_third_party_resource" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params) or (params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `delete_third_party_resource`") + + + collection_formats = {} + + resource_path = '/apis/{fqdn}/v1/namespaces/{namespace}/{resource}/{name}'.replace('{format}', 'json') + path_params = {} + + query_params = {} + if 'grace_period_seconds' in params: + query_params['gracePeriodSeconds'] = params['grace_period_seconds'] + if 'orphan_dependents' in params: + query_params['orphanDependents'] = params['orphan_dependents'] + if 'propagation_policy' in params: + query_params['propagationPolicy'] = params['propagation_policy'] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # Authentication setting + auth_settings = [] + + return self.api_client.call_api(resource_path, 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='object', + auth_settings=auth_settings, + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_third_party_resource(self, namespace, name, fqdn, resource, **kwargs): + """ + Gets a specific Resource + Returns a specific Resource in a namespace + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please define a `callback` function + to be invoked when receiving the response. + >>> def callback_function(response): + >>> pprint(response) + >>> + >>> thread = api.get_third_party_resource(namespace, name, fqdn, resource, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str namespace: The Resource's namespace (required) + :param str name: The Resource's name (required) + :param str fqdn: The Third party Resource fqdn (required) + :param str resource: The Resource type (required) + :return: object + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('callback'): + return self.get_third_party_resource_with_http_info(namespace, name, fqdn, resource, **kwargs) + else: + (data) = self.get_third_party_resource_with_http_info(namespace, name, fqdn, resource, **kwargs) + return data + + def get_third_party_resource_with_http_info(self, namespace, name, fqdn, resource, **kwargs): + """ + Gets a specific Resource + Returns a specific Resource in a namespace + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please define a `callback` function + to be invoked when receiving the response. + >>> def callback_function(response): + >>> pprint(response) + >>> + >>> thread = api.get_third_party_resource_with_http_info(namespace, name, fqdn, resource, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str namespace: The Resource's namespace (required) + :param str name: The Resource's name (required) + :param str fqdn: The Third party Resource fqdn (required) + :param str resource: The Resource type (required) + :return: object + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['namespace', 'name', 'fqdn', 'resource'] + all_params.append('callback') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_third_party_resource" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'namespace' is set + if ('namespace' not in params) or (params['namespace'] is None): + raise ValueError("Missing the required parameter `namespace` when calling `get_third_party_resource`") + # verify the required parameter 'name' is set + if ('name' not in params) or (params['name'] is None): + raise ValueError("Missing the required parameter `name` when calling `get_third_party_resource`") + # verify the required parameter 'fqdn' is set + if ('fqdn' not in params) or (params['fqdn'] is None): + raise ValueError("Missing the required parameter `fqdn` when calling `get_third_party_resource`") + # verify the required parameter 'resource' is set + if ('resource' not in params) or (params['resource'] is None): + raise ValueError("Missing the required parameter `resource` when calling `get_third_party_resource`") + + + collection_formats = {} + + resource_path = '/apis/{fqdn}/v1/namespaces/{namespace}/{resource}/{name}'.replace('{format}', 'json') + path_params = {} + if 'namespace' in params: + path_params['namespace'] = params['namespace'] + if 'name' in params: + path_params['name'] = params['name'] + if 'fqdn' in params: + path_params['fqdn'] = params['fqdn'] + if 'resource' in params: + path_params['resource'] = params['resource'] + + query_params = {} + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # Authentication setting + auth_settings = [] + + return self.api_client.call_api(resource_path, 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='object', + auth_settings=auth_settings, + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def list_third_party_resource(self, fqdn, resource, **kwargs): + """ + Gets Resources + Returns a list of Resources + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please define a `callback` function + to be invoked when receiving the response. + >>> def callback_function(response): + >>> pprint(response) + >>> + >>> thread = api.list_third_party_resource(fqdn, resource, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str fqdn: The Third party Resource fqdn (required) + :param str resource: The Resource type (required) + :param bool watch: Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion. + :return: object + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('callback'): + return self.list_third_party_resource_with_http_info(fqdn, resource, **kwargs) + else: + (data) = self.list_third_party_resource_with_http_info(fqdn, resource, **kwargs) + return data + + def list_third_party_resource_with_http_info(self, fqdn, resource, **kwargs): + """ + Gets Resources + Returns a list of Resources + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please define a `callback` function + to be invoked when receiving the response. + >>> def callback_function(response): + >>> pprint(response) + >>> + >>> thread = api.list_third_party_resource_with_http_info(fqdn, resource, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str fqdn: The Third party Resource fqdn (required) + :param str resource: The Resource type (required) + :param bool watch: Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion. + :return: object + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['fqdn', 'resource', 'watch'] + all_params.append('callback') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method list_third_party_resource" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'fqdn' is set + if ('fqdn' not in params) or (params['fqdn'] is None): + raise ValueError("Missing the required parameter `fqdn` when calling `list_third_party_resource`") + # verify the required parameter 'resource' is set + if ('resource' not in params) or (params['resource'] is None): + raise ValueError("Missing the required parameter `resource` when calling `list_third_party_resource`") + + + collection_formats = {} + + resource_path = '/apis/{fqdn}/v1/{resource}'.replace('{format}', 'json') + path_params = {} + if 'fqdn' in params: + path_params['fqdn'] = params['fqdn'] + if 'resource' in params: + path_params['resource'] = params['resource'] + + query_params = {} + if 'watch' in params: + query_params['watch'] = params['watch'] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # Authentication setting + auth_settings = [] + + return self.api_client.call_api(resource_path, 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='object', + auth_settings=auth_settings, + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def update_third_party_resource(self, namespace, fqdn, resource, body, **kwargs): + """ + Update a Resource + Update the specified third party resource of the type specified + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please define a `callback` function + to be invoked when receiving the response. + >>> def callback_function(response): + >>> pprint(response) + >>> + >>> thread = api.update_third_party_resource(namespace, fqdn, resource, body, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str namespace: The Resource's namespace (required) + :param str fqdn: The Third party Resource fqdn (required) + :param str resource: The Resource type (required) + :param object body: The JSON schema of the Resource to create. (required) + :return: object + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('callback'): + return self.update_third_party_resource_with_http_info(namespace, fqdn, resource, body, **kwargs) + else: + (data) = self.update_third_party_resource_with_http_info(namespace, fqdn, resource, body, **kwargs) + return data + + def update_third_party_resource_with_http_info(self, namespace, fqdn, resource, body, **kwargs): + """ + Update a Resource + Update the specified third party resource of the type specified + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please define a `callback` function + to be invoked when receiving the response. + >>> def callback_function(response): + >>> pprint(response) + >>> + >>> thread = api.update_third_party_resource_with_http_info(namespace, fqdn, resource, body, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str namespace: The Resource's namespace (required) + :param str fqdn: The Third party Resource fqdn (required) + :param str resource: The Resource type (required) + :param object body: The JSON schema of the Resource to create. (required) + :return: object + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['namespace', 'fqdn', 'resource', 'body'] + all_params.append('callback') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_third_party_resource" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'namespace' is set + if ('namespace' not in params) or (params['namespace'] is None): + raise ValueError("Missing the required parameter `namespace` when calling `update_third_party_resource`") + # verify the required parameter 'fqdn' is set + if ('fqdn' not in params) or (params['fqdn'] is None): + raise ValueError("Missing the required parameter `fqdn` when calling `update_third_party_resource`") + # verify the required parameter 'resource' is set + if ('resource' not in params) or (params['resource'] is None): + raise ValueError("Missing the required parameter `resource` when calling `update_third_party_resource`") + # verify the required parameter 'body' is set + if ('body' not in params) or (params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `update_third_party_resource`") + + + collection_formats = {} + + resource_path = '/apis/{fqdn}/v1/namespaces/{namespace}/{resource}/{name}'.replace('{format}', 'json') + path_params = {} + if 'namespace' in params: + path_params['namespace'] = params['namespace'] + if 'fqdn' in params: + path_params['fqdn'] = params['fqdn'] + if 'resource' in params: + path_params['resource'] = params['resource'] + + query_params = {} + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # Authentication setting + auth_settings = [] + + return self.api_client.call_api(resource_path, 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='object', + auth_settings=auth_settings, + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/kubernetes/docs/ThirdPartyResourcesApi.md b/kubernetes/docs/ThirdPartyResourcesApi.md new file mode 100644 index 000000000..e5cca4ad4 --- /dev/null +++ b/kubernetes/docs/ThirdPartyResourcesApi.md @@ -0,0 +1,281 @@ +# kubernetes.client.ThirdPartyResourcesApi + +All URIs are relative to *https://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_third_party_resource**](ThirdPartyResourcesApi.md#create_third_party_resource) | **POST** /apis/{fqdn}/v1/namespaces/{namespace}/{resource} | Create a Resource +[**delete_third_party_resource**](ThirdPartyResourcesApi.md#delete_third_party_resource) | **DELETE** /apis/{fqdn}/v1/namespaces/{namespace}/{resource}/{name} | Deletes a specific Resource +[**get_third_party_resource**](ThirdPartyResourcesApi.md#get_third_party_resource) | **GET** /apis/{fqdn}/v1/namespaces/{namespace}/{resource}/{name} | Gets a specific Resource +[**list_third_party_resource**](ThirdPartyResourcesApi.md#list_third_party_resource) | **GET** /apis/{fqdn}/v1/{resource} | Gets Resources +[**update_third_party_resource**](ThirdPartyResourcesApi.md#update_third_party_resource) | **PUT** /apis/{fqdn}/v1/namespaces/{namespace}/{resource}/{name} | Update a Resource + + +# **create_third_party_resource** +> object create_third_party_resource(namespace, fqdn, resource, body) + +Create a Resource + +Creates a third party resource of the type specified + +### Example +```python +from __future__ import print_statement +import time +import kubernetes.client +from kubernetes.client.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = kubernetes.client.ThirdPartyResourcesApi() +namespace = 'namespace_example' # str | The Resource's namespace +fqdn = 'fqdn_example' # str | The Third party Resource fqdn +resource = 'resource_example' # str | The Resource type +body = NULL # object | The JSON schema of the Resource to create. + +try: + # Create a Resource + api_response = api_instance.create_third_party_resource(namespace, fqdn, resource, body) + pprint(api_response) +except ApiException as e: + print("Exception when calling ThirdPartyResourcesApi->create_third_party_resource: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **namespace** | **str**| The Resource's namespace | + **fqdn** | **str**| The Third party Resource fqdn | + **resource** | **str**| The Resource type | + **body** | **object**| The JSON schema of the Resource to create. | + +### Return type + +**object** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **delete_third_party_resource** +> object delete_third_party_resource(body, grace_period_seconds=grace_period_seconds, orphan_dependents=orphan_dependents, propagation_policy=propagation_policy) + +Deletes a specific Resource + +Deletes the specified Resource in the specified namespace + +### Example +```python +from __future__ import print_statement +import time +import kubernetes.client +from kubernetes.client.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = kubernetes.client.ThirdPartyResourcesApi() +body = kubernetes.client.V1DeleteOptions() # V1DeleteOptions | +grace_period_seconds = 56 # int | 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. (optional) +orphan_dependents = true # bool | 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. (optional) +propagation_policy = 'propagation_policy_example' # str | 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. (optional) + +try: + # Deletes a specific Resource + api_response = api_instance.delete_third_party_resource(body, grace_period_seconds=grace_period_seconds, orphan_dependents=orphan_dependents, propagation_policy=propagation_policy) + pprint(api_response) +except ApiException as e: + print("Exception when calling ThirdPartyResourcesApi->delete_third_party_resource: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**V1DeleteOptions**](V1DeleteOptions.md)| | + **grace_period_seconds** | **int**| 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. | [optional] + **orphan_dependents** | **bool**| 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. | [optional] + **propagation_policy** | **str**| 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. | [optional] + +### Return type + +**object** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_third_party_resource** +> object get_third_party_resource(namespace, name, fqdn, resource) + +Gets a specific Resource + +Returns a specific Resource in a namespace + +### Example +```python +from __future__ import print_statement +import time +import kubernetes.client +from kubernetes.client.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = kubernetes.client.ThirdPartyResourcesApi() +namespace = 'namespace_example' # str | The Resource's namespace +name = 'name_example' # str | The Resource's name +fqdn = 'fqdn_example' # str | The Third party Resource fqdn +resource = 'resource_example' # str | The Resource type + +try: + # Gets a specific Resource + api_response = api_instance.get_third_party_resource(namespace, name, fqdn, resource) + pprint(api_response) +except ApiException as e: + print("Exception when calling ThirdPartyResourcesApi->get_third_party_resource: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **namespace** | **str**| The Resource's namespace | + **name** | **str**| The Resource's name | + **fqdn** | **str**| The Third party Resource fqdn | + **resource** | **str**| The Resource type | + +### Return type + +**object** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **list_third_party_resource** +> object list_third_party_resource(fqdn, resource, watch=watch) + +Gets Resources + +Returns a list of Resources + +### Example +```python +from __future__ import print_statement +import time +import kubernetes.client +from kubernetes.client.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = kubernetes.client.ThirdPartyResourcesApi() +fqdn = 'fqdn_example' # str | The Third party Resource fqdn +resource = 'resource_example' # str | The Resource type +watch = true # bool | Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion. (optional) + +try: + # Gets Resources + api_response = api_instance.list_third_party_resource(fqdn, resource, watch=watch) + pprint(api_response) +except ApiException as e: + print("Exception when calling ThirdPartyResourcesApi->list_third_party_resource: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **fqdn** | **str**| The Third party Resource fqdn | + **resource** | **str**| The Resource type | + **watch** | **bool**| Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion. | [optional] + +### Return type + +**object** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **update_third_party_resource** +> object update_third_party_resource(namespace, fqdn, resource, body) + +Update a Resource + +Update the specified third party resource of the type specified + +### Example +```python +from __future__ import print_statement +import time +import kubernetes.client +from kubernetes.client.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = kubernetes.client.ThirdPartyResourcesApi() +namespace = 'namespace_example' # str | The Resource's namespace +fqdn = 'fqdn_example' # str | The Third party Resource fqdn +resource = 'resource_example' # str | The Resource type +body = NULL # object | The JSON schema of the Resource to create. + +try: + # Update a Resource + api_response = api_instance.update_third_party_resource(namespace, fqdn, resource, body) + pprint(api_response) +except ApiException as e: + print("Exception when calling ThirdPartyResourcesApi->update_third_party_resource: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **namespace** | **str**| The Resource's namespace | + **fqdn** | **str**| The Third party Resource fqdn | + **resource** | **str**| The Resource type | + **body** | **object**| The JSON schema of the Resource to create. | + +### Return type + +**object** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/kubernetes/test/test_third_party_resources_api.py b/kubernetes/test/test_third_party_resources_api.py new file mode 100644 index 000000000..39f99d089 --- /dev/null +++ b/kubernetes/test/test_third_party_resources_api.py @@ -0,0 +1,76 @@ +# coding: utf-8 + +""" + Kubernetes + + No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + + OpenAPI spec version: v1.6.3 + + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import kubernetes.client +from kubernetes.client.rest import ApiException +from kubernetes.client.apis.third_party_resources_api import ThirdPartyResourcesApi + + +class TestThirdPartyResourcesApi(unittest.TestCase): + """ ThirdPartyResourcesApi unit test stubs """ + + def setUp(self): + self.api = kubernetes.client.apis.third_party_resources_api.ThirdPartyResourcesApi() + + def tearDown(self): + pass + + def test_create_third_party_resource(self): + """ + Test case for create_third_party_resource + + Create a Resource + """ + pass + + def test_delete_third_party_resource(self): + """ + Test case for delete_third_party_resource + + Deletes a specific Resource + """ + pass + + def test_get_third_party_resource(self): + """ + Test case for get_third_party_resource + + Gets a specific Resource + """ + pass + + def test_list_third_party_resource(self): + """ + Test case for list_third_party_resource + + Gets Resources + """ + pass + + def test_update_third_party_resource(self): + """ + Test case for update_third_party_resource + + Update a Resource + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/scripts/preprocess_spec.py b/scripts/preprocess_spec.py index da5352611..6a903b9e6 100644 --- a/scripts/preprocess_spec.py +++ b/scripts/preprocess_spec.py @@ -34,6 +34,8 @@ SPEC_URL = 'https://raw.githubusercontent.com/kubernetes/kubernetes/' \ OUTPUT_PATH = os.path.join(os.path.dirname(__file__), 'swagger.json') +TPR_SPEC_PATH = os.path.join(os.path.dirname(__file__), 'thirdpartypaths.json') + _ops = ['get', 'put', 'post', 'delete', 'options', 'head', 'patch'] @@ -103,7 +105,7 @@ def strip_tags_from_operation_id(operation, _): def add_thirdparty_resource_paths(spec): - with open('thirdpartypaths.json', 'r') as third_party_spec_file: + with open(TPR_SPEC_PATH, 'r') as third_party_spec_file: third_party_spec = json.loads(third_party_spec_file.read()) for path in third_party_spec.keys(): if path not in spec['paths'].keys(): diff --git a/scripts/swagger.json b/scripts/swagger.json index f2af8a2c9..3b352f606 100644 --- a/scripts/swagger.json +++ b/scripts/swagger.json @@ -33315,6 +33315,265 @@ } } } + }, + "/apis/{fqdn}/v1/{resource}": { + "get": { + "responses": { + "200": { + "description": "A list of Resources", + "schema": { + "type": "object" + } + } + }, + "description": "Returns a list of Resources", + "parameters": [ + { + "uniqueItems": true, + "in": "query", + "type": "boolean", + "name": "watch", + "description": "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion." + }, + { + "description": "The Third party Resource fqdn", + "required": true, + "type": "string", + "name": "fqdn", + "in": "path" + }, + { + "description": "The Resource type", + "required": true, + "type": "string", + "name": "resource", + "in": "path" + } + ], + "tags": [ + "third_party_resources" + ], + "summary": "Gets Resources", + "security": [ + { + "Bearer": [] + } + ], + "operationId": "listThirdPartyResource" + } + }, + "/apis/{fqdn}/v1/namespaces/{namespace}/{resource}/{name}": { + "put": { + "responses": { + "201": { + "description": "A list of Resources", + "schema": { + "type": "object" + } + } + }, + "description": "Update the specified third party resource of the type specified", + "parameters": [ + { + "description": "The Resource's namespace", + "required": true, + "type": "string", + "name": "namespace", + "in": "path" + }, + { + "description": "The Third party Resource fqdn", + "required": true, + "type": "string", + "name": "fqdn", + "in": "path" + }, + { + "description": "The Resource type", + "required": true, + "type": "string", + "name": "resource", + "in": "path" + }, + { + "schema": { + "type": "object" + }, + "description": "The JSON schema of the Resource to create.", + "required": true, + "name": "body", + "in": "body" + } + ], + "tags": [ + "third_party_resources" + ], + "summary": "Update a Resource", + "security": [ + { + "Bearer": [] + } + ], + "operationId": "updateThirdPartyResource" + }, + "delete": { + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object" + } + } + }, + "description": "Deletes the specified Resource in the specified namespace", + "parameters": [ + { + "schema": { + "$ref": "#/definitions/v1.DeleteOptions" + }, + "required": true, + "name": "body", + "in": "body" + }, + { + "uniqueItems": true, + "in": "query", + "type": "integer", + "name": "gracePeriodSeconds", + "description": "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." + }, + { + "uniqueItems": true, + "in": "query", + "type": "boolean", + "name": "orphanDependents", + "description": "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." + }, + { + "uniqueItems": true, + "in": "query", + "type": "string", + "name": "propagationPolicy", + "description": "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." + } + ], + "tags": [ + "third_party_resources" + ], + "summary": "Deletes a specific Resource", + "security": [ + { + "Bearer": [] + } + ], + "operationId": "deleteThirdPartyResource" + }, + "get": { + "responses": { + "200": { + "description": "A single Resource", + "schema": { + "type": "object" + } + } + }, + "description": "Returns a specific Resource in a namespace", + "parameters": [ + { + "description": "The Resource's namespace", + "required": true, + "type": "string", + "name": "namespace", + "in": "path" + }, + { + "description": "The Resource's name", + "required": true, + "type": "string", + "name": "name", + "in": "path" + }, + { + "description": "The Third party Resource fqdn", + "required": true, + "type": "string", + "name": "fqdn", + "in": "path" + }, + { + "description": "The Resource type", + "required": true, + "type": "string", + "name": "resource", + "in": "path" + } + ], + "tags": [ + "third_party_resources" + ], + "summary": "Gets a specific Resource", + "security": [ + { + "Bearer": [] + } + ], + "operationId": "getThirdPartyResource" + } + }, + "/apis/{fqdn}/v1/namespaces/{namespace}/{resource}": { + "post": { + "responses": { + "201": { + "description": "A list of Resources", + "schema": { + "type": "object" + } + } + }, + "description": "Creates a third party resource of the type specified", + "parameters": [ + { + "description": "The Resource's namespace", + "required": true, + "type": "string", + "name": "namespace", + "in": "path" + }, + { + "description": "The Third party Resource fqdn", + "required": true, + "type": "string", + "name": "fqdn", + "in": "path" + }, + { + "description": "The Resource type", + "required": true, + "type": "string", + "name": "resource", + "in": "path" + }, + { + "schema": { + "type": "object" + }, + "description": "The JSON schema of the Resource to create.", + "required": true, + "name": "body", + "in": "body" + } + ], + "tags": [ + "third_party_resources" + ], + "summary": "Create a Resource", + "security": [ + { + "Bearer": [] + } + ], + "operationId": "createThirdPartyResource" + } } }, "definitions": { diff --git a/scripts/thirdpartypaths.json b/scripts/thirdpartypaths.json index 5dd01f4cc..367df9e96 100644 --- a/scripts/thirdpartypaths.json +++ b/scripts/thirdpartypaths.json @@ -1,6 +1,7 @@ { "/apis/{fqdn}/v1/{resource}": { "get": { + "operationId": "listThirdPartyResource", "security": [ { "Bearer": [ @@ -48,6 +49,7 @@ }, "/apis/{fqdn}/v1/namespaces/{namespace}/{resource}": { "post": { + "operationId": "createThirdPartyResource", "security": [ { "Bearer": [ @@ -104,6 +106,7 @@ }, "/apis/{fqdn}/v1/namespaces/{namespace}/{resource}/{name}": { "get": { + "operationId": "getThirdPartyResource", "security": [ { "Bearer": [ @@ -156,6 +159,7 @@ } }, "delete": { + "operationId": "deleteThirdPartyResource", "security": [ { "Bearer": [ @@ -209,6 +213,7 @@ } }, "put": { + "operationId": "updateThirdPartyResource", "security": [ { "Bearer": [ @@ -216,8 +221,8 @@ ] } ], - "summary": "Replace a Resource", - "description": "Replaces the specified third party resource of the type specified", + "summary": "Update a Resource", + "description": "Update the specified third party resource of the type specified", "tags": [ "third_party_resources" ],