Skip to content

Instantly share code, notes, and snippets.

@mbohlool
Created December 23, 2016 18:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbohlool/d5ec1dace27ef90cf742555c05480146 to your computer and use it in GitHub Desktop.
Save mbohlool/d5ec1dace27ef90cf742555c05480146 to your computer and use it in GitHub Desktop.
# simplified read_namespaced_pod method from core_v1_api.py located at https://raw.githubusercontent.com/kubernetes-incubator/client-python/master/kubernetes/client/apis/core_v1_api.py
""" Generated python client""" ...
def read_namespaced_pod(self, name, namespace, **params):
"""
read the specified Pod
:param str name: name of the Pod (required)
:param str namespace: object name and auth scope, such as for teams and projects (required)
:param str pretty: If 'true', then the output is pretty printed.
:param bool exact: Should the export be exact. Exact export maintains cluster-specific fields like 'Namespace'
:param bool export: Should this value be exported. Export strips fields that a user can not specify.
:return: V1Pod
"""
# 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 `read_namespaced_pod`")
# 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 `read_namespaced_pod`")
resource_path = '/api/v1/namespaces/{namespace}/pods/{name}'.replace('{format}', 'json')
path_params = {}
if 'name' in params:
path_params['name'] = params['name']
if 'namespace' in params:
path_params['namespace'] = params['namespace']
query_params = {}
if 'pretty' in params:
query_params['pretty'] = params['pretty']
if 'exact' in params:
query_params['exact'] = params['exact']
if 'export' in params:
query_params['export'] = params['export']
header_params['Accept'] = {'Accept' : 'application/json'}
return self.api_client.call_api(resource_path, 'GET',
path_params,
query_params,
header_params,
response_type='V1Pod',
auth_settings=['BearerToken'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment