As of January 1, 2020 this library no longer supports Python 2 on the latest released version. Library versions released prior to that date will continue to be available. For more information please visit Python 2 support on Google Cloud.

Grafeas

class grafeas.grafeas_v1.services.grafeas.GrafeasAsyncClient(*, transport: Union[str, grafeas.grafeas_v1.services.grafeas.transports.base.GrafeasTransport] = 'grpc_asyncio', credentials: Optional[google.auth.credentials.Credentials] = None)[source]

Grafeas API.

Retrieves analysis results of Cloud components such as Docker container images.

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.

Instantiate the grafeas client.

Parameters
  • 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 creation failed for any reason.

async batch_create_notes(request: Optional[Union[grafeas.grafeas_v1.types.grafeas.BatchCreateNotesRequest, dict]] = None, *, parent: Optional[str] = None, notes: Optional[MutableMapping[str, grafeas.grafeas_v1.types.grafeas.Note]] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) grafeas.grafeas_v1.types.grafeas.BatchCreateNotesResponse[source]

Creates new notes in batch.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from grafeas import grafeas_v1

async def sample_batch_create_notes():
    # Create a client
    client = grafeas_v1.GrafeasAsyncClient()

    # Initialize request argument(s)
    request = grafeas_v1.BatchCreateNotesRequest(
        parent="parent_value",
    )

    # Make the request
    response = await client.batch_create_notes(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[grafeas.grafeas_v1.types.BatchCreateNotesRequest, dict]]) – The request object. Request to create notes in batch.

  • parent (str) –

    The name of the project in the form of projects/[PROJECT_ID], under which the notes are to be created.

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • notes (MutableMapping[str, grafeas.grafeas_v1.types.Note]) –

    The notes to create. Max allowed length is 1000.

    This corresponds to the notes field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Response for creating notes in batch.

Return type

grafeas.grafeas_v1.types.BatchCreateNotesResponse

async batch_create_occurrences(request: Optional[Union[grafeas.grafeas_v1.types.grafeas.BatchCreateOccurrencesRequest, dict]] = None, *, parent: Optional[str] = None, occurrences: Optional[MutableSequence[grafeas.grafeas_v1.types.grafeas.Occurrence]] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) grafeas.grafeas_v1.types.grafeas.BatchCreateOccurrencesResponse[source]

Creates new occurrences in batch.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from grafeas import grafeas_v1

async def sample_batch_create_occurrences():
    # Create a client
    client = grafeas_v1.GrafeasAsyncClient()

    # Initialize request argument(s)
    request = grafeas_v1.BatchCreateOccurrencesRequest(
        parent="parent_value",
    )

    # Make the request
    response = await client.batch_create_occurrences(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[grafeas.grafeas_v1.types.BatchCreateOccurrencesRequest, dict]]) – The request object. Request to create occurrences in batch.

  • parent (str) –

    The name of the project in the form of projects/[PROJECT_ID], under which the occurrences are to be created.

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • occurrences (MutableSequence[grafeas.grafeas_v1.types.Occurrence]) –

    The occurrences to create. Max allowed length is 1000.

    This corresponds to the occurrences field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Response for creating occurrences in batch.

Return type

grafeas.grafeas_v1.types.BatchCreateOccurrencesResponse

static common_billing_account_path(billing_account: str) str

Returns a fully-qualified billing_account string.

static common_folder_path(folder: str) str

Returns a fully-qualified folder string.

static common_location_path(project: str, location: str) str

Returns a fully-qualified location string.

static common_organization_path(organization: str) str

Returns a fully-qualified organization string.

static common_project_path(project: str) str

Returns a fully-qualified project string.

async create_note(request: Optional[Union[grafeas.grafeas_v1.types.grafeas.CreateNoteRequest, dict]] = None, *, parent: Optional[str] = None, note_id: Optional[str] = None, note: Optional[grafeas.grafeas_v1.types.grafeas.Note] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) grafeas.grafeas_v1.types.grafeas.Note[source]

Creates a new note.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from grafeas import grafeas_v1

async def sample_create_note():
    # Create a client
    client = grafeas_v1.GrafeasAsyncClient()

    # Initialize request argument(s)
    request = grafeas_v1.CreateNoteRequest(
        parent="parent_value",
        note_id="note_id_value",
    )

    # Make the request
    response = await client.create_note(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[grafeas.grafeas_v1.types.CreateNoteRequest, dict]]) – The request object. Request to create a new note.

  • parent (str) –

    The name of the project in the form of projects/[PROJECT_ID], under which the note is to be created.

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • note_id (str) – The ID to use for this note. This corresponds to the note_id field on the request instance; if request is provided, this should not be set.

  • note (grafeas.grafeas_v1.types.Note) – The note to create. This corresponds to the note field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A type of analysis that can be done for a resource.

Return type

grafeas.grafeas_v1.types.Note

async create_occurrence(request: Optional[Union[grafeas.grafeas_v1.types.grafeas.CreateOccurrenceRequest, dict]] = None, *, parent: Optional[str] = None, occurrence: Optional[grafeas.grafeas_v1.types.grafeas.Occurrence] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) grafeas.grafeas_v1.types.grafeas.Occurrence[source]

