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

from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2
from spaceone.api.statistics.v1 import resource_pb2 as spaceone_dot_api_dot_statistics_dot_v1_dot_resource__pb2


class ResourceStub(object):
    """Missing associated documentation comment in .proto file."""

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

        Args:
            channel: A grpc.Channel.
        """
        self.stat = channel.unary_unary(
                '/spaceone.api.statistics.v1.Resource/stat',
                request_serializer=spaceone_dot_api_dot_statistics_dot_v1_dot_resource__pb2.ResourceStatRequest.SerializeToString,
                response_deserializer=google_dot_protobuf_dot_struct__pb2.Struct.FromString,
                )


class ResourceServicer(object):
    """Missing associated documentation comment in .proto file."""

    def stat(self, request, context):
        """
        desc: Enables data preprocessing of different services. Although limited, it is possible to create not only basic queries but also data suitable for users' needs, such as joins between two tables created by the query, handling missing values, and sorting.
        request_example: >-
        {
        "aggregate": [
        {"query": {"resource_type": "inventory.CloudServiceType",
        "query": {
        "filter": [{"k": "labels", "v": ["Server"], "o": "in"},
        {"k": "is_primary", "v": true, "o": "eq"}], "aggregate": [{
        "group": {
        "keys": [
        {
        "key": "cloud_service_type_id",
        "name": "cloud_service_type_id"},
        {
        "key": "name",
        "name": "cloud_service_type"},
        {
        "key": "group",
        "name": "cloud_service_group"},
        {
        "key": "provider",
        "name": "provider"},
        {
        "key": "cloud_service_type_id",
        "name": "cloud_service_type_id"}],
        "fields": [
        {
        "key": "tags",
        "name": "tags",
        "operator": "first"},
        {
        "key": "labels",
        "name": "labels",
        "operator": "first"}]}}]}}},
        {"join": {"resource_type": "inventory.CloudService", "query": {"filter": [
        {"k": "ref_cloud_service_type.cloud_service_type_id",
        "v": ["cloud-svc-type-58c926b19aca", "cloud-svc-type-c7e5bc38d911",
        "cloud-svc-type-8dd4d7a13b95", "cloud-svc-type-719e705cb529",
        "cloud-svc-type-50bd62cf6e0e"], "o": "in"}], "aggregate": [{"group": {
        "keys": [{"key": "cloud_service_type", "name": "cloud_service_type"},
        {"key": "cloud_service_group", "name": "cloud_service_group"},
        {"key": "provider", "name": "provider"}],
        "fields": [{"name": "count", "operator": "count"}]}}]},
        "keys": ["cloud_service_type", "cloud_service_group", "provider"]}},
        {"fill_na": {"data": {"count": 0.0}}}, {"formula": {"query": "count > 0"}},
        {"sort": {"key": "count", "desc": true}}],
        "domain_id": "domain-58010aa2e451"
        }
        response_example: >-
        {
        "total_count": 5.0,
        "results": [
        {
        "labels": [
        "Compute",
        "Server"
        ],
        "cloud_service_type_id": "cloud-svc-type-58c926b19aca",
        "cloud_service_type": "Instance",
        "count": 44.0,
        "tags": [
        {
        "key": "spaceone:icon",
        "value": "https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/aws-ec2.svg"
        }
        ],
        "provider": "aws",
        "cloud_service_group": "EC2"
        },
        {
        "tags": [
        {
        "key": "spaceone:icon",
        "value": "https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/cloud-services/openstack/openstack_compute.svg"
        },
        {
        "key": "spaceone:display_name",
        "value": "Instance"
        }
        ],
        "cloud_service_group": "Compute",
        "cloud_service_type": "Instance",
        "provider": "openstack",
        "count": 12.0,
        "labels": [
        "Compute",
        "Server"
        ],
        "cloud_service_type_id": "cloud-svc-type-50bd62cf6e0e"
        },
        {
        "cloud_service_type": "Node",
        "count": 8.0,
        "provider": "kubernetes",
        "cloud_service_type_id": "cloud-svc-type-719e705cb529",
        "cloud_service_group": "Cluster",
        "tags": [
        {
        "value": "https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/cloud-services/kubernetes/node.svg",
        "key": "spaceone:icon"
        }
        ],
        "labels": [
        "Compute",
        "Server",
        "Container"
        ]
        },
        {
        "cloud_service_type_id": "cloud-svc-type-8dd4d7a13b95",
        "cloud_service_type": "Instance",
        "cloud_service_group": "ComputeEngine",
        "labels": [
        "Compute",
        "Server"
        ],
        "tags": [
        {
        "key": "spaceone:icon",
        "value": "https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/cloud-services/google_cloud/Compute_Engine.svg"
        }
        ],
        "count": 5.0,
        "provider": "google_cloud"
        },
        {
        "tags": [
        {
        "value": "https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/azure-vm.svg",
        "key": "spaceone:icon"
        }
        ],
        "cloud_service_type": "VirtualMachine",
        "cloud_service_group": "Compute",
        "count": 2.0,
        "provider": "azure",
        "cloud_service_type_id": "cloud-svc-type-c7e5bc38d911",
        "labels": [
        "Compute",
        "Server"
        ]
        }
        ]
        }
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_ResourceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'stat': grpc.unary_unary_rpc_method_handler(
                    servicer.stat,
                    request_deserializer=spaceone_dot_api_dot_statistics_dot_v1_dot_resource__pb2.ResourceStatRequest.FromString,
                    response_serializer=google_dot_protobuf_dot_struct__pb2.Struct.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'spaceone.api.statistics.v1.Resource', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class Resource(object):
    """Missing associated documentation comment in .proto file."""

    @staticmethod
    def stat(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, '/spaceone.api.statistics.v1.Resource/stat',
            spaceone_dot_api_dot_statistics_dot_v1_dot_resource__pb2.ResourceStatRequest.SerializeToString,
            google_dot_protobuf_dot_struct__pb2.Struct.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
