How to use the grafeas.grafeas_v1.proto.grafeas_pb2 function in grafeas

To help you get started, we’ve selected a few grafeas examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github googleapis / google-cloud-python / grafeas / grafeas / grafeas_v1 / types.py View on Github external
_shared_modules = [
    any_pb2,
    empty_pb2,
    field_mask_pb2,
    timestamp_pb2,
    status_pb2,
]

_local_modules = [
    attestation_pb2,
    build_pb2,
    common_pb2,
    cvss_pb2,
    deployment_pb2,
    discovery_pb2,
    grafeas_pb2,
    image_pb2,
    package_pb2,
    provenance_pb2,
    vulnerability_pb2,
]

names = []

for module in _shared_modules:  # pragma: NO COVER
    for name, message in get_messages(module).items():
        setattr(sys.modules[__name__], name, message)
        names.append(name)
for module in _local_modules:
    for name, message in get_messages(module).items():
        message.__module__ = "grafeas.grafeas_v1.types"
        setattr(sys.modules[__name__], name, message)
github googleapis / google-cloud-python / grafeas / grafeas / grafeas_v1 / gapic / grafeas_client.py View on Github external
google.api_core.exceptions.RetryError: If the request failed due
                    to a retryable error and retry attempts failed.
            ValueError: If the parameters are invalid.
        """
        # Wrap the transport method to add retry and timeout logic.
        if "get_occurrence" not in self._inner_api_calls:
            self._inner_api_calls[
                "get_occurrence"
            ] = google.api_core.gapic_v1.method.wrap_method(
                self.transport.get_occurrence,
                default_retry=self._method_configs["GetOccurrence"].retry,
                default_timeout=self._method_configs["GetOccurrence"].timeout,
                client_info=self._client_info,
            )

        request = grafeas_pb2.GetOccurrenceRequest(name=name,)
        if metadata is None:
            metadata = []
        metadata = list(metadata)
        try:
            routing_header = [("name", name)]
        except AttributeError:
            pass
        else:
            routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
                routing_header
            )
            metadata.append(routing_metadata)

        return self._inner_api_calls["get_occurrence"](
            request, retry=retry, timeout=timeout, metadata=metadata
        )
github googleapis / google-cloud-python / grafeas / grafeas / grafeas_v1 / gapic / grafeas_client.py View on Github external
google.api_core.exceptions.RetryError: If the request failed due
                    to a retryable error and retry attempts failed.
            ValueError: If the parameters are invalid.
        """
        # Wrap the transport method to add retry and timeout logic.
        if "create_note" not in self._inner_api_calls:
            self._inner_api_calls[
                "create_note"
            ] = google.api_core.gapic_v1.method.wrap_method(
                self.transport.create_note,
                default_retry=self._method_configs["CreateNote"].retry,
                default_timeout=self._method_configs["CreateNote"].timeout,
                client_info=self._client_info,
            )

        request = grafeas_pb2.CreateNoteRequest(
            parent=parent, note_id=note_id, note=note,
        )
        if metadata is None:
            metadata = []
        metadata = list(metadata)
        try:
            routing_header = [("parent", parent)]
        except AttributeError:
            pass
        else:
            routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
                routing_header
            )
            metadata.append(routing_metadata)

        return self._inner_api_calls["create_note"](