Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] feat: client generated by openapi-generator #738

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions kubernetes/.openapi-generator/COMMIT
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Requested Commit: v3.3.4
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kubernete/.swagger-codegen is deleted, openapi-generator uses kubernetes/.openapi-generator and also .openapi-generator-ignore instead of .swagger-codegen-ignore (renamed).

Actual Commit: 2353d71d4b02be6dbabe25aac1a9e56eb3b812a2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since its been a while can you bump this to v4.0.3, commit 203fc812bda4267020165e656f55185f72df4cc0?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also just curious, how often would the version need to be bumped in the future?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that we rarely bump the version of swagger-codegen right now.

1 change: 1 addition & 0 deletions kubernetes/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.3.4
1 change: 1 addition & 0 deletions kubernetes/.openapi-generator/swagger.json.sha256
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b91982e3c7d98cbe1b39dc348ce2ba7499db73e8007b0d2a9ce4d633c564b272
23 changes: 13 additions & 10 deletions kubernetes/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# kubernetes.client
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: v1.13.1
- API version: v1.13.3
- Package version: 9.0.0-snapshot
- Build package: io.swagger.codegen.languages.PythonClientCodegen
- Build package: org.openapitools.codegen.languages.PythonClientCodegen

## Requirements.

Expand All @@ -17,9 +17,9 @@ Python 2.7 and 3.4+
If the python package is hosted on Github, you can install directly from Github

```sh
pip install git+https://github.com/kubernetes-client/python.git
pip install git+https://github.com/kubernetes-kubernetes.client/python.git
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these changed to this weird URL?

```
(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/kubernetes-client/python.git`)
(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/kubernetes-kubernetes.client/python.git`)

