diff --git a/packages/grafeas/grafeas/grafeas_v1/services/grafeas/async_client.py b/packages/grafeas/grafeas/grafeas_v1/services/grafeas/async_client.py index bd568d04889c..39156490f4ea 100644 --- a/packages/grafeas/grafeas/grafeas_v1/services/grafeas/async_client.py +++ b/packages/grafeas/grafeas/grafeas_v1/services/grafeas/async_client.py @@ -19,14 +19,17 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core.client_options import ClientOptions # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +from google.api_core.client_options import ClientOptions +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore -OptionalRetry = Union[retries.Retry, object] +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore diff --git a/packages/grafeas/grafeas/grafeas_v1/services/grafeas/client.py b/packages/grafeas/grafeas/grafeas_v1/services/grafeas/client.py index 2effbc3232e8..02a16dabffa1 100644 --- a/packages/grafeas/grafeas/grafeas_v1/services/grafeas/client.py +++ b/packages/grafeas/grafeas/grafeas_v1/services/grafeas/client.py @@ -14,23 +14,25 @@ # limitations under the License. # from collections import OrderedDict -from distutils import util import os import re from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +from google.api_core import client_options as client_options_lib +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore -OptionalRetry = Union[retries.Retry, object] +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore diff --git a/packages/grafeas/grafeas/grafeas_v1/services/grafeas/transports/base.py b/packages/grafeas/grafeas/grafeas_v1/services/grafeas/transports/base.py index b643aa26ec42..8b145b14ab42 100644 --- a/packages/grafeas/grafeas/grafeas_v1/services/grafeas/transports/base.py +++ b/packages/grafeas/grafeas/grafeas_v1/services/grafeas/transports/base.py @@ -18,10 +18,10 @@ import pkg_resources import google.auth # type: ignore -import google.api_core # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +import google.api_core +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore diff --git a/packages/grafeas/grafeas/grafeas_v1/services/grafeas/transports/grpc.py b/packages/grafeas/grafeas/grafeas_v1/services/grafeas/transports/grpc.py index 77ab08c6ff51..7416c3dc4233 100644 --- a/packages/grafeas/grafeas/grafeas_v1/services/grafeas/transports/grpc.py +++ b/packages/grafeas/grafeas/grafeas_v1/services/grafeas/transports/grpc.py @@ -16,8 +16,8 @@ import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers +from google.api_core import gapic_v1 import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore diff --git a/packages/grafeas/grafeas/grafeas_v1/services/grafeas/transports/grpc_asyncio.py b/packages/grafeas/grafeas/grafeas_v1/services/grafeas/transports/grpc_asyncio.py index 2a008b668df7..ea5b119560fa 100644 --- a/packages/grafeas/grafeas/grafeas_v1/services/grafeas/transports/grpc_asyncio.py +++ b/packages/grafeas/grafeas/grafeas_v1/services/grafeas/transports/grpc_asyncio.py @@ -16,8 +16,8 @@ import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import gapic_v1 # type: ignore -from google.api_core import grpc_helpers_async # type: ignore +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers_async from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore diff --git a/packages/grafeas/grafeas/grafeas_v1/types/grafeas.py b/packages/grafeas/grafeas/grafeas_v1/types/grafeas.py index b66c8b22bbf2..da85b7544c35 100644 --- a/packages/grafeas/grafeas/grafeas_v1/types/grafeas.py +++ b/packages/grafeas/grafeas/grafeas_v1/types/grafeas.py @@ -98,39 +98,49 @@ class Occurrence(proto.Message): last updated. vulnerability (grafeas.grafeas_v1.types.VulnerabilityOccurrence): Describes a security vulnerability. + This field is a member of `oneof`_ ``details``. build (grafeas.grafeas_v1.types.BuildOccurrence): Describes a verifiable build. + This field is a member of `oneof`_ ``details``. image (grafeas.grafeas_v1.types.ImageOccurrence): Describes how this resource derives from the basis in the associated note. + This field is a member of `oneof`_ ``details``. package (grafeas.grafeas_v1.types.PackageOccurrence): Describes the installation of a package on the linked resource. + This field is a member of `oneof`_ ``details``. deployment (grafeas.grafeas_v1.types.DeploymentOccurrence): Describes the deployment of an artifact on a runtime. + This field is a member of `oneof`_ ``details``. discovery (grafeas.grafeas_v1.types.DiscoveryOccurrence): Describes when a resource was discovered. + This field is a member of `oneof`_ ``details``. attestation (grafeas.grafeas_v1.types.AttestationOccurrence): Describes an attestation of an artifact. + This field is a member of `oneof`_ ``details``. upgrade (grafeas.grafeas_v1.types.UpgradeOccurrence): Describes an available package upgrade on the linked resource. + This field is a member of `oneof`_ ``details``. compliance (grafeas.grafeas_v1.types.ComplianceOccurrence): Describes a compliance violation on a linked resource. + This field is a member of `oneof`_ ``details``. dsse_attestation (grafeas.grafeas_v1.types.DSSEAttestationOccurrence): Describes an attestation of an artifact using dsse. + This field is a member of `oneof`_ ``details``. envelope (grafeas.grafeas_v1.types.Envelope): https://github.com/secure-systems-lab/dsse @@ -232,37 +242,47 @@ class Note(proto.Message): Other notes related to this note. vulnerability (grafeas.grafeas_v1.types.VulnerabilityNote): A note describing a package vulnerability. + This field is a member of `oneof`_ ``type``. build (grafeas.grafeas_v1.types.BuildNote): A note describing build provenance for a verifiable build. + This field is a member of `oneof`_ ``type``. image (grafeas.grafeas_v1.types.ImageNote): A note describing a base image. + This field is a member of `oneof`_ ``type``. package (grafeas.grafeas_v1.types.PackageNote): A note describing a package hosted by various package managers. + This field is a member of `oneof`_ ``type``. deployment (grafeas.grafeas_v1.types.DeploymentNote): A note describing something that can be deployed. + This field is a member of `oneof`_ ``type``. discovery (grafeas.grafeas_v1.types.DiscoveryNote): A note describing the initial analysis of a resource. + This field is a member of `oneof`_ ``type``. attestation (grafeas.grafeas_v1.types.AttestationNote): A note describing an attestation role. + This field is a member of `oneof`_ ``type``. upgrade (grafeas.grafeas_v1.types.UpgradeNote): A note describing available package upgrades. + This field is a member of `oneof`_ ``type``. compliance (grafeas.grafeas_v1.types.ComplianceNote): A note describing a compliance check. + This field is a member of `oneof`_ ``type``. dsse_attestation (grafeas.grafeas_v1.types.DSSEAttestationNote): A note describing a dsse attestation note. + This field is a member of `oneof`_ ``type``. """ diff --git a/packages/grafeas/grafeas/grafeas_v1/types/provenance.py b/packages/grafeas/grafeas/grafeas_v1/types/provenance.py index 722604191baa..b1d10be7ad1a 100644 --- a/packages/grafeas/grafeas/grafeas_v1/types/provenance.py +++ b/packages/grafeas/grafeas/grafeas_v1/types/provenance.py @@ -243,14 +243,17 @@ class SourceContext(proto.Message): cloud_repo (grafeas.grafeas_v1.types.CloudRepoSourceContext): A SourceContext referring to a revision in a Google Cloud Source Repo. + This field is a member of `oneof`_ ``context``. gerrit (grafeas.grafeas_v1.types.GerritSourceContext): A SourceContext referring to a Gerrit project. + This field is a member of `oneof`_ ``context``. git (grafeas.grafeas_v1.types.GitSourceContext): A SourceContext referring to any third party Git repo (e.g., GitHub). + This field is a member of `oneof`_ ``context``. labels (Sequence[grafeas.grafeas_v1.types.SourceContext.LabelsEntry]): Labels with user defined metadata. @@ -305,9 +308,11 @@ class CloudRepoSourceContext(proto.Message): The ID of the repo. revision_id (str): A revision ID. + This field is a member of `oneof`_ ``revision``. alias_context (grafeas.grafeas_v1.types.AliasContext): An alias, which may be a branch or tag. + This field is a member of `oneof`_ ``revision``. """ @@ -338,9 +343,11 @@ class GerritSourceContext(proto.Message): hostURI/project. revision_id (str): A revision (commit) ID. + This field is a member of `oneof`_ ``revision``. alias_context (grafeas.grafeas_v1.types.AliasContext): An alias, which may be a branch or tag. + This field is a member of `oneof`_ ``revision``. """ @@ -381,10 +388,12 @@ class RepoId(proto.Message): project_repo_id (grafeas.grafeas_v1.types.ProjectRepoId): A combination of a project ID and a repo name. + This field is a member of `oneof`_ ``id``. uid (str): A server-assigned, globally unique identifier. + This field is a member of `oneof`_ ``id``. """ diff --git a/packages/grafeas/tests/unit/gapic/grafeas_v1/test_grafeas.py b/packages/grafeas/tests/unit/gapic/grafeas_v1/test_grafeas.py index a7f12740a438..31107aba4ec0 100644 --- a/packages/grafeas/tests/unit/gapic/grafeas_v1/test_grafeas.py +++ b/packages/grafeas/tests/unit/gapic/grafeas_v1/test_grafeas.py @@ -224,7 +224,9 @@ def test_get_occurrence_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_get_occurrence_flattened_error(): @@ -256,7 +258,9 @@ async def test_get_occurrence_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -416,8 +420,12 @@ def test_list_occurrences_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].filter == "filter_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].filter + mock_val = "filter_value" + assert arg == mock_val def test_list_occurrences_flattened_error(): @@ -455,8 +463,12 @@ async def test_list_occurrences_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].filter == "filter_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].filter + mock_val = "filter_value" + assert arg == mock_val @pytest.mark.asyncio @@ -758,7 +770,9 @@ def test_delete_occurrence_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_delete_occurrence_flattened_error(): @@ -792,7 +806,9 @@ async def test_delete_occurrence_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -981,8 +997,12 @@ def test_create_occurrence_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].occurrence == grafeas.Occurrence(name="name_value") + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].occurrence + mock_val = grafeas.Occurrence(name="name_value") + assert arg == mock_val def test_create_occurrence_flattened_error(): @@ -1020,8 +1040,12 @@ async def test_create_occurrence_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].occurrence == grafeas.Occurrence(name="name_value") + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].occurrence + mock_val = grafeas.Occurrence(name="name_value") + assert arg == mock_val @pytest.mark.asyncio @@ -1191,8 +1215,12 @@ def test_batch_create_occurrences_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].occurrences == [grafeas.Occurrence(name="name_value")] + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].occurrences + mock_val = [grafeas.Occurrence(name="name_value")] + assert arg == mock_val def test_batch_create_occurrences_flattened_error(): @@ -1232,8 +1260,12 @@ async def test_batch_create_occurrences_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].occurrences == [grafeas.Occurrence(name="name_value")] + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].occurrences + mock_val = [grafeas.Occurrence(name="name_value")] + assert arg == mock_val @pytest.mark.asyncio @@ -1426,9 +1458,15 @@ def test_update_occurrence_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].occurrence == grafeas.Occurrence(name="name_value") - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].occurrence + mock_val = grafeas.Occurrence(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + assert arg == mock_val def test_update_occurrence_flattened_error(): @@ -1469,9 +1507,15 @@ async def test_update_occurrence_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].occurrence == grafeas.Occurrence(name="name_value") - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].occurrence + mock_val = grafeas.Occurrence(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + assert arg == mock_val @pytest.mark.asyncio @@ -1661,7 +1705,9 @@ def test_get_occurrence_note_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_get_occurrence_note_flattened_error(): @@ -1695,7 +1741,9 @@ async def test_get_occurrence_note_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -1868,7 +1916,9 @@ def test_get_note_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_get_note_flattened_error(): @@ -1900,7 +1950,9 @@ async def test_get_note_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -2058,8 +2110,12 @@ def test_list_notes_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].filter == "filter_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].filter + mock_val = "filter_value" + assert arg == mock_val def test_list_notes_flattened_error(): @@ -2095,8 +2151,12 @@ async def test_list_notes_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].filter == "filter_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].filter + mock_val = "filter_value" + assert arg == mock_val @pytest.mark.asyncio @@ -2350,7 +2410,9 @@ def test_delete_note_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_delete_note_flattened_error(): @@ -2382,7 +2444,9 @@ async def test_delete_note_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -2559,9 +2623,15 @@ def test_create_note_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].note_id == "note_id_value" - assert args[0].note == grafeas.Note(name="name_value") + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].note_id + mock_val = "note_id_value" + assert arg == mock_val + arg = args[0].note + mock_val = grafeas.Note(name="name_value") + assert arg == mock_val def test_create_note_flattened_error(): @@ -2600,9 +2670,15 @@ async def test_create_note_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].note_id == "note_id_value" - assert args[0].note == grafeas.Note(name="name_value") + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].note_id + mock_val = "note_id_value" + assert arg == mock_val + arg = args[0].note + mock_val = grafeas.Note(name="name_value") + assert arg == mock_val @pytest.mark.asyncio @@ -2773,8 +2849,12 @@ def test_batch_create_notes_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].notes == {"key_value": grafeas.Note(name="name_value")} + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].notes + mock_val = {"key_value": grafeas.Note(name="name_value")} + assert arg == mock_val def test_batch_create_notes_flattened_error(): @@ -2814,8 +2894,12 @@ async def test_batch_create_notes_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].notes == {"key_value": grafeas.Note(name="name_value")} + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].notes + mock_val = {"key_value": grafeas.Note(name="name_value")} + assert arg == mock_val @pytest.mark.asyncio @@ -2994,9 +3078,15 @@ def test_update_note_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].note == grafeas.Note(name="name_value") - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].note + mock_val = grafeas.Note(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + assert arg == mock_val def test_update_note_flattened_error(): @@ -3035,9 +3125,15 @@ async def test_update_note_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].note == grafeas.Note(name="name_value") - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].note + mock_val = grafeas.Note(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + assert arg == mock_val @pytest.mark.asyncio @@ -3214,8 +3310,12 @@ def test_list_note_occurrences_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].filter == "filter_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].filter + mock_val = "filter_value" + assert arg == mock_val def test_list_note_occurrences_flattened_error(): @@ -3255,8 +3355,12 @@ async def test_list_note_occurrences_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].filter == "filter_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].filter + mock_val = "filter_value" + assert arg == mock_val @pytest.mark.asyncio