# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc

from google.iam.v1 import iam_policy_pb2 as google_dot_iam_dot_v1_dot_iam__policy__pb2
from google.iam.v1 import policy_pb2 as google_dot_iam_dot_v1_dot_policy__pb2


class ContainerAnalysisStub(object):
    """Retrieves analysis results of Cloud components such as Docker container
  images. The Container Analysis API is an implementation of the
  [Grafeas](https://grafeas.io) API.

  Analysis results are stored as a series of occurrences. An `Occurrence`
  contains information about a specific analysis instance on a resource. An
  occurrence refers to a `Note`. A note contains details describing the
  analysis and is generally stored in a separate project, called a `Provider`.
  Multiple occurrences can refer to the same note.

  For example, an SSL vulnerability could affect multiple images. In this case,
  there would be one note for the vulnerability and an occurrence for each
  image with the vulnerability referring to that note.
  """

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

    Args:
      channel: A grpc.Channel.
    """
        self.SetIamPolicy = channel.unary_unary(
            "/google.devtools.containeranalysis.v1.ContainerAnalysis/SetIamPolicy",
            request_serializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.SetIamPolicyRequest.SerializeToString,
            response_deserializer=google_dot_iam_dot_v1_dot_policy__pb2.Policy.FromString,
        )
        self.GetIamPolicy = channel.unary_unary(
            "/google.devtools.containeranalysis.v1.ContainerAnalysis/GetIamPolicy",
            request_serializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.GetIamPolicyRequest.SerializeToString,
            response_deserializer=google_dot_iam_dot_v1_dot_policy__pb2.Policy.FromString,
        )
        self.TestIamPermissions = channel.unary_unary(
            "/google.devtools.containeranalysis.v1.ContainerAnalysis/TestIamPermissions",
            request_serializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.TestIamPermissionsRequest.SerializeToString,
            response_deserializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.TestIamPermissionsResponse.FromString,
        )


class ContainerAnalysisServicer(object):
    """Retrieves analysis results of Cloud components such as Docker container
  images. The Container Analysis API is an implementation of the
  [Grafeas](https://grafeas.io) API.

  Analysis results are stored as a series of occurrences. An `Occurrence`
  contains information about a specific analysis instance on a resource. An
  occurrence refers to a `Note`. A note contains details describing the
  analysis and is generally stored in a separate project, called a `Provider`.
  Multiple occurrences can refer to the same note.

  For example, an SSL vulnerability could affect multiple images. In this case,
  there would be one note for the vulnerability and an occurrence for each
  image with the vulnerability referring to that note.
  """

    def SetIamPolicy(self, request, context):
        """Sets the access control policy on the specified note or occurrence.
    Requires `containeranalysis.notes.setIamPolicy` or
    `containeranalysis.occurrences.setIamPolicy` permission if the resource is
    a note or an occurrence, respectively.

    The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for
    notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for
    occurrences.
    """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def GetIamPolicy(self, request, context):
        """Gets the access control policy for a note or an occurrence resource.
    Requires `containeranalysis.notes.setIamPolicy` or
    `containeranalysis.occurrences.setIamPolicy` permission if the resource is
    a note or occurrence, respectively.

    The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for
    notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for
    occurrences.
    """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def TestIamPermissions(self, request, context):
        """Returns the permissions that a caller has on the specified note or
    occurrence. Requires list permission on the project (for example,
    `containeranalysis.notes.list`).

    The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for
    notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for
    occurrences.
    """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")


def add_ContainerAnalysisServicer_to_server(servicer, server):
    rpc_method_handlers = {
        "SetIamPolicy": grpc.unary_unary_rpc_method_handler(
            servicer.SetIamPolicy,
            request_deserializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.SetIamPolicyRequest.FromString,
            response_serializer=google_dot_iam_dot_v1_dot_policy__pb2.Policy.SerializeToString,
        ),
        "GetIamPolicy": grpc.unary_unary_rpc_method_handler(
            servicer.GetIamPolicy,
            request_deserializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.GetIamPolicyRequest.FromString,
            response_serializer=google_dot_iam_dot_v1_dot_policy__pb2.Policy.SerializeToString,
        ),
        "TestIamPermissions": grpc.unary_unary_rpc_method_handler(
            servicer.TestIamPermissions,
            request_deserializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.TestIamPermissionsRequest.FromString,
            response_serializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.TestIamPermissionsResponse.SerializeToString,
        ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
        "google.devtools.containeranalysis.v1.ContainerAnalysis", rpc_method_handlers
    )
    server.add_generic_rpc_handlers((generic_handler,))
