# coding: utf-8

"""
    Sonatype Lifecycle Public REST API

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

    The version of the OpenAPI document: 1.196.0-01
    Contact: community@sonatype.com
    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 pydantic import Field, StrictStr, field_validator
from typing_extensions import Annotated
from sonatype_iq_api_client.models.api_role_member_mapping_list_dto import ApiRoleMemberMappingListDTO

from sonatype_iq_api_client.api_client import ApiClient, RequestSerialized
from sonatype_iq_api_client.api_response import ApiResponse
from sonatype_iq_api_client.rest import RESTResponseType


class RoleMembershipsApi:
    """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:
        if api_client is None:
            api_client = ApiClient.get_default()
        self.api_client = api_client


    @validate_call
    def get_role_memberships_application_or_organization(
        self,
        owner_type: Annotated[str, Field(strict=True, description="Enter the ownerType for which you want to retrieve users and their role Ids.")],
        internal_owner_id: Annotated[StrictStr, Field(description="Enter the corresponding id for the ownerType specified above.")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, 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,
    ) -> ApiRoleMemberMappingListDTO:
        """get_role_memberships_application_or_organization

        Use this method to retrieve the users, user groups and the corresponding role Ids.  Permissions required: Edit system configuration and users for a global context or view IQ elements for a non-global context

        :param owner_type: Enter the ownerType for which you want to retrieve users and their role Ids. (required)
        :type owner_type: str
        :param internal_owner_id: Enter the corresponding id for the ownerType specified above. (required)
        :type internal_owner_id: str
        :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_role_memberships_application_or_organization_serialize(
            owner_type=owner_type,
            internal_owner_id=internal_owner_id,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ApiRoleMemberMappingListDTO",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def get_role_memberships_application_or_organization_with_http_info(
        self,
        owner_type: Annotated[str, Field(strict=True, description="Enter the ownerType for which you want to retrieve users and their role Ids.")],
        internal_owner_id: Annotated[StrictStr, Field(description="Enter the corresponding id for the ownerType specified above.")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, 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,
    ) -> ApiResponse[ApiRoleMemberMappingListDTO]:
        """get_role_memberships_application_or_organization

        Use this method to retrieve the users, user groups and the corresponding role Ids.  Permissions required: Edit system configuration and users for a global context or view IQ elements for a non-global context

        :param owner_type: Enter the ownerType for which you want to retrieve users and their role Ids. (required)
        :type owner_type: str
        :param internal_owner_id: Enter the corresponding id for the ownerType specified above. (required)
        :type internal_owner_id: str
        :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_role_memberships_application_or_organization_serialize(
            owner_type=owner_type,
            internal_owner_id=internal_owner_id,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ApiRoleMemberMappingListDTO",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def get_role_memberships_application_or_organization_without_preload_content(
        self,
        owner_type: Annotated[str, Field(strict=True, description="Enter the ownerType for which you want to retrieve users and their role Ids.")],
        internal_owner_id: Annotated[StrictStr, Field(description="Enter the corresponding id for the ownerType specified above.")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, 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,
    ) -> RESTResponseType:
        """get_role_memberships_application_or_organization

        Use this method to retrieve the users, user groups and the corresponding role Ids.  Permissions required: Edit system configuration and users for a global context or view IQ elements for a non-global context

        :param owner_type: Enter the ownerType for which you want to retrieve users and their role Ids. (required)
        :type owner_type: str
        :param internal_owner_id: Enter the corresponding id for the ownerType specified above. (required)
        :type internal_owner_id: str
        :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_role_memberships_application_or_organization_serialize(
            owner_type=owner_type,
            internal_owner_id=internal_owner_id,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ApiRoleMemberMappingListDTO",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _get_role_memberships_application_or_organization_serialize(
        self,
        owner_type,
        internal_owner_id,
        _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
        if owner_type is not None:
            _path_params['ownerType'] = owner_type
        if internal_owner_id is not None:
            _path_params['internalOwnerId'] = internal_owner_id
        # 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'
                ]
            )


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

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/api/v2/roleMemberships/{ownerType}/{internalOwnerId}',
            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
        )




    @validate_call
    def get_role_memberships_global_or_repository_container(
        self,
        owner_type: Annotated[str, Field(strict=True, description="Enter the value for ownerType. Using `global` will return the users and groups who have been assigned the administrator role.")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, 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,
    ) -> ApiRoleMemberMappingListDTO:
        """get_role_memberships_global_or_repository_container

        Use this method to retrieve all users and roles globally or for all repositories.  Permissions required: Edit system configuration and users for a global context or view IQ elements for a non-global context

        :param owner_type: Enter the value for ownerType. Using `global` will return the users and groups who have been assigned the administrator role. (required)
        :type owner_type: str
        :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_role_memberships_global_or_repository_container_serialize(
            owner_type=owner_type,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ApiRoleMemberMappingListDTO",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def get_role_memberships_global_or_repository_container_with_http_info(
        self,
        owner_type: Annotated[str, Field(strict=True, description="Enter the value for ownerType. Using `global` will return the users and groups who have been assigned the administrator role.")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, 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,
    ) -> ApiResponse[ApiRoleMemberMappingListDTO]:
        """get_role_memberships_global_or_repository_container

        Use this method to retrieve all users and roles globally or for all repositories.  Permissions required: Edit system configuration and users for a global context or view IQ elements for a non-global context

        :param owner_type: Enter the value for ownerType. Using `global` will return the users and groups who have been assigned the administrator role. (required)
        :type owner_type: str
        :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_role_memberships_global_or_repository_container_serialize(
            owner_type=owner_type,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ApiRoleMemberMappingListDTO",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def get_role_memberships_global_or_repository_container_without_preload_content(
        self,
        owner_type: Annotated[str, Field(strict=True, description="Enter the value for ownerType. Using `global` will return the users and groups who have been assigned the administrator role.")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, 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,
    ) -> RESTResponseType:
        """get_role_memberships_global_or_repository_container

        Use this method to retrieve all users and roles globally or for all repositories.  Permissions required: Edit system configuration and users for a global context or view IQ elements for a non-global context

        :param owner_type: Enter the value for ownerType. Using `global` will return the users and groups who have been assigned the administrator role. (required)
        :type owner_type: str
        :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_role_memberships_global_or_repository_container_serialize(
            owner_type=owner_type,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "ApiRoleMemberMappingListDTO",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _get_role_memberships_global_or_repository_container_serialize(
        self,
        owner_type,
        _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
        if owner_type is not None:
            _path_params['ownerType'] = owner_type
        # 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'
                ]
            )


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

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/api/v2/roleMemberships/{ownerType}',
            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
        )




    @validate_call
    def grant_role_membership_application_or_organization(
        self,
        owner_type: Annotated[str, Field(strict=True, description="Enter the value for the ownerType for which you want to grant the role.")],
        internal_owner_id: Annotated[StrictStr, Field(description="Enter the value for the internalId associated with the ownerType specified above.")],
        role_id: Annotated[StrictStr, Field(description="Enter the roleId for the role to be granted.  Use the Roles REST API for roleIds and descriptions.")],
        member_type: Annotated[str, Field(strict=True, description="Enter the value for memberType, to specify a user or a user group.")],
        member_name: Annotated[StrictStr, Field(description="Enter the value for memberName. This can be a username or group name depending upon the value of memberType above.")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, 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,
    ) -> None:
        """grant_role_membership_application_or_organization

        Use this method to grant a role to a user or user group for the specified application or organization.  Permissions required: Edit access control

        :param owner_type: Enter the value for the ownerType for which you want to grant the role. (required)
        :type owner_type: str
        :param internal_owner_id: Enter the value for the internalId associated with the ownerType specified above. (required)
        :type internal_owner_id: str
        :param role_id: Enter the roleId for the role to be granted.  Use the Roles REST API for roleIds and descriptions. (required)
        :type role_id: str
        :param member_type: Enter the value for memberType, to specify a user or a user group. (required)
        :type member_type: str
        :param member_name: Enter the value for memberName. This can be a username or group name depending upon the value of memberType above. (required)
        :type member_name: str
        :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._grant_role_membership_application_or_organization_serialize(
            owner_type=owner_type,
            internal_owner_id=internal_owner_id,
            role_id=role_id,
            member_type=member_type,
            member_name=member_name,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '204': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def grant_role_membership_application_or_organization_with_http_info(
        self,
        owner_type: Annotated[str, Field(strict=True, description="Enter the value for the ownerType for which you want to grant the role.")],
        internal_owner_id: Annotated[StrictStr, Field(description="Enter the value for the internalId associated with the ownerType specified above.")],
        role_id: Annotated[StrictStr, Field(description="Enter the roleId for the role to be granted.  Use the Roles REST API for roleIds and descriptions.")],
        member_type: Annotated[str, Field(strict=True, description="Enter the value for memberType, to specify a user or a user group.")],
        member_name: Annotated[StrictStr, Field(description="Enter the value for memberName. This can be a username or group name depending upon the value of memberType above.")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, 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,
    ) -> ApiResponse[None]:
        """grant_role_membership_application_or_organization

        Use this method to grant a role to a user or user group for the specified application or organization.  Permissions required: Edit access control

        :param owner_type: Enter the value for the ownerType for which you want to grant the role. (required)
        :type owner_type: str
        :param internal_owner_id: Enter the value for the internalId associated with the ownerType specified above. (required)
        :type internal_owner_id: str
        :param role_id: Enter the roleId for the role to be granted.  Use the Roles REST API for roleIds and descriptions. (required)
        :type role_id: str
        :param member_type: Enter the value for memberType, to specify a user or a user group. (required)
        :type member_type: str
        :param member_name: Enter the value for memberName. This can be a username or group name depending upon the value of memberType above. (required)
        :type member_name: str
        :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._grant_role_membership_application_or_organization_serialize(
            owner_type=owner_type,
            internal_owner_id=internal_owner_id,
            role_id=role_id,
            member_type=member_type,
            member_name=member_name,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '204': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def grant_role_membership_application_or_organization_without_preload_content(
        self,
        owner_type: Annotated[str, Field(strict=True, description="Enter the value for the ownerType for which you want to grant the role.")],
        internal_owner_id: Annotated[StrictStr, Field(description="Enter the value for the internalId associated with the ownerType specified above.")],
        role_id: Annotated[StrictStr, Field(description="Enter the roleId for the role to be granted.  Use the Roles REST API for roleIds and descriptions.")],
        member_type: Annotated[str, Field(strict=True, description="Enter the value for memberType, to specify a user or a user group.")],
        member_name: Annotated[StrictStr, Field(description="Enter the value for memberName. This can be a username or group name depending upon the value of memberType above.")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, 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,
    ) -> RESTResponseType:
        """grant_role_membership_application_or_organization

        Use this method to grant a role to a user or user group for the specified application or organization.  Permissions required: Edit access control

        :param owner_type: Enter the value for the ownerType for which you want to grant the role. (required)
        :type owner_type: str
        :param internal_owner_id: Enter the value for the internalId associated with the ownerType specified above. (required)
        :type internal_owner_id: str
        :param role_id: Enter the roleId for the role to be granted.  Use the Roles REST API for roleIds and descriptions. (required)
        :type role_id: str
        :param member_type: Enter the value for memberType, to specify a user or a user group. (required)
        :type member_type: str
        :param member_name: Enter the value for memberName. This can be a username or group name depending upon the value of memberType above. (required)
        :type member_name: str
        :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._grant_role_membership_application_or_organization_serialize(
            owner_type=owner_type,
            internal_owner_id=internal_owner_id,
            role_id=role_id,
            member_type=member_type,
            member_name=member_name,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '204': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _grant_role_membership_application_or_organization_serialize(
        self,
        owner_type,
        internal_owner_id,
        role_id,
        member_type,
        member_name,
        _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
        if owner_type is not None:
            _path_params['ownerType'] = owner_type
        if internal_owner_id is not None:
            _path_params['internalOwnerId'] = internal_owner_id
        if role_id is not None:
            _path_params['roleId'] = role_id
        if member_type is not None:
            _path_params['memberType'] = member_type
        if member_name is not None:
            _path_params['memberName'] = member_name
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter




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

        return self.api_client.param_serialize(
            method='PUT',
            resource_path='/api/v2/roleMemberships/{ownerType}/{internalOwnerId}/role/{roleId}/{memberType}/{memberName}',
            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
        )




    @validate_call
    def grant_role_membership_global_or_repository_container(
        self,
        owner_type: Annotated[str, Field(strict=True, description="Enter the value for the ownerType for which you want to grant the role.")],
        role_id: Annotated[StrictStr, Field(description="Enter the roleId for the role to be granted.  Use the Roles REST API for roleIds and descriptions.")],
        member_type: Annotated[str, Field(strict=True, description="Enter the value for memberType, to specify a user or a user group.")],
        member_name: Annotated[StrictStr, Field(description="Enter the value for memberName. This can be a username or group name depending upon the value of memberType above.")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, 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,
    ) -> None:
        """grant_role_membership_global_or_repository_container

        Use this method to grant a role to a user or user group globally or on all repositories.  Permissions required: Edit system configuration and users for a global context or edit access control for a non-global context

        :param owner_type: Enter the value for the ownerType for which you want to grant the role. (required)
        :type owner_type: str
        :param role_id: Enter the roleId for the role to be granted.  Use the Roles REST API for roleIds and descriptions. (required)
        :type role_id: str
        :param member_type: Enter the value for memberType, to specify a user or a user group. (required)
        :type member_type: str
        :param member_name: Enter the value for memberName. This can be a username or group name depending upon the value of memberType above. (required)
        :type member_name: str
        :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._grant_role_membership_global_or_repository_container_serialize(
            owner_type=owner_type,
            role_id=role_id,
            member_type=member_type,
            member_name=member_name,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '204': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def grant_role_membership_global_or_repository_container_with_http_info(
        self,
        owner_type: Annotated[str, Field(strict=True, description="Enter the value for the ownerType for which you want to grant the role.")],
        role_id: Annotated[StrictStr, Field(description="Enter the roleId for the role to be granted.  Use the Roles REST API for roleIds and descriptions.")],
        member_type: Annotated[str, Field(strict=True, description="Enter the value for memberType, to specify a user or a user group.")],
        member_name: Annotated[StrictStr, Field(description="Enter the value for memberName. This can be a username or group name depending upon the value of memberType above.")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, 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,
    ) -> ApiResponse[None]:
        """grant_role_membership_global_or_repository_container

        Use this method to grant a role to a user or user group globally or on all repositories.  Permissions required: Edit system configuration and users for a global context or edit access control for a non-global context

        :param owner_type: Enter the value for the ownerType for which you want to grant the role. (required)
        :type owner_type: str
        :param role_id: Enter the roleId for the role to be granted.  Use the Roles REST API for roleIds and descriptions. (required)
        :type role_id: str
        :param member_type: Enter the value for memberType, to specify a user or a user group. (required)
        :type member_type: str
        :param member_name: Enter the value for memberName. This can be a username or group name depending upon the value of memberType above. (required)
        :type member_name: str
        :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._grant_role_membership_global_or_repository_container_serialize(
            owner_type=owner_type,
            role_id=role_id,
            member_type=member_type,
            member_name=member_name,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '204': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def grant_role_membership_global_or_repository_container_without_preload_content(
        self,
        owner_type: Annotated[str, Field(strict=True, description="Enter the value for the ownerType for which you want to grant the role.")],
        role_id: Annotated[StrictStr, Field(description="Enter the roleId for the role to be granted.  Use the Roles REST API for roleIds and descriptions.")],
        member_type: Annotated[str, Field(strict=True, description="Enter the value for memberType, to specify a user or a user group.")],
        member_name: Annotated[StrictStr, Field(description="Enter the value for memberName. This can be a username or group name depending upon the value of memberType above.")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, 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,
    ) -> RESTResponseType:
        """grant_role_membership_global_or_repository_container

        Use this method to grant a role to a user or user group globally or on all repositories.  Permissions required: Edit system configuration and users for a global context or edit access control for a non-global context

        :param owner_type: Enter the value for the ownerType for which you want to grant the role. (required)
        :type owner_type: str
        :param role_id: Enter the roleId for the role to be granted.  Use the Roles REST API for roleIds and descriptions. (required)
        :type role_id: str
        :param member_type: Enter the value for memberType, to specify a user or a user group. (required)
        :type member_type: str
        :param member_name: Enter the value for memberName. This can be a username or group name depending upon the value of memberType above. (required)
        :type member_name: str
        :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._grant_role_membership_global_or_repository_container_serialize(
            owner_type=owner_type,
            role_id=role_id,
            member_type=member_type,
            member_name=member_name,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '204': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _grant_role_membership_global_or_repository_container_serialize(
        self,
        owner_type,
        role_id,
        member_type,
        member_name,
        _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
        if owner_type is not None:
            _path_params['ownerType'] = owner_type
        if role_id is not None:
            _path_params['roleId'] = role_id
        if member_type is not None:
            _path_params['memberType'] = member_type
        if member_name is not None:
            _path_params['memberName'] = member_name
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter




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

        return self.api_client.param_serialize(
            method='PUT',
            resource_path='/api/v2/roleMemberships/{ownerType}/role/{roleId}/{memberType}/{memberName}',
            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
        )




    @validate_call
    def revoke_role_membership_application_or_organization(
        self,
        owner_type: Annotated[str, Field(strict=True, description="Enter the value for the ownerType for which you want to revoke the role. Using `global` will revoke the administrator role.")],
        internal_owner_id: Annotated[StrictStr, Field(description="Enter the internalId associated with the ownerType specified above.")],
        role_id: Annotated[StrictStr, Field(description="Enter the roleId for the role to be revoked.")],
        member_type: Annotated[str, Field(strict=True, description="Enter the value for memberType, to specify a user or a user group.")],
        member_name: Annotated[StrictStr, Field(description="Enter the value for memberName. This can be a username or group name depending upon the value of memberType above.")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, 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,
    ) -> None:
        """revoke_role_membership_application_or_organization

        Use this method to revoke a role from a user or user group, on a specific application or organization.  Permissions required: Edit access control

        :param owner_type: Enter the value for the ownerType for which you want to revoke the role. Using `global` will revoke the administrator role. (required)
        :type owner_type: str
        :param internal_owner_id: Enter the internalId associated with the ownerType specified above. (required)
        :type internal_owner_id: str
        :param role_id: Enter the roleId for the role to be revoked. (required)
        :type role_id: str
        :param member_type: Enter the value for memberType, to specify a user or a user group. (required)
        :type member_type: str
        :param member_name: Enter the value for memberName. This can be a username or group name depending upon the value of memberType above. (required)
        :type member_name: str
        :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._revoke_role_membership_application_or_organization_serialize(
            owner_type=owner_type,
            internal_owner_id=internal_owner_id,
            role_id=role_id,
            member_type=member_type,
            member_name=member_name,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '204': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def revoke_role_membership_application_or_organization_with_http_info(
        self,
        owner_type: Annotated[str, Field(strict=True, description="Enter the value for the ownerType for which you want to revoke the role. Using `global` will revoke the administrator role.")],
        internal_owner_id: Annotated[StrictStr, Field(description="Enter the internalId associated with the ownerType specified above.")],
        role_id: Annotated[StrictStr, Field(description="Enter the roleId for the role to be revoked.")],
        member_type: Annotated[str, Field(strict=True, description="Enter the value for memberType, to specify a user or a user group.")],
        member_name: Annotated[StrictStr, Field(description="Enter the value for memberName. This can be a username or group name depending upon the value of memberType above.")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, 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,
    ) -> ApiResponse[None]:
        """revoke_role_membership_application_or_organization

        Use this method to revoke a role from a user or user group, on a specific application or organization.  Permissions required: Edit access control

        :param owner_type: Enter the value for the ownerType for which you want to revoke the role. Using `global` will revoke the administrator role. (required)
        :type owner_type: str
        :param internal_owner_id: Enter the internalId associated with the ownerType specified above. (required)
        :type internal_owner_id: str
        :param role_id: Enter the roleId for the role to be revoked. (required)
        :type role_id: str
        :param member_type: Enter the value for memberType, to specify a user or a user group. (required)
        :type member_type: str
        :param member_name: Enter the value for memberName. This can be a username or group name depending upon the value of memberType above. (required)
        :type member_name: str
        :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._revoke_role_membership_application_or_organization_serialize(
            owner_type=owner_type,
            internal_owner_id=internal_owner_id,
            role_id=role_id,
            member_type=member_type,
            member_name=member_name,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '204': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def revoke_role_membership_application_or_organization_without_preload_content(
        self,
        owner_type: Annotated[str, Field(strict=True, description="Enter the value for the ownerType for which you want to revoke the role. Using `global` will revoke the administrator role.")],
        internal_owner_id: Annotated[StrictStr, Field(description="Enter the internalId associated with the ownerType specified above.")],
        role_id: Annotated[StrictStr, Field(description="Enter the roleId for the role to be revoked.")],
        member_type: Annotated[str, Field(strict=True, description="Enter the value for memberType, to specify a user or a user group.")],
        member_name: Annotated[StrictStr, Field(description="Enter the value for memberName. This can be a username or group name depending upon the value of memberType above.")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, 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,
    ) -> RESTResponseType:
        """revoke_role_membership_application_or_organization

        Use this method to revoke a role from a user or user group, on a specific application or organization.  Permissions required: Edit access control

        :param owner_type: Enter the value for the ownerType for which you want to revoke the role. Using `global` will revoke the administrator role. (required)
        :type owner_type: str
        :param internal_owner_id: Enter the internalId associated with the ownerType specified above. (required)
        :type internal_owner_id: str
        :param role_id: Enter the roleId for the role to be revoked. (required)
        :type role_id: str
        :param member_type: Enter the value for memberType, to specify a user or a user group. (required)
        :type member_type: str
        :param member_name: Enter the value for memberName. This can be a username or group name depending upon the value of memberType above. (required)
        :type member_name: str
        :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._revoke_role_membership_application_or_organization_serialize(
            owner_type=owner_type,
            internal_owner_id=internal_owner_id,
            role_id=role_id,
            member_type=member_type,
            member_name=member_name,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '204': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _revoke_role_membership_application_or_organization_serialize(
        self,
        owner_type,
        internal_owner_id,
        role_id,
        member_type,
        member_name,
        _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
        if owner_type is not None:
            _path_params['ownerType'] = owner_type
        if internal_owner_id is not None:
            _path_params['internalOwnerId'] = internal_owner_id
        if role_id is not None:
            _path_params['roleId'] = role_id
        if member_type is not None:
            _path_params['memberType'] = member_type
        if member_name is not None:
            _path_params['memberName'] = member_name
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter




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

        return self.api_client.param_serialize(
            method='DELETE',
            resource_path='/api/v2/roleMemberships/{ownerType}/{internalOwnerId}/role/{roleId}/{memberType}/{memberName}',
            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
        )




    @validate_call
    def revoke_role_membership_global_or_repository_container(
        self,
        owner_type: Annotated[str, Field(strict=True, description="Enter the value for ownerType. Using `global` will revoke the administrator role.")],
        role_id: Annotated[StrictStr, Field(description="Enter the roleId for the role to be revoked.")],
        member_type: Annotated[str, Field(strict=True, description="Enter the value for memberType, to specify a user or a user group.")],
        member_name: Annotated[StrictStr, Field(description="Enter the value for memberName. This can be a username or group name depending upon the value of memberType above.")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, 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,
    ) -> None:
        """revoke_role_membership_global_or_repository_container

        Use this method to revoke roles globally or on all repositories.  Permissions required: Edit system configuration and users for a global context or view IQ elements for a non-global context

        :param owner_type: Enter the value for ownerType. Using `global` will revoke the administrator role. (required)
        :type owner_type: str
        :param role_id: Enter the roleId for the role to be revoked. (required)
        :type role_id: str
        :param member_type: Enter the value for memberType, to specify a user or a user group. (required)
        :type member_type: str
        :param member_name: Enter the value for memberName. This can be a username or group name depending upon the value of memberType above. (required)
        :type member_name: str
        :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._revoke_role_membership_global_or_repository_container_serialize(
            owner_type=owner_type,
            role_id=role_id,
            member_type=member_type,
            member_name=member_name,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '204': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def revoke_role_membership_global_or_repository_container_with_http_info(
        self,
        owner_type: Annotated[str, Field(strict=True, description="Enter the value for ownerType. Using `global` will revoke the administrator role.")],
        role_id: Annotated[StrictStr, Field(description="Enter the roleId for the role to be revoked.")],
        member_type: Annotated[str, Field(strict=True, description="Enter the value for memberType, to specify a user or a user group.")],
        member_name: Annotated[StrictStr, Field(description="Enter the value for memberName. This can be a username or group name depending upon the value of memberType above.")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, 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,
    ) -> ApiResponse[None]:
        """revoke_role_membership_global_or_repository_container

        Use this method to revoke roles globally or on all repositories.  Permissions required: Edit system configuration and users for a global context or view IQ elements for a non-global context

        :param owner_type: Enter the value for ownerType. Using `global` will revoke the administrator role. (required)
        :type owner_type: str
        :param role_id: Enter the roleId for the role to be revoked. (required)
        :type role_id: str
        :param member_type: Enter the value for memberType, to specify a user or a user group. (required)
        :type member_type: str
        :param member_name: Enter the value for memberName. This can be a username or group name depending upon the value of memberType above. (required)
        :type member_name: str
        :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._revoke_role_membership_global_or_repository_container_serialize(
            owner_type=owner_type,
            role_id=role_id,
            member_type=member_type,
            member_name=member_name,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '204': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def revoke_role_membership_global_or_repository_container_without_preload_content(
        self,
        owner_type: Annotated[str, Field(strict=True, description="Enter the value for ownerType. Using `global` will revoke the administrator role.")],
        role_id: Annotated[StrictStr, Field(description="Enter the roleId for the role to be revoked.")],
        member_type: Annotated[str, Field(strict=True, description="Enter the value for memberType, to specify a user or a user group.")],
        member_name: Annotated[StrictStr, Field(description="Enter the value for memberName. This can be a username or group name depending upon the value of memberType above.")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, 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,
    ) -> RESTResponseType:
        """revoke_role_membership_global_or_repository_container

        Use this method to revoke roles globally or on all repositories.  Permissions required: Edit system configuration and users for a global context or view IQ elements for a non-global context

        :param owner_type: Enter the value for ownerType. Using `global` will revoke the administrator role. (required)
        :type owner_type: str
        :param role_id: Enter the roleId for the role to be revoked. (required)
        :type role_id: str
        :param member_type: Enter the value for memberType, to specify a user or a user group. (required)
        :type member_type: str
        :param member_name: Enter the value for memberName. This can be a username or group name depending upon the value of memberType above. (required)
        :type member_name: str
        :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._revoke_role_membership_global_or_repository_container_serialize(
            owner_type=owner_type,
            role_id=role_id,
            member_type=member_type,
            member_name=member_name,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '204': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _revoke_role_membership_global_or_repository_container_serialize(
        self,
        owner_type,
        role_id,
        member_type,
        member_name,
        _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
        if owner_type is not None:
            _path_params['ownerType'] = owner_type
        if role_id is not None:
            _path_params['roleId'] = role_id
        if member_type is not None:
            _path_params['memberType'] = member_type
        if member_name is not None:
            _path_params['memberName'] = member_name
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter




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

        return self.api_client.param_serialize(
            method='DELETE',
            resource_path='/api/v2/roleMemberships/{ownerType}/role/{roleId}/{memberType}/{memberName}',
            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
        )


