ConfigServiceV2Client(
transport=None,
channel=None,
credentials=None,
client_config=None,
client_info=None,
client_options=None,
)
Service for configuring sinks used to route log entries.
Methods
ConfigServiceV2Client
ConfigServiceV2Client(
transport=None,
channel=None,
credentials=None,
client_config=None,
client_info=None,
client_options=None,
)
Constructor.
Parameters | |
---|---|
Name | Description |
channel |
grpc.Channel
DEPRECATED. A |
credentials |
google.auth.credentials.Credentials
The authorization credentials to attach to requests. These credentials identify this application to the service. If none are specified, the client will attempt to ascertain the credentials from the environment. This argument is mutually exclusive with providing a transport instance to |
client_config |
dict
DEPRECATED. A dictionary of call options for each method. If not specified, the default configuration is used. |
client_info |
google.api_core.gapic_v1.client_info.ClientInfo
The client info used to send a user-agent string along with API requests. If |
client_options |
Union[dict, google.api_core.client_options.ClientOptions]
Client options used to set user options on the client. API Endpoint should be set through client_options. |
billing_exclusion_path
billing_exclusion_path(billing_account, exclusion)
Return a fully-qualified billing_exclusion string.
billing_path
billing_path(billing_account)
Return a fully-qualified billing string.
billing_sink_path
billing_sink_path(billing_account, sink)
Return a fully-qualified billing_sink string.
create_exclusion
create_exclusion(parent, exclusion, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Creates a new exclusion in a specified parent resource. Only log entries belonging to that resource can be excluded. You can have up to 10 exclusions in a resource.
.. rubric:: Example
from google.cloud import logging_v2
client = logging_v2.ConfigServiceV2Client()
parent = client.project_path('[PROJECT]')
TODO: Initialize
exclusion
:exclusion = {}
response = client.create_exclusion(parent, exclusion)
Parameters | |
---|---|
Name | Description |
parent |
str
Required. The parent resource in which to create the exclusion: :: "projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" Examples: |
exclusion |
Union[dict, LogExclusion]
Required. The new exclusion, whose |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
create_sink
create_sink(parent, sink, unique_writer_identity=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Creates a sink that exports specified log entries to a destination. The
export of newly-ingested log entries begins immediately, unless the
sink's writer_identity
is not permitted to write to the destination.
A sink can export log entries only from the resource owning the sink.
.. rubric:: Example
from google.cloud import logging_v2
client = logging_v2.ConfigServiceV2Client()
parent = client.project_path('[PROJECT]')
TODO: Initialize
sink
:sink = {}
response = client.create_sink(parent, sink)
Parameters | |
---|---|
Name | Description |
parent |
str
Required. The resource in which to create the sink: :: "projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" Examples: |
sink |
Union[dict, LogSink]
Required. The new sink, whose |
unique_writer_identity |
bool
Optional. Determines the kind of IAM identity returned as |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
delete_exclusion
delete_exclusion(name, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Deletes an exclusion.
.. rubric:: Example
from google.cloud import logging_v2
client = logging_v2.ConfigServiceV2Client()
name = client.exclusion_path('[PROJECT]', '[EXCLUSION]')
client.delete_exclusion(name)
Parameters | |
---|---|
Name | Description |
name |
str
Required. The resource name of an existing exclusion to delete: :: "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" Example: |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
delete_sink
delete_sink(sink_name, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Deletes a sink. If the sink has a unique writer_identity
, then that
service account is also deleted.
.. rubric:: Example
from google.cloud import logging_v2
client = logging_v2.ConfigServiceV2Client()
sink_name = client.sink_path('[PROJECT]', '[SINK]')
client.delete_sink(sink_name)
Parameters | |
---|---|
Name | Description |
sink_name |
str
Required. The full resource name of the sink to delete, including the parent resource and the sink identifier: :: "projects/[PROJECT_ID]/sinks/[SINK_ID]" "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" "folders/[FOLDER_ID]/sinks/[SINK_ID]" Example: |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
exclusion_path
exclusion_path(project, exclusion)
Return a fully-qualified exclusion string.
folder_exclusion_path
folder_exclusion_path(folder, exclusion)
Return a fully-qualified folder_exclusion string.
folder_path
folder_path(folder)
Return a fully-qualified folder string.
folder_sink_path
folder_sink_path(folder, sink)
Return a fully-qualified folder_sink string.
from_service_account_file
from_service_account_file(filename, *args, **kwargs)
Creates an instance of this client using the provided credentials file.
Parameter | |
---|---|
Name | Description |
filename |
str
The path to the service account private key json file. |
Returns | |
---|---|
Type | Description |
ConfigServiceV2Client | The constructed client. |
from_service_account_json
from_service_account_json(filename, *args, **kwargs)
Creates an instance of this client using the provided credentials file.
Parameter | |
---|---|
Name | Description |
filename |
str
The path to the service account private key json file. |
Returns | |
---|---|
Type | Description |
ConfigServiceV2Client | The constructed client. |
get_cmek_settings
get_cmek_settings(name=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Gets the Logs Router CMEK settings for the given resource.
Note: CMEK for the Logs Router can currently only be configured for GCP organizations. Once configured, it applies to all projects and folders in the GCP organization.
See Enabling CMEK for Logs
Router <https://cloud.google.com/logging/docs/routing/managed-encryption>
__
for more information.
.. rubric:: Example
from google.cloud import logging_v2
client = logging_v2.ConfigServiceV2Client()
response = client.get_cmek_settings()
Parameters | |
---|---|
Name | Description |
name |
str
Required. The resource for which to retrieve CMEK settings. :: "projects/[PROJECT_ID]/cmekSettings" "organizations/[ORGANIZATION_ID]/cmekSettings" "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings" "folders/[FOLDER_ID]/cmekSettings" Example: |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
get_exclusion
get_exclusion(name, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Gets the description of an exclusion.
.. rubric:: Example
from google.cloud import logging_v2
client = logging_v2.ConfigServiceV2Client()
name = client.exclusion_path('[PROJECT]', '[EXCLUSION]')
response = client.get_exclusion(name)
Parameters | |
---|---|
Name | Description |
name |
str
Required. The resource name of an existing exclusion: :: "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" Example: |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
get_sink
get_sink(sink_name, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Gets a sink.
.. rubric:: Example
from google.cloud import logging_v2
client = logging_v2.ConfigServiceV2Client()
sink_name = client.sink_path('[PROJECT]', '[SINK]')
response = client.get_sink(sink_name)
Parameters | |
---|---|
Name | Description |
sink_name |
str
Required. The resource name of the sink: :: "projects/[PROJECT_ID]/sinks/[SINK_ID]" "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" "folders/[FOLDER_ID]/sinks/[SINK_ID]" Example: |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
list_exclusions
list_exclusions(parent, page_size=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Lists all the exclusions in a parent resource.
.. rubric:: Example
from google.cloud import logging_v2
client = logging_v2.ConfigServiceV2Client()
parent = client.project_path('[PROJECT]')
Iterate over all results
for element in client.list_exclusions(parent): ... # process element ... pass
Alternatively:
Iterate over results one page at a time
for page in client.list_exclusions(parent).pages: ... for element in page: ... # process element ... pass
Parameters | |
---|---|
Name | Description |
parent |
str
Required. The parent resource whose exclusions are to be listed. :: "projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" |
page_size |
int
The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page. |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
list_sinks
list_sinks(parent, page_size=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Lists sinks.
.. rubric:: Example
from google.cloud import logging_v2
client = logging_v2.ConfigServiceV2Client()
parent = client.project_path('[PROJECT]')
Iterate over all results
for element in client.list_sinks(parent): ... # process element ... pass
Alternatively:
Iterate over results one page at a time
for page in client.list_sinks(parent).pages: ... for element in page: ... # process element ... pass
Parameters | |
---|---|
Name | Description |
parent |
str
Required. The parent resource whose sinks are to be listed: :: "projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" |
page_size |
int
The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page. |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
organization_exclusion_path
organization_exclusion_path(organization, exclusion)
Return a fully-qualified organization_exclusion string.
organization_path
organization_path(organization)
Return a fully-qualified organization string.
organization_sink_path
organization_sink_path(organization, sink)
Return a fully-qualified organization_sink string.
project_path
project_path(project)
Return a fully-qualified project string.
sink_path
sink_path(project, sink)
Return a fully-qualified sink string.
update_cmek_settings
update_cmek_settings(name=None, cmek_settings=None, update_mask=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Updates the Logs Router CMEK settings for the given resource.
Note: CMEK for the Logs Router can currently only be configured for GCP organizations. Once configured, it applies to all projects and folders in the GCP organization.
UpdateCmekSettings
will fail if 1) kms_key_name
is invalid, or
2) the associated service account does not have the required
roles/cloudkms.cryptoKeyEncrypterDecrypter
role assigned for the
key, or
3) access to the key is disabled.
See Enabling CMEK for Logs
Router <https://cloud.google.com/logging/docs/routing/managed-encryption>
__
for more information.
.. rubric:: Example
from google.cloud import logging_v2
client = logging_v2.ConfigServiceV2Client()
response = client.update_cmek_settings()
Parameters | |
---|---|
Name | Description |
name |
str
Required. The resource name for the CMEK settings to update. :: "projects/[PROJECT_ID]/cmekSettings" "organizations/[ORGANIZATION_ID]/cmekSettings" "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings" "folders/[FOLDER_ID]/cmekSettings" Example: |
cmek_settings |
Union[dict, CmekSettings]
Required. The CMEK settings to update. See |
update_mask |
Union[dict, FieldMask]
Optional. Field mask identifying which fields from |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
update_exclusion
update_exclusion(name, exclusion, update_mask, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Changes one or more properties of an existing exclusion.
.. rubric:: Example
from google.cloud import logging_v2
client = logging_v2.ConfigServiceV2Client()
name = client.exclusion_path('[PROJECT]', '[EXCLUSION]')
TODO: Initialize
exclusion
:exclusion = {}
TODO: Initialize
update_mask
:update_mask = {}
response = client.update_exclusion(name, exclusion, update_mask)
Parameters | |
---|---|
Name | Description |
name |
str
Required. The resource name of the exclusion to update: :: "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" Example: |
exclusion |
Union[dict, LogExclusion]
Required. New values for the existing exclusion. Only the fields specified in |
update_mask |
Union[dict, FieldMask]
Required. A non-empty list of fields to change in the existing exclusion. New values for the fields are taken from the corresponding fields in the |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
update_sink
update_sink(sink_name, sink, unique_writer_identity=None, update_mask=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Updates a sink. This method replaces the following fields in the
existing sink with values from the new sink: destination
, and
filter
.
The updated sink might also have a new writer_identity
; see the
unique_writer_identity
field.
.. rubric:: Example
from google.cloud import logging_v2
client = logging_v2.ConfigServiceV2Client()
sink_name = client.sink_path('[PROJECT]', '[SINK]')
TODO: Initialize
sink
:sink = {}
response = client.update_sink(sink_name, sink)
Parameters | |
---|---|
Name | Description |
sink_name |
str
Required. The full resource name of the sink to update, including the parent resource and the sink identifier: :: "projects/[PROJECT_ID]/sinks/[SINK_ID]" "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" "folders/[FOLDER_ID]/sinks/[SINK_ID]" Example: |
sink |
Union[dict, LogSink]
Required. The updated sink, whose name is the same identifier that appears as part of |
unique_writer_identity |
bool
Optional. See |
update_mask |
Union[dict, FieldMask]
Optional. Field mask that specifies the fields in |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |