# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
import warnings

from yandex.cloud.billing.usage_records.v1 import metadata_service_pb2 as yandex_dot_cloud_dot_billing_dot_usage__records_dot_v1_dot_metadata__service__pb2

GRPC_GENERATED_VERSION = '1.70.0'
GRPC_VERSION = grpc.__version__
_version_not_supported = False

try:
    from grpc._utilities import first_version_is_lower
    _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
except ImportError:
    _version_not_supported = True

if _version_not_supported:
    raise RuntimeError(
        f'The grpc package installed is at version {GRPC_VERSION},'
        + f' but the generated code in yandex/cloud/billing/usage_records/v1/metadata_service_pb2_grpc.py depends on'
        + f' grpcio>={GRPC_GENERATED_VERSION}.'
        + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
        + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
    )


class MetadataServiceStub(object):
    """MetadataService service for retrieving metadata related to usage records

    The MetadataService provides a set of methods for retrieving metadata and reference information
    about billing usage records within a specific billing account and date range. This metadata
    includes information about clouds, services, SKUs, labels, and resources
    to understand the available entity structure before building detailed usage reports.

    Required permissions:
    All methods in this service require one of the following permissions on the specified billing account:
    - `billing.accounts.getReport`

    Rate limits:
    This API is limited to 1 request per minute per IP address.
    """

    def __init__(self, channel):
        """Constructor.

        Args:
            channel: A grpc.Channel.
        """
        self.GetUsage = channel.unary_unary(
                '/yandex.cloud.billing.usage_records.v1.MetadataService/GetUsage',
                request_serializer=yandex_dot_cloud_dot_billing_dot_usage__records_dot_v1_dot_metadata__service__pb2.GetUsageRequest.SerializeToString,
                response_deserializer=yandex_dot_cloud_dot_billing_dot_usage__records_dot_v1_dot_metadata__service__pb2.GetUsageResponse.FromString,
                _registered_method=True)
        self.GetLabel = channel.unary_unary(
                '/yandex.cloud.billing.usage_records.v1.MetadataService/GetLabel',
                request_serializer=yandex_dot_cloud_dot_billing_dot_usage__records_dot_v1_dot_metadata__service__pb2.GetLabelRequest.SerializeToString,
                response_deserializer=yandex_dot_cloud_dot_billing_dot_usage__records_dot_v1_dot_metadata__service__pb2.GetLabelResponse.FromString,
                _registered_method=True)
        self.GetCloud = channel.unary_unary(
                '/yandex.cloud.billing.usage_records.v1.MetadataService/GetCloud',
                request_serializer=yandex_dot_cloud_dot_billing_dot_usage__records_dot_v1_dot_metadata__service__pb2.GetCloudRequest.SerializeToString,
                response_deserializer=yandex_dot_cloud_dot_billing_dot_usage__records_dot_v1_dot_metadata__service__pb2.GetCloudResponse.FromString,
                _registered_method=True)
        self.GetResourceIDs = channel.unary_unary(
                '/yandex.cloud.billing.usage_records.v1.MetadataService/GetResourceIDs',
                request_serializer=yandex_dot_cloud_dot_billing_dot_usage__records_dot_v1_dot_metadata__service__pb2.GetResourceIDsRequest.SerializeToString,
                response_deserializer=yandex_dot_cloud_dot_billing_dot_usage__records_dot_v1_dot_metadata__service__pb2.GetResourceIDsResponse.FromString,
                _registered_method=True)