Then import the package:
```python
Expand Down Expand Up @@ -52,11 +52,13 @@ from kubernetes.client.rest import ApiException
from pprint import pprint

# Configure API key authorization: BearerToken
kubernetes.client.configuration.api_key['authorization'] = 'YOUR_API_KEY'
configuration = kubernetes.client.Configuration()
configuration.api_key['authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# kubernetes.client.configuration.api_key_prefix['authorization'] = 'Bearer'
# configuration.api_key_prefix['authorization'] = 'Bearer'

# create an instance of the API class
api_instance = kubernetes.client.AdmissionregistrationApi()
api_instance = kubernetes.client.AdmissionregistrationApi(kubernetes.client.ApiClient(configuration))

try:
api_response = api_instance.get_api_group()
Expand All @@ -68,7 +70,7 @@ except ApiException as e:

## Documentation for API Endpoints

All URIs are relative to *https://localhost*
All URIs are relative to *http://localhost*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also curious why it's http now instead of https?


Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
Expand Down Expand Up @@ -1511,3 +1513,4 @@ Class | Method | HTTP request | Description




1,283 changes: 642 additions & 641 deletions kubernetes/client/__init__.py

Large diffs are not rendered by default.

64 changes: 64 additions & 0 deletions kubernetes/client/api/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
from __future__ import absolute_import

# flake8: noqa

# import apis into api package
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This packages is renamed from apis to api.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, why did you change it from apis to api?

from kubernetes.client.api.admissionregistration_api import AdmissionregistrationApi
from kubernetes.client.api.admissionregistration_v1alpha1_api import AdmissionregistrationV1alpha1Api
from kubernetes.client.api.admissionregistration_v1beta1_api import AdmissionregistrationV1beta1Api
from kubernetes.client.api.apiextensions_api import ApiextensionsApi
from kubernetes.client.api.apiextensions_v1beta1_api import ApiextensionsV1beta1Api
from kubernetes.client.api.apiregistration_api import ApiregistrationApi
from kubernetes.client.api.apiregistration_v1_api import ApiregistrationV1Api
from kubernetes.client.api.apiregistration_v1beta1_api import ApiregistrationV1beta1Api
from kubernetes.client.api.apis_api import ApisApi
from kubernetes.client.api.apps_api import AppsApi
from kubernetes.client.api.apps_v1_api import AppsV1Api
from kubernetes.client.api.apps_v1beta1_api import AppsV1beta1Api
from kubernetes.client.api.apps_v1beta2_api import AppsV1beta2Api
from kubernetes.client.api.auditregistration_api import AuditregistrationApi
from kubernetes.client.api.auditregistration_v1alpha1_api import AuditregistrationV1alpha1Api
from kubernetes.client.api.authentication_api import AuthenticationApi
from kubernetes.client.api.authentication_v1_api import AuthenticationV1Api
from kubernetes.client.api.authentication_v1beta1_api import AuthenticationV1beta1Api
from kubernetes.client.api.authorization_api import AuthorizationApi
from kubernetes.client.api.authorization_v1_api import AuthorizationV1Api
from kubernetes.client.api.authorization_v1beta1_api import AuthorizationV1beta1Api
from kubernetes.client.api.autoscaling_api import AutoscalingApi
from kubernetes.client.api.autoscaling_v1_api import AutoscalingV1Api
from kubernetes.client.api.autoscaling_v2beta1_api import AutoscalingV2beta1Api
from kubernetes.client.api.autoscaling_v2beta2_api import AutoscalingV2beta2Api
from kubernetes.client.api.batch_api import BatchApi
from kubernetes.client.api.batch_v1_api import BatchV1Api
from kubernetes.client.api.batch_v1beta1_api import BatchV1beta1Api
from kubernetes.client.api.batch_v2alpha1_api import BatchV2alpha1Api
from kubernetes.client.api.certificates_api import CertificatesApi
from kubernetes.client.api.certificates_v1beta1_api import CertificatesV1beta1Api
from kubernetes.client.api.coordination_api import CoordinationApi
from kubernetes.client.api.coordination_v1beta1_api import CoordinationV1beta1Api
from kubernetes.client.api.core_api import CoreApi
from kubernetes.client.api.core_v1_api import CoreV1Api
from kubernetes.client.api.custom_objects_api import CustomObjectsApi
from kubernetes.client.api.events_api import EventsApi
from kubernetes.client.api.events_v1beta1_api import EventsV1beta1Api
from kubernetes.client.api.extensions_api import ExtensionsApi
from kubernetes.client.api.extensions_v1beta1_api import ExtensionsV1beta1Api
from kubernetes.client.api.logs_api import LogsApi
from kubernetes.client.api.networking_api import NetworkingApi
from kubernetes.client.api.networking_v1_api import NetworkingV1Api
from kubernetes.client.api.policy_api import PolicyApi
from kubernetes.client.api.policy_v1beta1_api import PolicyV1beta1Api
from kubernetes.client.api.rbac_authorization_api import RbacAuthorizationApi
from kubernetes.client.api.rbac_authorization_v1_api import RbacAuthorizationV1Api
from kubernetes.client.api.rbac_authorization_v1alpha1_api import RbacAuthorizationV1alpha1Api
from kubernetes.client.api.rbac_authorization_v1beta1_api import RbacAuthorizationV1beta1Api
from kubernetes.client.api.scheduling_api import SchedulingApi
from kubernetes.client.api.scheduling_v1alpha1_api import SchedulingV1alpha1Api
from kubernetes.client.api.scheduling_v1beta1_api import SchedulingV1beta1Api
from kubernetes.client.api.settings_api import SettingsApi
from kubernetes.client.api.settings_v1alpha1_api import SettingsV1alpha1Api
from kubernetes.client.api.storage_api import StorageApi
from kubernetes.client.api.storage_v1_api import StorageV1Api
from kubernetes.client.api.storage_v1alpha1_api import StorageV1alpha1Api
from kubernetes.client.api.storage_v1beta1_api import StorageV1beta1Api
from kubernetes.client.api.version_api import VersionApi
121 changes: 121 additions & 0 deletions kubernetes/client/api/admissionregistration_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# coding: utf-8

"""
Kubernetes

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501

OpenAPI spec version: v1.13.3
Generated by: https://openapi-generator.tech
"""


from __future__ import absolute_import

import re # noqa: F401

# python 2 and python 3 compatibility library
import six

from kubernetes.client.api_client import ApiClient


class AdmissionregistrationApi(object):
"""NOTE: This class is auto generated by OpenAPI Generator
Ref: https://openapi-generator.tech

Do not edit the class manually.
"""

def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client

def get_api_group(self, **kwargs): # noqa: E501
"""get_api_group # noqa: E501

get information of a group # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_api_group(async_req=True)
>>> result = thread.get()

:param async_req bool
:return: V1APIGroup
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_api_group_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.get_api_group_with_http_info(**kwargs) # noqa: E501
return data

def get_api_group_with_http_info(self, **kwargs): # noqa: E501
"""get_api_group # noqa: E501

get information of a group # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_api_group_with_http_info(async_req=True)
>>> result = thread.get()

:param async_req bool
:return: V1APIGroup
If the method is called asynchronously,
returns the request thread.
"""

local_var_params = locals()

all_params = [] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')

for key, val in six.iteritems(local_var_params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_api_group" % key
)
local_var_params[key] = val
del local_var_params['kwargs']

collection_formats = {}

path_params = {}

query_params = []

header_params = {}

form_params = []
local_var_files = {}

body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'application/yaml', 'application/vnd.kubernetes.protobuf']) # noqa: E501

# Authentication setting
auth_settings = ['BearerToken'] # noqa: E501

return self.api_client.call_api(
'/apis/admissionregistration.k8s.io/', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='V1APIGroup', # noqa: E501
auth_settings=auth_settings,
async_req=local_var_params.get('async_req'),
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
_preload_content=local_var_params.get('_preload_content', True),
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats)
Loading