Skip to content
This repository has been archived by the owner on Dec 31, 2023. It is now read-only.

Commit

Permalink
feat: Import of Grafeas from Github (#235)
Browse files Browse the repository at this point in the history
* feat: enable "rest" transport in Python for services supporting numeric enums

PiperOrigin-RevId: 508143576

Source-Link: googleapis/googleapis@7a702a9

Source-Link: https://github.com/googleapis/googleapis-gen/commit/6ad1279c0e7aa787ac6b66c9fd4a210692edffcd
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNmFkMTI3OWMwZTdhYTc4N2FjNmI2NmM5ZmQ0YTIxMDY5MmVkZmZjZCJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* chore: Update gapic-generator-python to v1.8.5

PiperOrigin-RevId: 511892190

Source-Link: googleapis/googleapis@a45d9c0

Source-Link: https://github.com/googleapis/googleapis-gen/commit/1907294b1d8365ea24f8c5f2e059a64124c4ed3b
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMTkwNzI5NGIxZDgzNjVlYTI0ZjhjNWYyZTA1OWE2NDEyNGM0ZWQzYiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* fix build

* feat: Import of Grafeas from Github

PiperOrigin-RevId: 513603965

Source-Link: googleapis/googleapis@7044962

Source-Link: https://github.com/googleapis/googleapis-gen/commit/0ca25aa1245ce4057f3fbd88653e58970731f571
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMGNhMjVhYTEyNDVjZTQwNTdmM2ZiZDg4NjUzZTU4OTcwNzMxZjU3MSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* restore credentials

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Victor Chudnovsky <vchudnov@google.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
  • Loading branch information
4 people authored Mar 8, 2023
1 parent 478ac65 commit c1c2e7c
Show file tree
Hide file tree
Showing 26 changed files with 8,342 additions and 155 deletions.
75 changes: 75 additions & 0 deletions grafeas/grafeas_v1/gapic_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,81 @@
]
}
}
},
"rest": {
"libraryClient": "GrafeasClient",
"rpcs": {
"BatchCreateNotes": {
"methods": [
"batch_create_notes"
]
},
"BatchCreateOccurrences": {
"methods": [
"batch_create_occurrences"
]
},
"CreateNote": {
"methods": [
"create_note"
]
},
"CreateOccurrence": {
"methods": [
"create_occurrence"
]
},
"DeleteNote": {
"methods": [
"delete_note"
]
},
"DeleteOccurrence": {
"methods": [
"delete_occurrence"
]
},
"GetNote": {
"methods": [
"get_note"
]
},
"GetOccurrence": {
"methods": [
"get_occurrence"
]
},
"GetOccurrenceNote": {
"methods": [
"get_occurrence_note"
]
},
"ListNoteOccurrences": {
"methods": [
"list_note_occurrences"
]
},
"ListNotes": {
"methods": [
"list_notes"
]
},
"ListOccurrences": {
"methods": [
"list_occurrences"
]
},
"UpdateNote": {
"methods": [
"update_note"
]
},
"UpdateOccurrence": {
"methods": [
"update_occurrence"
]
}
}
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions grafeas/grafeas_v1/services/grafeas/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,18 @@ def __init__(
self,
*,
transport: Union[str, GrafeasTransport] = "grpc_asyncio",
credentials: Optional[ga_credentials.Credentials] = None,
) -> None:
"""Instantiate the grafeas client.
Args:
transport (Union[str, ~.GrafeasTransport]): The
transport to use.
credentials (Optional[google.auth.credentials.Credentials]): The
authorization credentials to attach to requests. These
credentials identify the application to the service; if none
are specified, the client will attempt to ascertain the
credentials from the environment.
Raises:
google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
Expand All @@ -152,6 +158,7 @@ def __init__(

self._client = GrafeasClient(
transport=transport,
credentials=credentials,
)

async def get_occurrence(
Expand Down
11 changes: 9 additions & 2 deletions grafeas/grafeas_v1/services/grafeas/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
from .transports.base import GrafeasTransport, DEFAULT_CLIENT_INFO
from .transports.grpc import GrafeasGrpcTransport
from .transports.grpc_asyncio import GrafeasGrpcAsyncIOTransport
from .transports.rest import GrafeasRestTransport


class GrafeasClientMeta(type):
Expand All @@ -77,6 +78,7 @@ class GrafeasClientMeta(type):
_transport_registry = OrderedDict() # type: Dict[str, Type[GrafeasTransport]]
_transport_registry["grpc"] = GrafeasGrpcTransport
_transport_registry["grpc_asyncio"] = GrafeasGrpcAsyncIOTransport
_transport_registry["rest"] = GrafeasRestTransport

def get_transport_class(
cls,
Expand Down Expand Up @@ -308,13 +310,18 @@ def __init__(
self,
*,
transport: Union[str, GrafeasTransport] = None,
credentials: Optional[ga_credentials.Credentials] = None,
) -> None:
"""Instantiate the grafeas client.
Args:
transport (Union[str, ~.GrafeasTransport]): The
transport to use.
credentials (Optional[google.auth.credentials.Credentials]): The
authorization credentials to attach to requests. These
credentials identify the application to the service; if none
are specified, the client will attempt to ascertain the
credentials from the environment.
Raises:
google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
Expand All @@ -325,7 +332,7 @@ def __init__(
self._transport = transport
else:
Transport = type(self).get_transport_class(transport)
self._transport = Transport()
self._transport = Transport(credentials=credentials)

def get_occurrence(
self,
Expand Down
5 changes: 5 additions & 0 deletions grafeas/grafeas_v1/services/grafeas/transports/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,20 @@
from .base import GrafeasTransport
from .grpc import GrafeasGrpcTransport
from .grpc_asyncio import GrafeasGrpcAsyncIOTransport
from .rest import GrafeasRestTransport
from .rest import GrafeasRestInterceptor


# Compile a registry of transports.
_transport_registry = OrderedDict() # type: Dict[str, Type[GrafeasTransport]]
_transport_registry["grpc"] = GrafeasGrpcTransport
_transport_registry["grpc_asyncio"] = GrafeasGrpcAsyncIOTransport
_transport_registry["rest"] = GrafeasRestTransport

__all__ = (
"GrafeasTransport",
"GrafeasGrpcTransport",
"GrafeasGrpcAsyncIOTransport",
"GrafeasRestTransport",
"GrafeasRestInterceptor",
)
Loading

0 comments on commit c1c2e7c

Please sign in to comment.