# Sinks

3.16.0 (latest) 3.15.0 3.13.0 3.12.1 3.11.3 3.10.0 3.9.0 3.8.0 3.7.0 3.6.0 3.5.0 3.4.0 3.3.1 3.2.5 3.1.2 3.0.0 2.7.2 2.6.0 2.5.0 2.4.0 2.3.1 2.2.0 2.1.1 2.0.2 1.15.3 1.14.0 1.13.0 1.12.1 Define Cloud Logging API Sinks.

### *class* google.cloud.logging_v2.sink.Sink(name, \*, filter_=None, parent=None, destination=None, client=None)

Bases: [`object`](https://docs.python.org/3/library/functions.html#object)

Sinks represent filtered exports for log entries.

See <https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks>

- **Parameters**

  - **name** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) -- The name of the sink.

  - **parent** (*Optional* *\[* [*str*](https://docs.python.org/3/library/stdtypes.html#str)*\]*) -- The resource in which to create the sink:

        "projects/[PROJECT_ID]"
        "organizations/[ORGANIZATION_ID]"
        "billingAccounts/[BILLING_ACCOUNT_ID]"
        "folders/[FOLDER_ID]".

    Defaults to the project stored on the client.
  - **filter** (*Optional* *\[* [*str*](https://docs.python.org/3/library/stdtypes.html#str)*\]*) -- The advanced logs filter expression defining
    the entries exported by the sink.

  - **destination** (*Optional* *\[* [*str*](https://docs.python.org/3/library/stdtypes.html#str)*\]* ) -- Destination URI for the entries exported by the sink.
    If not passed, the instance should already exist, to
    be refreshed via `reload()`.

  - **client** (*Optional* *\[* [*Client*](https://docs.cloud.google.com/python/docs/reference/logging/latest/client#google.cloud.logging_v2.client.Client)*\]*) -- A client which holds
    credentials and project configuration for the sink (which requires a project).

#### *property* client()

Client bound to the sink.

#### create(\*, client=None, unique_writer_identity=False)

Create the sink via a PUT request

See
<https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/create>

- **Parameters**

  - **client** (*Optional* *\[* [*Client*](https://docs.cloud.google.com/python/docs/reference/logging/latest/client#google.cloud.logging_v2.client.Client)*\]* ) -- The client to use. If not passed, falls back to the
    `client` stored on the current sink.

  - **unique_writer_identity** (*Optional* *\[* [*bool*](https://docs.python.org/3/library/functions.html#bool)*\]*) -- Determines the kind of
    IAM identity returned as writer_identity in the new sink.

#### delete(\*, client=None)

Delete a sink via a DELETE request

See
<https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/delete>

- **Parameters**

  **client** (*Optional* *\[* [*Client*](https://docs.cloud.google.com/python/docs/reference/logging/latest/client#google.cloud.logging_v2.client.Client)*\]* ) -- The client to use. If not passed, falls back to the
  `client` stored on the current sink.

#### exists(\*, client=None)

Test for the existence of the sink via a GET request

See
<https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/get>

- **Parameters**

  **client** (*Optional* *\[* [*Client*](https://docs.cloud.google.com/python/docs/reference/logging/latest/client#google.cloud.logging_v2.client.Client)*\]* ) -- The client to use. If not passed, falls back to the
  `client` stored on the current sink.
- **Returns**

  Boolean indicating existence of the sink.
- **Return type**

  [bool](https://docs.python.org/3/library/functions.html#bool)

#### *classmethod* from_api_repr(resource, client, \*, parent=None)

Construct a sink given its API representation

- **Parameters**

  - **resource** ([*dict*](https://docs.python.org/3/library/stdtypes.html#dict)) -- sink resource representation returned from the API

  - **client** ([*Client*](https://docs.cloud.google.com/python/docs/reference/logging/latest/client#google.cloud.logging_v2.client.Client)) -- Client which holds
    credentials and project configuration for the sink.

  - **parent** (*Optional* *\[* [*str*](https://docs.python.org/3/library/stdtypes.html#str)*\]*) -- The resource in which to create the sink:

        "projects/[PROJECT_ID]"
        "organizations/[ORGANIZATION_ID]"
        "billingAccounts/[BILLING_ACCOUNT_ID]"
        "folders/[FOLDER_ID]".

    Defaults to the project stored on the client.
- **Returns**

  Sink parsed from `resource`.
- **Return type**

  *Sink*
- **Raises**

  [**ValueError**](https://docs.python.org/3/library/exceptions.html#ValueError) -- if `client` is not `None` and the
  project from the resource does not agree with the project
  from the client.

#### *property* full_name()

Fully-qualified name used in sink APIs

#### *property* parent()

Parent resource of the sink (project, organization, billingAccount, or folder).

#### *property* path()

URL path for the sink's APIs

#### reload(\*, client=None)

Sync local sink configuration via a GET request

See
<https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/get>

- **Parameters**

  **client** (*Optional* *\[* [*Client*](https://docs.cloud.google.com/python/docs/reference/logging/latest/client#google.cloud.logging_v2.client.Client)*\]* ) -- The client to use. If not passed, falls back to the
  `client` stored on the current sink.

#### update(\*, client=None, unique_writer_identity=False)

Update sink configuration via a PUT request

See
<https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/update>

- **Parameters**

  - **client** (*Optional* *\[* [*Client*](https://docs.cloud.google.com/python/docs/reference/logging/latest/client#google.cloud.logging_v2.client.Client)*\]* ) -- The client to use. If not passed, falls back to the
    `client` stored on the current sink.

  - **unique_writer_identity** (*Optional* *\[* [*bool*](https://docs.python.org/3/library/functions.html#bool)*\]*) -- Determines the kind of
    IAM identity returned as writer_identity in the new sink.

#### *property* writer_identity()

Identity used for exports via the sink