Creates a new occurrence.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from grafeas import grafeas_v1

async def sample_create_occurrence():
    # Create a client
    client = grafeas_v1.GrafeasAsyncClient()

    # Initialize request argument(s)
    request = grafeas_v1.CreateOccurrenceRequest(
        parent="parent_value",
    )

    # Make the request
    response = await client.create_occurrence(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[grafeas.grafeas_v1.types.CreateOccurrenceRequest, dict]]) – The request object. Request to create a new occurrence.

  • parent (str) –

    The name of the project in the form of projects/[PROJECT_ID], under which the occurrence is to be created.

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • occurrence (grafeas.grafeas_v1.types.Occurrence) – The occurrence to create. This corresponds to the occurrence field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

An instance of an analysis type that has been found on a resource.

Return type

grafeas.grafeas_v1.types.Occurrence

async delete_note(request: Optional[Union[grafeas.grafeas_v1.types.grafeas.DeleteNoteRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None[source]

Deletes the specified note.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from grafeas import grafeas_v1

async def sample_delete_note():
    # Create a client
    client = grafeas_v1.GrafeasAsyncClient()

    # Initialize request argument(s)
    request = grafeas_v1.DeleteNoteRequest(
        name="name_value",
    )

    # Make the request
    await client.delete_note(request=request)
Parameters
  • request (Optional[Union[grafeas.grafeas_v1.types.DeleteNoteRequest, dict]]) – The request object. Request to delete a note.

  • name (str) –

    The name of the note in the form of projects/[PROVIDER_ID]/notes/[NOTE_ID].

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

async delete_occurrence(request: Optional[Union[grafeas.grafeas_v1.types.grafeas.DeleteOccurrenceRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None[source]

Deletes the specified occurrence. For example, use this method to delete an occurrence when the occurrence is no longer applicable for the given resource.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from grafeas import grafeas_v1

async def sample_delete_occurrence():
    # Create a client
    client = grafeas_v1.GrafeasAsyncClient()

    # Initialize request argument(s)
    request = grafeas_v1.DeleteOccurrenceRequest(
        name="name_value",
    )

    # Make the request
    await client.delete_occurrence(request=request)
Parameters
  • request (Optional[Union[grafeas.grafeas_v1.types.DeleteOccurrenceRequest, dict]]) – The request object. Request to delete an occurrence.

  • name (str) –

    The name of the occurrence in the form of projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID].

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

classmethod from_service_account_info(info: dict, *args, **kwargs)[source]
Creates an instance of this client using the provided credentials

info.

Parameters
  • info (dict) – The service account private key info.

  • args – Additional arguments to pass to the constructor.

  • kwargs – Additional arguments to pass to the constructor.

Returns

The constructed client.

Return type

GrafeasAsyncClient

async get_note(request: Optional[Union[grafeas.grafeas_v1.types.grafeas.GetNoteRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) grafeas.grafeas_v1.types.grafeas.Note[source]

Gets the specified note.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from grafeas import grafeas_v1

async def sample_get_note():
    # Create a client
    client = grafeas_v1.GrafeasAsyncClient()

    # Initialize request argument(s)
    request = grafeas_v1.GetNoteRequest(
        name="name_value",
    )

    # Make the request
    response = await client.get_note(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[grafeas.grafeas_v1.types.GetNoteRequest, dict]]) – The request object. Request to get a note.

  • name (str) –

    The name of the note in the form of projects/[PROVIDER_ID]/notes/[NOTE_ID].

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A type of analysis that can be done for a resource.

Return type

grafeas.grafeas_v1.types.Note

async get_occurrence(request: Optional[Union[grafeas.grafeas_v1.types.grafeas.GetOccurrenceRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) grafeas.grafeas_v1.types.grafeas.Occurrence[source]

Gets the specified occurrence.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from grafeas import grafeas_v1

async def sample_get_occurrence():
    # Create a client
    client = grafeas_v1.GrafeasAsyncClient()

    # Initialize request argument(s)
    request = grafeas_v1.GetOccurrenceRequest(
        name="name_value",
    )

    # Make the request
    response = await client.get_occurrence(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[grafeas.grafeas_v1.types.GetOccurrenceRequest, dict]]) – The request object. Request to get an occurrence.

  • name (str) –

    The name of the occurrence in the form of projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID].

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

An instance of an analysis type that has been found on a resource.

Return type

grafeas.grafeas_v1.types.Occurrence

async get_occurrence_note(request: Optional[Union[grafeas.grafeas_v1.types.grafeas.GetOccurrenceNoteRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) grafeas.grafeas_v1.types.grafeas.Note[source]

Gets the note attached to the specified occurrence. Consumer projects can use this method to get a note that belongs to a provider project.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from grafeas import grafeas_v1

async def sample_get_occurrence_note():
    # Create a client
    client = grafeas_v1.GrafeasAsyncClient()

    # Initialize request argument(s)
    request = grafeas_v1.GetOccurrenceNoteRequest(
        name="name_value",
    )

    # Make the request
    response = await client.get_occurrence_note(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[grafeas.grafeas_v1.types.GetOccurrenceNoteRequest, dict]]) – The request object. Request to get the note to which the specified occurrence is attached.

  • name (str) –

    The name of the occurrence in the form of projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID].

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A type of analysis that can be done for a resource.

Return type

grafeas.grafeas_v1.types.Note

get_transport_class() Type[grafeas.grafeas_v1.services.grafeas.transports.base.GrafeasTransport]

Returns an appropriate transport class.

Parameters

label – The name of the desired transport. If none is provided, then the first transport in the registry is used.

Returns

The transport class to use.

async list_note_occurrences(request: Optional[Union[grafeas.grafeas_v1.types.grafeas.ListNoteOccurrencesRequest, dict]] = None, *, name: Optional[str] = None, filter: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) grafeas.grafeas_v1.services.grafeas.pagers.ListNoteOccurrencesAsyncPager[source]

Lists occurrences referencing the specified note. Provider projects can use this method to get all occurrences across consumer projects referencing the specified note.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from grafeas import grafeas_v1

async def sample_list_note_occurrences():
    # Create a client
    client = grafeas_v1.GrafeasAsyncClient()

    # Initialize request argument(s)
    request = grafeas_v1.ListNoteOccurrencesRequest(
        name="name_value",
    )

    # Make the request
    page_result = client.list_note_occurrences(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
Parameters
  • request (Optional[Union[grafeas.grafeas_v1.types.ListNoteOccurrencesRequest, dict]]) – The request object. Request to list occurrences for a note.

  • name (str) –

    The name of the note to list occurrences for in the form of projects/[PROVIDER_ID]/notes/[NOTE_ID].

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • filter (str) – The filter expression. This corresponds to the filter field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Response for listing occurrences for a note. Iterating over this object will yield results and resolve additional pages automatically.

Return type

grafeas.grafeas_v1.services.grafeas.pagers.ListNoteOccurrencesAsyncPager

async list_notes(request: Optional[Union[grafeas.grafeas_v1.types.grafeas.ListNotesRequest, dict]] = None, *, parent: Optional[str] = None, filter: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) grafeas.grafeas_v1.services.grafeas.pagers.ListNotesAsyncPager[source]

Lists notes for the specified project.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from grafeas import grafeas_v1

async def sample_list_notes():
    # Create a client
    client = grafeas_v1.GrafeasAsyncClient()

    # Initialize request argument(s)
    request = grafeas_v1.ListNotesRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_notes(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
Parameters
  • request (Optional[Union[grafeas.grafeas_v1.types.ListNotesRequest, dict]]) – The request object. Request to list notes.

  • parent (str) –

    The name of the project to list notes for in the form of projects/[PROJECT_ID].

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • filter (str) – The filter expression. This corresponds to the filter field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Response for listing notes.

Iterating over this object will yield results and resolve additional pages automatically.

Return type

grafeas.grafeas_v1.services.grafeas.pagers.ListNotesAsyncPager

async list_occurrences(request: Optional[Union[grafeas.grafeas_v1.types.grafeas.ListOccurrencesRequest, dict]] = None, *, parent: Optional[str] = None, filter: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) grafeas.grafeas_v1.services.grafeas.pagers.ListOccurrencesAsyncPager[source]

Lists occurrences for the specified project.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from grafeas import grafeas_v1

async def sample_list_occurrences():
    # Create a client
    client = grafeas_v1.GrafeasAsyncClient()

    # Initialize request argument(s)
    request = grafeas_v1.ListOccurrencesRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_occurrences(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
Parameters
  • request (Optional[Union[grafeas.grafeas_v1.types.ListOccurrencesRequest, dict]]) – The request object. Request to list occurrences.

  • parent (str) –

    The name of the project to list occurrences for in the form of projects/[PROJECT_ID].

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • filter (str) – The filter expression. This corresponds to the filter field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Response for listing occurrences.

Iterating over this object will yield results and resolve additional pages automatically.

Return type

grafeas.grafeas_v1.services.grafeas.pagers.ListOccurrencesAsyncPager

static note_path(project: str, note: str) str

Returns a fully-qualified note string.

static occurrence_path(project: str, occurrence: str) str

Returns a fully-qualified occurrence string.

static parse_common_billing_account_path(path: str) Dict[str, str]

Parse a billing_account path into its component segments.

static parse_common_folder_path(path: str) Dict[str, str]

Parse a folder path into its component segments.

static parse_common_location_path(path: str) Dict[str, str]

Parse a location path into its component segments.

static parse_common_organization_path(path: str) Dict[str, str]

Parse a organization path into its component segments.

static parse_common_project_path(path: str) Dict[str, str]

Parse a project path into its component segments.

static parse_note_path(path: str) Dict[str, str]

Parses a note path into its component segments.

static parse_occurrence_path(path: str) Dict[str, str]

Parses a occurrence path into its component segments.

static parse_project_path(path: str) Dict[str, str]

Parses a project path into its component segments.

static project_path(project: str) str

Returns a fully-qualified project string.

property transport: grafeas.grafeas_v1.services.grafeas.transports.base.GrafeasTransport

Returns the transport used by the client instance.

Returns

The transport used by the client instance.

Return type

GrafeasTransport

async update_note(request: Optional[Union[grafeas.grafeas_v1.types.grafeas.UpdateNoteRequest, dict]] = None, *, name: Optional[str] = None, note: Optional[grafeas.grafeas_v1.types.grafeas.Note] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) grafeas.grafeas_v1.types.grafeas.Note[source]

Updates the specified note.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from grafeas import grafeas_v1

async def sample_update_note():
    # Create a client
    client = grafeas_v1.GrafeasAsyncClient()

    # Initialize request argument(s)
    request = grafeas_v1.UpdateNoteRequest(
        name="name_value",
    )

    # Make the request
    response = await client.update_note(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[grafeas.grafeas_v1.types.UpdateNoteRequest, dict]]) – The request object. Request to update a note.

  • name (str) –

    The name of the note in the form of projects/[PROVIDER_ID]/notes/[NOTE_ID].

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • note (grafeas.grafeas_v1.types.Note) – The updated note. This corresponds to the note field on the request instance; if request is provided, this should not be set.

  • update_mask (google.protobuf.field_mask_pb2.FieldMask) – The fields to update. This corresponds to the update_mask field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A type of analysis that can be done for a resource.

Return type

grafeas.grafeas_v1.types.Note

async update_occurrence(request: Optional[Union[grafeas.grafeas_v1.types.grafeas.UpdateOccurrenceRequest, dict]] = None, *, name: Optional[str] = None, occurrence: Optional[grafeas.grafeas_v1.types.grafeas.Occurrence] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) grafeas.grafeas_v1.types.grafeas.Occurrence[source]

Updates the specified occurrence.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from grafeas import grafeas_v1

async def sample_update_occurrence():
    # Create a client
    client = grafeas_v1.GrafeasAsyncClient()

    # Initialize request argument(s)
    request = grafeas_v1.UpdateOccurrenceRequest(
        name="name_value",
    )

    # Make the request
    response = await client.update_occurrence(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[grafeas.grafeas_v1.types.UpdateOccurrenceRequest, dict]]) – The request object. Request to update an occurrence.

  • name (str) –

    The name of the occurrence in the form of projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID].

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • occurrence (grafeas.grafeas_v1.types.Occurrence) – The updated occurrence. This corresponds to the occurrence field on the request instance; if request is provided, this should not be set.

  • update_mask (google.protobuf.field_mask_pb2.FieldMask) – The fields to update. This corresponds to the update_mask field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

An instance of an analysis type that has been found on a resource.

Return type

grafeas.grafeas_v1.types.Occurrence

class grafeas.grafeas_v1.services.grafeas.GrafeasClient(*, transport: Optional[Union[str, grafeas.grafeas_v1.services.grafeas.transports.base.GrafeasTransport]] = None, credentials: Optional[google.auth.credentials.Credentials] = None)[source]

Grafeas API.

Retrieves analysis results of Cloud components such as Docker container images.

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.

Instantiate the grafeas client.

Parameters
  • 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 creation failed for any reason.

__exit__(type, value, traceback)[source]

Releases underlying transport’s resources.

Warning

ONLY use as a context manager if the transport is NOT shared with other clients! Exiting the with block will CLOSE the transport and may cause errors in other clients!

batch_create_notes(request: Optional[Union[grafeas.grafeas_v1.types.grafeas.BatchCreateNotesRequest, dict]] = None, *, parent: Optional[str] = None, notes: Optional[MutableMapping[str, grafeas.grafeas_v1.types.grafeas.Note]] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) grafeas.grafeas_v1.types.grafeas.BatchCreateNotesResponse[source]

Creates new notes in batch.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from grafeas import grafeas_v1

def sample_batch_create_notes():
    # Create a client
    client = grafeas_v1.GrafeasClient()

    # Initialize request argument(s)
    request = grafeas_v1.BatchCreateNotesRequest(
        parent="parent_value",
    )

    # Make the request
    response = client.batch_create_notes(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[grafeas.grafeas_v1.types.BatchCreateNotesRequest, dict]) – The request object. Request to create notes in batch.

  • parent (str) –

    The name of the project in the form of projects/[PROJECT_ID], under which the notes are to be created.

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • notes (MutableMapping[str, grafeas.grafeas_v1.types.Note]) –

    The notes to create. Max allowed length is 1000.

    This corresponds to the notes field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Response for creating notes in batch.

Return type

grafeas.grafeas_v1.types.BatchCreateNotesResponse

batch_create_occurrences(request: Optional[Union[grafeas.grafeas_v1.types.grafeas.BatchCreateOccurrencesRequest, dict]] = None, *, parent: Optional[str] = None, occurrences: Optional[MutableSequence[grafeas.grafeas_v1.types.grafeas.Occurrence]] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) grafeas.grafeas_v1.types.grafeas.BatchCreateOccurrencesResponse[source]

Creates new occurrences in batch.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from grafeas import grafeas_v1

def sample_batch_create_occurrences():
    # Create a client
    client = grafeas_v1.GrafeasClient()

    # Initialize request argument(s)
    request = grafeas_v1.BatchCreateOccurrencesRequest(
        parent="parent_value",
    )

    # Make the request
    response = client.batch_create_occurrences(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[grafeas.grafeas_v1.types.BatchCreateOccurrencesRequest, dict]) – The request object. Request to create occurrences in batch.

  • parent (str) –

    The name of the project in the form of projects/[PROJECT_ID], under which the occurrences are to be created.

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • occurrences (MutableSequence[grafeas.grafeas_v1.types.Occurrence]) –

    The occurrences to create. Max allowed length is 1000.

    This corresponds to the occurrences field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Response for creating occurrences in batch.

Return type

grafeas.grafeas_v1.types.BatchCreateOccurrencesResponse

static common_billing_account_path(billing_account: str) str[source]

Returns a fully-qualified billing_account string.

static common_folder_path(folder: str) str[source]

Returns a fully-qualified folder string.

static common_location_path(project: str, location: str) str[source]

Returns a fully-qualified location string.

static common_organization_path(organization: str) str[source]

Returns a fully-qualified organization string.

static common_project_path(project: str) str[source]

Returns a fully-qualified project string.

create_note(request: Optional[Union[grafeas.grafeas_v1.types.grafeas.CreateNoteRequest, dict]] = None, *, parent: Optional[str] = None, note_id: Optional[str] = None, note: Optional[grafeas.grafeas_v1.types.grafeas.Note] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) grafeas.grafeas_v1.types.grafeas.Note[source]

Creates a new note.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from grafeas import grafeas_v1

def sample_create_note():
    # Create a client
    client = grafeas_v1.GrafeasClient()

    # Initialize request argument(s)
    request = grafeas_v1.CreateNoteRequest(
        parent="parent_value",
        note_id="note_id_value",
    )

    # Make the request
    response = client.create_note(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[grafeas.grafeas_v1.types.CreateNoteRequest, dict]) – The request object. Request to create a new note.

  • parent (str) –

    The name of the project in the form of projects/[PROJECT_ID], under which the note is to be created.

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • note_id (str) – The ID to use for this note. This corresponds to the note_id field on the request instance; if request is provided, this should not be set.

  • note (grafeas.grafeas_v1.types.Note) – The note to create. This corresponds to the note field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A type of analysis that can be done for a resource.

Return type

grafeas.grafeas_v1.types.Note

create_occurrence(request: Optional[Union[grafeas.grafeas_v1.types.grafeas.CreateOccurrenceRequest, dict]] = None, *, parent: Optional[str] = None, occurrence: Optional[grafeas.grafeas_v1.types.grafeas.Occurrence] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) grafeas.grafeas_v1.types.grafeas.Occurrence[source]

Creates a new occurrence.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from grafeas import grafeas_v1

def sample_create_occurrence():
    # Create a client
    client = grafeas_v1.GrafeasClient()

    # Initialize request argument(s)
    request = grafeas_v1.CreateOccurrenceRequest(
        parent="parent_value",
    )

    # Make the request
    response = client.create_occurrence(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[grafeas.grafeas_v1.types.CreateOccurrenceRequest, dict]) – The request object. Request to create a new occurrence.

  • parent (str) –

    The name of the project in the form of projects/[PROJECT_ID], under which the occurrence is to be created.

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • occurrence (grafeas.grafeas_v1.types.Occurrence) – The occurrence to create. This corresponds to the occurrence field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

An instance of an analysis type that has been found on a resource.

Return type

grafeas.grafeas_v1.types.Occurrence

delete_note(request: Optional[Union[grafeas.grafeas_v1.types.grafeas.DeleteNoteRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None[source]

Deletes the specified note.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from grafeas import grafeas_v1

def sample_delete_note():
    # Create a client
    client = grafeas_v1.GrafeasClient()

    # Initialize request argument(s)
    request = grafeas_v1.DeleteNoteRequest(
        name="name_value",
    )

    # Make the request
    client.delete_note(request=request)
Parameters
  • request (Union[grafeas.grafeas_v1.types.DeleteNoteRequest, dict]) – The request object. Request to delete a note.

  • name (str) –

    The name of the note in the form of projects/[PROVIDER_ID]/notes/[NOTE_ID].

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

delete_occurrence(request: Optional[Union[grafeas.grafeas_v1.types.grafeas.DeleteOccurrenceRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) None[source]

Deletes the specified occurrence. For example, use this method to delete an occurrence when the occurrence is no longer applicable for the given resource.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from grafeas import grafeas_v1

def sample_delete_occurrence():
    # Create a client
    client = grafeas_v1.GrafeasClient()

    # Initialize request argument(s)
    request = grafeas_v1.DeleteOccurrenceRequest(
        name="name_value",
    )

    # Make the request
    client.delete_occurrence(request=request)
Parameters
  • request (Union[grafeas.grafeas_v1.types.DeleteOccurrenceRequest, dict]) – The request object. Request to delete an occurrence.

  • name (str) –

    The name of the occurrence in the form of projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID].

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

classmethod from_service_account_info(info: dict, *args, **kwargs)[source]
Creates an instance of this client using the provided credentials

info.

Parameters
  • info (dict) – The service account private key info.

  • args – Additional arguments to pass to the constructor.

  • kwargs – Additional arguments to pass to the constructor.

Returns

The constructed client.

Return type

GrafeasClient

get_note(request: Optional[Union[grafeas.grafeas_v1.types.grafeas.GetNoteRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) grafeas.grafeas_v1.types.grafeas.Note[source]

Gets the specified note.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from grafeas import grafeas_v1

def sample_get_note():
    # Create a client
    client = grafeas_v1.GrafeasClient()

    # Initialize request argument(s)
    request = grafeas_v1.GetNoteRequest(
        name="name_value",
    )

    # Make the request
    response = client.get_note(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[grafeas.grafeas_v1.types.GetNoteRequest, dict]) – The request object. Request to get a note.

  • name (str) –

    The name of the note in the form of projects/[PROVIDER_ID]/notes/[NOTE_ID].

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A type of analysis that can be done for a resource.

Return type

grafeas.grafeas_v1.types.Note

get_occurrence(request: Optional[Union[grafeas.grafeas_v1.types.grafeas.GetOccurrenceRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) grafeas.grafeas_v1.types.grafeas.Occurrence[source]

Gets the specified occurrence.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from grafeas import grafeas_v1

def sample_get_occurrence():
    # Create a client
    client = grafeas_v1.GrafeasClient()

    # Initialize request argument(s)
    request = grafeas_v1.GetOccurrenceRequest(
        name="name_value",
    )

    # Make the request
    response = client.get_occurrence(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[grafeas.grafeas_v1.types.GetOccurrenceRequest, dict]) – The request object. Request to get an occurrence.

  • name (str) –

    The name of the occurrence in the form of projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID].

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

An instance of an analysis type that has been found on a resource.

Return type

grafeas.grafeas_v1.types.Occurrence

get_occurrence_note(request: Optional[Union[grafeas.grafeas_v1.types.grafeas.GetOccurrenceNoteRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) grafeas.grafeas_v1.types.grafeas.Note[source]

Gets the note attached to the specified occurrence. Consumer projects can use this method to get a note that belongs to a provider project.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from grafeas import grafeas_v1

def sample_get_occurrence_note():
    # Create a client
    client = grafeas_v1.GrafeasClient()

    # Initialize request argument(s)
    request = grafeas_v1.GetOccurrenceNoteRequest(
        name="name_value",
    )

    # Make the request
    response = client.get_occurrence_note(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[grafeas.grafeas_v1.types.GetOccurrenceNoteRequest, dict]) – The request object. Request to get the note to which the specified occurrence is attached.

  • name (str) –

    The name of the occurrence in the form of projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID].

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A type of analysis that can be done for a resource.

Return type

grafeas.grafeas_v1.types.Note

list_note_occurrences(request: Optional[Union[grafeas.grafeas_v1.types.grafeas.ListNoteOccurrencesRequest, dict]] = None, *, name: Optional[str] = None, filter: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) grafeas.grafeas_v1.services.grafeas.pagers.ListNoteOccurrencesPager[source]

Lists occurrences referencing the specified note. Provider projects can use this method to get all occurrences across consumer projects referencing the specified note.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from grafeas import grafeas_v1

def sample_list_note_occurrences():
    # Create a client
    client = grafeas_v1.GrafeasClient()

    # Initialize request argument(s)
    request = grafeas_v1.ListNoteOccurrencesRequest(
        name="name_value",
    )

    # Make the request
    page_result = client.list_note_occurrences(request=request)

    # Handle the response
    for response in page_result:
        print(response)
Parameters
  • request (Union[grafeas.grafeas_v1.types.ListNoteOccurrencesRequest, dict]) – The request object. Request to list occurrences for a note.

  • name (str) –

    The name of the note to list occurrences for in the form of projects/[PROVIDER_ID]/notes/[NOTE_ID].

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • filter (str) – The filter expression. This corresponds to the filter field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Response for listing occurrences for a note. Iterating over this object will yield results and resolve additional pages automatically.

Return type

grafeas.grafeas_v1.services.grafeas.pagers.ListNoteOccurrencesPager

list_notes(request: Optional[Union[grafeas.grafeas_v1.types.grafeas.ListNotesRequest, dict]] = None, *, parent: Optional[str] = None, filter: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) grafeas.grafeas_v1.services.grafeas.pagers.ListNotesPager[source]

Lists notes for the specified project.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from grafeas import grafeas_v1

def sample_list_notes():
    # Create a client
    client = grafeas_v1.GrafeasClient()

    # Initialize request argument(s)
    request = grafeas_v1.ListNotesRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_notes(request=request)

    # Handle the response
    for response in page_result:
        print(response)
Parameters
  • request (Union[grafeas.grafeas_v1.types.ListNotesRequest, dict]) – The request object. Request to list notes.

  • parent (str) –

    The name of the project to list notes for in the form of projects/[PROJECT_ID].

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • filter (str) – The filter expression. This corresponds to the filter field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Response for listing notes.

Iterating over this object will yield results and resolve additional pages automatically.

Return type

grafeas.grafeas_v1.services.grafeas.pagers.ListNotesPager

list_occurrences(request: Optional[Union[grafeas.grafeas_v1.types.grafeas.ListOccurrencesRequest, dict]] = None, *, parent: Optional[str] = None, filter: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) grafeas.grafeas_v1.services.grafeas.pagers.ListOccurrencesPager[source]

Lists occurrences for the specified project.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from grafeas import grafeas_v1

def sample_list_occurrences():
    # Create a client
    client = grafeas_v1.GrafeasClient()

    # Initialize request argument(s)
    request = grafeas_v1.ListOccurrencesRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_occurrences(request=request)

    # Handle the response
    for response in page_result:
        print(response)
Parameters
  • request (Union[grafeas.grafeas_v1.types.ListOccurrencesRequest, dict]) – The request object. Request to list occurrences.

  • parent (str) –

    The name of the project to list occurrences for in the form of projects/[PROJECT_ID].

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • filter (str) – The filter expression. This corresponds to the filter field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Response for listing occurrences.

Iterating over this object will yield results and resolve additional pages automatically.

Return type

grafeas.grafeas_v1.services.grafeas.pagers.ListOccurrencesPager

static note_path(project: str, note: str) str[source]

Returns a fully-qualified note string.

static occurrence_path(project: str, occurrence: str) str[source]

Returns a fully-qualified occurrence string.

static parse_common_billing_account_path(path: str) Dict[str, str][source]

Parse a billing_account path into its component segments.

static parse_common_folder_path(path: str) Dict[str, str][source]

Parse a folder path into its component segments.

static parse_common_location_path(path: str) Dict[str, str][source]

Parse a location path into its component segments.

static parse_common_organization_path(path: str) Dict[str, str][source]

Parse a organization path into its component segments.

static parse_common_project_path(path: str) Dict[str, str][source]

Parse a project path into its component segments.

static parse_note_path(path: str) Dict[str, str][source]

Parses a note path into its component segments.

static parse_occurrence_path(path: str) Dict[str, str][source]

Parses a occurrence path into its component segments.

static parse_project_path(path: str) Dict[str, str][source]

Parses a project path into its component segments.

static project_path(project: str) str[source]

Returns a fully-qualified project string.

property transport: grafeas.grafeas_v1.services.grafeas.transports.base.GrafeasTransport

Returns the transport used by the client instance.

Returns

The transport used by the client

instance.

Return type

GrafeasTransport

update_note(request: Optional[Union[grafeas.grafeas_v1.types.grafeas.UpdateNoteRequest, dict]] = None, *, name: Optional[str] = None, note: Optional[grafeas.grafeas_v1.types.grafeas.Note] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) grafeas.grafeas_v1.types.grafeas.Note[source]

Updates the specified note.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from grafeas import grafeas_v1

def sample_update_note():
    # Create a client
    client = grafeas_v1.GrafeasClient()

    # Initialize request argument(s)
    request = grafeas_v1.UpdateNoteRequest(
        name="name_value",
    )

    # Make the request
    response = client.update_note(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[grafeas.grafeas_v1.types.UpdateNoteRequest, dict]) – The request object. Request to update a note.

  • name (str) –

    The name of the note in the form of projects/[PROVIDER_ID]/notes/[NOTE_ID].

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • note (grafeas.grafeas_v1.types.Note) – The updated note. This corresponds to the note field on the request instance; if request is provided, this should not be set.

  • update_mask (google.protobuf.field_mask_pb2.FieldMask) – The fields to update. This corresponds to the update_mask field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A type of analysis that can be done for a resource.

Return type

grafeas.grafeas_v1.types.Note

update_occurrence(request: Optional[Union[grafeas.grafeas_v1.types.grafeas.UpdateOccurrenceRequest, dict]] = None, *, name: Optional[str] = None, occurrence: Optional[grafeas.grafeas_v1.types.grafeas.Occurrence] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) grafeas.grafeas_v1.types.grafeas.Occurrence[source]

Updates the specified occurrence.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from grafeas import grafeas_v1

def sample_update_occurrence():
    # Create a client
    client = grafeas_v1.GrafeasClient()

    # Initialize request argument(s)
    request = grafeas_v1.UpdateOccurrenceRequest(
        name="name_value",
    )

    # Make the request
    response = client.update_occurrence(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[grafeas.grafeas_v1.types.UpdateOccurrenceRequest, dict]) – The request object. Request to update an occurrence.

  • name (str) –

    The name of the occurrence in the form of projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID].

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • occurrence (grafeas.grafeas_v1.types.Occurrence) – The updated occurrence. This corresponds to the occurrence field on the request instance; if request is provided, this should not be set.

  • update_mask (google.protobuf.field_mask_pb2.FieldMask) – The fields to update. This corresponds to the update_mask field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

An instance of an analysis type that has been found on a resource.

Return type

grafeas.grafeas_v1.types.Occurrence

class grafeas.grafeas_v1.services.grafeas.pagers.ListNoteOccurrencesAsyncPager(method: Callable[[...], Awaitable[grafeas.grafeas_v1.types.grafeas.ListNoteOccurrencesResponse]], request: grafeas.grafeas_v1.types.grafeas.ListNoteOccurrencesRequest, response: grafeas.grafeas_v1.types.grafeas.ListNoteOccurrencesResponse, *, metadata: Sequence[Tuple[str, str]] = ())[source]

A pager for iterating through list_note_occurrences requests.

This class thinly wraps an initial grafeas.grafeas_v1.types.ListNoteOccurrencesResponse object, and provides an __aiter__ method to iterate through its occurrences field.

If there are more pages, the __aiter__ method will make additional ListNoteOccurrences requests and continue to iterate through the occurrences field on the corresponding responses.

All the usual grafeas.grafeas_v1.types.ListNoteOccurrencesResponse attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.

Instantiates the pager.

Parameters
class grafeas.grafeas_v1.services.grafeas.pagers.ListNoteOccurrencesPager(method: Callable[[...], grafeas.grafeas_v1.types.grafeas.ListNoteOccurrencesResponse], request: grafeas.grafeas_v1.types.grafeas.ListNoteOccurrencesRequest, response: grafeas.grafeas_v1.types.grafeas.ListNoteOccurrencesResponse, *, metadata: Sequence[Tuple[str, str]] = ())[source]

A pager for iterating through list_note_occurrences requests.

This class thinly wraps an initial grafeas.grafeas_v1.types.ListNoteOccurrencesResponse object, and provides an __iter__ method to iterate through its occurrences field.

If there are more pages, the __iter__ method will make additional ListNoteOccurrences requests and continue to iterate through the occurrences field on the corresponding responses.

All the usual grafeas.grafeas_v1.types.ListNoteOccurrencesResponse attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.

Instantiate the pager.

Parameters
class grafeas.grafeas_v1.services.grafeas.pagers.ListNotesAsyncPager(method: Callable[[...], Awaitable[grafeas.grafeas_v1.types.grafeas.ListNotesResponse]], request: grafeas.grafeas_v1.types.grafeas.ListNotesRequest, response: grafeas.grafeas_v1.types.grafeas.ListNotesResponse, *, metadata: Sequence[Tuple[str, str]] = ())[source]

A pager for iterating through list_notes requests.

This class thinly wraps an initial grafeas.grafeas_v1.types.ListNotesResponse object, and provides an __aiter__ method to iterate through its notes field.

If there are more pages, the __aiter__ method will make additional ListNotes requests and continue to iterate through the notes field on the corresponding responses.

All the usual grafeas.grafeas_v1.types.ListNotesResponse attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.

Instantiates the pager.

Parameters
class grafeas.grafeas_v1.services.grafeas.pagers.ListNotesPager(method: Callable[[...], grafeas.grafeas_v1.types.grafeas.ListNotesResponse], request: grafeas.grafeas_v1.types.grafeas.ListNotesRequest, response: grafeas.grafeas_v1.types.grafeas.ListNotesResponse, *, metadata: Sequence[Tuple[str, str]] = ())[source]

A pager for iterating through list_notes requests.

This class thinly wraps an initial grafeas.grafeas_v1.types.ListNotesResponse object, and provides an __iter__ method to iterate through its notes field.

If there are more pages, the __iter__ method will make additional ListNotes requests and continue to iterate through the notes field on the corresponding responses.

All the usual grafeas.grafeas_v1.types.ListNotesResponse attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.

Instantiate the pager.

Parameters
class grafeas.grafeas_v1.services.grafeas.pagers.ListOccurrencesAsyncPager(method: Callable[[...], Awaitable[grafeas.grafeas_v1.types.grafeas.ListOccurrencesResponse]], request: grafeas.grafeas_v1.types.grafeas.ListOccurrencesRequest, response: grafeas.grafeas_v1.types.grafeas.ListOccurrencesResponse, *, metadata: Sequence[Tuple[str, str]] = ())[source]

A pager for iterating through list_occurrences requests.

This class thinly wraps an initial grafeas.grafeas_v1.types.ListOccurrencesResponse object, and provides an __aiter__ method to iterate through its occurrences field.

If there are more pages, the __aiter__ method will make additional ListOccurrences requests and continue to iterate through the occurrences field on the corresponding responses.

All the usual grafeas.grafeas_v1.types.ListOccurrencesResponse attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.

Instantiates the pager.

Parameters
class grafeas.grafeas_v1.services.grafeas.pagers.ListOccurrencesPager(method: Callable[[...], grafeas.grafeas_v1.types.grafeas.ListOccurrencesResponse], request: grafeas.grafeas_v1.types.grafeas.ListOccurrencesRequest, response: grafeas.grafeas_v1.types.grafeas.ListOccurrencesResponse, *, metadata: Sequence[Tuple[str, str]] = ())[source]

A pager for iterating through list_occurrences requests.

This class thinly wraps an initial grafeas.grafeas_v1.types.ListOccurrencesResponse object, and provides an __iter__ method to iterate through its occurrences field.

If there are more pages, the __iter__ method will make additional ListOccurrences requests and continue to iterate through the occurrences field on the corresponding responses.

All the usual grafeas.grafeas_v1.types.ListOccurrencesResponse attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.

Instantiate the pager.

Parameters