class MetadataServiceServicer(object):
    """MetadataService service for retrieving metadata related to usage records

    The MetadataService provides a set of methods for retrieving metadata and reference information
    about billing usage records within a specific billing account and date range. This metadata
    includes information about clouds, services, SKUs, labels, and resources
    to understand the available entity structure before building detailed usage reports.

    Required permissions:
    All methods in this service require one of the following permissions on the specified billing account:
    - `billing.accounts.getReport`

    Rate limits:
    This API is limited to 1 request per minute per IP address.
    """

    def GetUsage(self, request, context):
        """GetUsage returns usage metadata including available clouds, services, SKUs, label keys, and date ranges
        for a specific billing account and date range.

        This method provides a view of all available entities
        that can be used for usage reporting within the specified date range
        for the billing account and all its sub-accounts including:
        - List of available clouds in provided data range
        - Available label keys that can be used for filtering or grouping
        - Available services
        - Available SKUs
        - Available billing accounts (user billing account and his sub-accounts)

        Implementation details:
        - Empty cloud_id values are translated to a "Usage is out of scope of the Cloud" designation
        - All data is filtered to only include items that had usage during the specified date range

        Error handling:
        - Returns INVALID_ARGUMENT if the request parameters fail validation
        - Returns UNAUTHENTICATED if the user is not authenticated or the billing account does not exist
        - Returns PERMISSION_DENIED if the user lacks required permissions
        - Returns INTERNAL for internal server errors

        Required permissions:
        - `billing.accounts.getReport` on the specified billing account
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetLabel(self, request, context):
        """GetLabel returns available label keys and values for a specific billing account
        with pagination support.

        This method retrieves all available label values for a specified label key
        within the given date range. It supports filtering by label value substring
        and provides pagination for handling large result sets.

        The method can be used in several ways:
        - With label_key only: Returns all values for that key with pagination
        - With label_key and label_value: Returns array of matching labelValues with pagination
        - With label_key and label_value_filter: Returns all values for that key with pagination
        and a separate array of labelValues from the labelValueFilters parameter
        - With label_key, label_value and label_value_filter: returns only an array of matching labelValues
        with pagination and ignores labelValueFilters (i.e., labelValueFilters won't be returned)

        Implementation details:
        - Case-insensitive label value matching when label_value is provided
        - When label_value is specified, label_value_filter is ignored
        - Label values are sorted alphabetically
        - Pagination occurs when results exceed page_size

        Error handling:
        - Returns INVALID_ARGUMENT if the request parameters fail validation
        - Returns UNAUTHENTICATED if the user is not authenticated or the billing account does not exist
        - Returns PERMISSION_DENIED if the user lacks required permissions
        - Returns INTERNAL for internal server errors

        Required permissions:
        - `billing.accounts.getReport` on the specified billing account
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetCloud(self, request, context):
        """GetCloud returns available folders for specified clouds within a billing account
        with optional filtering by cloud IDs, folder IDs and pagination support.

        This method returns a hierarchical view of clouds and their folders that the user
        has access to within the specified date range. Results can be filtered by
        specific cloud IDs and/or folder IDs, and pagination is supported for handling
        large result sets.

        Implementation details:
        - The method result does not contain empty cloud id information
        - Filtering is done using case-insensitive substring matching
        - Only clouds with at least one folder are included in the response
        - Folder pagination is based on folder IDs, ordered alphabetically
        - NextPageToken is only returned when there are more results available
        - Base64-encoded page tokens are used for pagination state

        Error handling:
        - Returns INVALID_ARGUMENT if the request parameters fail validation
        - Returns UNAUTHENTICATED if the user is not authenticated or the billing account does not exist
        - Returns PERMISSION_DENIED if the user lacks required permissions
        - Returns INTERNAL for internal server errors

        Required permissions:
        - `billing.accounts.getReport` on the specified billing account
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetResourceIDs(self, request, context):
        """GetResourceIDs returns all resource IDs for a specific billing account and date range
        with pagination support.

        This method retrieves a list of all resource IDs that have usage records
        within the specified date range and billing account. The results can be
        filtered by a case-insensitive substring search on the resource ID.

        Implementation details:
        - Filtering is done using case-insensitive substring matching
        - Only resource IDs with actual usage in the period are returned

        Error handling:
        - Returns INVALID_ARGUMENT if the request parameters fail validation
        - Returns UNAUTHENTICATED if the user is not authenticated or the billing account does not exist
        - Returns PERMISSION_DENIED if the user lacks required permissions
        - Returns INTERNAL for internal server errors

        Required permissions:
        - `billing.accounts.getReport` on the specified billing account

        Note: This RPC method is not yet implemented and will return UNIMPLEMENTED.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_MetadataServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'GetUsage': grpc.unary_unary_rpc_method_handler(
                    servicer.GetUsage,
                    request_deserializer=yandex_dot_cloud_dot_billing_dot_usage__records_dot_v1_dot_metadata__service__pb2.GetUsageRequest.FromString,
                    response_serializer=yandex_dot_cloud_dot_billing_dot_usage__records_dot_v1_dot_metadata__service__pb2.GetUsageResponse.SerializeToString,
            ),
            'GetLabel': grpc.unary_unary_rpc_method_handler(
                    servicer.GetLabel,
                    request_deserializer=yandex_dot_cloud_dot_billing_dot_usage__records_dot_v1_dot_metadata__service__pb2.GetLabelRequest.FromString,
                    response_serializer=yandex_dot_cloud_dot_billing_dot_usage__records_dot_v1_dot_metadata__service__pb2.GetLabelResponse.SerializeToString,
            ),
            'GetCloud': grpc.unary_unary_rpc_method_handler(
                    servicer.GetCloud,
                    request_deserializer=yandex_dot_cloud_dot_billing_dot_usage__records_dot_v1_dot_metadata__service__pb2.GetCloudRequest.FromString,
                    response_serializer=yandex_dot_cloud_dot_billing_dot_usage__records_dot_v1_dot_metadata__service__pb2.GetCloudResponse.SerializeToString,
            ),
            'GetResourceIDs': grpc.unary_unary_rpc_method_handler(
                    servicer.GetResourceIDs,
                    request_deserializer=yandex_dot_cloud_dot_billing_dot_usage__records_dot_v1_dot_metadata__service__pb2.GetResourceIDsRequest.FromString,
                    response_serializer=yandex_dot_cloud_dot_billing_dot_usage__records_dot_v1_dot_metadata__service__pb2.GetResourceIDsResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'yandex.cloud.billing.usage_records.v1.MetadataService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('yandex.cloud.billing.usage_records.v1.MetadataService', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class MetadataService(object):
    """MetadataService service for retrieving metadata related to usage records

    The MetadataService provides a set of methods for retrieving metadata and reference information
    about billing usage records within a specific billing account and date range. This metadata
    includes information about clouds, services, SKUs, labels, and resources
    to understand the available entity structure before building detailed usage reports.

    Required permissions:
    All methods in this service require one of the following permissions on the specified billing account:
    - `billing.accounts.getReport`

    Rate limits:
    This API is limited to 1 request per minute per IP address.
    """

    @staticmethod
    def GetUsage(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/yandex.cloud.billing.usage_records.v1.MetadataService/GetUsage',
            yandex_dot_cloud_dot_billing_dot_usage__records_dot_v1_dot_metadata__service__pb2.GetUsageRequest.SerializeToString,
            yandex_dot_cloud_dot_billing_dot_usage__records_dot_v1_dot_metadata__service__pb2.GetUsageResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def GetLabel(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/yandex.cloud.billing.usage_records.v1.MetadataService/GetLabel',
            yandex_dot_cloud_dot_billing_dot_usage__records_dot_v1_dot_metadata__service__pb2.GetLabelRequest.SerializeToString,
            yandex_dot_cloud_dot_billing_dot_usage__records_dot_v1_dot_metadata__service__pb2.GetLabelResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def GetCloud(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/yandex.cloud.billing.usage_records.v1.MetadataService/GetCloud',
            yandex_dot_cloud_dot_billing_dot_usage__records_dot_v1_dot_metadata__service__pb2.GetCloudRequest.SerializeToString,
            yandex_dot_cloud_dot_billing_dot_usage__records_dot_v1_dot_metadata__service__pb2.GetCloudResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def GetResourceIDs(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/yandex.cloud.billing.usage_records.v1.MetadataService/GetResourceIDs',
            yandex_dot_cloud_dot_billing_dot_usage__records_dot_v1_dot_metadata__service__pb2.GetResourceIDsRequest.SerializeToString,
            yandex_dot_cloud_dot_billing_dot_usage__records_dot_v1_dot_metadata__service__pb2.GetResourceIDsResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
