"""
    Kubernetes

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

    The version of the OpenAPI document: release-1.37
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


import warnings
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated

from kubernetes.client.models.v1_api_group import V1APIGroup

from kubernetes.client.api_client import ApiClient, RequestSerialized
from kubernetes.client.api_response import ApiResponse
from kubernetes.client.rest import RESTResponseType


class LifecycleApi:
    """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) -> None:
        # api_client remains publicly assignable. Retain the client acquired at
        # construction so reassignment cannot transfer or discard ownership.
        if api_client is None:
            api_client, owns_api_client = ApiClient._get_default_or_new()
        else:
            owns_api_client = False
        self.api_client = api_client
        self._owned_api_client: Optional[ApiClient] = (
            api_client if owns_api_client else None
        )


    def close(self) -> None:
        owned_api_client = self._owned_api_client
        self._owned_api_client = None
        if owned_api_client is not None:
            owned_api_client.close()

    def __enter__(self):
        return self

    def __exit__(self, exc_type, exc_value, traceback):
        self.close()


    @validate_call(config={'defer_build': True})
    def get_api_group(
        self,
        async_req: Optional[bool] = None,
        _return_http_data_only: Optional[bool] = None,
        _preload_content: bool = True,
        _request_timeout: Union[
            None,
            Annotated[Union[StrictFloat, StrictInt], Field(gt=0)],
            Tuple[
                Annotated[Union[StrictFloat, StrictInt], Field(gt=0)],
                Annotated[Union[StrictFloat, StrictInt], Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> V1APIGroup:
        """get_api_group

        get information of a group

        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _return_http_data_only: only affects with_http_info; ordinary
                                       methods always return data only.
        :type _return_http_data_only: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_api_group_serialize(
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "V1APIGroup",
            '401': None,
        }
        return self.api_client._call_with_legacy_options(
            _param,
            _response_types_map,
            async_req,
            _preload_content,
            _request_timeout,
            True,
        )


    @validate_call(config={'defer_build': True})
    def get_api_group_with_http_info(
        self,
        async_req: Optional[bool] = None,
        _return_http_data_only: Optional[bool] = None,
        _preload_content: bool = True,
        _request_timeout: Union[
            None,
            Annotated[Union[StrictFloat, StrictInt], Field(gt=0)],
            Tuple[
                Annotated[Union[StrictFloat, StrictInt], Field(gt=0)],
                Annotated[Union[StrictFloat, StrictInt], Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> Tuple[V1APIGroup, int, Any]:
        """get_api_group

        get information of a group

        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _return_http_data_only: only affects with_http_info; ordinary
                                       methods always return data only.
        :type _return_http_data_only: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_api_group_serialize(
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "V1APIGroup",
            '401': None,
        }
        return self.api_client._call_with_legacy_options(
            _param,
            _response_types_map,
            async_req,
            _preload_content,
            _request_timeout,
            _return_http_data_only,
        )


    def _get_api_group_serialize(
        self,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json',
                    'application/yaml',
                    'application/vnd.kubernetes.protobuf',
                    'application/cbor'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'BearerToken'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/apis/lifecycle.k8s.io/',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )
